org.wso2.carbon.registry.core
Class ResourceImpl

java.lang.Object
  extended by org.wso2.carbon.registry.core.ResourceImpl
All Implemented Interfaces:
org.wso2.carbon.registry.api.Resource
Direct Known Subclasses:
CollectionImpl, Comment, RemoteResourceImpl

public class ResourceImpl
extends Object
implements Resource

Represents any file or collection stored in the registry. It encapsulates both the content of the entity and its meta data. In addition to files and collections, instances of Resource are used to represent results of runtime queries. In such scenarios, 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. CoreRegistry.get(String) 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.

Handling content

Contents of resource can be set either as an input stream or an object. If an input stream is set, an unique file based content will be created for the given input stream. If an object of type byte[] or String is set, an in-memory input stream will be created from it and then a unique file based input stream is created. If an object of any other type is set, there should be a handler to convert it to an input stream before reaching the repository.

When a resource is retrieved from the database layer, its content is not retrieved from the database. Instead, UUID referring to the database content is stored in dbBasedContentID. When the content is first accessed, a file based input stream is created from the database content and fileBasedContentID is set (fileBasedContentID = dbBasedContentID).


Field Summary
protected  String authorUserName
          User name of the user who added the resource to the registry.
protected  Object content
          Content of the resource.
protected  boolean contentModified
          Used to detect whether the resource content is modified after it is retrieved from the Registry.
protected  long createdTime
          Time at which the resource is first added to the registry.
protected  DataAccessManager dataAccessManager
          The data access manager is to be used only by the resource implementation and users of the resource are not needed to use this.
protected  int dbBasedContentID
          UUID of the content stored in the database.
protected  String description
          Description about the resource.
protected  boolean directory
          Specified whether the resource is a collection (directory) or a file.
protected  String id
          UUID to identify the resource.
protected  long lastModified
          Time at which the resource modified most recently.
protected  String lastUpdaterUserName
          User name of the user who modified the resource most recently.
protected  long matchingSnapshotID
          The matching snapshot identifier.
protected  String mediaType
          Media type of the resource.
protected  String name
          the name of the resource if collection - NULL non-collection - the name of the resource..
protected  String parentPath
          Path of the parent collection of the resource.
protected  String path
          Unique path of the resource within the registry.
protected  int pathID
          path id, if collection - id of the path of the collection if non-collection - id of the path of the non-collection
protected  String permanentPath
          The permanent path of the resource.
protected  Properties properties
          Properties associated with the resource.
protected  boolean propertiesModified
          Used to detect whether properties of this resource is modified since retrieval from the repository.
protected  ResourceDAO resourceDAO
          Resource DAO instance to access the database directly.
protected  long snapshotID
          Snapshot for which this resource instance is created.
protected  int state
          Normal resources have the state RegistryConstants.ACTIVE_STATE (100) Deleted resources have the state RegistryConstants.DELETED_STATE (101)
protected  int tenantId
          tenant id resource belongs to
protected  String userName
          Resources and collections can be accessed outside the user registry.
protected  org.wso2.carbon.user.core.UserRealm userRealm
          Resources and collections can be accessed outside the user registry.
protected  String uuid
           
protected  boolean versionableChange
          Determines whether the resource is subjected to changes, which causes it to create a new version.
protected  long versionNumber
          Version of this instance of the resource.
 
Constructor Summary
ResourceImpl()
          Default constructor for the resource.
ResourceImpl(ResourceImpl resource)
          A copy constructor used to create a shallow-copy of this resource.
ResourceImpl(String path, ResourceDO resourceDO)
          Construct a resource with given path and resource data object.
 
Method Summary
 void addAspect(String name)
          Method to add an aspect.
 void addProperty(String key, String value)
          Add a property value for the provided key.
 void addPropertyWithNoUpdate(String key, String value)
          Add a property value for the provided key.
protected  void clearSessionInformation()
          UnSet the session information.
 void discard()
          Method to discard the resource
 void editPropertyValue(String key, String oldValue, String newValue)
          Edit property value.
