org.wso2.carbon.registry.core.jdbc.dao
Class JDBCResourceDAO

java.lang.Object
  extended by org.wso2.carbon.registry.core.jdbc.dao.JDBCResourceDAO
All Implemented Interfaces:
ResourceDAO

public class JDBCResourceDAO
extends Object
implements ResourceDAO

An implementation of the ResourceDAO to store resources on a JDBC-based database.


Constructor Summary
JDBCResourceDAO()
           
 
Method Summary
 void add(String path, ResourceIDImpl parentID, ResourceImpl resourceImpl)
          Add the resource to a pat when resource instance and the parent resource id is given.
 void addContent(ResourceImpl resourceImpl)
          Add the content for a resource.
 int addContentBytes(InputStream contentStream)
          Add the content to the content table and return the auto generated id of content table.
 void addProperties(ResourceImpl resource)
          Add the properties to the database from given resource
 void addResourceDO(ResourceDO resourceDO)
          Add the resource data object.
 void addResourceWithNoUpdate(ResourceImpl resourceImpl)
          Add a resource without setting the resource modified flag on.
 void addResourceWithoutContentId(ResourceImpl resourceImpl, boolean isUpdatingExisting)
          Add a resource without a content id, provided whether it is overwriting existing one or not.
 void addRoot(ResourceImpl resourceImpl)
          Add the root collection.
 void createAndApplyResourceID(String path, ResourceIDImpl parentID, ResourceImpl resourceImpl)
          The method to create a resource id and assign to resource instance
 ResourceIDImpl createResourceID(String path, ResourceIDImpl parentID, boolean isCollection)
          Create a resource ID for a path given the parent resource id and whether it is a collection or not.
 void deleteContentStream(int contentID)
          delete the content for a given content id.
 void deleteResource(ResourceDO resourceDO)
          Delete the resource provided as a resource DO
 void fillChildren(CollectionImpl collection, DataAccessManager dataAccessManager)
          Fill the children for a resource that already filled with meta data.
 void fillChildren(CollectionImpl collection, int start, int pageLen)
          Fill the children for a resource that already filled with meta data.
 void fillChildren(CollectionImpl collection, int start, int pageLen, Connection conn)
          Fill the children for a resource that already filled with meta data.
 void fillResource(CollectionImpl collection, int start, int pageLen)
          Fill the children and the properties for a resource that already filled with meta data.
 void fillResource(ResourceImpl resourceImpl)
          Fill the content (for non-collection) and the properties for a resource that already filled meta data
 void fillResourceContent(ResourceImpl resourceImpl)
          Fill resource content for a given resource implementation.
 void fillResourceContentWithNoUpdate(ResourceImpl resourceImpl)
          Fill resource content for a given resource implementation without setting the resource modified flag on.
 void fillResourceProperties(ResourceImpl resourceImpl)
          Fill the properties for a resource, this will change the properties modified flag.
 void fillResourcePropertiesWithNoUpdate(ResourceImpl resourceImpl)
          Fill the properties for a resource without making the properties modified flag.
 ResourceImpl get(ResourceIDImpl resourceID)
          Returns the resource in the given path filled with meta-data and access to the content.
 CollectionImpl get(ResourceIDImpl resourceID, int start, int pageLen)
          Return a collection with children only at the range of the intersect of the given range and resource existence range provided the resource id.
 ResourceImpl get(String path)
          Returns the resource in the given path filled with meta-data and access to the content.
 CollectionImpl get(String path, int start, int pageLen)
          Return a collection with children only at the range of the intersect of the given range and resource existence range provided the resource path.
 int getChildCount(CollectionImpl collection, Connection conn)
          Method to return a child count of a collection (database connection should also be provided)
 int getChildCount(CollectionImpl collection, DataAccessManager dataAccessManager)
          Method to return a child count of a collection (database connection should also be provided)
 List<ResourceIDImpl> getChildPathIds(ResourceIDImpl resourceID)
          Get the child path ids of a resource, (should be a collection)
 String[] getChildren(CollectionImpl collection, int start, int pageLen)
          Get the children of the collection.
 String[] getChildren(CollectionImpl collection, int start, int pageLen, Connection conn)
          Get the children of the collection.
 String[] getChildren(CollectionImpl collection, int start, int pageLen, DataAccessManager dataAccessManager)
          Get the children of the collection.
 InputStream getContentStream(int contentID)
          Get the content input stream for a given content id.
 String getPath(int pathId, String resourceName, boolean checkExistence)
          Get the path given the path id, resource name and provided whether the resourceExistence should be checked.
 String getPath(long version)
          Get the path provided the resource version.
 String getPathFromId(int pathId)
          Get the path from the path id.
 ResourceDO getResourceDO(long version)
          Method to return resourceDO from a version number.
 ResourceDO getResourceDO(ResourceIDImpl resourceID)
          Method to get resource from resource id.
 ResourceIDImpl getResourceID(String path)
          Returns the resource ID (RID) of the resource referred by the given path.
 ResourceIDImpl getResourceID(String path, boolean isCollection)
          Returns the resource ID (RID) of the resource referred by the given path.
 ResourceImpl getResourceMetaData(ResourceIDImpl resourceID)
          Method to return the resource meta data (excluding properties, content and children)
 ResourceImpl getResourceMetaData(String path)
          Method to return the resource meta data (excluding properties, content and children)
 ResourceImpl getResourceWithNoUpdate(ResourceIDImpl resourceID)
          Method to get resource without setting the resource modified flags on.
 long getVersion(ResourceIDImpl resourceID)
          Method to return the version of a resource from resourceID
 void moveProperties(ResourceIDImpl source, ResourceIDImpl target)
          Move the properties.
 void movePropertyPaths(ResourceIDImpl source, ResourceIDImpl target)
          this function will move the paths from one path id to another regardless of the resource name
 void moveResourcePaths(ResourceIDImpl source, ResourceIDImpl target)
          This method will move the paths from one path id to another regardless of the resource name
 void moveResources(ResourceIDImpl source, ResourceIDImpl target)
          Move resource provided the source and target resource ids.
 void removeProperties(ResourceDO resourceDO)
          Remove properties of a resource.
 boolean resourceExists(ResourceIDImpl resourceID)
          Method to check the whether a resource in the provided resource id exist or not.
 boolean resourceExists(String path)
          Method to check the resource existence for a given path.
 boolean resourceExists(String path, boolean isCollection)
          Method to check the resource existence for a given path provided the resource is collection or not.
 void update(ResourceImpl resourceImpl)
          Save the updates of a given resource.
 void updateCollectionLastUpdatedTime(ResourceIDImpl resourceID)
          Update the last updated time of a resource, This is called to update the parent's last updated time when a child is created, deleted or moved out/in, copy in.
 void updateContentId(ResourceImpl resourceImpl)
          Update the content id of a resource, Normally this should be called after calling addResourceWithoutContentId is called.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JDBCResourceDAO

