org.apache.jackrabbit.core
Class XASessionImpl

java.lang.Object
  extended byorg.apache.jackrabbit.core.SessionImpl
      extended byorg.apache.jackrabbit.core.XASessionImpl
All Implemented Interfaces:
Dumpable, Session, XAResource, XASession

public class XASessionImpl
extends SessionImpl
implements XASession, XAResource

Session extension that provides XA support.


Field Summary
 
Fields inherited from class org.apache.jackrabbit.core.SessionImpl
accessMgr, ADD_NODE_ACTION, alive, attributes, hierMgr, itemMgr, itemStateMgr, listeners, lockTokens, loginContext, nsMappings, ntMgr, READ_ACTION, REMOVE_ACTION, rep, SET_PROPERTY_ACTION, subject, userId, valueFactory, versionMgr, wsp
 
Fields inherited from interface javax.transaction.xa.XAResource
TMENDRSCAN, TMFAIL, TMJOIN, TMNOFLAGS, TMONEPHASE, TMRESUME, TMSTARTRSCAN, TMSUCCESS, TMSUSPEND, XA_OK, XA_RDONLY
 
Constructor Summary
protected XASessionImpl(RepositoryImpl rep, AuthContext loginContext, WorkspaceConfig wspConfig)
          Create a new instance of this class.
protected XASessionImpl(RepositoryImpl rep, Subject subject, WorkspaceConfig wspConfig)
          Create a new instance of this class.
 
Method Summary
 void commit(Xid xid, boolean onePhase)
          
protected  void dispatch(EventStateCollection events)
          Dispatch events belonging to a save operation.

If we are currently associated with a transaction, the dispatch operation will be postponed until commit.

 void end(Xid xid, int flags)
          

If TMSUCCESS is specified, we disassociate this session from the transaction specified.

 void forget(Xid xid)
          

No recovery support yet.

 int getTransactionTimeout()
          
 XAResource getXAResource()
          Retrieves an XAResource object that the transaction manager will use to manage this XASession object's participation in a distributed transaction.
 boolean isSameRM(XAResource xares)
          

Two resources belong to the same resource manager if both connections (i.e.

 int prepare(Xid xid)
          
 Xid[] recover(int flags)
          

No recovery support yet.

 void rollback(Xid xid)
          
 boolean setTransactionTimeout(int seconds)
          
 void start(Xid xid, int flags)
          

If TMNOFLAGS is specified, we create a new transaction context and associate it with this resource.

 
Methods inherited from class org.apache.jackrabbit.core.SessionImpl
addListener, addLockToken, addLockToken, checkPermission, createAccessManager, createItemManager, createSessionItemStateManager, createWorkspace, createWorkspaceInstance, dump, exportDocumentView, exportDocumentView, exportSystemView, exportSystemView, getAccessManager, getAttribute, getAttributeNames, getHierarchyManager, getImportContentHandler, getItem, getItemManager, getItemStateManager, getLockTokens, getNamespacePrefix, getNamespacePrefixes, getNamespaceResolver, getNamespaceURI, getNodeByUUID, getNodeTypeManager, getRepository, getRootNode, getSubject, getUserID, getValueFactory, getVersionManager, getWorkspace, getWorkspaceNames, hasPendingChanges, impersonate, importXML, isLive, itemExists, logout, move, notifyLoggedOut, notifyLoggingOut, refresh, removeListener, removeLockToken, removeLockToken, sanityCheck, save, setNamespacePrefix
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.jcr.Session
addLockToken, checkPermission, exportDocumentView, exportDocumentView, exportSystemView, exportSystemView, getAttribute, getAttributeNames, getImportContentHandler, getItem, getLockTokens, getNamespacePrefix, getNamespacePrefixes, getNamespaceURI, getNodeByUUID, getRepository, getRootNode, getUserID, getValueFactory, getWorkspace, hasPendingChanges, impersonate, importXML, isLive, itemExists, logout, move, refresh, removeLockToken, save, setNamespacePrefix
 

Constructor Detail

XASessionImpl

protected XASessionImpl(RepositoryImpl rep,
                        AuthContext loginContext,
                        WorkspaceConfig wspConfig)
                 throws AccessDeniedException,
                        RepositoryException
Create a new instance of this class.

Parameters:
rep - repository
loginContext - login context containing authenticated subject
wspConfig - workspace configuration
Throws:
AccessDeniedException - if the subject of the given login context is not granted access to the specified workspace
RepositoryException - if another error occurs

XASessionImpl

protected XASessionImpl(RepositoryImpl rep,
                        Subject subject,
                        WorkspaceConfig wspConfig)
                 throws AccessDeniedException,
                        RepositoryException
Create a new instance of this class.

Parameters:
rep - repository
subject - authenticated subject
wspConfig - workspace configuration
Throws:
AccessDeniedException - if the given subject is not granted access to the specified workspace
RepositoryException - if another error occurs
Method Detail

getXAResource

public XAResource getXAResource()
Retrieves an XAResource object that the transaction manager will use to manage this XASession object's participation in a distributed transaction.

Specified by:
getXAResource in interface XASession
Returns:
the XAResource object.

getTransactionTimeout

public int getTransactionTimeout()
                          throws XAException

Specified by:
getTransactionTimeout in interface XAResource
Throws:
XAException

setTransactionTimeout

public boolean setTransactionTimeout(int seconds)
                              throws XAException

Specified by:
setTransactionTimeout in interface XAResource
Throws:
XAException

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:
isSameRM in interface XAResource
Throws:
XAException

start

public void start(Xid xid,
                  int flags)
           throws XAException

If TMNOFLAGS is specified, we create a new transaction context and associate it with this resource. If TMJOIN is specified, this resource should use the same transaction context as another, already known transaction. If TMRESUME is specified, we should resume work on a transaction context that was suspended earlier. All other flags generate an XAException of type XAER_INVAL

Specified by:
start in interface XAResource
Throws:
XAException

end

public void end(Xid xid,
                int flags)
         throws XAException

If TMSUCCESS is specified, we disassociate this session from the transaction specified. If TMFAIL is specified, we disassociate this session from the transaction specified and mark the transaction rollback only. If TMSUSPEND is specified, we disassociate this session from the transaction specified. All other flags generate an XAException of type XAER_INVAL

Specified by:
end in interface XAResource
Throws:
XAException

prepare

public int prepare(Xid xid)
            throws XAException

Specified by:
prepare in interface XAResource
Throws:
XAException

rollback

public void rollback(Xid xid)
              throws XAException

Specified by:
rollback in interface XAResource
Throws:
XAException

commit

public void commit(Xid xid,
                   boolean onePhase)
            throws XAException

Specified by:
commit in interface XAResource
Throws:
XAException

recover

public Xid[] recover(int flags)
              throws XAException

No recovery support yet.

Specified by:
recover in interface XAResource
Throws:
XAException

forget

public void forget(Xid xid)
            throws XAException

No recovery support yet.

Specified by:
forget in interface XAResource
Throws:
XAException

dispatch

protected void dispatch(EventStateCollection events)
Dispatch events belonging to a save operation.

If we are currently associated with a transaction, the dispatch operation will be postponed until commit.

Overrides:
dispatch in class SessionImpl
Parameters:
events - events to dispatch as result of a successful save operation


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