protected  ResourceImpl fillResourceCopy(ResourceImpl resource)
          Fill the resource.
 List<String> getAspects()
          Get the aspects associated with the resource.
 String getAuthorUserName()
          Method to get the author user name.
 Object getContent()
          Method to get the content of the resource.
 InputStream getContentStream()
          Method to get the content stream.
 Date getCreatedTime()
          Method to get the created time.
 int getDbBasedContentID()
          Method to get the db id of the content
 String getDescription()
          Method to get the description.
 String getId()
          The Resource ID, In the default implementation this returns the path.
 Date getLastModified()
          Method to get the created time.
 String getLastUpdaterUserName()
          Method to get the last updated user name.
 long getMatchingSnapshotID()
          Method to get the matching snapshot id.
 String getMediaType()
          Method to get the media type.
 String getName()
          Get the resource name.
 String getParentPath()
          Method to get the parent path.
 String getPath()
          Method to get the path.
 int getPathID()
          Get the path id.
 String getPermanentPath()
          Method to get the permanent path.
 Properties getProperties()
          Returns all properties of the resource.
 String getProperty(String key)
          Get the property value for the given key, if there are multiple value for that key, it will return the first value.
 List<String> getPropertyValues(String key)
          Returns the list of values for the given property name.
 ResourceDO getResourceDO()
          Method to get the resource data object.
 ResourceIDImpl getResourceIDImpl()
          Get the resource id implementation instance.
 ResourceImpl getShallowCopy()
          Create a shallow copy of the resource.
 long getSnapshotID()
          Method to get the snapshot id.
 int getState()
          Method to get the state.
 String getUUID()
          Method to get the UUID
 long getVersionNumber()
          Method to get the version number.
 boolean isContentModified()
          Method to check if the content is modified.
 boolean isPropertiesModified()
          Method to check whether the properties are modified.
 boolean isVersionableChange()
          Check whether there are any changes that need to make a version
 void prepareContentForPut()
          Prepare the resource content to be put.
 void removeAspect(String name)
          Method to remove an aspect.
 void removeProperty(String key)
          Remove property.
 void removePropertyValue(String key, String value)
          Remove property value.
 void removePropertyWithNoUpdate(String key)
          Remove property without modifiying the resource.
 void setAuthorUserName(String authorUserName)
          Method to set the author user name.
 void setContent(Object content)
          Set the content of the resource.
 void setContentModified(boolean contentModified)
          This method is used to explicitly set the content modified state of the resource.
 void setContentStream(InputStream contentStream)
          Invalidates the current file based content and creates a new file based content for the new content stream.
 void setContentStreamWithNoUpdate(InputStream contentStream)
          Invalidates the current file based content and creates a new file based content for the new content stream.
 void setContentWithNoUpdate(Object content)
          Set the content of the resource without setting the modified flag.
 void setCreatedTime(Date createdTime)
          Method to set the created time.
 void setDataAccessManager(DataAccessManager dataAccessManager)
          Method to set the data access manager.
 void setDbBasedContentID(int dbBasedContentID)
          Method to set the db id of the content.
 void setDescription(String description)
          Method to set the description.
 void setId(String id)
          Method to set the resource id, currently it will just set the path.
 void setLastModified(Date lastModified)
          Method to set the last modified date.
 void setLastUpdaterUserName(String lastUpdaterUserName)
          Method to set the last updater user name.
 void setMatchingSnapshotID(long matchingSnapshotID)
          Method to set the matching snapshot id.
 void setMediaType(String mediaType)
          Method to set the media type.
 void setName(String name)
          Method to set the name.
 void setParentPath(String parentPath)
          Method to set the parent path.
 void setPath(String path)
          Method to get the path.
 void setPathID(int pathID)
          Set path id.
 void setProperties(Properties properties)
          Set properties.
 void setPropertiesModified(boolean propertiesModified)
          Method to set the whether properties are modified.
 void setPropertiesModifiedWithNoUpdate(boolean propertiesModified)
          Make the properties modified flag true, without changing the last updated time.
 void setProperty(String key, List<String> value)
          Set a property with multiple value.
 void setProperty(String key, String value)
          Set a property with single value.
protected  void setSessionInformation()
          Set the session information.
 void setSnapshotID(long snapshotID)
          Method to set the snapshot id.
 void setState(int state)
          Method to set the state.
 void setTenantId(int tenantId)
          Method to set the tenant id associated with the resource.
 void setUserName(String userName)
          Method to set the user name.
 void setUserRealm(org.wso2.carbon.user.core.UserRealm userRealm)
          Method to set the user realm.
 void setUUID(String uuid)
          Method to set the UUID of the resource
 void setVersionableChange(boolean versionableChange)
          Method to set whether there are any changes that need to make a version
 void setVersionNumber(long versionNumber)
          Method to set the version number.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

id

protected String id
UUID to identify the resource. currently this is same as the path


snapshotID

