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

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

public class VersionRepository
extends Object

Repository for versioned resources.


Constructor Summary
VersionRepository(DataSource dataSource)
          Constructor accepting data source.
 
Method Summary
 void addDescendants(ResourceIDImpl resourceID, ArrayList<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.
 String[] getVersions(String resourcePath)
          Method to obtain a list of versioned paths.
 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(DataSource dataSource)
Constructor accepting data source.

Parameters:
dataSource - the data source 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,
                           ArrayList<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 String[] getVersions(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.

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 © 2010. All Rights Reserved.