public JDBCResourceDAO()
Method Detail

getResourceID

public ResourceIDImpl getResourceID(String path)
                             throws RegistryException
Description copied from interface: ResourceDAO
Returns the resource ID (RID) of the resource referred by the given path. NOTE: This doesn't guarantee that the path exist in the resource. It only guarantee if it is a collection: the path exist in the path table. if it is a resource: the parent path exist in the path table. In order to make sure the existence of the resource please use the resourceExists function Note that if the same path is used for a collection and resource, this returns the resourceID of the collection.

Specified by:
getResourceID in interface ResourceDAO
Parameters:
path - Pure path of the resource
Returns:
Resource id of resource exists in path cache. null if the resource does not exists.
Throws:
RegistryException - throws the retrieval of resource id failed

getResourceID

public ResourceIDImpl getResourceID(String path,
                                    boolean isCollection)
                             throws RegistryException
Description copied from interface: ResourceDAO
Returns the resource ID (RID) of the resource referred by the given path. We use this overloaded function when we know our resource is a collection or non-collection NOTE: This doesn't guarantee that the path exist in the resource. It only guarantee if it is a collection: the path exist in the path table. if it is a resource: the parent path exist in the path table. In order to make sure the existence of the resource please use the resourceExists function

Specified by:
getResourceID in interface ResourceDAO
Parameters:
path - Pure path of the resource
isCollection - true if it is a collection
Returns:
Resource id of resource exists. null if the resource does not exists.
Throws:
RegistryException - throws the retrieval of resource id failed

resourceExists

public boolean resourceExists(ResourceIDImpl resourceID)
                       throws RegistryException
