Class XASessionImpl
- java.lang.Object
-
- org.apache.jackrabbit.commons.AbstractSession
-
- org.apache.jackrabbit.core.SessionImpl
-
- org.apache.jackrabbit.core.XASessionImpl
-
- All Implemented Interfaces:
Session,XAResource,JackrabbitSession,XASession,IdentifierResolver,NamePathResolver,NameResolver,PathResolver,NamespaceResolver,SessionExtensions
public class XASessionImpl extends SessionImpl implements XASession, XAResource
Session extension that provides XA support.
-
-
Field Summary
Fields Modifier and Type Field Description static StringSYSTEM_PROPERTY_DEFAULT_TRANSACTION_TIMEOUTSystem property specifying the default Transaction Timeout-
Fields inherited from class org.apache.jackrabbit.core.SessionImpl
attributes, AUTO_FIX_CORRUPTIONS, context, DISABLE_CLUSTER_SYNC_ON_REFRESH, listeners, loginContext, namePathResolver, repositoryContext, subject, userId, versionMgr
-
Fields inherited from interface org.apache.jackrabbit.api.JackrabbitSession
ACTION_ADD_PROPERTY, ACTION_LOCKING, ACTION_MODIFY_ACCESS_CONTROL, ACTION_MODIFY_PROPERTY, ACTION_NODE_TYPE_MANAGEMENT, ACTION_READ_ACCESS_CONTROL, ACTION_REMOVE_NODE, ACTION_REMOVE_PROPERTY, ACTION_USER_MANAGEMENT, ACTION_VERSIONING
-
Fields inherited from interface javax.jcr.Session
ACTION_ADD_NODE, ACTION_READ, ACTION_REMOVE, ACTION_SET_PROPERTY
-
Fields inherited from interface javax.transaction.xa.XAResource
TMENDRSCAN, TMFAIL, TMJOIN, TMNOFLAGS, TMONEPHASE, TMRESUME, TMSTARTRSCAN, TMSUCCESS, TMSUSPEND, XA_OK, XA_RDONLY
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedXASessionImpl(RepositoryContext repositoryContext, Subject subject, WorkspaceConfig wspConfig)Create a new instance of this class.protectedXASessionImpl(RepositoryContext repositoryContext, AuthContext loginContext, WorkspaceConfig wspConfig)Create a new instance of this class.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidassociate(TransactionContext tx)Associate this session with a global transaction.voidcommit(Xid xid, boolean onePhase)protected InternalVersionManagercreateVersionManager()Create the version manager.voidend(Xid xid, int flags)voidforget(Xid xid)intgetTransactionTimeout()XAResourcegetXAResource()booleanisSameRM(XAResource xares)voidlogout()Invalidates this session and releases all associated resources.intprepare(Xid xid)Xid[]recover(int flags)voidrollback(Xid xid)booleansetTransactionTimeout(int seconds)voidstart(Xid xid, int flags)-
Methods inherited from class org.apache.jackrabbit.core.SessionImpl
addListener, addLockToken, autoFixCorruptions, checkFormat, checkPermission, clusterSyncOnRefresh, createAccessManager, createDataStoreGarbageCollector, createItemManager, createObservationManager, createSession, createSessionItemStateManager, finalize, getAccessControlManager, getAccessManager, getAttribute, getAttributeNames, getHierarchyManager, getImportContentHandler, getInternalVersionManager, getItem, getItemManager, getItemOrNull, getJCRName, getJCRPath, getLocks, getLockTokens, getNode, getNodeById, getNodeByIdentifier, getNodeByUUID, getNodeOrNull, getNodeTypeManager, getPath, getPrefix, getPrincipalManager, getProperty, getPropertyOrNull, getQName, getQPath, getQPath, getRepository, getRetentionManager, getRetentionRegistry, getRootNode, getSubject, getURI, getUserID, getUserManager, getValueFactory, getWorkspace, hasCapability, hasPendingChanges, hasPermission, hasPermission, impersonate, isAdmin, isLive, isSystem, itemExists, move, nodeExists, notifyLoggedOut, notifyLoggingOut, propertyExists, refresh, removeItem, removeListener, removeLockToken, retrieveUserId, save, setAttribute, setNamespacePrefix, toString
-
Methods inherited from class org.apache.jackrabbit.commons.AbstractSession
exportDocumentView, exportDocumentView, exportSystemView, exportSystemView, getNamespacePrefix, getNamespacePrefixes, getNamespaceURI, importXML
-
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.jackrabbit.api.JackrabbitSession
getParentOrNull
-
Methods inherited from interface javax.jcr.Session
addLockToken, checkPermission, exportDocumentView, exportDocumentView, exportSystemView, exportSystemView, getAccessControlManager, getAttribute, getAttributeNames, getImportContentHandler, getItem, getLockTokens, getNamespacePrefix, getNamespacePrefixes, getNamespaceURI, getNode, getNodeByIdentifier, getNodeByUUID, getProperty, getRepository, getRetentionManager, getRootNode, getUserID, getValueFactory, getWorkspace, hasCapability, hasPendingChanges, hasPermission, impersonate, importXML, isLive, itemExists, move, nodeExists, propertyExists, refresh, removeItem, removeLockToken, save, setNamespacePrefix
-
-
-
-
Field Detail
-
SYSTEM_PROPERTY_DEFAULT_TRANSACTION_TIMEOUT
public static final String SYSTEM_PROPERTY_DEFAULT_TRANSACTION_TIMEOUT
System property specifying the default Transaction Timeout- See Also:
- Constant Field Values
-
-
Constructor Detail
-
XASessionImpl
protected XASessionImpl(RepositoryContext repositoryContext, AuthContext loginContext, WorkspaceConfig wspConfig) throws AccessDeniedException, RepositoryException
Create a new instance of this class.- Parameters:
repositoryContext- repository contextloginContext- login context containing authenticated subjectwspConfig- workspace configuration- Throws:
AccessDeniedException- if the subject of the given login context is not granted access to the specified workspaceRepositoryException- if another error occurs
-
XASessionImpl
protected XASessionImpl(RepositoryContext repositoryContext, Subject subject, WorkspaceConfig wspConfig) throws AccessDeniedException, RepositoryException
Create a new instance of this class.- Parameters:
repositoryContext- repository contextsubject- authenticated subjectwspConfig- workspace configuration- Throws:
AccessDeniedException- if the given subject is not granted access to the specified workspaceRepositoryException- if another error occurs
-
-
Method Detail
-
createVersionManager
protected InternalVersionManager createVersionManager() throws RepositoryException
Create the version manager. If we are not using XA, we may safely use the repository version manager.- Overrides:
createVersionManagerin classSessionImpl- Returns:
- version manager
- Throws:
RepositoryException
-
getXAResource
public XAResource getXAResource()
- Specified by:
getXAResourcein interfaceXASession
-
getTransactionTimeout
public int getTransactionTimeout()
- Specified by:
getTransactionTimeoutin interfaceXAResource
-
setTransactionTimeout
public boolean setTransactionTimeout(int seconds)
- Specified by:
setTransactionTimeoutin interfaceXAResource
-
isSameRM
public boolean isSameRM(XAResource xares) throws XAException
Two resources belong to the same resource manager if both connections (i.e. sessions) have the same credentials.
- Specified by:
isSameRMin interfaceXAResource- Throws:
XAException
-
start
public void start(Xid xid, int flags) throws XAException
If
TMNOFLAGSis specified, we create a new transaction context and associate it with this resource. IfTMJOINis specified, this resource should use the same transaction context as another, already known transaction. IfTMRESUMEis specified, we should resume work on a transaction context that was suspended earlier. All other flags generate anXAExceptionof typeXAER_INVAL- Specified by:
startin interfaceXAResource- Throws:
XAException
-
end
public void end(Xid xid, int flags) throws XAException
If
TMSUCCESSis specified, we disassociate this session from the transaction specified. IfTMFAILis specified, we disassociate this session from the transaction specified and mark the transaction rollback only. IfTMSUSPENDis specified, we disassociate this session from the transaction specified. All other flags generate anXAExceptionof typeXAER_INVALIt is legal for a transaction association to be suspended and then ended (either with
TMSUCCESSorTMFAIL) without having been resumed again.- Specified by:
endin interfaceXAResource- Throws:
XAException
-
prepare
public int prepare(Xid xid) throws XAException
- Specified by:
preparein interfaceXAResource- Throws:
XAException
-
commit
public void commit(Xid xid, boolean onePhase) throws XAException
- Specified by:
commitin interfaceXAResource- Throws:
XAException
-
rollback
public void rollback(Xid xid) throws XAException
- Specified by:
rollbackin interfaceXAResource- Throws:
XAException
-
recover
public Xid[] recover(int flags) throws XAException
No recovery support yet.
- Specified by:
recoverin interfaceXAResource- Throws:
XAException
-
forget
public void forget(Xid xid) throws XAException
No recovery support yet.
- Specified by:
forgetin interfaceXAResource- Throws:
XAException
-
associate
public void associate(TransactionContext tx)
Associate this session with a global transaction. Internally, set the transaction containing all transaction-local objects to be used when performing item retrieval and store.
-
logout
public void logout()
Invalidates this session and releases all associated resources.- Specified by:
logoutin interfaceSession- Overrides:
logoutin classSessionImpl
-
-