org.xiruss.repository.server
Class MutableSnapshotBase

java.lang.Object
  extended by org.xiruss.repository.server.RepositoryObjectBase
      extended by org.xiruss.repository.server.SnapshotBase
          extended by org.xiruss.repository.server.MutableSnapshotBase
All Implemented Interfaces:
java.lang.Comparable, MutableSnapshot, RepositoryObject, Snapshot

public class MutableSnapshotBase
extends SnapshotBase
implements MutableSnapshot

A snapshot that can have its various version lists modified until it is committed. The commit operation can be performed directly on the mutable snapshot instance in this implementation but it should really be used to initialize a new read-only snapshot.


Field Summary
 
Fields inherited from class org.xiruss.repository.server.SnapshotBase
branch, createdVersions, creationTime, effectiveVersions, excludedVersions, isFixed, nextSnapshot, previousSnapshot, versionsByResource, visibleVersions
 
Fields inherited from class org.xiruss.repository.server.RepositoryObjectBase
id, name, objectTypeConstant, properties, rep
 
Constructor Summary
MutableSnapshotBase()
           
 
Method Summary
 void addCreatedVersion(Version createdVer)
          Adds a newly-created version to the snapshot.
 void addEffectiveVersion(Version ver)
          Adds an existing version to the snapshot as an effective version.
 void excludeVersion(java.lang.String versionId)
          Excludes the version from the set of visible versions on the snapshot.
 void excludeVersion(Version ver)
           
 void initialize(Branch br, java.lang.String objId, java.lang.String objName)
          Initialize a newly-created mutable snapshot.
 void initialize(MutableSnapshot baseSnapshot, java.lang.String objId)
           
 void removeCreatedVersion(Resource resource)
          Removes the version for the specified resource from the created versions list.
 void removeCreatedVersion(Version version)
          Removes the version for the specified resource from the created versions list.
protected  void setCreatedVersionsSet(java.util.Set createdVersionsSet)
           
 void setPreviousSnapshot(Snapshot snap)
          Sets the previous snapshot.
 
Methods inherited from class org.xiruss.repository.server.SnapshotBase
accept, checkIsNotFixed, getBranch, getCreatedVersions, getCreatedVersionsSet, getEffectiveVersions, getExcludedVersions, getNext, getPrevious, getVersion, getVersionById, getVersionsByPropertyValue, getVersionsByResource, getVisibleVersionCount, getVisibleVersions, initialize, isFixed, resourceIsVisible, setBranch, setNext, versionIsVisible, versionIsVisible
 
Methods inherited from class org.xiruss.repository.server.RepositoryObjectBase
compareTo, getId, getName, getProperties, getProperty, getPropertyNames, getRepository, getType, hasProperty, initialize, initialize, isNull, setId, setName, setProperties, setProperty, setRepository, setType, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.xiruss.snapcm.api.MutableSnapshot
setBranch
 
Methods inherited from interface org.xiruss.snapcm.api.Snapshot
checkIsNotFixed, getBranch, getCreatedVersions, getEffectiveVersions, getExcludedVersions, getNext, getPrevious, getVersion, getVersionById, getVersionsByPropertyValue, getVersionsByResource, getVisibleVersionCount, getVisibleVersions, initialize, isFixed, resourceIsVisible, setNext, versionIsVisible, versionIsVisible
 
Methods inherited from interface org.xiruss.snapcm.api.RepositoryObject
accept, compareTo, getId, getName, getProperties, getProperty, getPropertyNames, getRepository, getType, hasProperty, initialize, isNull, setId, setName, setProperty, toString
 

Constructor Detail

MutableSnapshotBase

public MutableSnapshotBase()
Method Detail

initialize

public void initialize(Branch br,
                       java.lang.String objId,
                       java.lang.String objName)
                throws ObjectMutationException
Description copied from interface: MutableSnapshot
Initialize a newly-created mutable snapshot. The initial state of the created snapshot will reflect the state of the latest snapshot on the branch. Note that it's not meaningful to create a snapshot for a given branch from any snapshot other than the latest. If the desire is to use some older snapshot as a starting point, that requires creation of a new branch and sync operation from the starting snapshot of the starting branch to create the first fixed snapshot on the new branch, from which you then create a new mutable snapshot. It is the sync operation that determines the initial set of versions reflected in the new branch's initial snapshot. If the branch has no snapshots then the mutable snapshot has a starting state with no versions.

Specified by:
initialize in interface MutableSnapshot
Throws:
ObjectMutationException

initialize

public void initialize(MutableSnapshot baseSnapshot,
                       java.lang.String objId)
                throws ObjectMutationException
Throws:
ObjectMutationException

excludeVersion

public void excludeVersion(java.lang.String versionId)
                    throws SnapshotException
Excludes the version from the set of visible versions on the snapshot. The version may be an effective or created version; however, excluding a created version has the effect of removing it entirely from the snapshot, while an effective version will be listed in the excluded versions list. This reflects the fact that a version is not known to the repository until the snapshot is committed, so it would not make sense to keep a list of versions that were added and then removed from the snapshot before it was committed. That is, the repository does not itself maintain any record of the mutation history of a mutable snapshot before it is committed and made immutable.

Specified by:
excludeVersion in interface MutableSnapshot
Parameters:
versionId - ID of the version to be excluded.
Throws:
SnapshotException - If version is neither effective nor created

excludeVersion

public void excludeVersion(Version ver)
                    throws SnapshotException
Throws:
SnapshotException

setCreatedVersionsSet

protected void setCreatedVersionsSet(java.util.Set createdVersionsSet)

setPreviousSnapshot

public void setPreviousSnapshot(Snapshot snap)
Sets the previous snapshot. Can only be set if the snapshot is not fixed.

Specified by:
setPreviousSnapshot in interface MutableSnapshot
Parameters:
latest -

addCreatedVersion

public void addCreatedVersion(Version createdVer)
                       throws SnapCMException
Description copied from interface: MutableSnapshot
Adds a newly-created version to the snapshot.

Specified by:
addCreatedVersion in interface MutableSnapshot
Parameters:
createdVer - Version to add. The version must be new, meaning it is unfixed.
Throws:
VersionException
SnapshotException
SnapCMException

removeCreatedVersion

public void removeCreatedVersion(Resource resource)
Description copied from interface: MutableSnapshot
Removes the version for the specified resource from the created versions list. It is not an error to remove a version that is not in the list.

Specified by:
removeCreatedVersion in interface MutableSnapshot
Parameters:
resource - Resource of the version to be removed.

removeCreatedVersion

public void removeCreatedVersion(Version version)
                          throws SnapCMException
Description copied from interface: MutableSnapshot
Removes the version for the specified resource from the created versions list. It is not an error to remove a version that is not in the list.

Specified by:
removeCreatedVersion in interface MutableSnapshot
Parameters:
version - Version to be removed.
Throws:
SnapCMException

addEffectiveVersion

public void addEffectiveVersion(Version ver)
Adds an existing version to the snapshot as an effective version.

Specified by:
addEffectiveVersion in interface MutableSnapshot
Parameters:
ver -