protected long snapshotID
Snapshot for which this resource instance is created. Any resource and all its version-ed data can be accessed only using the resource ID and the version number. But snapshot ID is required to track currently accessing snapshot. Note that it is not possible to derive snapshot ID from the resource ID and the version number, as there can be multiple snapshots using the same version.


versionNumber

protected long versionNumber
Version of this instance of the resource. Version-ed attributes (e.g. content, last modified date) can be accessed by using the combination of id and versionNumber.


authorUserName

protected String authorUserName
User name of the user who added the resource to the registry.


createdTime

protected long createdTime
Time at which the resource is first added to the registry.


lastUpdaterUserName

protected String lastUpdaterUserName
User name of the user who modified the resource most recently.


lastModified

protected long lastModified
Time at which the resource modified most recently.


description

protected String description
Description about the resource. This may contain any text including HTML fragments.


path

protected String path
Unique path of the resource within the registry. This is generated by appending all ascendant paths to the resource name separated by "/". For example assume that the resource name is "users.xml". config.xml if inside the collection named "config". config collection is inside the root level collection named "servers". Then the path of the resource is /servers/config/users.xml.


matchingSnapshotID

protected long matchingSnapshotID
The matching snapshot identifier.


permanentPath

protected String permanentPath
The permanent path of the resource. This is a path that will not change for the given resource's lifetime.


mediaType

protected String mediaType
Media type of the resource. Each resource can have a media type associated with it. This can be either a standard MIME media type or a custom media type defined by the users of the registry. Media type is used to activate media type handlers defined in the registry. Thus, by defining a media type for a resource and by registering a media type handler to handle that media type, it is possible to apply special processing for resources.


parentPath

protected String parentPath
Path of the parent collection of the resource. If the resource path is /servers/config/users.xml, parent path is /servers/config.


contentModified

protected boolean contentModified
Used to detect whether the resource content is modified after it is retrieved from the Registry. If this is set to true at the time of adding the resource back to the Registry, new version will be created.


propertiesModified

protected boolean propertiesModified
Used to detect whether properties of this resource is modified since retrieval from the repository. If true, properties will be updated and new version will be created upon putting this resource to the repository.


versionableChange

protected boolean versionableChange
Determines whether the resource is subjected to changes, which causes it to create a new version. If true, a new version will be created upon adding the resource to the repository.


state

protected int state
Normal resources have the state RegistryConstants.ACTIVE_STATE (100) Deleted resources have the state RegistryConstants.DELETED_STATE (101)


properties

protected 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.


dbBasedContentID

protected int dbBasedContentID
UUID of the content stored in the database. This ID is set when a resource is retrieved from the database. Upon the first getContentStream() call, a file based content will be created from this database based content and file based content ID will be set.


content

protected 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[]) containing 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 up to 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.


directory

protected boolean directory
Specified whether the resource is a collection (directory) or a file. By default all resources are considered as files. If you want to make a collection, you have to explicitly set the directory field to true.


dataAccessManager

protected DataAccessManager dataAccessManager
The data access manager is to be used only by the resource implementation and users of the resource are not needed to use this. Some attributes of the resource (e.g. content) is fetched upon the first request to optimize the response time. Getters of such attributes use this data access manager to fetch the values from the database.


userName

protected String userName
Resources and collections can be accessed outside the user registry. There are some operations in these entities that require fetching fresh data, that are not authorized previously. For authorizing those data, it is necessary to store the user name and the realm of the user who retrieved the resource/collection instance.


userRealm

protected org.wso2.carbon.user.core.UserRealm userRealm
Resources and collections can be accessed outside the user registry. There are some operations in these entities that require fetching fresh data, that are not authorized previously. For authorizing those data, it is necessary to store the user name and the realm of the user who retrieved the resource/collection instance.


tenantId

protected int tenantId
tenant id resource belongs to


resourceDAO

protected ResourceDAO resourceDAO
Resource DAO instance to access the database directly. Note that the Version-ed ResourceDAO is thread safe, so it is possible to keep a single instance for the resource.


pathID

protected int pathID
path id, if collection - id of the path of the collection if non-collection - id of the path of the non-collection


name

protected String name
the name of the resource if collection - NULL non-collection - the name of the resource..


uuid

protected String uuid
Constructor Detail

ResourceImpl

public ResourceImpl()
Default constructor for the resource. Creates an empty resource.


ResourceImpl

public ResourceImpl(String path,
                    ResourceDO resourceDO)
Construct a resource with given path and resource data object.

Parameters:
path - the path of the resource.
resourceDO - the resource data object.

ResourceImpl

public ResourceImpl(ResourceImpl resource)
A copy constructor used to create a shallow-copy of this resource.

Parameters:
resource - the resource of which the copy is created.
Method Detail

getUUID

public String getUUID()
Method to get the UUID

Returns:
the UUID of the resource

setUUID

public void setUUID(String uuid)
Method to set the UUID of the resource

Parameters:
uuid - the UUID of the resource

setDataAccessManager

public void setDataAccessManager(DataAccessManager dataAccessManager)
Method to set the data access manager.

Parameters:
dataAccessManager - the data access manager.

setUserName

public void setUserName(String userName)
Method to set the user name.

Parameters:
userName - the user name.

setUserRealm

public void setUserRealm(org.wso2.carbon.user.core.UserRealm userRealm)
Method to set the user realm.

Parameters:
userRealm - the user realm.

setTenantId

public void setTenantId(int tenantId)
Method to set the tenant id associated with the resource.

Parameters:
tenantId - the tenant id.

getId

public String getId()
The Resource ID, In the default implementation this returns the path.

Specified by:
getId in interface org.wso2.carbon.registry.api.Resource
Returns:
the resource id

setId

public void setId(String id)
Method to set the resource id, currently it will just set the path.

Parameters:
id - the path

getSnapshotID

public long getSnapshotID()
Method to get the snapshot id.

Returns:
the snapshot id.

setSnapshotID

public void setSnapshotID(long snapshotID)
Method to set the snapshot id.

Parameters:
snapshotID - the snapshot id.

getVersionNumber

public long getVersionNumber()
Method to get the version number.

Returns:
the version number.

setVersionNumber

public void setVersionNumber(long versionNumber)
Method to set the version number.

Parameters:
versionNumber - the version number.

getAuthorUserName

public String getAuthorUserName()
Method to get the author user name.

Specified by:
getAuthorUserName in interface org.wso2.carbon.registry.api.Resource
Returns:
the author user name.

setAuthorUserName

public void setAuthorUserName(String authorUserName)
Method to set the author user name.

Parameters:
authorUserName - the author user name.

getCreatedTime

public Date getCreatedTime()
Method to get the created time.

Specified by:
getCreatedTime in interface org.wso2.carbon.registry.api.Resource
Returns:
the created time.

setCreatedTime

public void setCreatedTime(Date createdTime)
Method to set the created time.

Parameters:
createdTime - the created time.

getLastModified

public Date getLastModified()
Method to get the created time.

Specified by:
getLastModified in interface org.wso2.carbon.registry.api.Resource
Returns:
the created time

setLastModified

public void setLastModified(Date lastModified)
Method to set the last modified date.

Parameters:
lastModified - the last modified date.

getDescription

public String getDescription()
Method to get the description.

Specified by:
getDescription in interface org.wso2.carbon.registry.api.Resource
Returns:
the description.

setDescription

public void setDescription(String description)
Method to set the description.

Specified by:
setDescription in interface org.wso2.carbon.registry.api.Resource
Parameters:
description - the description.

getPath

public String getPath()
Method to get the path. the unique identifier of the resources in the present state.

Specified by:
getPath in interface org.wso2.carbon.registry.api.Resource
Returns:
the path.

setPath

public void setPath(String path)
Method to get the path. the unique identifier of the resources in the present state.

Parameters:
path - the path.

getMatchingSnapshotID

public long getMatchingSnapshotID()
Method to get the matching snapshot id.

Returns:
the snapshot id.

setMatchingSnapshotID

public void setMatchingSnapshotID(long matchingSnapshotID)
Method to set the matching snapshot id.

Parameters:
matchingSnapshotID - the snapshot id.

getPermanentPath

public String getPermanentPath()
Method to get the permanent path.

Specified by:
getPermanentPath in interface org.wso2.carbon.registry.api.Resource
Returns:
the permanent path.

getMediaType

public String getMediaType()
Method to get the media type.

Specified by:
getMediaType in interface org.wso2.carbon.registry.api.Resource
Returns:
the media type.

setMediaType

public void setMediaType(String mediaType)
Method to set the media type.

Specified by:
setMediaType in interface org.wso2.carbon.registry.api.Resource
Parameters:
mediaType - the media type.

getParentPath

public String getParentPath()
Method to get the parent path.

Specified by:
getParentPath in interface org.wso2.carbon.registry.api.Resource
Returns:
the parent path.

setParentPath

public void setParentPath(String parentPath)
Method to set the parent path.

Parameters:
parentPath - the parent path.

getState

public int getState()
Method to get the state.

Specified by:
getState in interface org.wso2.carbon.registry.api.Resource
Returns:
the state.

setState

public void setState(int state)
Method to set the state.

Parameters:
state - the state.

getProperty

public String getProperty(String key)
Get the property value for the given key, if there are multiple value for that key, it will return the first value.

Specified by:
getProperty in interface org.wso2.carbon.registry.api.Resource
Parameters:
key - the property key.
Returns:
the property value.

getPropertyValues

public List<String> getPropertyValues(String key)
Returns the list of values for the given property name. Note that these values are read-only. Changes made to these values will not be persisted on putting the resource.

Specified by:
getPropertyValues in interface org.wso2.carbon.registry.api.Resource
Parameters:
key - Key of the property.
Returns:
List of values of the given property key.

getProperties

public Properties getProperties()
Returns all properties of the resource. Properties are stored as key (String) -> values (List) pairs. It is not recommended to use this method to access properties. Instead, use other property related Resource API methods provided.

Note that these values are read-only. Changes made to these values will not be persisted on putting the resource.

Specified by:
getProperties in interface org.wso2.carbon.registry.api.Resource
Returns:
All properties of the resource.

removeProperty

public void removeProperty(String key)
Remove property.

Specified by:
removeProperty in interface org.wso2.carbon.registry.api.Resource
Parameters:
key - the property key.

removePropertyWithNoUpdate

public void removePropertyWithNoUpdate(String key)
Remove property without modifiying the resource.

Parameters:
key - the property key.

removePropertyValue

public void removePropertyValue(String key,
                                String value)
Remove property value.

Specified by:
removePropertyValue in interface org.wso2.carbon.registry.api.Resource
Parameters:
key - the property key.
value - the property value.

editPropertyValue

public void editPropertyValue(String key,
                              String oldValue,
                              String newValue)
Edit property value.

Specified by:
editPropertyValue in interface org.wso2.carbon.registry.api.Resource
Parameters:
key - the key.
oldValue - the old value.
newValue - the new value.

setProperty

public void setProperty(String key,
                        String value)
Set a property with single value.

Specified by:
setProperty in interface org.wso2.carbon.registry.api.Resource
Parameters:
key - the property key.
value - the property value.

setProperty

public void setProperty(String key,
                        List<String> value)
Set a property with multiple value.

Specified by:
setProperty in interface org.wso2.carbon.registry.api.Resource
Parameters:
key - the property key.
value - the property values.

addProperty

public void addProperty(String key,
                        String value)
Add a property value for the provided key. If there are values associated with the key, this will add append value. If not this will create a new property value for the key.

Specified by:
addProperty in interface org.wso2.carbon.registry.api.Resource
Parameters:
key - the property key.
value - the property value.

addPropertyWithNoUpdate

public void addPropertyWithNoUpdate(String key,
                                    String value)
Add a property value for the provided key. If there are values associated with the key, this will add append value. If not this will create a new property value for the key. Here the resource modified flag is not set.

Parameters:
key - the property key.
value - the property value.

setProperties

public void setProperties(Properties properties)
Set properties.

Specified by:
setProperties in interface org.wso2.carbon.registry.api.Resource
Parameters:
properties - the properties.

getDbBasedContentID

public int getDbBasedContentID()
Method to get the db id of the content

Returns:
the db content id.

setDbBasedContentID

public void setDbBasedContentID(int dbBasedContentID)
Method to set the db id of the content.

Parameters:
dbBasedContentID - the db id of the content.

getContentStream

public InputStream getContentStream()
                             throws RegistryException
Method to get the content stream.

Specified by:
getContentStream in interface org.wso2.carbon.registry.api.Resource
Returns:
the content stream.
Throws:
RegistryException - throws if the operation fail.

setContentStream

public void setContentStream(InputStream contentStream)
                      throws RegistryException
Invalidates the current file based content and creates a new file based content for the new content stream. Given content stream will be closed after completing this method.

Specified by:
setContentStream in interface org.wso2.carbon.registry.api.Resource
Parameters:
contentStream - input stream containing the new content
Throws:
RegistryException - throws if the operation fail.

setContentStreamWithNoUpdate

public void setContentStreamWithNoUpdate(InputStream contentStream)
                                  throws RegistryException
Invalidates the current file based content and creates a new file based content for the new content stream. Given content stream will be closed after completing this method. Here the resource modified flag is not set.

Parameters:
contentStream - input stream containing the new content
Throws:
RegistryException - throws if the operation fail.

getContent

public Object getContent()
                  throws RegistryException
Method to get the content of the resource. If the resource is a collection this will return an array of string that represent the paths of its children, otherwise it returns an byte array or a string from the default resource implementation.

Specified by:
getContent in interface org.wso2.carbon.registry.api.Resource
Returns:
the content.
Throws:
RegistryException - throws if the operation fail.

setContent

public void setContent(Object content)
                throws RegistryException
Set the content of the resource.

Specified by:
setContent in interface org.wso2.carbon.registry.api.Resource
Parameters:
content - the resource.
Throws:
RegistryException - throws if the operation fail.

setContentWithNoUpdate

public void setContentWithNoUpdate(Object content)
                            throws RegistryException
Set the content of the resource without setting the modified flag.

Parameters:
content - the resource.
Throws:
RegistryException - throws if the operation fail.

prepareContentForPut

public void prepareContentForPut()
                          throws RegistryException
Prepare the resource content to be put.

Throws:
RegistryException - throws if the operation fail.

getLastUpdaterUserName

public String getLastUpdaterUserName()
Method to get the last updated user name.

Specified by:
getLastUpdaterUserName in interface org.wso2.carbon.registry.api.Resource
Returns:
the last updated user name.

setLastUpdaterUserName

public void setLastUpdaterUserName(String lastUpdaterUserName)
Method to set the last updater user name.

Parameters:
lastUpdaterUserName - the last updater user name.

isContentModified

public boolean isContentModified()
Method to check if the content is modified.

Returns:
true, if it is modified, false otherwise.

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.

isPropertiesModified

public boolean isPropertiesModified()
Method to check whether the properties are modified.

Returns:
true if the properties modified, false otherwise.

setPropertiesModified

public void setPropertiesModified(boolean propertiesModified)
Method to set the whether properties are modified.

Parameters:
propertiesModified - whether the properties modified or not.

setPropertiesModifiedWithNoUpdate

public void setPropertiesModifiedWithNoUpdate(boolean propertiesModified)
Make the properties modified flag true, without changing the last updated time.

Parameters:
propertiesModified - whether the properties modified or not.

isVersionableChange

public boolean isVersionableChange()
Check whether there are any changes that need to make a version

Returns:
true, if there are version-able changes, false otherwise.

setVersionableChange

public void setVersionableChange(boolean versionableChange)
Method to set whether there are any changes that need to make a version

Parameters:
versionableChange - whether version-able change is made or not.

getAspects

public List<String> getAspects()
Get the aspects associated with the resource.

Specified by:
getAspects in interface org.wso2.carbon.registry.api.Resource
Returns:
an array of associated aspects.

addAspect

public void addAspect(String name)
Method to add an aspect.

Specified by:
addAspect in interface org.wso2.carbon.registry.api.Resource
Parameters:
name - the name of the aspect.

removeAspect

public void removeAspect(String name)
Method to remove an aspect.

Specified by:
removeAspect in interface org.wso2.carbon.registry.api.Resource
Parameters:
name - the name of the aspect to remove.

discard

public void discard()
Method to discard the resource

Specified by:
discard in interface org.wso2.carbon.registry.api.Resource

setSessionInformation

protected void setSessionInformation()
Set the session information.


clearSessionInformation

protected void clearSessionInformation()
UnSet the session information.


getPathID

public int getPathID()
Get the path id.

Returns:
the path id.

setPathID

public void setPathID(int pathID)
Set path id.

Parameters:
pathID - the path id.

getName

public String getName()
Get the resource name.

Returns:
the resource name.

setName

public void setName(String name)
Method to set the name.

Parameters:
name - the name.

getResourceIDImpl

public ResourceIDImpl getResourceIDImpl()
Get the resource id implementation instance.

Returns:
the resource id.

getResourceDO

public ResourceDO getResourceDO()
Method to get the resource data object.

Returns:
the resource data object.

getShallowCopy

public ResourceImpl getShallowCopy()
                            throws RegistryException
Create a shallow copy of the resource.

Returns:
the new resource with a shallow copy of the current resource.
Throws:
RegistryException - throws if the operation fail.

fillResourceCopy

protected ResourceImpl fillResourceCopy(ResourceImpl resource)
                                 throws RegistryException
Fill the resource.

Parameters:
resource - the resource to be filled.
Returns:
the filled resource
Throws:
RegistryException - throws if the operation fail.


Copyright © 2012 WSO2 Inc. All Rights Reserved.