org.wso2.carbon.registry.core.jdbc
Class VersionRepository

java.lang.Object
  extended by org.wso2.carbon.registry.core.jdbc.VersionRepository

public class VersionRepository
extends java.lang.Object

Repository for versioned resources.


Constructor Summary
VersionRepository(DataAccessManager dataAccessManager)
          Constructor accepting data access manager.
 
Method Summary
 void addDescendants(ResourceIDImpl resourceID, java.util.ArrayList<java.lang.Long> versionList, boolean isRenewing, boolean keepProperties)
          Here the versions of the descendants of the resource is added to the versionList array.
 void createSnapshot(Resource resource, boolean isRenewing, boolean keepProperties)
          Method used to create a snapshot of a given resource.
 void createSnapshot(ResourcePath resourcePath, boolean isRenewing, boolean keepProperties)
          Method used to create a snapshot of a given resource.
 Resource get(VersionedPath versionedPath)
          Gets the pure resource referred by the given path.
 Collection get(VersionedPath versionedPath, int start, int pageLen)
          Method to get a paged collection.
 Resource getMetaData(VersionedPath versionedPath)
          Gets the meta data of resource referred by the given path.
 java.lang.String[] getVersions(java.lang.String resourcePath)
          Method to obtain a list of versioned paths.
 boolean resourceExists(VersionedPath versionedPath)
          Checks if a pure resource exists in the given path.
 void restoreVersion(ResourcePath resourcePath)
          Method to restore a version.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VersionRepository

public VersionRepository(DataAccessManager dataAccessManager)
Constructor accepting data access manager.

Parameters:
dataAccessManager - the data access manager that is used for database communications.
Method Detail

createSnapshot

public void createSnapshot(Resource resource,
                           boolean isRenewing,
                           boolean keepProperties)
                    throws RegistryException
Method used to create a snapshot of a given resource.

Parameters:
resource - the resource.
isRenewing - whether we are renewing.
keepProperties - whether to preserve properties.
Throws:
RegistryException - if the operation failed.

createSnapshot

public void createSnapshot(ResourcePath resourcePath,
                           boolean isRenewing,
                           boolean keepProperties)
                    throws RegistryException
Method used to create a snapshot of a given resource.

Parameters:
resourcePath - the resource path.
isRenewing - whether we are renewing.
keepProperties - whether to preserve properties.
Throws:
RegistryException - if the operation failed.

addDescendants

public void addDescendants(ResourceIDImpl resourceID,
                           java.util.ArrayList<java.lang.Long> versionList,
                           boolean isRenewing,
                           boolean keepProperties)
                    throws RegistryException
Here the versions of the descendants of the resource is added to the versionList array. immediate descendants will be added to the list before others

Parameters:
resourceID - the resource identifier
versionList - a list of versions.
isRenewing - whether we are renewing.
keepProperties - whether to preserve properties.
Throws:
RegistryException - if the operation failed.

getVersions

public java.lang.String[] getVersions(java.lang.String resourcePath)
                               throws RegistryException
Method to obtain a list of versioned paths. for a given path.

Parameters:
resourcePath - the resource path.
Returns:
array of version paths.
Throws:
RegistryException - if the operation failed.

getMetaData

public Resource getMetaData(VersionedPath versionedPath)
                     throws RegistryException
Gets the meta data of resource referred by the given path.

Parameters:
versionedPath - Path of a versioned resource.
Returns:
Resource referred by the given path. Resource can be a file or a collection.
Throws:
RegistryException - if the operation failed.

resourceExists

public boolean resourceExists(VersionedPath versionedPath)
                       throws RegistryException
Checks if a pure resource exists in the given path.

Parameters:
versionedPath - Path of a versioned resource.
Returns:
true if a resource exists in the given path. false otherwise.
Throws:
RegistryException - if the operation failed.

get

public Resource get(VersionedPath versionedPath)
             throws RegistryException
Gets the pure resource referred by the given path.

Parameters:
versionedPath - Path of a versioned resource.
Returns:
Resource referred by the given path. Resource can be a file or a collection.
Throws:
RegistryException - if the operation failed.

get

public Collection get(VersionedPath versionedPath,
                      int start,
                      int pageLen)
               throws RegistryException
Method to get a paged collection.

Parameters:
versionedPath - the collection path (which also contains the version).
start - the starting index.
pageLen - the page length.
Returns:
collection with resources on the given page.
Throws:
RegistryException - if the operation failed.

restoreVersion

public void restoreVersion(ResourcePath resourcePath)
                    throws RegistryException
Method to restore a version.

Parameters:
resourcePath - the resource path (which also contains the version).
Throws:
RegistryException - if the operation failed.


Copyright © 2011 WSO2 Inc. All Rights Reserved.