org.xiruss.repository.api
Class NullRepository

java.lang.Object
  extended by org.xiruss.repository.api.NullRepository
All Implemented Interfaces:
Repository

public class NullRepository
extends java.lang.Object
implements Repository

Null repository. Needed to allow complete closure over null returns for null repository objects.


Field Summary
 
Fields inherited from interface org.xiruss.repository.api.Repository
builtinContainerNames, nullBranch, nullDependencyLink, nullDependencyMap, nullMutableSnapshot, nullRepository, nullRepositoryObject, nullResolutionPolicy, nullResource, nullResourceMap, nullSnapshot, nullSnapshotMap, nullStorageManager, nullVersion, nullVersionByResourceMap, nullVersionMap
 
Constructor Summary
NullRepository()
           
 
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 and names it.
 ResolutionPolicy createResolutionPolicy(java.lang.String policyType)
           
 Resource createResource(java.lang.String resourceName)
          Creates a new resource instance with the specified name.
 Snapshot createSnapshot(Branch branch, MutableSnapshot snapshot, java.util.Date commitTime)
          Create a new immutable snapshot from an existing mutable snapshot.
 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()
           
 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 token)
          Gets the specified resolution policy.
 long getPolicyCount()
          Returns the number of resolution policy objects in the repository.
 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.
 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.
 void registerSnapshot(Snapshot snapshot)
           
 void registerVersion(Version ver)
           
 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 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 versions of the specified type 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 versions of the specified type visible on the specified snapshot that have a dependency relationship of the specified type to the specified resource.
 VersionMap whereUsedOnSnapshot(Resource resource, Snapshot snapshot)
          Returns a version map of versions 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 versions 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
 

Constructor Detail

NullRepository

public NullRepository()
Method Detail

setId

public void setId(java.lang.Integer id)
Specified by:
setId in interface Repository

getId

public java.lang.Integer getId()
Specified by:
getId in interface Repository

createResource

public Resource createResource(java.lang.String resourceName)
                        throws NameNotUniqueException
Description copied from interface: Repository
Creates a new resource instance with the specified name.

Specified by:
createResource in interface Repository
Parameters:
resourceName - The display name to use for the resource.
Returns:
The created resource
Throws:
NameNotUniqueException

createBranch

public Branch createBranch(java.lang.String branchName)
                    throws RepositoryException
Description copied from interface: Repository
Create a new branch and assign the specified branch name to it.

Specified by:
createBranch in interface Repository
Parameters:
branchName - The name to use for the branch. This will act as an alias for the internal branch ID.
Returns:
The created branch
Throws:
RepositoryException

importCompoundDoc

public void importCompoundDoc(java.io.File compoundDocumentRootFile,
                              Branch branch,
                              User user,
                              java.lang.String docName)
                       throws ImporterException,
                              VersionCommitException,
                              NoSuchPolicyTypeException,
                              NoSuchDependencyTypeException,
                              RepositoryException,
                              VersionMutationException
Description copied from interface: Repository
Import a compound document into the repository.

Specified by:
importCompoundDoc in interface Repository
Throws:
ImporterException
VersionCommitException
NoSuchPolicyTypeException
NoSuchDependencyTypeException
RepositoryException
VersionMutationException

getStorageManager

public StorageManager getStorageManager(java.lang.String managerId)
Description copied from interface: Repository
Returns the storage manager with the specified ID, if it exists. Otherwise returns a null storage manager.

Specified by:
getStorageManager in interface Repository

getBranch

public Branch getBranch(java.lang.String branchId)
                 throws RepositoryException
Description copied from interface: Repository
Returns the specified branch.

Specified by:
getBranch in interface Repository
Throws:
RepositoryException

getBranchIds

public java.util.Set getBranchIds()
Specified by:
getBranchIds in interface Repository

getBranchNames

public java.util.Set getBranchNames()
Specified by:
getBranchNames in interface Repository

getBranchByName

public Branch getBranchByName(java.lang.String branchName)
Specified by:
getBranchByName in interface Repository

hasBranchNamed

