}
loadAllConnectorResources();
Iterator iter = connPools.iterator();
_logger.log(Level.FINE,"Recovering pools : " + connPools.size());
ConnectorRuntime crt = ConnectorRuntime.getRuntime();
//for(int i = 0; i<connectorConnectionPools.length;++i) {
while( iter.hasNext() ) {
com.sun.enterprise.config.serverbeans.ConnectorConnectionPool
connPool = (com.sun.enterprise.config.serverbeans.ConnectorConnectionPool)
iter.next();
String poolName = connPool.getName();
try {
String[] dbUserPassword =
resourceUtil.getdbUserPasswordOfConnectorConnectionPool(
connPool);
if ( dbUserPassword == null ) {
continue;
}
String dbUser = dbUserPassword[0];
String dbPassword = dbUserPassword[1];
Subject subject = new Subject();
//If username or password of the connector connection pool
//is null a warning is logged and recovery continues with
//empty String username or password as the case may be,
//because some databases allow null[as in empty string]
//username [pointbase interprets this as "root"]/password.
if(dbPassword==null) {
dbPassword = "";
_logger.log(Level.WARNING,
"datasource.xadatasource_nullpassword_error",poolName);
}
if(dbUser == null){
dbUser = "";
_logger.log(Level.WARNING,
"datasource.xadatasource_nulluser_error",poolName);
}
String rarName = connPool.getResourceAdapterName();
if (ConnectorAdminServiceUtils.isJMSRA(rarName)) {
_logger.log(Level.FINE,"Performing recovery for JMS RA, poolName " + poolName);
ManagedConnectionFactory[] mcfs =
crt.obtainManagedConnectionFactories(poolName);
_logger.log (Level.INFO, "JMS resource recovery has created CFs = " + mcfs.length);
for (int i = 0; i<mcfs.length;i++) {
PasswordCredential pc = new PasswordCredential(
dbUser, dbPassword.toCharArray());
pc.setManagedConnectionFactory(mcfs[i]);
Principal prin =
new ResourcePrincipal(dbUser, dbPassword);
subject.getPrincipals().add(prin);
subject.getPrivateCredentials().add(pc);
ManagedConnection mc = mcfs[i].
createManagedConnection(subject, null);
connList.addElement(mc);
try {
XAResource xares = mc.getXAResource();
if (xares != null) {
xaresList.addElement(xares);
}
} catch (ResourceException ex) {
// ignored. Not at XA_TRANSACTION level
}
}
} else {
ManagedConnectionFactory mcf =
crt.obtainManagedConnectionFactory(poolName);
PasswordCredential pc = new PasswordCredential(
dbUser, dbPassword.toCharArray());
pc.setManagedConnectionFactory(mcf);
Principal prin = new ResourcePrincipal(dbUser, dbPassword);
subject.getPrincipals().add(prin);