org.apache.sling.api.resource
Class ResourceMetadata

java.lang.Object
  extended by java.util.AbstractMap<K,V>
      extended by java.util.HashMap<java.lang.String,java.lang.Object>
          extended by org.apache.sling.api.resource.ResourceMetadata
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.util.Map<java.lang.String,java.lang.Object>

public class ResourceMetadata
extends java.util.HashMap<java.lang.String,java.lang.Object>

The ResourceMetadata interface defines the API for the metadata of a Sling Resource. Essentially the resource's metadata is just a map of objects indexed by string keys.

The actual contents of the meta data map is implementation specific with the exception of the sling.resolutionPath property which must be provided by all implementations and contain the part of the request URI used to resolve the resource. The type of this property value is defined to be String.

Note, that the prefix sling. to key names is reserved for the Sling implementation.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.util.AbstractMap
java.util.AbstractMap.SimpleEntry<K,V>, java.util.AbstractMap.SimpleImmutableEntry<K,V>
 
Field Summary
static java.lang.String CHARACTER_ENCODING
          The name of the optional property providing the character encoding of the resource if the resource is streamable and contains character data (value is "sling.characterEncoding").
static java.lang.String CONTENT_LENGTH
          The name of the optional property providing the content length of the resource if the resource is streamable (value is "sling.contentLength").
static java.lang.String CONTENT_TYPE
          The name of the optional property providing the content type of the resource if the resource is streamable (value is "sling.contentType").
static java.lang.String CREATION_TIME
          Returns the creation time of this resource in the repository in milliseconds (value is "sling.creationTime").
static java.lang.String MODIFICATION_TIME
          Returns the last modification time of this resource in the repository in milliseconds (value is "sling.modificationTime").
static java.lang.String RESOLUTION_PATH
          The name of the required property providing the part of the request URI which was used to the resolve the resource to which the meta data instance belongs (value is "sling.resolutionPath").
static java.lang.String RESOLUTION_PATH_INFO
          The name of the required property providing the part of the request URI which was not used to the resolve the resource to which the meta data instance belongs (value is "sling.resolutionPathInfo").
 
Constructor Summary
ResourceMetadata()
           
 
Method Summary
 java.lang.String getCharacterEncoding()
          Returns the CHARACTER_ENCODING property if not null and a String instance.
 long getContentLength()
          Returns the CONTENT_LENGTH property if not null and a long.
 java.lang.String getContentType()
          Returns the CONTENT_TYPE property if not null and a String instance.
 long getCreationTime()
          Returns the CREATION_TIME property if not null and a long.
 long getModificationTime()
          Returns the MODIFICATION_TIME property if not null and a long.
 java.lang.String getResolutionPath()
          Returns the RESOLUTION_PATH property if not null and a String instance.
 java.lang.String getResolutionPathInfo()
          Returns the RESOLUTION_PATH_INFO property if not null and a String instance.
 void setCharacterEncoding(java.lang.String encoding)
          Sets the CHARACTER_ENCODING property to encoding if not null.
 void setContentLength(long contentLength)
          Sets the CONTENT_LENGTH property to contentType if not null.
 void setContentType(java.lang.String contentType)
          Sets the CONTENT_TYPE property to contentType if not null.
 void setCreationTime(long creationTime)
          Sets the CREATION_TIME property to creationTime if not negative.
 void setModificationTime(long modificationTime)
          Sets the MODIFICATION_TIME property to modificationTime if not negative.
 void setResolutionPath(java.lang.String resolutionPath)
          Sets the RESOLUTION_PATH property to resolutionPath if not null.
 void setResolutionPathInfo(java.lang.String resolutionPathInfo)
          Sets the RESOLUTION_PATH_INFO property to resolutionPathInfo if not null.
 
Methods inherited from class java.util.HashMap
clear, clone, containsKey, containsValue, entrySet, get, isEmpty, keySet, put, putAll, remove, size, values
 
Methods inherited from class java.util.AbstractMap
equals, hashCode, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode
 

Field Detail

RESOLUTION_PATH

public static final java.lang.String RESOLUTION_PATH
The name of the required property providing the part of the request URI which was used to the resolve the resource to which the meta data instance belongs (value is "sling.resolutionPath").

