org.apache.oodt.xmlquery
Class Result

java.lang.Object
  extended by org.apache.oodt.xmlquery.Result
All Implemented Interfaces:
Serializable, Cloneable, Documentable

public class Result
extends Object
implements Serializable, Cloneable, Documentable

A single result. An object of this class is a result of a query.

Author:
Kelly
See Also:
Serialized Form

Field Summary
protected static Map codecs
          Mapping of MIME type to codec.
protected  String id
          The identification of this result.
static long INFINITE
          Sentinel value for validity that indicates a product never expires.
protected  String mimeType
          The MIME type.
protected  Retriever retriever
          Object to retrieve this product's data.
protected  Object value
          The result instance.
 
Constructor Summary
Result()
          Create a new, blank result.
Result(Node node)
          Create a result from a DOM node.
Result(String id, Object value)
          Create a result.
Result(String id, String mimeType, String profileID, String resourceID, List headers, Object value)
          Create a more fully specified result that's not classified and lasts forever.
Result(String id, String mimeType, String profileID, String resourceID, List headers, Object value, boolean classified, long validity)
          Create a fully specified result.
 
Method Summary
 Object clone()
           
 boolean equals(Object rhs)
           
 List getHeaders()
          Get the headers.
 String getID()
          Get the result ID.
 InputStream getInputStream()
          Get an input stream version of the result's value.
 String getMimeType()
          Get the MIME type of this result.
 String getProfileID()
          Get the profile ID.
 String getResourceID()
          Get the resource ID.
 long getSize()
          Get the size of this product.
 URI getURIID()
           
 long getValidity()
          Get how long this product is valid.
 Object getValue()
          Deprecated. This method requires the caller to know the return type and to downcast to it; further, the result may be too large to contain in memory. Use getInputStream() instead to perform stream processing on product data.
 int hashCode()
           
 boolean isClassified()
          Is this result classified?
 void setClassified(boolean classified)
          Set whether this result is classified.
 void setID(String id)
          Set the result ID.
 void setMimeType(String mimeType)
          Set the MIME type of this result.
 void setProfileID(String profileID)
          Set the profile ID.
 void setResourceID(String resourceID)
          Set the resource ID.
 void setRetriever(Retriever retriever)
           
 void setValidity(long validity)
          Set the time this product is valid.
 void setValue(Object value)
          Set the result's value.
 String toString()
           
 Node toXML(Document doc)
           
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

id

protected String id
The identification of this result.


mimeType

protected String mimeType
The MIME type.


value

protected Object value
The result instance.


codecs

protected static Map codecs
Mapping of MIME type to codec.


retriever

protected transient Retriever retriever
Object to retrieve this product's data.


INFINITE

public static final long INFINITE
Sentinel value for validity that indicates a product never expires.

See Also:
Constant Field Values
Constructor Detail

Result

public Result()
Create a new, blank result. This initializes the result with default values for various properties.


Result

public Result(String id,
              Object value)
Create a result. Here, you specify the result's ID and value only.

Parameters:
id - Identification of this result.
value - The result.

Result

public Result(String id,
              String mimeType,
              String profileID,
              String resourceID,
              List headers,
              Object value)
Create a more fully specified result that's not classified and lasts forever.

Parameters:
id - Identification of this result.
mimeType - MIME Type.
profileID - ID of the resource profile where this result originated.
resourceID - ID of the resource where this result originated.
headers - A header elements, describing the result.
value - The result.

Result

public Result(String id,
              String mimeType,
              String profileID,
              String resourceID,
              List headers,
              Object value,
              boolean classified,
              long validity)
Create a fully specified result.

Parameters:
id - Identification of this result.
mimeType - MIME Type.
profileID - ID of the resource profile where this result originated.
resourceID - ID of the resource where this result originated.
headers - A header elements, describing the result.
value - The result.
classified - True if this result is secret, false otherwise.
validity - Time for how long this product is valid in milliseconds or INFINITE.

Result

public Result(Node node)
Create a result from a DOM node.

Parameters:
node - The DOM node, which must be a <resultElement> element.
Method Detail

getID

public String getID()
Get the result ID.

Returns:
The identification of this result.

getURIID

public URI getURIID()

getMimeType

public String getMimeType()
Get the MIME type of this result.

Returns:
The MIME type.

getProfileID

public String getProfileID()
Get the profile ID.

Returns:
The ID of the resource profile where this result originated.

getResourceID

public String getResourceID()
Get the resource ID.

Returns:
The ID of the resource where this result originated.

getHeaders

public List getHeaders()
Get the headers.

Returns:
A list of Headers describing the result.

getValue

public Object getValue()
Deprecated. This method requires the caller to know the return type and to downcast to it; further, the result may be too large to contain in memory. Use getInputStream() instead to perform stream processing on product data.

Get the result's value.

Returns:
The result instance.

setID

public void setID(String id)
Set the result ID.

Parameters:
id - The identification of this result.

setMimeType

public void setMimeType(String mimeType)
Set the MIME type of this result.

Parameters:
mimeType - The MIME type.

setProfileID

public void setProfileID(String profileID)
Set the profile ID.

Parameters:
profileID - The ID of the resource profile where this result originated.

setResourceID

public void setResourceID(String resourceID)
Set the resource ID.

Parameters:
resourceID - The ID of the resource where this result originated.

setValue

public void setValue(Object value)
Set the result's value.

Parameters:
value - The result instance.

getSize

public long getSize()
Get the size of this product.

Returns:
Size in bytes.

toXML

public Node toXML(Document doc)
           throws DOMException
Specified by:
toXML in interface Documentable
Throws:
DOMException

getInputStream

public InputStream getInputStream()
                           throws IOException
Get an input stream version of the result's value.

Returns:
an InputStream value.
Throws:
IOException - if an error occurs.

isClassified

public boolean isClassified()
Is this result classified?

Returns:
a boolean value.

setClassified

public void setClassified(boolean classified)
Set whether this result is classified.

Parameters:
classified - a boolean value.

getValidity

public long getValidity()
Get how long this product is valid.

Returns:
Time in milliseconds or INFINITE.

setValidity

public void setValidity(long validity)
Set the time this product is valid.

Parameters:
validity - Time in milliseconds or INFINITE.

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object rhs)
Overrides:
equals in class Object

clone

public Object clone()
Overrides:
clone in class Object

setRetriever

public void setRetriever(Retriever retriever)

toString

public String toString()
Overrides:
toString in class Object


Copyright © 1999-2012 Apache OODT. All Rights Reserved.