|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.jackrabbit.core.version.XAVersionManager
public class XAVersionManager
Implementation of a VersionManager that works in an XA environment.
Works as a filter between a version manager client and the global version
manager.
| Field Summary | |
|---|---|
protected NodeStateEx |
historyRoot
Persistent root node of the version histories. |
protected NodeTypeRegistry |
ntReg
Node type registry. |
protected LocalItemStateManager |
stateMgr
State manager for the version storage. |
| Constructor Summary | |
|---|---|
XAVersionManager(VersionManagerImpl vMgr,
NodeTypeRegistry ntReg,
SessionImpl session,
ItemStateCacheFactory cacheFactory)
Creates a new instance of this class. |
|
| Method Summary | |
|---|---|
protected ISMLocking.ReadLock |
acquireReadLock()
acquires the read lock on this version manager. |
protected ISMLocking.WriteLock |
acquireWriteLock()
Acquires the write lock on this version manager. |
void |
addListener(ItemStateListener listener)
Add an ItemStateListener |
void |
afterOperation(TransactionContext tx)
Invoked after one of the InternalXAResource.prepare(org.apache.jackrabbit.core.TransactionContext), InternalXAResource.commit(org.apache.jackrabbit.core.TransactionContext) or
InternalXAResource.rollback(org.apache.jackrabbit.core.TransactionContext) method has been called. |
void |
associate(TransactionContext tx)
Associate this resource with a transaction. |
void |
beforeOperation(TransactionContext tx)
Invoked before one of the InternalXAResource.prepare(org.apache.jackrabbit.core.TransactionContext), InternalXAResource.commit(org.apache.jackrabbit.core.TransactionContext) or
InternalXAResource.rollback(org.apache.jackrabbit.core.TransactionContext) method is called. |
protected java.lang.String |
calculateCheckinVersionName(org.apache.jackrabbit.core.version.InternalVersionHistoryImpl history,
NodeImpl node)
Calculates the name of the new version that will be created by a checkin call. |
protected InternalVersion |
checkin(org.apache.jackrabbit.core.version.InternalVersionHistoryImpl history,
NodeImpl node)
Checks in a node |
javax.jcr.version.Version |
checkin(NodeImpl node)
invokes the checkin() on the persistent version manager and remaps the newly created version objects. |
void |
close()
Close this version manager. |
void |
commit(TransactionContext tx)
Commit transaction. |
EventStateCollection |
createEventStateCollection()
Creates an EventStateCollection. |
protected InternalVersionItem |
createInternalVersionItem(NodeId id)
Creates an InternalVersionItem based on the NodeState
identified by id. |
VirtualNodeState |
createNodeState(VirtualNodeState parent,
Name name,
NodeId id,
Name nodeTypeName)
Creates a new virtual node state |
VirtualPropertyState |
createPropertyState(VirtualNodeState parent,
Name name,
int type,
boolean multiValued)
Creats a new virtual property state |
protected VersionHistoryInfo |
createVersionHistory(javax.jcr.Session session,
NodeState node)
Creates a new version history. |
protected InternalVersionItem |
getItem(NodeId id)
Returns the item with the given persistent id. |
ItemState |
getItemState(ItemId id)
Return an item state, given its item id. |
NodeReferences |
getNodeReferences(NodeReferencesId id)
Return a node references object, given its target id |
InternalVersion |
getVersion(NodeId id)
Returns the version with the given id |
InternalVersionHistory |
getVersionHistory(NodeId id)
Returns the version history with the given id |
VersionHistoryInfo |
getVersionHistory(javax.jcr.Session session,
NodeState node)
Returns information about the version history of the specified node. |
VirtualItemStateProvider |
getVirtualItemStateProvider()
returns the virtual item state provider that exposes the internal versions as items. |
NodeId |
getVirtualRootId()
Returns the id of the root node of the virtual tree. |
InternalXAResource |
getXAResourceBegin()
Returns an InternalXAResource that acquires a write lock on the
version manager in InternalXAResource.prepare(TransactionContext). |
InternalXAResource |
getXAResourceEnd()
Returns an InternalXAResource that releases the write lock on the
version manager in InternalXAResource.commit(TransactionContext)
or InternalXAResource.rollback(TransactionContext). |
protected boolean |
hasItem(NodeId id)
Return a flag indicating if the item specified exists. |
protected boolean |
hasItemReferences(InternalVersionItem item)
Checks if there are item references (from outside the version storage) that reference the given version item. |
boolean |
hasItemState(ItemId id)
Return a flag indicating whether an item state for a given item id exists. |
boolean |
hasNodeReferences(NodeReferencesId id)
Return a flag indicating whether a node references object for a given target id exists. |
boolean |
isVirtualRoot(ItemId id)
Checks if the id refers to the root of a virtual tree. |
protected void |
itemDiscarded(InternalVersionItem item)
Invoked by the internal version item itself, when it's underlying persistence state was discarded. |
void |
prepare(TransactionContext tx)
Prepare transaction. |
void |
removeListener(ItemStateListener listener)
Remove an ItemStateListener |
protected void |
removeVersion(org.apache.jackrabbit.core.version.InternalVersionHistoryImpl history,
Name name)
Removes the specified version from the history |
void |
removeVersion(javax.jcr.version.VersionHistory history,
Name versionName)
Removes the specified version from the given version history. |
void |
rollback(TransactionContext tx)
Rollback transaction. |
boolean |
setNodeReferences(ChangeLog references)
Informs this provider that the node references to some of its states have changed. |
protected InternalVersion |
setVersionLabel(org.apache.jackrabbit.core.version.InternalVersionHistoryImpl history,
Name version,
Name label,
boolean move)
Set version label on the specified version. |
javax.jcr.version.Version |
setVersionLabel(javax.jcr.version.VersionHistory history,
Name version,
Name label,
boolean move)
Sets the version label to the given version. |
protected void |
versionCreated(InternalVersion version)
Invoked when a new internal item has been created. |
protected void |
versionDestroyed(InternalVersion version)
Invoked when a new internal item has been destroyed. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected LocalItemStateManager stateMgr
protected final NodeTypeRegistry ntReg
protected NodeStateEx historyRoot
| Constructor Detail |
|---|
public XAVersionManager(VersionManagerImpl vMgr,
NodeTypeRegistry ntReg,
SessionImpl session,
ItemStateCacheFactory cacheFactory)
throws javax.jcr.RepositoryException
javax.jcr.RepositoryException| Method Detail |
|---|
public EventStateCollection createEventStateCollection()
throws javax.jcr.RepositoryException
EventStateCollectionFactoryEventStateCollection.
createEventStateCollection in interface EventStateCollectionFactoryEventStateCollection
javax.jcr.RepositoryException - if creation fails for some reasonpublic VirtualItemStateProvider getVirtualItemStateProvider()
getVirtualItemStateProvider in interface VersionManager
protected VersionHistoryInfo createVersionHistory(javax.jcr.Session session,
NodeState node)
throws javax.jcr.RepositoryException
javax.jcr.RepositoryExceptiongetVersionHistory(Session, NodeState)
public javax.jcr.version.Version checkin(NodeImpl node)
throws javax.jcr.RepositoryException
checkin in interface VersionManagerjavax.jcr.RepositoryException
public void removeVersion(javax.jcr.version.VersionHistory history,
Name versionName)
throws javax.jcr.RepositoryException
removeVersion in interface VersionManagerjavax.jcr.RepositoryException
public javax.jcr.version.Version setVersionLabel(javax.jcr.version.VersionHistory history,
Name version,
Name label,
boolean move)
throws javax.jcr.RepositoryException
label to the given version.
If the label is already assigned to another version, a VersionException is
thrown unless move is true. If version
is null, the label is removed from the respective version.
In either case, the version the label was previously assigned is returned,
or null of the label was not moved.
setVersionLabel in interface VersionManagerjavax.jcr.RepositoryException
public void close()
throws java.lang.Exception
close in interface VersionManagerjava.lang.Exception - if an error occurspublic boolean isVirtualRoot(ItemId id)
isVirtualRoot in interface VirtualItemStateProvidertrue if it is the rootpublic NodeId getVirtualRootId()
getVirtualRootId in interface VirtualItemStateProvider
public VirtualPropertyState createPropertyState(VirtualNodeState parent,
Name name,
int type,
boolean multiValued)
throws javax.jcr.RepositoryException
createPropertyState in interface VirtualItemStateProviderjavax.jcr.RepositoryException
public VirtualNodeState createNodeState(VirtualNodeState parent,
Name name,
NodeId id,
Name nodeTypeName)
throws javax.jcr.RepositoryException
createNodeState in interface VirtualItemStateProviderjavax.jcr.RepositoryExceptionpublic boolean setNodeReferences(ChangeLog references)
setNodeReferences in interface VirtualItemStateProviderreferences - collection of NodeReferences instances
true if the reference target is one of its items.
public ItemState getItemState(ItemId id)
throws NoSuchItemStateException,
ItemStateException
getItemState in interface ItemStateManagerid - item id
NoSuchItemStateException - if the item does not exist
ItemStateException - if an error occurspublic boolean hasItemState(ItemId id)
hasItemState in interface ItemStateManagerid - item id
true if an item state exists,
otherwise false
public NodeReferences getNodeReferences(NodeReferencesId id)
throws NoSuchItemStateException,
ItemStateException
getNodeReferences in interface ItemStateManagerid - target id
NoSuchItemStateException - if the item does not exist
ItemStateException - if an error occurspublic boolean hasNodeReferences(NodeReferencesId id)
hasNodeReferences in interface ItemStateManagerid - target id
true if a node reference object exists for the given
id, otherwise false.public void addListener(ItemStateListener listener)
ItemStateListener
Not needed.
addListener in interface VirtualItemStateProviderlistener - the new listener to be informed on modificationspublic void removeListener(ItemStateListener listener)
ItemStateListener
Not needed.
removeListener in interface VirtualItemStateProviderlistener - an existing listener
protected InternalVersionItem getItem(NodeId id)
throws javax.jcr.RepositoryException
id - the id of the item
javax.jcr.RepositoryException - if an error occursprotected boolean hasItem(NodeId id)
id - the id of the item
true if the item exists;
false otherwise
protected boolean hasItemReferences(InternalVersionItem item)
throws javax.jcr.RepositoryException
item - version item
true if there are item references from outside the
version storage; false otherwise.
javax.jcr.RepositoryException - if an error occurs while reading from the
repository.
protected InternalVersion checkin(org.apache.jackrabbit.core.version.InternalVersionHistoryImpl history,
NodeImpl node)
throws javax.jcr.RepositoryException
history - the version historynode - node to checkin
javax.jcr.RepositoryException - if an error occursNode.checkin()
protected void removeVersion(org.apache.jackrabbit.core.version.InternalVersionHistoryImpl history,
Name name)
throws javax.jcr.version.VersionException,
javax.jcr.RepositoryException
history - the version history from where to remove the version.name - the name of the version to remove.
javax.jcr.version.VersionException - if the version history does
not have a version with name.
javax.jcr.RepositoryException - if any other error occurs.
protected InternalVersion setVersionLabel(org.apache.jackrabbit.core.version.InternalVersionHistoryImpl history,
Name version,
Name label,
boolean move)
throws javax.jcr.RepositoryException
history - version historyversion - version namelabel - version labelmove - true to move from existing version;
false otherwise
javax.jcr.RepositoryException - if an error occursprotected void versionCreated(InternalVersion version)
version - internal version itemprotected void versionDestroyed(InternalVersion version)
version - internal version itempublic void associate(TransactionContext tx)
associate in interface InternalXAResourcetx - transaction context, if null disassociatepublic void beforeOperation(TransactionContext tx)
InternalXAResource.prepare(org.apache.jackrabbit.core.TransactionContext), InternalXAResource.commit(org.apache.jackrabbit.core.TransactionContext) or
InternalXAResource.rollback(org.apache.jackrabbit.core.TransactionContext) method is called.
Delegate the call to our XA item state manager.
beforeOperation in interface InternalXAResourcetx - transaction context
public void prepare(TransactionContext tx)
throws TransactionException
prepare in interface InternalXAResourcetx - transaction context
TransactionException - if an error occurs
public void commit(TransactionContext tx)
throws TransactionException
commit in interface InternalXAResourcetx - transaction context
TransactionException - if an error occurspublic void rollback(TransactionContext tx)
rollback in interface InternalXAResourcetx - transaction context.public void afterOperation(TransactionContext tx)
InternalXAResource.prepare(org.apache.jackrabbit.core.TransactionContext), InternalXAResource.commit(org.apache.jackrabbit.core.TransactionContext) or
InternalXAResource.rollback(org.apache.jackrabbit.core.TransactionContext) method has been called.
Delegate the call to our XA item state manager.
afterOperation in interface InternalXAResourcetx - transaction contextpublic InternalXAResource getXAResourceBegin()
InternalXAResource that acquires a write lock on the
version manager in InternalXAResource.prepare(TransactionContext).
public InternalXAResource getXAResourceEnd()
InternalXAResource that releases the write lock on the
version manager in InternalXAResource.commit(TransactionContext)
or InternalXAResource.rollback(TransactionContext).
public InternalVersion getVersion(NodeId id)
throws javax.jcr.RepositoryException
getVersion in interface VersionManagerjavax.jcr.RepositoryException
public InternalVersionHistory getVersionHistory(NodeId id)
throws javax.jcr.RepositoryException
getVersionHistory in interface VersionManagerjavax.jcr.RepositoryExceptionprotected ISMLocking.WriteLock acquireWriteLock()
protected ISMLocking.ReadLock acquireReadLock()
public VersionHistoryInfo getVersionHistory(javax.jcr.Session session,
NodeState node)
throws javax.jcr.RepositoryException
getVersionHistory in interface VersionManagernode - node whose version history should be returned
javax.jcr.RepositoryException - if an error occurs
protected java.lang.String calculateCheckinVersionName(org.apache.jackrabbit.core.version.InternalVersionHistoryImpl history,
NodeImpl node)
throws javax.jcr.RepositoryException
history - the version historynode - the node to checkin
javax.jcr.RepositoryException - if an error occurs.protected void itemDiscarded(InternalVersionItem item)
item -
protected InternalVersionItem createInternalVersionItem(NodeId id)
throws javax.jcr.RepositoryException
InternalVersionItem based on the NodeState
identified by id.
id - the node id of the version item.
null if there is no node state
with the given id.
javax.jcr.RepositoryException - if an error occurs while reading from the
version storage.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||