ModeShape Distribution 3.0.0.Beta4

org.modeshape.jcr
Class JcrXaSession

java.lang.Object
  extended by org.modeshape.jcr.JcrSession
      extended by org.modeshape.jcr.JcrXaSession
All Implemented Interfaces:
Session, XAResource

public class JcrXaSession
extends JcrSession
implements XAResource

An extension of JcrSession that is also an XAResource, enabling clients to explicitly enlist the session in the transaction.

This implementation simply delegates to the Infinispan cache's XAResource instance, since ModeShape does not need to itself be a resource that participates in the transaction. (Instead, ModeShape registers as a Synchronization on the transaction, ensuring that it is notified when the transaction completes.)


Nested Class Summary
 
Nested classes/interfaces inherited from class org.modeshape.jcr.JcrSession
JcrSession.JcrPreSave
 
Field Summary
 
Fields inherited from class org.modeshape.jcr.JcrSession
repository
 
Fields inherited from interface javax.transaction.xa.XAResource
TMENDRSCAN, TMFAIL, TMJOIN, TMNOFLAGS, TMONEPHASE, TMRESUME, TMSTARTRSCAN, TMSUCCESS, TMSUSPEND, XA_OK, XA_RDONLY
 
Fields inherited from interface javax.jcr.Session
ACTION_ADD_NODE, ACTION_READ, ACTION_REMOVE, ACTION_SET_PROPERTY
 
Constructor Summary
protected JcrXaSession(JcrRepository repository, String workspaceName, ExecutionContext context, Map<String,Object> sessionAttributes, boolean readOnly)
           
 
Method Summary
 void commit(Xid xid, boolean onePhase)
           
protected  XAResource delegate()
           
 void end(Xid xid, int flags)
           
 void forget(Xid xid)
           
 int getTransactionTimeout()
           
 boolean isSameRM(XAResource xaRes)
           
 int prepare(Xid xid)
           
 Xid[] recover(int flag)
           
 void rollback(Xid xid)
           
 boolean setTransactionTimeout(int seconds)
           
 void start(Xid xid, int flags)
           
 
Methods inherited from class org.modeshape.jcr.JcrSession
addLockToken, checkPermission, entryForNode, 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, initBaseVersionKeys, initOriginalVersionKeys, isAnonymous, isForeignKey, isLive, itemExists, logout, move, nodeExists, nodeExists, nodeIdentifier, propertyExists, readable, readableLocation, refresh, removeItem, removeLockToken, save, setNamespacePrefix, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JcrXaSession

protected JcrXaSession(JcrRepository repository,
                       String workspaceName,
                       ExecutionContext context,
                       Map<String,Object> sessionAttributes,
                       boolean readOnly)
Method Detail

delegate

protected final XAResource delegate()

start

public void start(Xid xid,
                  int flags)
           throws XAException
Specified by:
start in interface XAResource
Throws:
XAException

end

public void end(Xid xid,
                int flags)
         throws XAException
Specified by:
end in interface XAResource
Throws:
XAException

prepare

public int prepare(Xid xid)
            throws XAException
Specified by:
prepare in interface XAResource
Throws:
XAException

commit

public void commit(Xid xid,
                   boolean onePhase)
            throws XAException
Specified by:
commit in interface XAResource
Throws:
XAException

rollback

public void rollback(Xid xid)
              throws XAException
Specified by:
rollback in interface XAResource
Throws:
XAException

forget

public void forget(Xid xid)
            throws XAException
Specified by:
forget in interface XAResource
Throws:
XAException

recover

public Xid[] recover(int flag)
              throws XAException
Specified by:
recover in interface XAResource
Throws:
XAException

isSameRM

public boolean isSameRM(XAResource xaRes)
                 throws XAException
Specified by:
isSameRM in interface XAResource
Throws:
XAException

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

ModeShape Distribution 3.0.0.Beta4

Copyright © 2008-2012 JBoss, a division of Red Hat. All Rights Reserved.