org.wso2.registry.jdbc.dao
Class ResourceVersionDAO

java.lang.Object
  extended by org.wso2.registry.jdbc.dao.ResourceVersionDAO

public class ResourceVersionDAO
extends java.lang.Object


Constructor Summary
ResourceVersionDAO()
           
 
Method Summary
 java.lang.String addContentVersion(java.io.InputStream contentStream)
           
 void addDependencies(java.lang.String resourceID, int versionNumber, java.util.List<java.lang.String> childIDs)
           
 void addProperties(ResourceImpl resource, long version)
           
 int addResourceVersion(ResourceImpl resourceImpl, java.lang.String contentVersionID)
           
 long addSnapshot(java.lang.String snapshotRootID)
           
 void addSnapshotResource(long snapshotID, java.lang.String resourceID, int versionNumber)
           
 ResourceImpl get(java.lang.String resourceID, long snapshotID, long version)
           
 java.util.List<java.lang.String> getChildIDs(java.lang.String resourceID, long version)
           
 int getLatestResourceVersionNumber(java.lang.String resourceID)
           
 long getMatchingSnapshotID(java.lang.String resourceID, long version)
          Given a resource ID and a version number there may or may not be a snapshot ID.
 int getMaxResourceVersion(java.lang.String resourceID)
           
 java.io.InputStream getResourceContentStream(java.lang.String contentID, java.sql.Connection conn)
           
 ResourceDO getResourceVersionDO(java.lang.String resourceID, long snapshotID)
           
 java.lang.Long[] getSnapshotIDs(java.lang.String resourcePath)
           
 long getVersion(java.lang.String resourceID, long snapshotID)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResourceVersionDAO

public ResourceVersionDAO()
Method Detail

addSnapshot

public long addSnapshot(java.lang.String snapshotRootID)
                 throws RegistryException
Throws:
RegistryException

getLatestResourceVersionNumber

public int getLatestResourceVersionNumber(java.lang.String resourceID)
                                   throws RegistryException
Throws:
RegistryException

addResourceVersion

public int addResourceVersion(ResourceImpl resourceImpl,
                              java.lang.String contentVersionID)
                       throws RegistryException
Throws:
RegistryException

getMaxResourceVersion

public int getMaxResourceVersion(java.lang.String resourceID)
                          throws RegistryException
Throws:
RegistryException

addDependencies

public void addDependencies(java.lang.String resourceID,
                            int versionNumber,
                            java.util.List<java.lang.String> childIDs)
                     throws RegistryException
Throws:
RegistryException

addProperties

public void addProperties(ResourceImpl resource,
                          long version)
                   throws RegistryException
Throws:
RegistryException

addSnapshotResource

public void addSnapshotResource(long snapshotID,
                                java.lang.String resourceID,
                                int versionNumber)
                         throws RegistryException
Throws:
RegistryException

getSnapshotIDs

public java.lang.Long[] getSnapshotIDs(java.lang.String resourcePath)
                                throws RegistryException
Throws:
RegistryException

getVersion

public long getVersion(java.lang.String resourceID,
                       long snapshotID)
                throws RegistryException
Throws:
RegistryException

get

public ResourceImpl get(java.lang.String resourceID,
                        long snapshotID,
                        long version)
                 throws RegistryException
Throws:
RegistryException

addContentVersion

public java.lang.String addContentVersion(java.io.InputStream contentStream)
                                   throws RegistryException
Throws:
RegistryException

getResourceContentStream

public java.io.InputStream getResourceContentStream(java.lang.String contentID,
                                                    java.sql.Connection conn)
                                             throws RegistryException
Throws:
RegistryException

getResourceVersionDO

public ResourceDO getResourceVersionDO(java.lang.String resourceID,
                                       long snapshotID)
                                throws RegistryException
Throws:
RegistryException

getChildIDs

public java.util.List<java.lang.String> getChildIDs(java.lang.String resourceID,
                                                    long version)
                                             throws RegistryException
Throws:
RegistryException

getMatchingSnapshotID

public long getMatchingSnapshotID(java.lang.String resourceID,
                                  long version)
                           throws RegistryException
Given a resource ID and a version number there may or may not be a snapshot ID. That is, whenever a snapshot is created, an associating version of the resource is prepared. But, when creating a snapshot of a collection, new versions will be created for all dirty child resources/collections. Such resources/collection versions do not have a matching snapshot ID. Such versions are just a part of a snapshot of another collection. And it is possible to have more than one matching snapshot for a given resource ID and a version. A simple example is creating two snapshots of a resource, without modifying the resource. This method returns the latest (highest) snapshot ID for the given resource ID and the version. If a mathcing snapshot is not found, it will return -1.

Parameters:
resourceID - UUID of the resource
version - Version number of the resource.
Returns:
Matching snapshot number if available. -1 otherwise.
Throws:
RegistryException


Copyright © 2007 Apache Web Services Project. All Rights Reserved.