public boolean hasBranchNamed(java.lang.String branchName)
Specified by:
hasBranchNamed in interface Repository

hasResourceNamed

public boolean hasResourceNamed(java.lang.String resourceName)
Specified by:
hasResourceNamed in interface Repository
Returns:

getResourceByKey

public Resource getResourceByKey(java.lang.String resourceName)
Specified by:
getResourceByKey in interface Repository
Returns:

getResourceById

public Resource getResourceById(java.lang.String resId)
Description copied from interface: Repository
Gets a resource by its repository ID.

Specified by:
getResourceById in interface Repository
Returns:
Resource or null

getBranches

public java.util.Map getBranches()
Specified by:
getBranches in interface Repository
Returns:
Map of branch objects by branch ID

getBranchById

public Branch getBranchById(java.lang.String branchId)
Description copied from interface: Repository
Get a Branch by its repository ID.

Specified by:
getBranchById in interface Repository
Returns:
Branch with ID or NullBranch object

createDependency

public DependencyLink createDependency(java.lang.String dependencyType,
                                       Version sourceVersion,
                                       Resource targetResource,
                                       ResolutionPolicy policy)
                                throws RepositoryException,
                                       NoSuchDependencyTypeException
Description copied from interface: Repository
Create a new dependency between the specified Version and a target Resource, using the specified resolution policy. The dependency is added to the source version's dependencies.

Specified by:
createDependency in interface Repository
Returns:
Throws:
RepositoryException
NoSuchDependencyTypeException

createDependency

public DependencyLink createDependency(java.lang.String dependencyClassName,
                                       Version sourceVersion,
                                       Resource targetResource,
                                       java.lang.String resolutionPolicyClassName)
                                throws NoSuchDependencyTypeException,
                                       RepositoryException,
                                       NoSuchPolicyTypeException
Description copied from interface: Repository
Creates a new dependency link instance of the specified class and using the specified resolution policy class.

Specified by:
createDependency in interface Repository
Parameters:
dependencyClassName - Name of the dependency type to instantiate
sourceVersion - The specific version that has the dependency
targetResource - The resource on which the source version is dependent
resolutionPolicyClassName - The name of the resolution policy type to use for this dependency.
Returns:
New dependency link instance.
Throws:
NoSuchDependencyTypeException
RepositoryException
NoSuchPolicyTypeException

createDependency

public DependencyLink createDependency(java.lang.String dependencyType,
                                       Version sourceVersion,
                                       Resource targetResource,
                                       ResolutionPolicy policy,
                                       java.lang.Object sourceObject)
                                throws NoSuchDependencyTypeException,
                                       RepositoryException
Description copied from interface: Repository
Factory method for creating new dependency instances based on the dependency type value. The source object is used to maintain knowledge of what version object data the dependency reflects (i.e., a link element of some sort).

Specified by:
createDependency in interface Repository
Returns:
Throws:
NoSuchDependencyTypeException
RepositoryException

createResolutionPolicy

public ResolutionPolicy createResolutionPolicy(java.lang.String policyType)
                                        throws RepositoryException,
                                               NoSuchPolicyTypeException
Specified by:
createResolutionPolicy in interface Repository
Returns:
Throws:
RepositoryException
NoSuchPolicyTypeException

createMutableSnapshot

public MutableSnapshot createMutableSnapshot(Branch br)
Description copied from interface: Repository
Creates a new mutable snapshot.

Specified by:
createMutableSnapshot in interface Repository
Returns:

createMutableSnapshot

public MutableSnapshot createMutableSnapshot(Branch br,
                                             java.lang.String name)
Description copied from interface: Repository
Creates a new mutable snapshot and names it.

Specified by:
createMutableSnapshot in interface Repository
Returns:

createVersion

public Version createVersion(java.lang.String name,
                             Resource res,
                             java.lang.Class versionSubClass)
                      throws java.lang.InstantiationException,
                             java.lang.IllegalAccessException
Description copied from interface: Repository
Creates a new version instance of the specified class.

Specified by:
createVersion in interface Repository
Parameters:
name - Name (alias) for the version.
res - The resource this is a version of
Returns:
Throws:
java.lang.InstantiationException
java.lang.IllegalAccessException