Description copied from interface: ResourceDAO
Method to check the whether a resource in the provided resource id exist or not.

Specified by:
resourceExists in interface ResourceDAO
Parameters:
resourceID - the resource id which is checked for existence of a resource.
Returns:
true if the resource exists, false otherwise.
Throws:
RegistryException - throws if checking existence failed.

resourceExists

public boolean resourceExists(String path)
                       throws RegistryException
Description copied from interface: ResourceDAO
Method to check the resource existence for a given path.

Specified by:
resourceExists in interface ResourceDAO
Parameters:
path - the path to check the resource existence
Returns:
true, if the resource exists, false otherwise
Throws:
RegistryException - throws if checking existence failed.

resourceExists

public boolean resourceExists(String path,
                              boolean isCollection)
                       throws RegistryException
Description copied from interface: ResourceDAO
Method to check the resource existence for a given path provided the resource is collection or not.

Specified by:
resourceExists in interface ResourceDAO
Parameters:
path - the path to check the resource existence.
isCollection - provide whether the resource in the path is collection or not.
Returns:
true, if the resource exists, false otherwise.
Throws:
RegistryException - throws if checking existence failed.

getVersion

public long getVersion(ResourceIDImpl resourceID)
                throws RegistryException
Description copied from interface: ResourceDAO
Method to return the version of a resource from resourceID

Specified by:
getVersion in interface ResourceDAO
Parameters:
resourceID - the id of the resource to get the version of.
Returns:
the version of the resource for the given resource id.
Throws:
RegistryException - throws if the version retrieval failed.

get

public ResourceImpl get(String path)
                 throws RegistryException
Description copied from interface: ResourceDAO
Returns the resource in the given path filled with meta-data and access to the content. If a resource does not exist in the given path, null is returned.

Specified by:
get in interface ResourceDAO
Parameters:
path - Path of the resource.
Returns:
ResourceImpl filled with resource meta-data and access to the resource content.
Throws:
RegistryException - throws if the resource retrieval failed.

get

public ResourceImpl get(ResourceIDImpl resourceID)
                 throws RegistryException
Description copied from interface: ResourceDAO
Returns the resource in the given path filled with meta-data and access to the content. If a resource does not exist in the given resourceID, null is returned.

Specified by:
get in interface ResourceDAO
Parameters:
resourceID - the resource id
Returns:
resource object.
Throws:
RegistryException - throws if resource retrieval failed.

get

public CollectionImpl get(String path,
                          int start,
                          int pageLen)
                   throws RegistryException
Description copied from interface: ResourceDAO
Return a collection with children only at the range of the intersect of the given range and resource existence range provided the resource path. Use for resource browser pagination.

Specified by:
get in interface ResourceDAO
Parameters:
path - path of the collection
start - start value of the range of children.
pageLen - the length of the children to retrieve
Returns:
an instance of collection with child
Throws:
RegistryException - throws if resource retrieval failed.

get

public CollectionImpl get(ResourceIDImpl resourceID,
                          int start,
                          int pageLen)
                   throws RegistryException
Description copied from interface: ResourceDAO
Return a collection with children only at the range of the intersect of the given range and resource existence range provided the resource id. Use for resource browser pagination.

Specified by:
get in interface ResourceDAO
Parameters:
resourceID - resourceID of the collection
start - start value of the range of children.
pageLen - the length of the children to retrieve
Returns:
an instance of collection with child
Throws:
RegistryException - throws if resource retrieval failed.

fillResource

public void fillResource(ResourceImpl resourceImpl)
                  throws RegistryException
Description copied from interface: ResourceDAO
Fill the content (for non-collection) and the properties for a resource that already filled meta data

Specified by:
fillResource in interface ResourceDAO
Parameters:
resourceImpl - the resource instance to be filled with contents (if non-collection) and fill properties.
Throws:
RegistryException - throws if resource filling failed.

fillResource

public void fillResource(CollectionImpl collection,
                         int start,
                         int pageLen)
                  throws RegistryException
Description copied from interface: ResourceDAO
Fill the children and the properties for a resource that already filled with meta data. Children are filled only at the at of the intersect of the given range and resource existence range.

Specified by:
fillResource in interface ResourceDAO
Parameters:
collection - collection to fill the children and properties.
start - start value of the range of children.
pageLen - the length of the children to retrieve
Throws:
RegistryException - throws if resource filling failed.

