org.apache.jackrabbit.core.version
Class AbstractVersion

java.lang.Object
  extended byorg.apache.jackrabbit.core.ItemImpl
      extended byorg.apache.jackrabbit.core.NodeImpl
          extended byorg.apache.jackrabbit.core.version.AbstractVersion
All Implemented Interfaces:
Item, ItemStateListener, Node, Version
Direct Known Subclasses:
VersionImpl, XAVersion

public abstract class AbstractVersion
extends NodeImpl
implements Version

Base implementation of the Version interface.


Field Summary
 
Fields inherited from class org.apache.jackrabbit.core.NodeImpl
CREATED, definition, primaryTypeName
 
Fields inherited from class org.apache.jackrabbit.core.ItemImpl
id, itemMgr, listeners, rep, session, state, stateMgr, status, STATUS_DESTROYED, STATUS_INVALIDATED, STATUS_MODIFIED, STATUS_NORMAL
 
Constructor Summary
protected AbstractVersion(ItemManager itemMgr, SessionImpl session, NodeId id, NodeState state, NodeDefinition definition, ItemLifeCycleListener[] listeners)
          Create a new instance of this class.
 
Method Summary
 VersionHistory getContainingHistory()
          
 Calendar getCreated()
          
 InternalFrozenNode getFrozenNode()
          Returns the frozen node of this version
protected abstract  InternalVersion getInternalVersion()
          Returns the internal version.
 Version[] getPredecessors()
          
 Version[] getSuccessors()
          
 String getUUID()
          
 boolean isMoreRecent(AbstractVersion v)
          Checks if this version is more recent than the given version v.
 boolean isRootVersion()
          Checks if this is the root version.
 boolean isSame(Item otherItem)
          
 NodeIterator merge(String srcWorkspace, boolean bestEffort)
          Always throws a ConstraintViolationException since this node is protected.
 void update(String srcWorkspaceName)
          Always throws a ConstraintViolationException since this node is protected.
 
Methods inherited from class org.apache.jackrabbit.core.NodeImpl
accept, addMixin, addMixin, addNode, addNode, addNode, canAddMixin, cancelMerge, checkin, checkLock, checkout, checkSetProperty, computeSystemGeneratedPropertyValues, createChildNode, createChildProperty, doneMerge, getApplicableChildNodeDefinition, getApplicablePropertyDefinition, getBaseVersion, getCorrespondingNodePath, getDefinition, getEffectiveNodeType, getIndex, getLock, getMixinNodeTypes, getMixinTypeNames, getName, getNode, getNode, getNode, getNodeId, getNodes, getNodes, getOrCreateProperty, getOrCreateProperty, getOrCreateTransientItemState, getParent, getPrimaryItem, getPrimaryNodeType, getProperties, getProperties, getProperty, getProperty, getQName, getReferences, getVersionHistory, hasNode, hasNode, hasNode, hasNodes, hasPendingChanges, hasProperties, hasProperty, hasProperty, holdsLock, internalAddChildNode, internalAddChildNode, internalAddNode, internalAddNode, internalCopyPropertyFrom, internalGetUUID, internalIsCheckedOut, internalRestore, internalSetProperty, internalSetProperty, internalSetProperty, isCheckedOut, isLocked, isNode, isNodeType, isNodeType, lock, makePersistent, onRedefine, onRemove, orderBefore, removeChildNode, removeChildProperty, removeChildProperty, removeMixin, removeMixin, renameChildNode, resolveRelativeNodePath, resolveRelativePropertyPath, restore, restore, restore, restoreByLabel, restoreTransient, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, unlock
 
Methods inherited from class org.apache.jackrabbit.core.ItemImpl
getAncestor, getDepth, getId, getPath, getPrimaryPath, getSession, internalRemove, isModified, isNew, isTransactionalNew, isTransient, notifyDestroyed, notifyInvalidated, refresh, remove, safeGetJCRPath, sanityCheck, save, setRemoved, stateCreated, stateDestroyed, stateDiscarded, stateModified
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.jcr.Node
addMixin, addNode, addNode, canAddMixin, cancelMerge, checkin, checkout, doneMerge, getBaseVersion, getCorrespondingNodePath, getDefinition, getIndex, getLock, getMixinNodeTypes, getNode, getNodes, getNodes, getPrimaryItem, getPrimaryNodeType, getProperties, getProperties, getProperty, getReferences, getVersionHistory, hasNode, hasNodes, hasProperties, hasProperty, holdsLock, isCheckedOut, isLocked, isNodeType, lock, orderBefore, removeMixin, restore, restore, restore, restoreByLabel, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, unlock
 
Methods inherited from interface javax.jcr.Item
accept, getAncestor, getDepth, getName, getParent, getPath, getSession, isModified, isNew, isNode, refresh, remove, save
 

Constructor Detail

AbstractVersion

protected AbstractVersion(ItemManager itemMgr,
                          SessionImpl session,
                          NodeId id,
                          NodeState state,
                          NodeDefinition definition,
                          ItemLifeCycleListener[] listeners)
Create a new instance of this class.

Parameters:
itemMgr - item manager
session - session
id - node id
state - node state
definition - node definition
listeners - life cycle listeners
Method Detail

getInternalVersion

protected abstract InternalVersion getInternalVersion()
                                               throws RepositoryException
Returns the internal version. Subclass responsibility.

Returns:
internal version
Throws:
RepositoryException - if the internal version is not available

getCreated

public Calendar getCreated()
                    throws RepositoryException

Specified by:
getCreated in interface Version
Throws:
RepositoryException

getSuccessors

public Version[] getSuccessors()
                        throws RepositoryException

Specified by:
getSuccessors in interface Version
Throws:
RepositoryException

getPredecessors

public Version[] getPredecessors()
                          throws RepositoryException

Specified by:
getPredecessors in interface Version
Throws:
RepositoryException

getUUID

public String getUUID()
               throws UnsupportedRepositoryOperationException,
                      RepositoryException

Specified by:
getUUID in interface Node
Overrides:
getUUID in class NodeImpl
Throws:
UnsupportedRepositoryOperationException
RepositoryException

getContainingHistory

public VersionHistory getContainingHistory()
                                    throws RepositoryException

Specified by:
getContainingHistory in interface Version
Throws:
RepositoryException

getFrozenNode

public InternalFrozenNode getFrozenNode()
                                 throws RepositoryException
Returns the frozen node of this version

Returns:
Throws:
RepositoryException

isSame

public boolean isSame(Item otherItem)

Specified by:
isSame in interface Item
Overrides:
isSame in class ItemImpl

isMoreRecent

public boolean isMoreRecent(AbstractVersion v)
                     throws RepositoryException
Checks if this version is more recent than the given version v. A version is more recent if and only if it is a successor (or a successor of a successor, etc., to any degree of separation) of the compared one.

Parameters:
v - the version to check
Returns:
true if the version is more recent; false otherwise.
Throws:
RepositoryException

isRootVersion

public boolean isRootVersion()
                      throws RepositoryException
Checks if this is the root version.

Returns:
true if this version is the root version; false otherwise.
Throws:
RepositoryException

update

public void update(String srcWorkspaceName)
            throws ConstraintViolationException
Always throws a ConstraintViolationException since this node is protected.

Specified by:
update in interface Node
Overrides:
update in class NodeImpl
Throws:
ConstraintViolationException

merge

public NodeIterator merge(String srcWorkspace,
                          boolean bestEffort)
                   throws ConstraintViolationException
Always throws a ConstraintViolationException since this node is protected.

Specified by:
merge in interface Node
Overrides:
merge in class NodeImpl
Throws:
ConstraintViolationException


Copyright © 2004-2006 The Apache Software Foundation. All Rights Reserved.