|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.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 Repository
public java.lang.Integer getId()
getId
in interface Repository
protected void registerResource(Resource res)
res
- public void registerVersion(Version ver)
registerVersion
in interface Repository
ver
- The version to be registered.public Resource createResource(java.lang.String resourceName) throws NameNotUniqueException
createResource
in interface Repository
resourceName
- The display name to use for the resource.
NameNotUniqueException
public Branch createBranch(java.lang.String branchName) throws RepositoryException
createBranch
in interface Repository
branchName
- 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 Repository
cd1File
- The file to import. Currently expected to be an XML document.
ImporterException
VersionCommitException
NoSuchPolicyTypeException
NoSuchDependencyTypeException
RepositoryException
VersionMutationException
public StorageManager getStorageManager(java.lang.String managerId)
Repository
getStorageManager
in interface Repository
public Branch getBranch(java.lang.String branchId) throws RepositoryException
getBranch
in interface Repository
string
-
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.
RepositoryException
public java.util.Set getBranchIds()
getBranchIds
in interface Repository
public java.util.Set getBranchNames()
getBranchNames
in interface Repository
public Branch getBranchByName(java.lang.String branchName)
getBranchByName
in interface Repository
public boolean hasBranchNamed(java.lang.String branchName)
hasBranchNamed
in interface Repository
public boolean hasResourceNamed(java.lang.String resourceName)
hasResourceNamed
in interface Repository
string
-
public Resource getResourceByKey(java.lang.String resourceName)
getResourceByKey
in interface Repository
string
-
public Resource getResourceById(java.lang.String resId)
getResourceById
in interface Repository
resId1
-
public java.util.Map getBranches()
getBranches
in interface Repository
public Branch getBranchById(java.lang.String branchId)
getBranchById
in interface Repository
string
-
public void unRegisterBranchName(Branch branch, java.lang.String alias)
unRegisterBranchName
in interface Repository
branch
- 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 Repository
branch
- 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 Repository
RepositoryException
NoSuchDependencyTypeException
public DependencyLink createDependency(java.lang.String dependencyClassName, Version sourceVersion, Resource targetResource, java.lang.String resolutionPolicyClassName) throws NoSuchDependencyTypeException, NoSuchPolicyTypeException, RepositoryException
Repository
createDependency
in interface Repository
dependencyClassName
- 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 Repository
string
- string2
-
NoSuchDependencyTypeException
RepositoryException
public ResolutionPolicy createResolutionPolicy(java.lang.String policyType) throws RepositoryException, NoSuchPolicyTypeException
createResolutionPolicy
in interface Repository
string
-
RepositoryException
NoSuchPolicyTypeException
public 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 Repository
snapShot
- 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 Repository
name
- 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.InstantiationException
public Version getVersionById(java.lang.String verId)
getVersionById
in interface Repository
verId
-
public java.lang.String listVersionIds()
listVersionIds
in interface Repository
public VersionMap whereUsedOnSnapshot(Resource resource, Snapshot snapshot)
whereUsedOnSnapshot
in interface Repository
resource
- 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 Repository
resource
- 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 Repository
resource
- 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 Repository
resource
- The resource whose usage is being queriedsnapshot
- The snapshot the result versionSet must be visible on.
public java.util.Set getResourceIds()
getResourceIds
in interface Repository
public Snapshot getSnapshotById(java.lang.String objId)
getSnapshotById
in interface Repository
string
-
public RepositoryObject getObjectById(java.lang.String objId)
getObjectById
in interface Repository
objId
- 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 Repository
objId
-
SnapCMException
public 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 Repository
java.lang.Throwable
public void registerSnapshot(Snapshot snapshot)
registerSnapshot
in interface Repository
public MutableSnapshot getMutableSnapshotById(java.lang.String objId)
getMutableSnapshotById
in interface Repository
objId
- ID of mutable snapshot.
public Snapshot getNullSnapshot()
getNullSnapshot
in interface Repository
public ResourceMap getResources()
getResources
in interface Repository
public VersionMap getVersions()
getVersions
in interface Repository
public SnapshotMap getMutableSnapshots()
getMutableSnapshots
in interface Repository
public java.util.Map getDependencies()
getDependencies
in interface Repository
public Resource getNullResource()
getNullResource
in interface Repository
public java.lang.String getName()
Repository
getName
in interface Repository
public long getResourceCount()
getResourceCount
in interface Repository
public long getVersionCount()
getVersionCount
in interface Repository
public long getSnapshotCount()
getSnapshotCount
in interface Repository
public SnapshotMap getSnapShots()
getSnapShots
in interface Repository
public long getDependencyCount()
Repository
getDependencyCount
in interface Repository
public long getBranchCount()
Repository
getBranchCount
in interface Repository
public DependencyLink getDependencyById(java.lang.String objId)
getDependencyById
in interface Repository
public java.lang.String addStorageManager(StorageManager manager)
Repository
addStorageManager
in interface Repository
public void setDefaultStorageManager(java.lang.String managerId)
Repository
setDefaultStorageManager
in interface Repository
public StorageManager getDefaultStorageManager()
getDefaultStorageManager
in interface Repository
public 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 Repository
public java.util.Map getResolutionPolicies()
Repository
getResolutionPolicies
in interface Repository
public ResolutionPolicy getPolicyById(java.lang.String objId)
Repository
getPolicyById
in interface Repository
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |