Class VersionManagerImplBase
- java.lang.Object
- 
- org.apache.jackrabbit.core.version.VersionManagerImplBase
 
- 
- Direct Known Subclasses:
- VersionManagerImplRestore
 
 public abstract class VersionManagerImplBase extends Object The JCR Version Manager implementation is split in several classes in order to group related methods together.This class provides basic routines for all operations and the methods related to checkin and checkout. 
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description classVersionManagerImplBase.WriteOperationHelper for managing write operations.
 - 
Field SummaryFields Modifier and Type Field Description protected SessionContextcontextComponent context of the current sessionprotected NodeIdcurrentActivitythe node id of the current activityprotected HierarchyManagerhierMgrhierarchy manager that operates on the locale state managerprotected NodeTypeRegistryntRegnode type registryprotected SessionImplsessionworkspace sessionprotected UpdatableItemStateManagerstateMgritem state manager for all workspace operationsprotected InternalVersionManagervMgrthe session version manager.
 - 
Constructor SummaryConstructors Modifier Constructor Description protectedVersionManagerImplBase(SessionContext context, UpdatableItemStateManager stateMgr, HierarchyManager hierMgr)Creates a new version manager base for the given session
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description protected VersioningLock.ReadLockacquireReadLock()acquires the read lock on this version manager.protected VersioningLock.WriteLockacquireWriteLock()Acquires the write lock on this version manager.protected voidcheckModify(NodeImpl node, int options, int permissions)Checks modify and permissionsprotected voidcheckModify(NodeStateEx state, int options, int permissions)Checks modify and permissionsprotected NodeIdcheckoutCheckin(NodeStateEx state, boolean checkin, boolean checkout, Calendar created)Performs a checkin or checkout operation.protected booleancheckVersionable(NodeStateEx state)Checks if the underlying node is versionable, i.e.protected InternalVersiongetBaseVersion(NodeStateEx state)Returns the internal base version for the underlying node.protected NodeIdgetBaseVersionId(NodeStateEx state)Returns the node id of the base version, retrieved from the node stateprotected NodeStateExgetNodeStateEx(NodeId nodeId)returns the node state for the given node idprotected InternalVersiongetVersion(Version v)helper class that returns the internal version for a JCR one.protected InternalVersionHistorygetVersionHistory(NodeStateEx state)Returns the internal version history for the underlying node.protected booleanisCheckedOut(NodeStateEx state)Determines the checked-out status of the given node state.protected StringsafeGetJCRPath(NodeStateEx state)Returns the JCR path for the given node state without throwing an exception.VersionManagerImplBase.WriteOperationstartWriteOperation()Starts a write operation by acquiring the write lock and setting the item state manager to the "edit" state.
 
- 
- 
- 
Field Detail- 
contextprotected final SessionContext context Component context of the current session
 - 
sessionprotected final SessionImpl session workspace session
 - 
stateMgrprotected final UpdatableItemStateManager stateMgr item state manager for all workspace operations
 - 
hierMgrprotected final HierarchyManager hierMgr hierarchy manager that operates on the locale state manager
 - 
ntRegprotected final NodeTypeRegistry ntReg node type registry
 - 
vMgrprotected final InternalVersionManager vMgr the session version manager.
 - 
currentActivityprotected NodeId currentActivity the node id of the current activity
 
- 
 - 
Constructor Detail- 
VersionManagerImplBaseprotected VersionManagerImplBase(SessionContext context, UpdatableItemStateManager stateMgr, HierarchyManager hierMgr) Creates a new version manager base for the given session- Parameters:
- context- component context of the current session
- stateMgr- the underlying state manager
- hierMgr- local hierarchy manager
 
 
- 
 - 
Method Detail- 
checkoutCheckinprotected NodeId checkoutCheckin(NodeStateEx state, boolean checkin, boolean checkout, Calendar created) throws RepositoryException Performs a checkin or checkout operation. ifcheckinistruethe node is checked in. ifcheckoutistruethe node is checked out. if both flags aretruethe checkin is performed prior to the checkout and the operation is equivalent to a checkpoint operation.- Parameters:
- state- node state
- checkin- if- truethe node is checked in.
- checkout- if- truethe node is checked out.
- created- create time of the new version (if any), or- nullfor the current time
- Returns:
- the node id of the base version or nullfor a pure checkout.
- Throws:
- RepositoryException- if an error occurs
 
 - 
