org.wso2.registry
Class ResourceImpl
java.lang.Object
org.wso2.registry.ResourceImpl
- All Implemented Interfaces:
- Resource
- Direct Known Subclasses:
- CollectionImpl, Comment
public class ResourceImpl
- extends java.lang.Object
- implements Resource
Represents any file or collection stored in the registry. It encapsulates both the content
of the entity and its metadata. In addition to files and collections, instances of Resource
are used to represent results of runtime queries. In such secenarios, comments, tags, ratings as
well as collections of comments, etc. are also represented by Resource objects.
Each resource instance contains a unique path within a Registry instance. Registry.get(...)
method invocation using this path gives an instance of that resource. This path can be
combined with the base URL of the registry server to generate a URI for the resource.
Field Summary |
protected java.lang.Object |
content
Content of the resource. |
protected java.util.Properties |
properties
Properties associated with the resource. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
properties
protected java.util.Properties properties
- Properties associated with the resource. A resource can contain zero or more properties,
where each property is a name->value pair. Both name and the value should be strings.
content
protected java.lang.Object content
- Content of the resource. Object and the type stored in this field depends on the resource
type. If the resource is a file with no special media type handling, this contains an array
of bytes (byte[]) conatining the raw bytes of the file. If the resource is a collection, this
contains a String[] containing the paths of child resources. If the resource is processed
by a media type handler, it is upto the media type handler to set a content. In that case
content can be anything ranging from String to custom type. Therefore, clients of the API
should be aware of the media type and the content for that media type.
ResourceImpl
public ResourceImpl()
setDataSource
public void setDataSource(javax.sql.DataSource dataSource)
getId
public long getId()
setId
public void setId(long id)
getVersionNumber
public long getVersionNumber()
setVersionNumber
public void setVersionNumber(long versionNumber)
getAuthorUserName
public java.lang.String getAuthorUserName()
- Specified by:
getAuthorUserName
in interface Resource
setAuthorUserName
public void setAuthorUserName(java.lang.String authorUserName)
getCreatedTime
public java.util.Date getCreatedTime()
- Specified by:
getCreatedTime
in interface Resource
setCreatedTime
public void setCreatedTime(java.util.Date createdTime)
getLastModified
public java.util.Date getLastModified()
- Specified by:
getLastModified
in interface Resource
setLastModified
public void setLastModified(java.util.Date lastModified)
getDescription
public java.lang.String getDescription()
- Specified by:
getDescription
in interface Resource
setDescription
public void setDescription(java.lang.String description)
- Specified by:
setDescription
in interface Resource
getPath
public java.lang.String getPath()
- Specified by:
getPath
in interface Resource
setPath
public void setPath(java.lang.String path)
getMediaType
public java.lang.String getMediaType()
- Specified by:
getMediaType
in interface Resource
setMediaType
public void setMediaType(java.lang.String mediaType)
- Specified by:
setMediaType
in interface Resource
getParentPath
public java.lang.String getParentPath()
- Specified by:
getParentPath
in interface Resource
setParentPath
public void setParentPath(java.lang.String parentPath)
getState
public int getState()
- Specified by:
getState
in interface Resource
setState
public void setState(int state)
getProperty
public java.lang.String getProperty(java.lang.String key)
- Specified by:
getProperty
in interface Resource
getPropertyValues
public java.util.List getPropertyValues(java.lang.String key)
- Specified by:
getPropertyValues
in interface Resource
getProperties
public java.util.Properties getProperties()
- Specified by:
getProperties
in interface Resource
setProperty
public void setProperty(java.lang.String key,
java.lang.String value)
- Specified by:
setProperty
in interface Resource
setProperty
public void setProperty(java.lang.String key,
java.util.List<java.lang.String> value)
- Specified by:
setProperty
in interface Resource
addProperty
public void addProperty(java.lang.String key,
java.lang.String value)
- Specified by:
addProperty
in interface Resource
setProperties
public void setProperties(java.util.Properties properties)
- Specified by:
setProperties
in interface Resource
getContentStream
public java.io.InputStream getContentStream()
throws RegistryException
- Specified by:
getContentStream
in interface Resource
- Throws:
RegistryException
setContentStream
public void setContentStream(java.io.InputStream contentStream)
- Specified by:
setContentStream
in interface Resource
getContent
public java.lang.Object getContent()
throws RegistryException
- Specified by:
getContent
in interface Resource
- Throws:
RegistryException
setContent
public void setContent(java.lang.Object content)
- Specified by:
setContent
in interface Resource
getLastUpdaterUserName
public java.lang.String getLastUpdaterUserName()
- Specified by:
getLastUpdaterUserName
in interface Resource
setLastUpdaterUserName
public void setLastUpdaterUserName(java.lang.String lastUpdaterUserName)
isDirectory
public boolean isDirectory()
isContentModified
public boolean isContentModified()
setContentModified
public void setContentModified(boolean contentModified)
- This method is used to explicitly set the content modified state of the resource. Normal
users of the Registry API should not call this method.
- Parameters:
contentModified
- true if we want to add a new version upon putting this to the
registry. false otherwise.
getAspects
public java.util.List<java.lang.String> getAspects()
- Specified by:
getAspects
in interface Resource
addAspect
public void addAspect(java.lang.String name)
- Specified by:
addAspect
in interface Resource
removeAspect
public void removeAspect(java.lang.String name)
- Specified by:
removeAspect
in interface Resource
Copyright © 2007 Apache Web Services Project. All Rights Reserved.