identityClass = this.identityClass;
} else {
if (! (cxRequest instanceof ConnectionRequest)) {
if (out != null)
out.print("Provided ConnectionRequestInfo instance is not a JORAM object.");
throw new ResourceException("Provided ConnectionRequestInfo instance "
+ "is not a JORAM object.");
}
userName = ((ConnectionRequest) cxRequest).getUserName();
password = ((ConnectionRequest) cxRequest).getPassword();
identityClass = ((ConnectionRequest) cxRequest).getIdentityClass();
}
XAConnectionFactory factory;
XAConnection cnx = null;
if (collocated) {
hostName = "localhost";
serverPort = -1;
}
if (isHa) {
if (collocated) {
if (ra.haURL != null) {
factory = XAHATcpConnectionFactory.create(ra.haURL);
} else {
factory = XAHALocalConnectionFactory.create();
}
} else {
String urlHa = "hajoram://" + hostName + ":" + serverPort;
factory = XAHATcpConnectionFactory.create(urlHa);
}
} else {
if (collocated) {
factory = XALocalConnectionFactory.create();
} else {
factory = XATcpConnectionFactory.create(hostName, serverPort);
}
}
setParameters(factory);
((AbstractConnectionFactory) factory).setIdentityClassName(identityClass);
try {
cnx = factory.createXAConnection(userName, password);
if (AdapterTracing.dbgAdapter.isLoggable(BasicLevel.DEBUG))
AdapterTracing.dbgAdapter.log(BasicLevel.DEBUG,
this + " createManagedConnection cnx = " + cnx);
} catch (IllegalStateException exc) {
if (out != null)
out.print("Could not access the JORAM server: " + exc);
throw new CommException("Could not access the JORAM server: " + exc);
} catch (JMSSecurityException exc) {
if (out != null)
out.print("Invalid user identification: " + exc);
throw new SecurityException("Invalid user identification: " + exc);
} catch (JMSException exc) {
if (out != null)
out.print("Failed connecting process: " + exc);
throw new ResourceException("Failed connecting process: " + exc);
}
ManagedConnectionImpl managedCx = new ManagedConnectionImpl(ra,
cnx,
hostName,