checkVersionableprotected boolean checkVersionable(NodeStateEx state) throws UnsupportedRepositoryOperationException, RepositoryException Checks if the underlying node is versionable, i.e. has 'mix:versionable' or a 'mix:simpleVersionable'.- Parameters:
- state- node state
- Returns:
- trueif this node is full versionable, i.e. is of nodetype mix:versionable
- Throws:
- UnsupportedRepositoryOperationException- if this node is not versionable at all
- RepositoryException
 
 - 
safeGetJCRPathprotected String safeGetJCRPath(NodeStateEx state) Returns the JCR path for the given node state without throwing an exception.- Parameters:
- state- node state
- Returns:
- a JCR path string
 
 - 
isCheckedOutprotected boolean isCheckedOut(NodeStateEx state) throws RepositoryException Determines the checked-out status of the given node state.A node is considered checked-out if it is versionable and checked-out, or is non-versionable but its nearest versionable ancestor is checked-out, or is non-versionable and there are no versionable ancestors. - Parameters:
- state- node state
- Returns:
- a boolean
- Throws:
- RepositoryException- if an error occurs
- See Also:
- VersionManager.isCheckedOut(String),- Node.isCheckedOut()
 
 - 
getBaseVersionIdprotected NodeId getBaseVersionId(NodeStateEx state) Returns the node id of the base version, retrieved from the node state- Parameters:
- state- node state
- Returns:
- the node id of the base version or nullif not defined
 
 - 
getVersionHistoryprotected InternalVersionHistory getVersionHistory(NodeStateEx state) throws RepositoryException Returns the internal version history for the underlying node.- Parameters:
- state- node state
- Returns:
- internal version history
- Throws:
- RepositoryException- if an error occurs
 
 - 
getVersionprotected InternalVersion getVersion(Version v) throws RepositoryException helper class that returns the internal version for a JCR one.- Parameters:
- v- the jcr version
- Returns:
- the internal version
- Throws:
- RepositoryException- if an error occurs
 
 - 
getBaseVersionprotected InternalVersion getBaseVersion(NodeStateEx state) throws RepositoryException Returns the internal base version for the underlying node.- Parameters:
- state- node state
- Returns:
- internal base version
- Throws:
- RepositoryException- if an error occurs
 
 - 
getNodeStateExprotected NodeStateEx getNodeStateEx(NodeId nodeId) throws RepositoryException returns the node state for the given node id- Parameters:
- nodeId- the node id
- Returns:
- the node state or null if not found
- Throws:
- RepositoryException- if an error occurs
 
 - 
checkModifyprotected void checkModify(NodeStateEx state, int options, int permissions) throws RepositoryException Checks modify and permissions- Parameters:
- state- state to check
- options- options to check
- permissions- permissions to check
- Throws:
- RepositoryException- if an error occurs
 
 - 
checkModifyprotected void checkModify(NodeImpl node, int options, int permissions) throws RepositoryException Checks modify and permissions- Parameters:
- node- node to check
- options- options to check
- permissions- permissions to check
- Throws:
- RepositoryException- if an error occurs
 
 - 
acquireWriteLockprotected VersioningLock.WriteLock acquireWriteLock() Acquires the write lock on this version manager.- Returns:
- returns the write lock
 
 - 
acquireReadLockprotected VersioningLock.ReadLock acquireReadLock() acquires the read lock on this version manager.- Returns:
- returns the read lock
 
 - 
startWriteOperationpublic VersionManagerImplBase.WriteOperation startWriteOperation() throws RepositoryException Starts a write operation by acquiring the write lock and setting the item state manager to the "edit" state. If something goes wrong, the write lock is released and an exception is thrown.The pattern for using this method and the returned helper instance is: WriteOperation operation = startWriteOperation(); try { ... operation.save(); // if everything is OK ... } catch (...) { ... } finally { operation.close(); }- Returns:
- write operation helper
- Throws:
- RepositoryException- if the write operation could not be started
 
 
- 
 
-