fillResourcePropertiesWithNoUpdate

public void fillResourcePropertiesWithNoUpdate(ResourceImpl resourceImpl)
                                        throws RegistryException
Description copied from interface: ResourceDAO
Fill the properties for a resource without making the properties modified flag.

Specified by:
fillResourcePropertiesWithNoUpdate in interface ResourceDAO
Parameters:
resourceImpl - the resource object.
Throws:
RegistryException - throws if the operation failed.

fillResourceProperties

public void fillResourceProperties(ResourceImpl resourceImpl)
                            throws RegistryException
Description copied from interface: ResourceDAO
Fill the properties for a resource, this will change the properties modified flag.

Specified by:
fillResourceProperties in interface ResourceDAO
Parameters:
resourceImpl - the resource object.
Throws:
RegistryException - throws if the operation failed.

addRoot

public void addRoot(ResourceImpl resourceImpl)
             throws RegistryException
Description copied from interface: ResourceDAO
Add the root collection. Only called at the very first time resource loading process.

Specified by:
addRoot in interface ResourceDAO
Parameters:
resourceImpl - the resource instance
Throws:
RegistryException - throws if the operation failed

add

public void add(String path,
                ResourceIDImpl parentID,
                ResourceImpl resourceImpl)
         throws RegistryException
Description copied from interface: ResourceDAO
Add the resource to a pat when resource instance and the parent resource id is given.

Specified by:
add in interface ResourceDAO
Parameters:
path - path of the resource
parentID - parent resourceID
resourceImpl - the instance of the resource to be added.
Throws:
RegistryException - throws if the operation failed

createAndApplyResourceID

public void createAndApplyResourceID(String path,
                                     ResourceIDImpl parentID,
                                     ResourceImpl resourceImpl)
                              throws RegistryException
Description copied from interface: ResourceDAO
The method to create a resource id and assign to resource instance

Specified by:
createAndApplyResourceID in interface ResourceDAO
Parameters:
path - path of the resource
parentID - parent path id
resourceImpl - the resource instance to be assigned the resource id.
Throws:
RegistryException - throws if operation failed.

createResourceID

public ResourceIDImpl createResourceID(String path,
                                       ResourceIDImpl parentID,
                                       boolean isCollection)
                                throws RegistryException
Description copied from interface: ResourceDAO
Create a resource ID for a path given the parent resource id and whether it is a collection or not.

Specified by:
createResourceID in interface ResourceDAO
Parameters:
path - the path of the resource
parentID - parent resource id
isCollection - whether the resource is a collection or not
Returns:
the newly created resource id.
Throws:
RegistryException - throws if operation failed.

deleteContentStream

public void deleteContentStream(int contentID)
                         throws RegistryException
Description copied from interface: ResourceDAO
delete the content for a given content id.

Specified by:
deleteContentStream in interface ResourceDAO
Parameters:
contentID - content id.
Throws:
RegistryException - throws if the operation failed.

getContentStream

public InputStream getContentStream(int contentID)
                             throws RegistryException
Description copied from interface: ResourceDAO
Get the content input stream for a given content id.

Specified by:
getContentStream in interface ResourceDAO
Parameters:
contentID - the content id as an argument.
Returns:
the content input stream.
Throws:
RegistryException - throws if the operation failed.

update

public void update(ResourceImpl resourceImpl)
            throws RegistryException
Description copied from interface: ResourceDAO
Save the updates of a given resource.

Specified by:
update in interface ResourceDAO
Parameters:
resourceImpl - the resource to be updated.
Throws:
RegistryException - throws if the operation failed.

getChildCount

public int getChildCount(CollectionImpl collection,
                         DataAccessManager dataAccessManager)
                  throws RegistryException
Description copied from interface: ResourceDAO
Method to return a child count of a collection (database connection should also be provided)

Specified by:
getChildCount in interface ResourceDAO
Parameters:
collection - the collection object which the children are calculated.
dataAccessManager - the data access manager to access the database.
Returns:
the child count.
Throws:
RegistryException - throws if the operation failed.

getChildCount

public int getChildCount(CollectionImpl collection,
                         Connection conn)
                  throws RegistryException
Method to return a child count of a collection (database connection should also be provided)

Parameters:
collection - the collection object which the children are calculated.
conn - the database connection.
Returns:
the child count.
Throws:
RegistryException - throws if the operation failed.