See Also:
Constant Field Values

RESOLUTION_PATH_INFO

public static final java.lang.String RESOLUTION_PATH_INFO
The name of the required property providing the part of the request URI which was not used to the resolve the resource to which the meta data instance belongs (value is "sling.resolutionPathInfo"). The value of this property concatenated to the value of the sling.resolutionPath property returns the original request URI leading to the resource.

This property is optional. If missing, it should be assumed equal to an empty string.

Since:
2.0.3-incubator-SNAPSHOT
See Also:
Constant Field Values

CONTENT_TYPE

public static final java.lang.String CONTENT_TYPE
The name of the optional property providing the content type of the resource if the resource is streamable (value is "sling.contentType"). This property may be missing if the resource is not streamable or if the content type is not known.

See Also:
Constant Field Values

CONTENT_LENGTH

public static final java.lang.String CONTENT_LENGTH
The name of the optional property providing the content length of the resource if the resource is streamable (value is "sling.contentLength"). This property may be missing if the resource is not streamable or if the content length is not known.

Note, that unlike the other properties, this property may be set only after the resource has successfully been adapted to an InputStream for performance reasons.

See Also:
Constant Field Values

CHARACTER_ENCODING

public static final java.lang.String CHARACTER_ENCODING
The name of the optional property providing the character encoding of the resource if the resource is streamable and contains character data (value is "sling.characterEncoding"). This property may be missing if the resource is not streamable or if the character encoding is not known.

See Also:
Constant Field Values

CREATION_TIME

public static final java.lang.String CREATION_TIME
Returns the creation time of this resource in the repository in milliseconds (value is "sling.creationTime"). The type of this property is java.lang.Long. The property may be missing if the resource is not streamable or if the creation time is not known.

See Also:
Constant Field Values

MODIFICATION_TIME

public static final java.lang.String MODIFICATION_TIME
Returns the last modification time of this resource in the repository in milliseconds (value is "sling.modificationTime"). The type of this property is java.lang.Long. The property may be missing if the resource is not streamable or if the last modification time is not known.

See Also:
Constant Field Values
Constructor Detail

ResourceMetadata

public ResourceMetadata()
Method Detail

setCharacterEncoding

public void setCharacterEncoding(java.lang.String encoding)
Sets the CHARACTER_ENCODING property to encoding if not null.


getCharacterEncoding

public java.lang.String getCharacterEncoding()
Returns the CHARACTER_ENCODING property if not null and a String instance. Otherwise null is returned.


setContentType

public void setContentType(java.lang.String contentType)
Sets the CONTENT_TYPE property to contentType if not null.


getContentType

public java.lang.String getContentType()
Returns the CONTENT_TYPE property if not null and a String instance. Otherwise null is returned.


setContentLength

public void setContentLength(long contentLength)
Sets the CONTENT_LENGTH property to contentType if not null.


getContentLength

public long getContentLength()
Returns the CONTENT_LENGTH property if not null and a long. Otherwise -1 is returned.


setCreationTime

public void setCreationTime(long creationTime)
Sets the CREATION_TIME property to creationTime if not negative.


getCreationTime

public long getCreationTime()
Returns the CREATION_TIME property if not null and a long. Otherwise -1 is returned.


setModificationTime

public void setModificationTime(long modificationTime)
Sets the MODIFICATION_TIME property to modificationTime if not negative.


getModificationTime

public long getModificationTime()
Returns the MODIFICATION_TIME property if not null and a long. Otherwise -1 is returned.


setResolutionPath

public void setResolutionPath(java.lang.String resolutionPath)
Sets the RESOLUTION_PATH property to resolutionPath if not null.


getResolutionPath

public java.lang.String getResolutionPath()
Returns the RESOLUTION_PATH property if not null and a String instance. Otherwise null is returned.


setResolutionPathInfo

public void setResolutionPathInfo(java.lang.String resolutionPathInfo)
Sets the RESOLUTION_PATH_INFO property to resolutionPathInfo if not null.


getResolutionPathInfo

public java.lang.String getResolutionPathInfo()
Returns the RESOLUTION_PATH_INFO property if not null and a String instance. Otherwise null is returned.



Copyright © 2007-2009. All Rights Reserved.