org.wso2.carbon.registry.core.dao
Interface ResourceVersionDAO

All Known Implementing Classes:
JDBCResourceVersionDAO

public interface ResourceVersionDAO

Data Access Object for Resources when versioning for resources has been enabled.


Method Summary
 long createSnapshot(int pathId, String name, InputStream versionsStream)
          Creates a new snapshot of the resource.
 void fillChildren(CollectionImpl collectionImpl, VersionRetriever versionRetriever, int parentVersionIndex, int start, int pageLen, long snapshotID)
          Fill the children for a resource that already filled with meta data.
 void fillResourceContentArchived(ResourceImpl resourceImpl)
          Fill the archived content to the resource object.
 ResourceImpl get(ResourceIDImpl resourceID, long snapshotID)
          Returns the resource in the given path filled with meta-data and access to the content.
 CollectionImpl get(ResourceIDImpl resourceID, long snapshotID, 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.
 String[] getChildPaths(ResourceIDImpl resourceID, VersionRetriever versionRetriever, int parentVersionIndex, int start, int pageLen, long snapshotID, DataAccessManager dataAccessManager)
          Get the child paths of a resource, (should be a collection)
 Long[] getSnapshotIDs(String resourcePath)
          Get the identifiers of the snapshots created for a given path.
 VersionRetriever getVersionList(long snapshotID)
          Creates version retriever that can be used to get the list of versions of a given snapshot, which includes the versions of the children.
 VersionRetriever getVersionList(ResourceIDImpl resourceID, long snapshotID)
          Creates version retriever that can be used to get the list of versions of a given snapshot, which includes the versions of the children if this was a collection.
 boolean isContentHistoryExist(int contentId)
          Check whether the content is already in the history.
 boolean isResourceHistoryExist(long version)
          Check whether the resource is already in the history with the give version
 boolean isResourceHistoryExist(ResourceIDImpl resourceID)
          Check whether the resource is already in the history with the give resourceID
 boolean isResourceHistoryExist(String path)
          Check whether the resource is already in the history with the give path
 void putResourceToHistory(ResourceDO resourceDO)
          Method to Archive Resource.
 void removePropertyValues(long regVersionId)
          Removes any properties associated with a given version of a resource.
 void removeSnapshot(long snapshotId)
          Removes a snapshot of a given resource.
 boolean resourceExists(ResourceIDImpl resourceID, long snapshotID)
          Method to check the resource existence for a given path.
 String restoreResources(long version, long snapshotID)
          Restore the resource to the given version.
 void versionResource(ResourceDO resourceDO, boolean keepProperties)
          Create a version of the given resource.
 

Method Detail

getSnapshotIDs

Long[] getSnapshotIDs(String resourcePath)
                      throws RegistryException
Get the identifiers of the snapshots created for a given path.

Parameters:
resourcePath - the resource path
Returns:
a list of identifiers
Throws:
RegistryException - if an error occurs.

fillResourceContentArchived

void fillResourceContentArchived(ResourceImpl resourceImpl)
                                 throws RegistryException
Fill the archived content to the resource object.

Parameters:
resourceImpl - the resource object.
Throws:
RegistryException - if an error occurs.

get

ResourceImpl get(ResourceIDImpl resourceID,
                 long snapshotID)
                 throws RegistryException
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.

Parameters:
resourceID - the resource id
snapshotID - the snapshot id
Returns:
resource object.
Throws:
RegistryException - throws if resource retrieval failed.

resourceExists

boolean resourceExists(ResourceIDImpl resourceID,
                       long snapshotID)
                       throws RegistryException
Method to check the resource existence for a given path.

Parameters:
resourceID - the resource id
snapshotID - the snapshot id
Returns:
true, if the resource exists, false otherwise
Throws:
RegistryException - throws if checking existence failed.

getVersionList

VersionRetriever getVersionList(ResourceIDImpl resourceID,
                                long snapshotID)
                                throws RegistryException
Creates version retriever that can be used to get the list of versions of a given snapshot, which includes the versions of the children if this was a collection.

Parameters:
resourceID - the resource id
snapshotID - the snapshot id
Returns:
version retriever instance.
Throws:
RegistryException - if the operation failed.
See Also:
VersionRetriever

getVersionList

VersionRetriever getVersionList(long snapshotID)
                                throws RegistryException
Creates version retriever that can be used to get the list of versions of a given snapshot, which includes the versions of the children.

Parameters:
snapshotID - the snapshot id
Returns:
version retriever instance.
Throws:
RegistryException - if the operation failed.
See Also:
VersionRetriever

get

CollectionImpl get(ResourceIDImpl resourceID,
                   long snapshotID,
                   int start,
                   int pageLen)
                   throws RegistryException
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.

Parameters:
resourceID - resource id of the collection.
snapshotID - snapshot id 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.

fillChildren

void fillChildren(CollectionImpl collectionImpl,
                  VersionRetriever versionRetriever,
                  int parentVersionIndex,
                  int start,
                  int pageLen,
                  long snapshotID)
                  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:
collectionImpl - collection to fill the children and properties.
versionRetriever - the version retriever used to get the versions.
parentVersionIndex - the version index of the parent.
start - start value of the range of children.
pageLen - the length of the children to retrieve.
snapshotID - the snapshot id.
Throws:
RegistryException - if the operation failed.

getChildPaths

String[] getChildPaths(ResourceIDImpl resourceID,
                       VersionRetriever versionRetriever,
                       int parentVersionIndex,
                       int start,
                       int pageLen,
                       long snapshotID,
                       DataAccessManager dataAccessManager)
                       throws RegistryException
Get the child paths of a resource, (should be a collection)

Parameters:
resourceID - the resource id of the collection.
versionRetriever - the version retriever to be used.
snapshotID - the snapshot id.
start - start value of the range of children.
pageLen - the length of the children to retrieve.
parentVersionIndex - the version index of the parent.
dataAccessManager - the data access manager to access the database.
Returns:
an array of child paths.
Throws:
RegistryException - throws if the operation failed.

createSnapshot

long createSnapshot(int pathId,
                    String name,
                    InputStream versionsStream)
                    throws RegistryException
Creates a new snapshot of the resource.

Parameters:
pathId - the path identifier
name - the name of the resource
versionsStream - the input stream of versions
Returns:
the id of created snapshot.
Throws:
RegistryException - if the operation failed.

isResourceHistoryExist

boolean isResourceHistoryExist(long version)
                               throws RegistryException
Check whether the resource is already in the history with the give version

Parameters:
version - the version
Returns:
whether the resource exists in the history.
Throws:
RegistryException - if the operation failed.

isResourceHistoryExist

boolean isResourceHistoryExist(String path)
                               throws RegistryException
Check whether the resource is already in the history with the give path

Parameters:
path - the resource path
Returns:
whether the resource exists in the history.
Throws:
RegistryException - if the operation failed.

isResourceHistoryExist

boolean isResourceHistoryExist(ResourceIDImpl resourceID)
                               throws RegistryException
Check whether the resource is already in the history with the give resourceID

Parameters:
resourceID - the resource identifier.
Returns:
whether the resource exists in the history.
Throws:
RegistryException - if the operation failed.

isContentHistoryExist

boolean isContentHistoryExist(int contentId)
                              throws RegistryException
Check whether the content is already in the history.

Parameters:
contentId - the content identifier.
Returns:
true if it exist in history, false otherwise.
Throws:
RegistryException - if the operation failed.

restoreResources

String restoreResources(long version,
                        long snapshotID)
                        throws RegistryException
Restore the resource to the given version.

Parameters:
version - the version.
snapshotID - the snapshot id
Returns:
the resource path.
Throws:
RegistryException - if the operation failed.

versionResource

void versionResource(ResourceDO resourceDO,
                     boolean keepProperties)
                     throws RegistryException
Create a version of the given resource.

Parameters:
resourceDO - the resource data object.
keepProperties - whether to keep properties or not.
Throws:
RegistryException - if the operation failed.
See Also:
putResourceToHistory(org.wso2.carbon.registry.core.jdbc.dataobjects.ResourceDO)

putResourceToHistory

void putResourceToHistory(ResourceDO resourceDO)
                          throws RegistryException
Method to Archive Resource.

Parameters:
resourceDO - the resource data object.
Throws:
RegistryException - if the operation failed.

removeSnapshot

void removeSnapshot(long snapshotId)
                    throws RegistryException
Removes a snapshot of a given resource.

Parameters:
snapshotId - id of the snapshot to be removed.
Throws:
RegistryException - if the operation failed.

removePropertyValues

void removePropertyValues(long regVersionId)
                          throws RegistryException
Removes any properties associated with a given version of a resource.

Parameters:
regVersionId - version id of the resource.
Throws:
RegistryException - if the operation failed.


Copyright © 2013 WSO2 Inc. All Rights Reserved.