fillChildren

public void fillChildren(CollectionImpl collection,
                         int start,
                         int pageLen)
                  throws RegistryException
Description copied from interface: ResourceDAO
Fill the children for a resource that already filled with meta data. Children are filled only at the at of the intersect of the given range and resource existence range.

Specified by:
fillChildren in interface ResourceDAO
Parameters:
collection - collection to fill the children and properties.
start - start value of the range of children.
pageLen - the length of the children to retrieve
Throws:
RegistryException - if the operation failed.

fillChildren

public void fillChildren(CollectionImpl collection,
                         DataAccessManager dataAccessManager)
                  throws RegistryException
Description copied from interface: ResourceDAO
Fill the children for a resource that already filled with meta data. Children are filled only at the at of the intersect of the given range and resource existence range.

Specified by:
fillChildren in interface ResourceDAO
Parameters:
collection - collection to fill the children and properties.
dataAccessManager - the data access manager to access the database
Throws:
RegistryException - if the operation failed.

fillChildren

public void fillChildren(CollectionImpl collection,
                         int start,
                         int pageLen,
                         Connection conn)
                  throws RegistryException
Fill the children for a resource that already filled with meta data. Children are filled only at the at of the intersect of the given range and resource existence range.

Parameters:
collection - collection to fill the children and properties.
start - start value of the range of children.
pageLen - the length of the children to retrieve
conn - the database connection
Throws:
RegistryException - if the operation failed.

getChildren

public String[] getChildren(CollectionImpl collection,
                            int start,
                            int pageLen,
                            DataAccessManager dataAccessManager)
                     throws RegistryException
Description copied from interface: ResourceDAO
Get the children of the collection. Children are filled only at the at of the intersect of the given range and resource existence range.

Specified by:
getChildren in interface ResourceDAO
Parameters:
collection - collection to fill the children and properties.
start - start value of the range of children.
pageLen - the length of the children to retrieve
dataAccessManager - the data access manager to access the database
Returns:
an array of children paths
Throws:
RegistryException - throws if the operation failed.

getChildren

public String[] getChildren(CollectionImpl collection,
                            int start,
                            int pageLen,
                            Connection conn)
                     throws RegistryException
Get the children of the collection. Children are filled only at the at of the intersect of the given range and resource existence range.

Parameters:
collection - collection to fill the children and properties.
start - start value of the range of children.
pageLen - the length of the children to retrieve
conn - the database connection
Returns:
an array of children paths
Throws:
RegistryException - throws if the operation failed.

getChildren

public String[] getChildren(CollectionImpl collection,
                            int start,
                            int pageLen)
                     throws RegistryException
Description copied from interface: ResourceDAO
Get the children of the collection. Children are filled only at the at of the intersect of the given range and resource existence range.

Specified by:
getChildren in interface ResourceDAO
Parameters:
collection - collection to fill the children and properties.
start - start value of the range of children.
pageLen - the length of the children to retrieve
Returns:
an array of children paths
Throws:
RegistryException - throws if the operation failed.

getResourceMetaData

public ResourceImpl getResourceMetaData(String path)
                                 throws RegistryException
Description copied from interface: ResourceDAO
Method to return the resource meta data (excluding properties, content and children)

Specified by:
getResourceMetaData in interface ResourceDAO
Parameters:
path - the of the resource
Returns:
resource instance with the meta data filled.
Throws:
RegistryException - throws if the operation failed.

getResourceMetaData

public ResourceImpl getResourceMetaData(ResourceIDImpl resourceID)
                                 throws RegistryException
Description copied from interface: ResourceDAO
Method to return the resource meta data (excluding properties, content and children)

Specified by:
getResourceMetaData in interface ResourceDAO
Parameters:
resourceID - the resource id
Returns:
resource instance with the meta data filled.
Throws:
RegistryException - throws if the operation failed.

getResourceWithNoUpdate

public ResourceImpl getResourceWithNoUpdate(ResourceIDImpl resourceID)
                                     throws RegistryException
Description copied from interface: ResourceDAO
Method to get resource without setting the resource modified flags on.

Specified by:
getResourceWithNoUpdate in interface ResourceDAO
Parameters:
resourceID - the resource id.
Returns:
the resource for the given id.
Throws:
RegistryException - throws if the operation failed.