getVersionById

public Version getVersionById(java.lang.String verId)
Specified by:
getVersionById in interface Repository
Returns:

listVersionIds

public java.lang.String listVersionIds()
Specified by:
listVersionIds in interface Repository

whereUsedOnSnapshot

public VersionMap whereUsedOnSnapshot(Resource resource,
                                      Snapshot snapshot)
Description copied from interface: Repository
Returns a version map of versions visible on the specified snapshot that have a dependency relationship to the specified resource. Used to determine where a particular version (through its resource) is used.

Specified by:
whereUsedOnSnapshot in interface Repository
Parameters:
resource - The resource whose usage is being queried
snapshot - The snapshot the result versionSet must be visible on.
Returns:
A version map of versionSet that use the resource.

whereUsedOnSnapshot

public VersionMap whereUsedOnSnapshot(Resource resource,
                                      Snapshot snapshot,
                                      java.lang.String dependencyTypeName)
Description copied from interface: Repository
Returns a version map of versions visible on the specified snapshot that have a dependency of the specified type to the specified resource.

Specified by:
whereUsedOnSnapshot in interface Repository
Parameters:
resource - The resource whose usage is being queried
snapshot - The snapshot the result versionSet must be visible on.
Returns:

whereUsedByTypeOnSnapshot

public VersionMap whereUsedByTypeOnSnapshot(Resource resource,
                                            Snapshot snapshot,
                                            java.lang.Class versionClass)
Description copied from interface: Repository
Returns a version map of versions of the specified type visible on the specified snapshot that have a dependency relationship to the specified resource. Used to determine where a particular version (through its resource) is used.

Specified by:
whereUsedByTypeOnSnapshot in interface Repository
Parameters:
resource - The resource whose usage is being queried
snapshot - The snapshot the result versionSet must be visible on.
Returns:
A version map of versionSet that use the resource.

whereUsedByTypeOnSnapshot

public VersionMap whereUsedByTypeOnSnapshot(Resource resource,
                                            Snapshot snapshot,
                                            java.lang.Class versionClass,
                                            java.lang.String dependencyTypeName)
Description copied from interface: Repository
Returns a version map of versions of the specified type visible on the specified snapshot that have a dependency relationship of the specified type to the specified resource. Used to determine where a particular version (through its resource) is used.

Specified by:
whereUsedByTypeOnSnapshot in interface Repository
Parameters:
resource - The resource whose usage is being queried
snapshot - The snapshot the result versionSet must be visible on.
Returns:
A version map of versionSet that use the resource.

getResourceIds

public java.util.Set getResourceIds()
Description copied from interface: Repository
List of all resource IDs.

Specified by:
getResourceIds in interface Repository
Returns:

getSnapshotById

public Snapshot getSnapshotById(java.lang.String objId)
Specified by:
getSnapshotById in interface Repository
Returns:

getObjectById

public RepositoryObject getObjectById(java.lang.String objId)
Description copied from interface: Repository
Returns an object of any type given an object ID.

Specified by:
getObjectById in interface Repository
Parameters:
objId - The repository ID of the object to retrieve.
Returns:
The repository object with the specified ID, or null.

getRepositoryObjectType

public int getRepositoryObjectType(java.lang.String objId)
                            throws SnapCMException
Description copied from interface: Repository
Returns the repository object ID constant for the object identified by the specified object ID.

Specified by:
getRepositoryObjectType in interface Repository
Throws:
SnapCMException

registerSnapshot

public void registerSnapshot(Snapshot snapshot)
Specified by:
registerSnapshot in interface Repository

getMutableSnapshotById

public MutableSnapshot getMutableSnapshotById(java.lang.String objId)
Description copied from interface: Repository
Gets a mutable snapshot by ID

Specified by:
getMutableSnapshotById in interface Repository
Parameters:
objId - ID of mutable snapshot.
Returns:
Snapshot.

getNullSnapshot

public Snapshot getNullSnapshot()
Specified by:
getNullSnapshot in interface Repository

unRegisterBranchName

