1 23 24 package org.apache.slide.common; 25 26 import java.util.Hashtable ; 27 28 import javax.transaction.xa.XAException ; 29 import javax.transaction.xa.XAResource ; 30 import javax.transaction.xa.Xid ; 31 32 import org.apache.commons.transaction.util.xa.TransactionalResource; 33 34 39 public class XAServiceBase extends AbstractXAServiceBase { 40 41 protected boolean started = false; 42 43 public void setParameters(Hashtable parameters) 44 throws ServiceParameterErrorException, 45 ServiceParameterMissingException { 46 } 47 48 public void connect() throws ServiceConnectionFailedException { 49 started = true; 50 } 51 52 public void disconnect() throws ServiceDisconnectionFailedException { 53 started = false; 54 } 55 56 public void reset() throws ServiceResetFailedException { 57 } 58 59 public boolean isConnected() throws ServiceAccessException { 60 return started; 61 } 62 63 public boolean isSameRM(XAResource xares) throws XAException { 64 return (xares == this); 65 } 66 67 public Xid [] recover(int flag) throws XAException { 68 return null; 69 } 70 71 public int getTransactionTimeout() throws XAException { 72 return 0; 73 } 74 75 public boolean setTransactionTimeout(int arg0) throws XAException { 76 return false; 77 } 78 79 protected TransactionalResource createTransactionResource(Xid xid) { 80 return new DummyTxResource(xid); 81 } 82 83 protected boolean includeBranchInXid() { 84 return false; 85 } 86 87 protected class DummyTxResource implements TransactionalResource { 88 Xid xid; 89 90 int status; 91 92 DummyTxResource(Xid xid) { 93 this.xid = xid; 94 status = STATUS_ACTIVE; 95 } 96 97 public void commit() throws XAException { 98 } 99 100 public void rollback() throws XAException { 101 } 102 103 public int prepare() throws XAException { 104 return XA_OK; 106 } 107 108 public int getStatus() { 109 return status; 110 } 111 112 public void setStatus(int status) { 113 this.status = status; 114 } 115 116 public Xid getXid() { 117 return xid; 118 } 119 120 public void begin() throws XAException { 121 } 122 123 public void suspend() throws XAException { 124 } 125 126 public void resume() throws XAException { 127 } 128 } 129 130 } | Popular Tags |