fillResourceContent

public void fillResourceContent(ResourceImpl resourceImpl)
                         throws RegistryException
Description copied from interface: ResourceDAO
Fill resource content for a given resource implementation.

Specified by:
fillResourceContent in interface ResourceDAO
Parameters:
resourceImpl - resource object.
Throws:
RegistryException - throws if the operation failed.

fillResourceContentWithNoUpdate

public void fillResourceContentWithNoUpdate(ResourceImpl resourceImpl)
                                     throws RegistryException
Description copied from interface: ResourceDAO
Fill resource content for a given resource implementation without setting the resource modified flag on.

Specified by:
fillResourceContentWithNoUpdate in interface ResourceDAO
Parameters:
resourceImpl - resource object.
Throws:
RegistryException - throws if the operation failed.

updateCollectionLastUpdatedTime

public void updateCollectionLastUpdatedTime(ResourceIDImpl resourceID)
                                     throws RegistryException
Description copied from interface: ResourceDAO
Update the last updated time of a resource, This is called to update the parent's last updated time when a child is created, deleted or moved out/in, copy in.

Specified by:
updateCollectionLastUpdatedTime in interface ResourceDAO
Parameters:
resourceID - the id of the resource to get the version of.
Throws:
RegistryException - throws if the operation failed.

updateContentId

public void updateContentId(ResourceImpl resourceImpl)
                     throws RegistryException
Description copied from interface: ResourceDAO
Update the content id of a resource, Normally this should be called after calling addResourceWithoutContentId is called.

Specified by:
updateContentId in interface ResourceDAO
Parameters:
resourceImpl - the resource object.
Throws:
RegistryException - throws if the operation failed.

addResourceWithoutContentId

public void addResourceWithoutContentId(ResourceImpl resourceImpl,
                                        boolean isUpdatingExisting)
                                 throws RegistryException
Description copied from interface: ResourceDAO
Add a resource without a content id, provided whether it is overwriting existing one or not. If the resource is already existing the removal of the older resource will not be handled in this function.

Specified by:
addResourceWithoutContentId in interface ResourceDAO
Parameters:
resourceImpl - the resource object.
isUpdatingExisting - whether the resource is updating or not.
Throws:
RegistryException - throws if the operation failed.

addResourceWithNoUpdate

public void addResourceWithNoUpdate(ResourceImpl resourceImpl)
                             throws RegistryException
Description copied from interface: ResourceDAO
Add a resource without setting the resource modified flag on.

Specified by:
addResourceWithNoUpdate in interface ResourceDAO
Parameters:
resourceImpl - the resource to be added.
Throws:
RegistryException - throws if the operation failed.

addResourceDO

public void addResourceDO(ResourceDO resourceDO)
                   throws RegistryException
Description copied from interface: ResourceDAO
Add the resource data object.

Specified by:
addResourceDO in interface ResourceDAO
Parameters:
resourceDO - the resource data object.
Throws:
RegistryException - throws if the operation failed.

deleteResource

public void deleteResource(ResourceDO resourceDO)
                    throws RegistryException
Description copied from interface: ResourceDAO
Delete the resource provided as a resource DO

Specified by:
deleteResource in interface ResourceDAO
Parameters:
resourceDO - the resource to be deleted.
Throws:
RegistryException - throws if the operation failed.

addProperties

public void addProperties(ResourceImpl resource)
                   throws RegistryException
Description copied from interface: ResourceDAO
Add the properties to the database from given resource

Specified by:
addProperties in interface ResourceDAO
Parameters:
resource - to add properties for
Throws:
RegistryException - throws if the operation failed.

removeProperties

public void removeProperties(ResourceDO resourceDO)
                      throws RegistryException
Description copied from interface: ResourceDAO
Remove properties of a resource.

Specified by:
removeProperties in interface ResourceDAO
Parameters:
resourceDO - the resource DO which the properties have to be deleted.
Throws:
RegistryException - throws if the operation failed.

addContent

public void addContent(ResourceImpl resourceImpl)
                throws RegistryException
Description copied from interface: ResourceDAO
Add the content for a resource.

Specified by:
addContent in interface ResourceDAO
Parameters:
resourceImpl - the resource to add content.
Throws:
RegistryException - throws if the operation failed.

addContentBytes