public void unRegisterBranchName(Branch branch,
                                 java.lang.String alias)
Description copied from interface: Repository
Delete an alias entry for the specified branch. Does not report the case where the specified alias is not registered.

Specified by:
unRegisterBranchName in interface Repository
Parameters:
branch - The branch whose alias is to be unregistered.
alias - The alias value to unregister.

registerBranchName

public void registerBranchName(Branch branch,
                               java.lang.String name)
                        throws RepositoryException
Description copied from interface: Repository
Register a new alias for the specified branch.

Specified by:
registerBranchName in interface Repository
Parameters:
branch - The branch to which the alias will be associated.
Throws:
RepositoryException

registerVersion

public void registerVersion(Version ver)
Specified by:
registerVersion in interface Repository

getResources

public ResourceMap getResources()
Specified by:
getResources in interface Repository

getVersions

public VersionMap getVersions()
Specified by:
getVersions in interface Repository

getMutableSnapshots

public SnapshotMap getMutableSnapshots()
Specified by:
getMutableSnapshots in interface Repository

getDependencies

public java.util.Map getDependencies()
Specified by:
getDependencies in interface Repository

getDependencyById

public DependencyLink getDependencyById(java.lang.String objId)
Specified by:
getDependencyById in interface Repository

getNullResource

public Resource getNullResource()
Specified by:
getNullResource in interface Repository

accept

public void accept(RepositoryVisitor visitor)
            throws java.lang.Throwable
Specified by:
accept in interface Repository
Throws:
java.lang.Throwable

createSnapshot

public Snapshot createSnapshot(Branch branch,
                               MutableSnapshot snapshot,
                               java.util.Date commitTime)
Description copied from interface: Repository
Create a new immutable snapshot from an existing mutable snapshot.

Specified by:
createSnapshot in interface Repository
snapshot - Mutable snapshot with which to initialize the new snapshot.
Returns:

getName

public java.lang.String getName()
Description copied from interface: Repository
Get the display name of the repository.

Specified by:
getName in interface Repository

getResourceCount

public long getResourceCount()
Specified by:
getResourceCount in interface Repository

getSnapshotCount

public long getSnapshotCount()
Specified by:
getSnapshotCount in interface Repository

getSnapShots

public SnapshotMap getSnapShots()
Specified by:
getSnapShots in interface Repository

getDependencyCount

public long getDependencyCount()
Description copied from interface: Repository
Returns the total number of dependency objects in the repository.

Specified by:
getDependencyCount in interface Repository
Returns:

getBranchCount

public long getBranchCount()
Description copied from interface: Repository
Returns the total number of branches in the repository.

Specified by:
getBranchCount in interface Repository
Returns:

addStorageManager

public java.lang.String addStorageManager(StorageManager manager)
Description copied from interface: Repository
Sets the active storage manager to the specified manager.

Specified by:
addStorageManager in interface Repository
Returns:
Object ID of added storage manager

setDefaultStorageManager

public void setDefaultStorageManager(java.lang.String managerId)
Description copied from interface: Repository
Sets the storage manager that will store new storage objects by default.

Specified by:
setDefaultStorageManager in interface Repository

getDefaultStorageManager

public StorageManager getDefaultStorageManager()
Specified by:
getDefaultStorageManager in interface Repository

getVersionCount

public long getVersionCount()
Specified by:
getVersionCount in interface Repository

getMutableSnapshotCount

public long getMutableSnapshotCount()
Specified by:
getMutableSnapshotCount in interface Repository

getPolicyCount

public long getPolicyCount()
Description copied from interface: Repository
Returns the number of resolution policy objects in the repository.

Specified by:
getPolicyCount in interface Repository

getResolutionPolicies

public java.util.Map getResolutionPolicies()
Description copied from interface: Repository
Returns a map of all the resolution policies by object ID.

Specified by:
getResolutionPolicies in interface Repository

getPolicyById

public ResolutionPolicy getPolicyById(java.lang.String token)
Description copied from interface: Repository
Gets the specified resolution policy.

Specified by:
getPolicyById in interface Repository
Returns:
Specified policy or NullResolutionPolicy