00001 00026 package org.objectweb.jonas.jtm; 00027 00028 // JOnAS imports 00029 import org.objectweb.jonas.management.j2eemanagement.J2EEResource; 00030 import org.objectweb.jonas.management.ReconfiguredProp; 00031 00032 import javax.transaction.xa.Xid; 00033 00034 import java.util.ArrayList; 00035 00040 public class JTAResource extends J2EEResource { 00041 00045 public static final String SERVICE_NAME = "jtm"; 00046 00047 // Transaction Service configuration properties 00051 static final String TIMEOUT = "jonas.service.jtm.timeout"; 00052 00056 private long sequenceNumber = 0; 00057 00061 private Integer timeOut; 00062 00066 private Integer portNumber; 00067 00071 private String hostName; 00072 00076 private Boolean localJtm; 00077 00081 private TransactionServiceImpl jtm; 00082 00092 public JTAResource(String objectName, TransactionServiceImpl jtm, Integer timeOut, Boolean localJtm, 00093 Integer portNumber, String hostName) { 00094 super(objectName); 00095 this.jtm = jtm; 00096 this.timeOut = timeOut; 00097 this.localJtm = localJtm; 00098 this.portNumber = portNumber; 00099 this.hostName = hostName; 00100 } 00101 00105 public Integer getTimeOut() { 00106 return timeOut; 00107 } 00108 00112 public void setTimeOut(Integer timeOut) { 00113 this.timeOut = timeOut; 00114 jtm.setTimeout(timeOut.intValue()); 00115 // Send a notification containing the new value of this property to the 00116 // listner MBean 00117 sendReconfigNotification(++sequenceNumber, SERVICE_NAME, new ReconfiguredProp(TIMEOUT, timeOut.toString())); 00118 } 00119 00123 public Boolean isLocalJtm() { 00124 return localJtm; 00125 } 00126 00130 public Integer getPortNumber() { 00131 return portNumber; 00132 } 00133 00137 public String getHostName() { 00138 return hostName; 00139 } 00140 00144 public void saveConfig() { 00145 sendSaveNotification(++sequenceNumber, SERVICE_NAME); 00146 } 00147 00151 public Integer getTotalBegunTransactions() { 00152 return new Integer(jtm.getTotalBegunTransactions()); 00153 } 00157 public Integer getTotalCommittedTransactions() { 00158 return new Integer(jtm.getTotalCommittedTransactions()); 00159 } 00163 public Integer getTotalCurrentTransactions() { 00164 return new Integer(jtm.getTotalCurrentTransactions()); 00165 } 00169 public Integer getTotalExpiredTransactions() { 00170 return new Integer(jtm.getTotalExpiredTransactions()); 00171 } 00175 public Integer getTotalRolledbackTransactions() { 00176 return new Integer(jtm.getTotalRolledbackTransactions()); 00177 } 00181 public void resetAllCounters() { 00182 jtm.resetAllTxTotalCounters(); 00183 } 00184 00188 public Xid[] getAllActiveXids() { 00189 return jtm.getAllActiveXids(); 00190 } 00191 00195 public String [] getAllActiveTx() { 00196 String [] mysArray; 00197 00198 mysArray = jtm.getAllActiveTx(); 00199 return mysArray; 00200 } 00201 }