[vicky@posh atsintegration]$ svn diff Index: classes/com/arjuna/ats/internal/jbossatx/jta/AppServerJDBCXARecovery.java =================================================================== --- classes/com/arjuna/ats/internal/jbossatx/jta/AppServerJDBCXARecovery.java (revision 25705) +++ classes/com/arjuna/ats/internal/jbossatx/jta/AppServerJDBCXARecovery.java (working copy) @@ -32,10 +32,13 @@ import javax.management.ObjectName; import javax.management.MBeanException; import javax.management.InstanceNotFoundException; +import org.jboss.security.SecurityAssociation; +import org.jboss.security.SimplePrincipal; import java.sql.SQLException; import java.sql.Connection; import java.util.Properties; import java.util.Iterator; +import java.util.StringTokenizer; import java.io.InputStream; import java.io.ByteArrayInputStream; import java.lang.reflect.Method; @@ -66,7 +69,7 @@ * * * ... - * + * * * * @@ -102,7 +105,9 @@ if (parameter == null) return false; - + + retrieveData(parameter,_delimiter); + // don't create the datasource yet, we'll do it lazily. Just keep its id. _dataSourceId = parameter; @@ -162,6 +167,11 @@ // jmx classes (and the db drivers naturally) on the recovery manager classpath. InitialContext context = new InitialContext(); + if(_userName!=null && _passWord!=null) + { + SecurityAssociation.setPrincipal(new SimplePrincipal(_userName)); + SecurityAssociation.setCredential(_passWord); + } MBeanServerConnection server = (MBeanServerConnection)context.lookup("jmx/invoker/RMIAdaptor"); ObjectName objectName = new ObjectName("jboss.jca:name="+_dataSourceId+",service=ManagedConnectionFactory"); String className = (String)server.invoke(objectName, "getManagedConnectionFactoryAttribute", new Object[] {"XADataSourceClass"}, new String[] {"java.lang.String"}); @@ -343,7 +353,30 @@ } return xads; } - + + public void retrieveData(String parameter,String delimiter){ + StringTokenizer st = new StringTokenizer(parameter,delimiter); + while (st.hasMoreTokens()) + { + String data = (String)st.nextToken(); + if(data.length()>9) + { + if(_USERNAME.equals(data.substring(0,8))) + { + _userName=data.substring(9); + } + if(_PASSWORD.equals(data.substring(0,8))) + { + _passWord=data.substring(9); + } + if(_JNDINAME.equals(data.substring(0,8))) + { + _dataSourceId=data.substring(9); + } + } + } + } + private boolean _supportsIsValidMethod; private XAConnection _connection; private XADataSource _dataSource; @@ -351,5 +384,13 @@ private boolean _hasMoreResources; private String _dataSourceId; + private String _userName; + private String _passWord; + + private String _JNDINAME = "jndiName"; + private String _USERNAME = "username"; + private String _PASSWORD = "password"; + private String _delimiter = ","; + private Logger log = org.jboss.logging.Logger.getLogger(AppServerJDBCXARecovery.class); }