|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.jackrabbit.core.version.AbstractVersionManager org.apache.jackrabbit.core.version.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 org.apache.jackrabbit.core.version.NodeStateEx |
historyRoot
Persistent root node of the version histories. |
protected LocalItemStateManager |
stateMgr
State manager for the version storage. |
Constructor Summary | |
XAVersionManager(VersionManagerImpl vMgr,
NodeTypeRegistry ntReg,
SessionImpl session)
Creates a new instance of this class. |
Method Summary | |
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.
Delegate the call to our XA item state manager. |
void |
associate(TransactionContext tx)
Associate this resource with a transaction. All further operations on the object should be interpreted as part of this transaction and changes recorded in some attribute of the transaction context. |
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.
Delegate the call to our XA item state manager. |
protected InternalVersion |
checkin(org.apache.jackrabbit.core.version.InternalVersionHistoryImpl history,
NodeImpl node)
Checks in a node Before modifying version history given, make a local copy of it. |
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. After having closed a persistence manager, further operations on this object are treated as illegal and throw |
void |
commit(TransactionContext tx)
Commit transaction. The transaction is identified by a transaction context. If the method throws, other resources get their changes rolled back. Delegate the call to our XA item state manager. |
EventStateCollection |
createEventStateCollection()
Creates an EventStateCollection . |
VirtualNodeState |
createNodeState(VirtualNodeState parent,
QName name,
NodeId id,
QName nodeTypeName)
Creates a new virtual node state |
VirtualPropertyState |
createPropertyState(VirtualNodeState parent,
QName name,
int type,
boolean multiValued)
Creats a new virtual property state |
VersionHistory |
createVersionHistory(Session session,
NodeState node)
Creates a new version history. This action is needed either when creating a new 'mix:versionable' node or when adding the 'mix:versionable' mixin to a node. |
protected InternalVersionItem |
getItem(NodeId id)
Returns the item with the given persistent id. Subclass responsibility. |
protected List |
getItemReferences(InternalVersionItem item)
Returns the item references that reference the given version item. Subclass responsiblity. |
ItemState |
getItemState(ItemId id)
Return an item state, given its item id. Return item states for changes only. |
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 |
VersionHistory |
getVersionHistory(Session session,
NodeState node)
Returns the version history of the specified node or
null if the given node doesn't (yet) have an associated
version history. |
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. |
protected boolean |
hasItem(NodeId id)
Return a flag indicating if the item specified exists. Subclass responsibility. |
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 |
hasVersion(NodeId id)
Checks if the version with the given id exists |
boolean |
hasVersionHistory(NodeId id)
Checks if the version history with the given id exists |
boolean |
isVirtualRoot(ItemId id)
Checks if the id refers to the root of a virtual tree. |
void |
prepare(TransactionContext tx)
Prepare transaction. The transaction is identified by a transaction context. Delegate the call to our XA item state manager. |
protected void |
removeVersion(org.apache.jackrabbit.core.version.InternalVersionHistoryImpl history,
QName name)
Removes the specified version from the history Before modifying version history given, make a local copy of it. |
void |
removeVersion(VersionHistory history,
QName versionName)
Removes the specified version from the given version history. |
void |
rollback(TransactionContext tx)
Rollback transaction. The transaction is identified by a transaction context. Delegate the call to our XA item state manager. |
boolean |
setNodeReferences(NodeReferences refs)
Informs this provider that the node references to one of its states has changed. |
protected InternalVersion |
setVersionLabel(org.apache.jackrabbit.core.version.InternalVersionHistoryImpl history,
QName version,
QName label,
boolean move)
Set version label on the specified version. Before modifying version history given, make a local copy of it. |
Version |
setVersionLabel(VersionHistory history,
QName version,
QName label,
boolean move)
Sets the version 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. |
protected void |
versionCreated(InternalVersion version)
Invoked when a new internal item has been created. Put the version object into our cache. |
protected void |
versionDestroyed(InternalVersion version)
Invoked when a new internal item has been destroyed. Remove the version object from our cache. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected LocalItemStateManager stateMgr
protected org.apache.jackrabbit.core.version.NodeStateEx historyRoot
Constructor Detail |
public XAVersionManager(VersionManagerImpl vMgr, NodeTypeRegistry ntReg, SessionImpl session) throws RepositoryException
Method Detail |
public EventStateCollection createEventStateCollection() throws RepositoryException
EventStateCollectionFactory
EventStateCollection
.
createEventStateCollection
in interface EventStateCollectionFactory
EventStateCollection
RepositoryException
- if creation fails for some reasonpublic VirtualItemStateProvider getVirtualItemStateProvider()
getVirtualItemStateProvider
in interface VersionManager
public VersionHistory createVersionHistory(Session session, NodeState node) throws RepositoryException
createVersionHistory
in interface VersionManager
node
-
RepositoryException
VersionManager.getVersionHistory(Session, NodeState)
public Version checkin(NodeImpl node) throws RepositoryException
checkin
in interface VersionManager
node
-
RepositoryException
public void removeVersion(VersionHistory history, QName versionName) throws RepositoryException
removeVersion
in interface VersionManager
history
- versionName
-
RepositoryException
public Version setVersionLabel(VersionHistory history, QName version, QName label, boolean move) throws 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 VersionManager
history
- version
- label
- move
-
RepositoryException
public void close() throws Exception
close
in interface VersionManager
Exception
- if an error occurspublic boolean isVirtualRoot(ItemId id)
isVirtualRoot
in interface VirtualItemStateProvider
id
-
true
if it is the rootpublic NodeId getVirtualRootId()
getVirtualRootId
in interface VirtualItemStateProvider
public VirtualPropertyState createPropertyState(VirtualNodeState parent, QName name, int type, boolean multiValued) throws RepositoryException
createPropertyState
in interface VirtualItemStateProvider
parent
- name
- type
- multiValued
-
RepositoryException
public VirtualNodeState createNodeState(VirtualNodeState parent, QName name, NodeId id, QName nodeTypeName) throws RepositoryException
createNodeState
in interface VirtualItemStateProvider
parent
- name
- id
- nodeTypeName
-
RepositoryException
public boolean setNodeReferences(NodeReferences refs)
setNodeReferences
in interface VirtualItemStateProvider
refs
-
true
if the reference target is one of its items.public ItemState getItemState(ItemId id) throws NoSuchItemStateException, ItemStateException
getItemState
in interface ItemStateManager
id
- item id
NoSuchItemStateException
- if the item does not exist
ItemStateException
- if an error occurspublic boolean hasItemState(ItemId id)
hasItemState
in interface ItemStateManager
id
- item id
true
if an item state exists,
otherwise false
public NodeReferences getNodeReferences(NodeReferencesId id) throws NoSuchItemStateException, ItemStateException
getNodeReferences
in interface ItemStateManager
id
- target id
ItemStateException
- if an error occurs
NoSuchItemStateException
- if the item does not existpublic boolean hasNodeReferences(NodeReferencesId id)
hasNodeReferences
in interface ItemStateManager
id
- target id
true
if a node reference object exists for the given
id, otherwise false
.protected InternalVersionItem getItem(NodeId id) throws RepositoryException
id
- the id of the item
RepositoryException
- if an error occursprotected boolean hasItem(NodeId id)
id
- the id of the item
true
if the item exists;
false
otherwiseprotected List getItemReferences(InternalVersionItem item)
item
- version item
protected InternalVersion checkin(org.apache.jackrabbit.core.version.InternalVersionHistoryImpl history, NodeImpl node) throws RepositoryException
node
- node to checkin
RepositoryException
- if an error occursNode.checkin()
protected void removeVersion(org.apache.jackrabbit.core.version.InternalVersionHistoryImpl history, QName name) throws VersionException, RepositoryException
history
- the version history from where to remove the version.name
- the name of the version to remove.
VersionException
- if the version history
does
not have a version with name
.
RepositoryException
- if any other error occurs.protected InternalVersion setVersionLabel(org.apache.jackrabbit.core.version.InternalVersionHistoryImpl history, QName version, QName label, boolean move) throws RepositoryException
history
- version historyversion
- version namelabel
- version labelmove
- true
to move from existing version;
false
otherwise
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 InternalXAResource
tx
- 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 InternalXAResource
tx
- transaction contextpublic void prepare(TransactionContext tx) throws TransactionException
prepare
in interface InternalXAResource
tx
- transaction context
TransactionException
- if an error occurspublic void commit(TransactionContext tx) throws TransactionException
commit
in interface InternalXAResource
tx
- transaction context
TransactionException
- if an error occurspublic void rollback(TransactionContext tx)
rollback
in interface InternalXAResource
tx
- 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 InternalXAResource
tx
- transaction contextpublic InternalVersion getVersion(NodeId id) throws RepositoryException
getVersion
in interface VersionManager
id
-
RepositoryException
public InternalVersionHistory getVersionHistory(NodeId id) throws RepositoryException
getVersionHistory
in interface VersionManager
id
-
RepositoryException
public boolean hasVersionHistory(NodeId id)
hasVersionHistory
in interface VersionManager
id
-
true
if the version history exists.public boolean hasVersion(NodeId id)
hasVersion
in interface VersionManager
id
-
true
if the version exists.public VersionHistory getVersionHistory(Session session, NodeState node) throws RepositoryException
node
or
null
if the given node doesn't (yet) have an associated
version history.
getVersionHistory
in interface VersionManager
session
- node
- node whose version history should be returned
node
or
null
if the given node doesn't (yet) have an
associated version history.
RepositoryException
- if an error occursVersionManager.createVersionHistory(Session, NodeState)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |