org.wso2.registry.jdbc.dao
Class ResourceVersionDAO
java.lang.Object
org.wso2.registry.jdbc.dao.ResourceVersionDAO
public class ResourceVersionDAO
- extends java.lang.Object
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)
|
void |
createFileBasedContentFromDB(java.lang.String contentID,
java.sql.Connection conn)
|
ResourceImpl |
get(java.lang.String resourceID,
long snapshotID,
long version)
|
CollectionImpl |
get(java.lang.String resourceID,
long snapshotID,
long version,
int start,
int pageLen)
|
int |
getChildCount(java.lang.String resourceID,
long versionNumber,
java.sql.Connection conn)
|
java.util.List<java.lang.String> |
getChildIDs(java.lang.String resourceID,
long version)
|
java.util.List<java.lang.String> |
getChildPaths(ResourceImpl resourceImpl,
long snapshotID,
int start,
int pageLen,
java.sql.Connection conn)
|
java.util.List<java.lang.String> |
getChildPaths(java.lang.String resourceID,
long snapshotID,
long versionNumber,
java.sql.Connection conn)
|
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)
|
java.lang.String |
getResourceID(java.lang.String path,
long snapshotID)
For a given snapshot, there can be at most one resource in a given path. |
ResourceDO |
getResourceVersionDO(java.lang.String resourceID,
long snapshotID)
|
java.lang.Long[] |
getSnapshotIDs(java.lang.String resourcePath)
|
long |
getVersion(java.lang.String resourceID,
long snapshotID)
|
void |
invalidateAssociatedSnapshot(java.lang.String resourceID)
|
void |
removeSnapshotsOfResource(java.lang.String resourceID)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ResourceVersionDAO
public ResourceVersionDAO()
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
get
public CollectionImpl get(java.lang.String resourceID,
long snapshotID,
long version,
int start,
int pageLen)
throws RegistryException
- Throws:
RegistryException
getChildCount
public int getChildCount(java.lang.String resourceID,
long versionNumber,
java.sql.Connection conn)
throws RegistryException
- Throws:
RegistryException
getChildPaths
public java.util.List<java.lang.String> getChildPaths(java.lang.String resourceID,
long snapshotID,
long versionNumber,
java.sql.Connection conn)
throws RegistryException
- Throws:
RegistryException
getChildPaths
public java.util.List<java.lang.String> getChildPaths(ResourceImpl resourceImpl,
long snapshotID,
int start,
int pageLen,
java.sql.Connection conn)
throws RegistryException
- Throws:
RegistryException
addContentVersion
public java.lang.String addContentVersion(java.io.InputStream contentStream)
throws RegistryException
- Throws:
RegistryException
createFileBasedContentFromDB
public void createFileBasedContentFromDB(java.lang.String contentID,
java.sql.Connection conn)
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 resourceversion
- Version number of the resource.
- Returns:
- Matching snapshot number if available. -1 otherwise.
- Throws:
RegistryException
- something went wrong
getResourceID
public java.lang.String getResourceID(java.lang.String path,
long snapshotID)
throws RegistryException
- For a given snapshot, there can be at most one resource in a given path. But there may be
np resources for a given path or the given path may not be included in a given snapshot.
Therefore, given a path and snapshot ID we should get an unique resource or no resources
at all.
- Parameters:
path
- Path of the resource, at the time where snapshot is createdsnapshotID
- Snapshot ID
- Returns:
- Resource ID of the resource at given path in given snapshot, if a resource exists
at given path. Null otherwise.
- Throws:
RegistryException
- For database related errors
removeSnapshotsOfResource
public void removeSnapshotsOfResource(java.lang.String resourceID)
throws RegistryException
- Throws:
RegistryException
invalidateAssociatedSnapshot
public void invalidateAssociatedSnapshot(java.lang.String resourceID)
throws RegistryException
- Throws:
RegistryException
Copyright © 2007 Apache Web Services Project. All Rights Reserved.