public int addContentBytes(InputStream contentStream)
                    throws RegistryException
Description copied from interface: ResourceDAO
Add the content to the content table and return the auto generated id of content table.

Specified by:
addContentBytes in interface ResourceDAO
Parameters:
contentStream - the input stream.
Returns:
the auto generated id of content table.
Throws:
RegistryException - throws if the operation failed.

getResourceDO

public ResourceDO getResourceDO(long version)
                         throws RegistryException
Description copied from interface: ResourceDAO
Method to return resourceDO from a version number.

Specified by:
getResourceDO in interface ResourceDAO
Parameters:
version - the version of the resource.
Returns:
the resourceDO for the given version.
Throws:
RegistryException - throws if the operation failed.

getResourceDO

public ResourceDO getResourceDO(ResourceIDImpl resourceID)
                         throws RegistryException
Description copied from interface: ResourceDAO
Method to get resource from resource id.

Specified by:
getResourceDO in interface ResourceDAO
Parameters:
resourceID - the resource id.
Returns:
the resource DO for the resource id.
Throws:
RegistryException - throws if the operation failed.

getChildPathIds

public List<ResourceIDImpl> getChildPathIds(ResourceIDImpl resourceID)
                                     throws RegistryException
Description copied from interface: ResourceDAO
Get the child path ids of a resource, (should be a collection)

Specified by:
getChildPathIds in interface ResourceDAO
Parameters:
resourceID - the resource id of the collection.
Returns:
an array of child path ids.
Throws:
RegistryException - throws if the operation failed.

getPathFromId

public String getPathFromId(int pathId)
                     throws RegistryException
Description copied from interface: ResourceDAO
Get the path from the path id.

Specified by:
getPathFromId in interface ResourceDAO
Parameters:
pathId - the path id.
Returns:
the path corresponding to the path id.
Throws:
RegistryException - throws if operation failed.

getPath

public String getPath(long version)
               throws RegistryException
Description copied from interface: ResourceDAO
Get the path provided the resource version.

Specified by:
getPath in interface ResourceDAO
Parameters:
version - the version of the resource.
Returns:
the path of the resource.
Throws:
RegistryException - throws if the operation failed.

getPath

public String getPath(int pathId,
                      String resourceName,
                      boolean checkExistence)
               throws RegistryException
Description copied from interface: ResourceDAO
Get the path given the path id, resource name and provided whether the resourceExistence should be checked.

Specified by:
getPath in interface ResourceDAO
Parameters:
pathId - the path id
resourceName - the resource name
checkExistence - boolean to indicate whether the resource existence should be checked.
Returns:
the path
Throws:
RegistryException - if the operation failed.

moveResources

public void moveResources(ResourceIDImpl source,
                          ResourceIDImpl target)
                   throws RegistryException
Description copied from interface: ResourceDAO
Move resource provided the source and target resource ids.

Specified by:
moveResources in interface ResourceDAO
Parameters:
source - the resource Id of the source.
target - the resource id of the target.
Throws:
RegistryException - throws if the operation failed.

moveResourcePaths

public void moveResourcePaths(ResourceIDImpl source,
                              ResourceIDImpl target)
                       throws RegistryException
Description copied from interface: ResourceDAO
This method will move the paths from one path id to another regardless of the resource name

Specified by:
moveResourcePaths in interface ResourceDAO
Parameters:
source - the path id of the source resource.
target - the path id of the target resource.
Throws:
RegistryException - throws if the operation failed.

moveProperties

public void moveProperties(ResourceIDImpl source,
                           ResourceIDImpl target)
                    throws RegistryException
Description copied from interface: ResourceDAO
Move the properties.

Specified by:
moveProperties in interface ResourceDAO
Parameters:
source - the resource id of the source resource.
target - the resource id of the target resource.
Throws:
RegistryException - throws if the operation failed.

movePropertyPaths

public void movePropertyPaths(ResourceIDImpl source,
                              ResourceIDImpl target)
                       throws RegistryException
Description copied from interface: ResourceDAO
this function will move the paths from one path id to another regardless of the resource name

Specified by:
movePropertyPaths in interface ResourceDAO
Parameters:
source - the resource id of the source resource.
target - the resource id of the target resource.
Throws:
RegistryException - throws if the operation failed.


Copyright © 2013 WSO2 Inc. All Rights Reserved.