|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.xiruss.repository.server.RepositoryBase
public class RepositoryBase
Superclass for SnapCM repositories. Provides basic data structures for managing collections of SnapCM objects. Subclasses of Repository add functionality such as access control, integration with specific storage managers, and so on.
| Field Summary | |
|---|---|
protected java.util.Map |
branchesById
|
protected java.util.Map |
branchesByName
|
protected StorageManager |
defaultStorageManager
|
protected DependencyMap |
dependenciesById
|
protected java.lang.Integer |
id
|
protected static java.util.Map |
interfaceToClassMap
Map to hold mappings from interface types to implementation types. |
protected SnapshotMap |
mutableSnapshots
|
static Branch |
nullBranch
|
static MutableSnapshot |
nullMutableSnapshot
|
static RepositoryObject |
nullRepositoryObject
|
static Resource |
nullResource
|
static Snapshot |
nullSnapshot
|
(package private) java.text.DecimalFormat |
objectIdFormatter
|
protected RepositoryObjectMap |
objectsById
|
protected static java.util.Properties |
properties
Run-time configuration properties of the repository instance |
protected java.util.Map |
resourcesByAlias
|
protected ResourceMap |
resourcesById
|
protected long |
snapshotIdCtr
|
protected SnapshotMap |
snapshotsById
|
protected java.util.Map |
usersByAlias
|
protected RepositoryObjectMap |
usersById
|
protected long |
verIdCtr
|
protected java.util.Map |
versionsByAlias
|
protected VersionMap |
versionsById
|
| Fields inherited from interface org.xiruss.repository.api.Repository |
|---|
builtinContainerNames, nullDependencyLink, nullDependencyMap, nullRepository, nullResolutionPolicy, nullResourceMap, nullSnapshotMap, nullStorageManager, nullVersion, nullVersionByResourceMap, nullVersionMap |
| Constructor Summary | |
|---|---|
RepositoryBase()
|
|
| Method Summary | |
|---|---|
void |
accept(RepositoryVisitor visitor)
|
java.lang.String |
addStorageManager(StorageManager manager)
Sets the active storage manager to the specified manager. |
Branch |
createBranch(java.lang.String branchName)
Create a new branch and assign the specified branch name to it. |
DependencyLink |
createDependency(java.lang.String dependencyType,
Version sourceVersion,
Resource targetResource,
ResolutionPolicy policy)
Create a new dependency between the specified Version and a target Resource, using the specified resolution policy. |
DependencyLink |
createDependency(java.lang.String dependencyType,
Version sourceVersion,
Resource targetResource,
ResolutionPolicy policy,
java.lang.Object sourceObject)
Factory method for creating new dependency instances based on the dependency type value. |
DependencyLink |
createDependency(java.lang.String dependencyClassName,
Version sourceVersion,
Resource targetResource,
java.lang.String resolutionPolicyClassName)
Creates a new dependency link instance of the specified class and using the specified resolution policy class. |
MutableSnapshot |
createMutableSnapshot(Branch br)
Creates a new mutable snapshot. |
MutableSnapshot |
createMutableSnapshot(Branch br,
java.lang.String name)
Creates a new mutable snapshot. |
ResolutionPolicy |
createResolutionPolicy(java.lang.String policyType)
|
Resource |
createResource(java.lang.String resourceName)
Creates a new resource instance with the specified name. |
Snapshot |
createSnapshot(Branch br,
MutableSnapshot snapShot,
java.util.Date commitTime)
Creates a new mutable snapshot. |
User |
createUser(java.lang.String userName)
Creates a new user object. |
Version |
createVersion(java.lang.String name,
Resource res,
java.lang.Class versionSubClass)
Creates a new version instance of the specified class. |
Branch |
getBranch(java.lang.String branchId)
Returns the specified branch. |
Branch |
getBranchById(java.lang.String branchId)
Get a Branch by its repository ID. |
Branch |
getBranchByName(java.lang.String branchName)
|
long |
getBranchCount()
Returns the total number of branches in the repository. |
java.util.Map |
getBranches()
|
java.util.Set |
getBranchIds()
|
java.util.Set |
getBranchNames()
|
StorageManager |
getDefaultStorageManager()
|
java.util.Map |
getDependencies()
|
DependencyLink |
getDependencyById(java.lang.String objId)
|
long |
getDependencyCount()
Returns the total number of dependency objects in the repository. |
java.lang.Integer |
getId()
|
protected java.lang.Class |
getImplementationClassForClass(java.lang.Class startingClass)
|
MutableSnapshot |
getMutableSnapshotById(java.lang.String objId)
Gets a mutable snapshot by ID |
long |
getMutableSnapshotCount()
|
SnapshotMap |
getMutableSnapshots()
|
java.lang.String |
getName()
Get the display name of the repository. |
Resource |
getNullResource()
|
Snapshot |
getNullSnapshot()
|
RepositoryObject |
getObjectById(java.lang.String objId)
Returns an object of any type given an object ID. |
ResolutionPolicy |
getPolicyById(java.lang.String objId)
Gets the specified resolution policy. |
long |
getPolicyCount()
Returns the number of resolution policy objects in the repository. |
static java.util.Properties |
getProperties()
Gets a copy of the repository's runtime properties. |
int |
getRepositoryObjectType(java.lang.String objId)
Returns the repository object ID constant for the object identified by the specified object ID. |
java.util.Map |
getResolutionPolicies()
Returns a map of all the resolution policies by object ID. |
Resource |
getResourceById(java.lang.String resId)
Gets a resource by its repository ID. |
Resource |
getResourceByKey(java.lang.String resourceName)
|
long |
getResourceCount()
|
java.util.Set |
getResourceIds()
List of all resource IDs. |
ResourceMap |
getResources()
|
Snapshot |
getSnapshotById(java.lang.String objId)
|
long |
getSnapshotCount()
|
SnapshotMap |
getSnapShots()
|
StorageManager |
getStorageManager(java.lang.String managerId)
Returns the storage manager with the specified ID, if it exists. |
java.lang.String |
getURLforResource(Resource targetRes)
Given a resource, returns a relative URL using the default resolution policy (on snapshot). |
java.lang.String |
getUrlStringForBranch(Branch branch)
|
java.lang.String |
getUrlStringForResource(Resource resource)
|
java.lang.String |
getUrlStringForSnapshot(Snapshot snapshot)
|
java.lang.String |
getUrlStringForVersion(Version version)
|
Version |
getVersionById(java.lang.String verId)
|
long |
getVersionCount()
|
VersionMap |
getVersions()
|
boolean |
hasBranchNamed(java.lang.String branchName)
|
boolean |
hasResourceNamed(java.lang.String resourceName)
|
void |
importCompoundDoc(java.io.File compoundDocumentRootFile,
Branch branch,
User user,
java.lang.String docName)
Import a compound document into the repository. |
java.lang.String |
listVersionIds()
|
void |
registerBranchName(Branch branch,
java.lang.String name)
Register a new alias for the specified branch. |
protected void |
registerResource(Resource res)
Convenience function of registering a Resource to the repository. |
void |
registerSnapshot(Snapshot snapshot)
|
void |
registerVersion(Version ver)
Convenience function of registering (committing) a Version to the repository. |
java.lang.String |
reportRepositoryContents()
Returns a multi-line string listing of the repository contents. |
void |
setDefaultStorageManager(java.lang.String managerId)
Sets the storage manager that will store new storage objects by default. |
void |
setId(java.lang.Integer id)
|
void |
setName(java.lang.String repositoryName)
|
static void |
setProperty(java.lang.String propName,
java.lang.String propValue)
|
void |
unRegisterBranchName(Branch branch,
java.lang.String alias)
Delete an alias entry for the specified branch. |
VersionMap |
whereUsedByTypeOnSnapshot(Resource resource,
Snapshot snapshot,
java.lang.Class versionClass)
Returns a version map of versionSet visible on the specified snapshot that have a dependency relationship to the specified resource. |
VersionMap |
whereUsedByTypeOnSnapshot(Resource resource,
Snapshot snapshot,
java.lang.Class versionClass,
java.lang.String dependencyTypeName)
Returns a version map of versionSet visible on the specified snapshot that have a dependency relationship to the specified resource. |
VersionMap |
whereUsedOnSnapshot(Resource resource,
Snapshot snapshot)
Returns a version map of versionSet visible on the specified snapshot that have a dependency relationship to the specified resource. |
VersionMap |
whereUsedOnSnapshot(Resource resource,
Snapshot snapshot,
java.lang.String dependencyTypeName)
Returns a version map of versionSet visible on the specified snapshot that have a dependency of the specified type to the specified resource. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected java.lang.Integer id
protected static java.util.Properties properties
protected RepositoryObjectMap objectsById
protected DependencyMap dependenciesById
protected java.util.Map branchesById
protected java.util.Map branchesByName
protected SnapshotMap snapshotsById
protected RepositoryObjectMap usersById
protected java.util.Map usersByAlias
protected ResourceMap resourcesById
protected java.util.Map resourcesByAlias
protected VersionMap versionsById
protected java.util.Map versionsByAlias
protected long verIdCtr
protected long snapshotIdCtr
protected static java.util.Map interfaceToClassMap
java.text.DecimalFormat objectIdFormatter
protected StorageManager defaultStorageManager
protected SnapshotMap mutableSnapshots
public static final Resource nullResource
public static final Branch nullBranch
public static final RepositoryObject nullRepositoryObject
public static final Snapshot nullSnapshot
public static final MutableSnapshot nullMutableSnapshot
| Constructor Detail |
|---|
public RepositoryBase()
| Method Detail |
|---|
public void setId(java.lang.Integer id)
setId in interface Repositorypublic java.lang.Integer getId()
getId in interface Repositoryprotected void registerResource(Resource res)
res - public void registerVersion(Version ver)
registerVersion in interface Repositoryver - The version to be registered.
public Resource createResource(java.lang.String resourceName)
throws NameNotUniqueException
createResource in interface RepositoryresourceName - The display name to use for the resource.
NameNotUniqueException
public Branch createBranch(java.lang.String branchName)
throws RepositoryException
createBranch in interface RepositorybranchName - The name to use for the branch. This will act as an alias for the internal branch ID.
RepositoryException
public void importCompoundDoc(java.io.File compoundDocumentRootFile,
Branch branch,
User user,
java.lang.String docName)
throws ImporterException,
VersionCommitException,
NoSuchPolicyTypeException,
NoSuchDependencyTypeException,
RepositoryException,
VersionMutationException
importCompoundDoc in interface Repositorycd1File - The file to import. Currently expected to be an XML document.
ImporterException
VersionCommitException
NoSuchPolicyTypeException
NoSuchDependencyTypeException
RepositoryException
VersionMutationExceptionpublic StorageManager getStorageManager(java.lang.String managerId)
Repository
getStorageManager in interface Repository
public Branch getBranch(java.lang.String branchId)
throws RepositoryException
getBranch in interface Repositorystring -
RepositoryException
public User createUser(java.lang.String userName)
throws RepositoryException
userName - The user name to use. This is an alias for the invariant user ID.
RepositoryExceptionpublic java.util.Set getBranchIds()
getBranchIds in interface Repositorypublic java.util.Set getBranchNames()
getBranchNames in interface Repositorypublic Branch getBranchByName(java.lang.String branchName)
getBranchByName in interface Repositorypublic boolean hasBranchNamed(java.lang.String branchName)
hasBranchNamed in interface Repositorypublic boolean hasResourceNamed(java.lang.String resourceName)
hasResourceNamed in interface Repositorystring -
public Resource getResourceByKey(java.lang.String resourceName)
getResourceByKey in interface Repositorystring -
public Resource getResourceById(java.lang.String resId)
getResourceById in interface RepositoryresId1 -
public java.util.Map getBranches()
getBranches in interface Repositorypublic Branch getBranchById(java.lang.String branchId)
getBranchById in interface Repositorystring -
public void unRegisterBranchName(Branch branch,
java.lang.String alias)
unRegisterBranchName in interface Repositorybranch - The branch whose alias is to be unregistered.alias - The alias value to unregister.
public void registerBranchName(Branch branch,
java.lang.String name)
throws RepositoryException
registerBranchName in interface Repositorybranch - The branch to which the alias will be associated.alias - The alias to be registered.
RepositoryException
public DependencyLink createDependency(java.lang.String dependencyType,
Version sourceVersion,
Resource targetResource,
ResolutionPolicy policy)
throws RepositoryException,
NoSuchDependencyTypeException
Repository
createDependency in interface RepositoryRepositoryException
NoSuchDependencyTypeException
public DependencyLink createDependency(java.lang.String dependencyClassName,
Version sourceVersion,
Resource targetResource,
java.lang.String resolutionPolicyClassName)
throws NoSuchDependencyTypeException,
NoSuchPolicyTypeException,
RepositoryException
Repository
createDependency in interface RepositorydependencyClassName - Name of the dependency type to instantiatesourceVersion - The specific version that has the dependencytargetResource - The resource on which the source version is dependentresolutionPolicyClassName - The name of the resolution policy type to use for this
dependency.
NoSuchDependencyTypeException
NoSuchPolicyTypeException
RepositoryException
public DependencyLink createDependency(java.lang.String dependencyType,
Version sourceVersion,
Resource targetResource,
ResolutionPolicy policy,
java.lang.Object sourceObject)
throws NoSuchDependencyTypeException,
RepositoryException
createDependency in interface Repositorystring - string2 -
NoSuchDependencyTypeException
RepositoryException
public ResolutionPolicy createResolutionPolicy(java.lang.String policyType)
throws RepositoryException,
NoSuchPolicyTypeException
createResolutionPolicy in interface Repositorystring -
RepositoryException
NoSuchPolicyTypeExceptionpublic MutableSnapshot createMutableSnapshot(Branch br)
createMutableSnapshot in interface Repository
public MutableSnapshot createMutableSnapshot(Branch br,
java.lang.String name)
createMutableSnapshot in interface Repository
public Snapshot createSnapshot(Branch br,
MutableSnapshot snapShot,
java.util.Date commitTime)
createSnapshot in interface RepositorysnapShot - Mutable snapshot with which to initialize the new snapshot.
public Version createVersion(java.lang.String name,
Resource res,
java.lang.Class versionSubClass)
throws java.lang.InstantiationException,
java.lang.IllegalAccessException
createVersion in interface Repositoryname - Name (alias) for the version.res - The resource this is a version ofsubClass - The subsclass of version to instantiate
java.lang.InstantiationException
java.lang.IllegalAccessException
protected java.lang.Class getImplementationClassForClass(java.lang.Class startingClass)
throws java.lang.InstantiationException
java.lang.InstantiationExceptionpublic Version getVersionById(java.lang.String verId)
getVersionById in interface RepositoryverId -
public java.lang.String listVersionIds()
listVersionIds in interface Repository
public VersionMap whereUsedOnSnapshot(Resource resource,
Snapshot snapshot)
whereUsedOnSnapshot in interface Repositoryresource - The resource whose usage is being queriedsnapshot - The snapshot the result versionSet must be visible on.
public VersionMap whereUsedOnSnapshot(Resource resource,
Snapshot snapshot,
java.lang.String dependencyTypeName)
whereUsedOnSnapshot in interface Repositoryresource - The resource whose usage is being queriedsnapshot - The snapshot the result versionSet must be visible on.dependencyTypeName -
public VersionMap whereUsedByTypeOnSnapshot(Resource resource,
Snapshot snapshot,
java.lang.Class versionClass)
whereUsedByTypeOnSnapshot in interface Repositoryresource - The resource whose usage is being queriedsnapshot - The snapshot the result versionSet must be visible on.
public VersionMap whereUsedByTypeOnSnapshot(Resource resource,
Snapshot snapshot,
java.lang.Class versionClass,
java.lang.String dependencyTypeName)
whereUsedByTypeOnSnapshot in interface Repositoryresource - The resource whose usage is being queriedsnapshot - The snapshot the result versionSet must be visible on.
public java.util.Set getResourceIds()
getResourceIds in interface Repositorypublic Snapshot getSnapshotById(java.lang.String objId)
getSnapshotById in interface Repositorystring -
public RepositoryObject getObjectById(java.lang.String objId)
getObjectById in interface RepositoryobjId - The repository ID of the object to retrieve.
public java.lang.String getUrlStringForResource(Resource resource)
resource -
public java.lang.String getURLforResource(Resource targetRes)
targetRes -
public java.lang.String getUrlStringForSnapshot(Snapshot snapshot)
snapshot -
public java.lang.String getUrlStringForVersion(Version version)
version -
public int getRepositoryObjectType(java.lang.String objId)
throws SnapCMException
getRepositoryObjectType in interface RepositoryobjId -
SnapCMExceptionpublic java.lang.String getUrlStringForBranch(Branch branch)
branch -
public java.lang.String reportRepositoryContents()
throws java.lang.Throwable
java.lang.Throwable
public void accept(RepositoryVisitor visitor)
throws java.lang.Throwable
accept in interface Repositoryjava.lang.Throwablepublic void registerSnapshot(Snapshot snapshot)
registerSnapshot in interface Repositorypublic MutableSnapshot getMutableSnapshotById(java.lang.String objId)
getMutableSnapshotById in interface RepositoryobjId - ID of mutable snapshot.
public Snapshot getNullSnapshot()
getNullSnapshot in interface Repositorypublic ResourceMap getResources()
getResources in interface Repositorypublic VersionMap getVersions()
getVersions in interface Repositorypublic SnapshotMap getMutableSnapshots()
getMutableSnapshots in interface Repositorypublic java.util.Map getDependencies()
getDependencies in interface Repositorypublic Resource getNullResource()
getNullResource in interface Repositorypublic java.lang.String getName()
Repository
getName in interface Repositorypublic long getResourceCount()
getResourceCount in interface Repositorypublic long getVersionCount()
getVersionCount in interface Repositorypublic long getSnapshotCount()
getSnapshotCount in interface Repositorypublic SnapshotMap getSnapShots()
getSnapShots in interface Repositorypublic long getDependencyCount()
Repository
getDependencyCount in interface Repositorypublic long getBranchCount()
Repository
getBranchCount in interface Repositorypublic DependencyLink getDependencyById(java.lang.String objId)
getDependencyById in interface Repositorypublic java.lang.String addStorageManager(StorageManager manager)
Repository
addStorageManager in interface Repositorypublic void setDefaultStorageManager(java.lang.String managerId)
Repository
setDefaultStorageManager in interface Repositorypublic StorageManager getDefaultStorageManager()
getDefaultStorageManager in interface Repositorypublic void setName(java.lang.String repositoryName)
public long getMutableSnapshotCount()
getMutableSnapshotCount in interface Repository
public static void setProperty(java.lang.String propName,
java.lang.String propValue)
public static java.util.Properties getProperties()
public long getPolicyCount()
Repository
getPolicyCount in interface Repositorypublic java.util.Map getResolutionPolicies()