1 22 package org.jboss.tm; 23 24 import javax.transaction.xa.Xid ; 25 26 import org.jboss.system.ServiceMBeanSupport; 27 28 37 public class XidFactory 38 extends ServiceMBeanSupport 39 implements XidFactoryMBean 40 { 41 42 private static final javax.management.ObjectName NAMING_OBJECT_NAME = 44 org.jboss.mx.util.ObjectNameFactory.create("jboss:service=Naming"); 45 46 private XidFactoryImpl factory = new XidFactoryImpl(); 47 48 protected void startService() 49 throws Exception 50 { 51 long jndiPortOrStartUpTime; 52 try 53 { 54 Integer jndiPort = 55 (Integer ) getServer().getAttribute(NAMING_OBJECT_NAME, "Port"); 56 jndiPortOrStartUpTime = jndiPort.intValue(); 57 } 58 catch (Exception e) 59 { 60 jndiPortOrStartUpTime = System.currentTimeMillis(); 61 } 62 factory.setUniqueInstanceId(jndiPortOrStartUpTime); 63 factory.start(); 64 } 65 66 73 public XidFactoryMBean getInstance() 74 { 75 return this; 76 } 77 78 public String getBaseGlobalId() 79 { 80 return factory.getBaseGlobalId(); 81 } 82 83 public void setBaseGlobalId(String baseGlobalId) 84 { 85 factory.setBaseGlobalId(baseGlobalId); 86 } 87 88 public long getGlobalIdNumber() 89 { 90 return factory.getGlobalIdNumber(); 91 } 92 93 public void setGlobalIdNumber(long globalIdNumber) 94 { 95 factory.setGlobalIdNumber(globalIdNumber); 96 } 97 98 public String getBranchQualifier() 99 { 100 return factory.getBranchQualifier(); 101 } 102 103 public void setBranchQualifier(String branchQualifier) 104 { 105 factory.setBranchQualifier(branchQualifier); 106 } 107 108 public boolean isPad() 109 { 110 return factory.isPad(); 111 } 112 113 public void setPad(boolean pad) 114 { 115 factory.setPad(pad); 116 } 117 118 public XidImpl newXid() 119 { 120 return factory.newXid(); 121 } 122 123 public XidImpl newBranch(GlobalId globalId) 124 { 125 return factory.newBranch(globalId); 126 } 127 128 public XidImpl newBranch(XidImpl xid,long branchIdNum) 129 { 130 return factory.newBranch(xid, branchIdNum); 131 } 132 133 public XidImpl recreateXid(long localId) 134 { 135 return factory.recreateXid(localId); 136 } 137 138 public XidImpl recreateXid(long localId, GlobalId globalId) 139 { 140 return factory.recreateXid(localId, globalId); 141 } 142 143 public byte[] localIdToGlobalId(long localId) 144 { 145 return factory.localIdToGlobalId(localId); 146 } 147 148 public long extractLocalIdFrom(byte[] globalId) 149 { 150 return factory.extractLocalIdFrom(globalId); 151 } 152 153 public String getBaseBranchQualifier(byte[] branchQualifier) 154 { 155 return factory.getBaseBranchQualifier(branchQualifier); 156 } 157 158 public String toString(Xid xid) 159 { 160 return factory.toString(xid); 161 } 162 163 } 164 | Popular Tags |