PoolInfo poolInfo = ConnectorsUtil.getPoolInfo(connectorConnectionPool);
String rarName = connectorConnectionPool.getResourceAdapterName();
String connectionDefName =
connectorConnectionPool.getConnectionDefinitionName();
ConnectorRegistry connectorRegistry =
ConnectorRegistry.getInstance();
ConnectorDescriptor connectorDescriptor =
connectorRegistry.getDescriptor(rarName);
ConnectionDefDescriptor cdd =
connectorDescriptor.getConnectionDefinitionByCFType(
connectionDefName);
Set configProps = cdd.getConfigProperties();
for (Iterator iter = configProps.iterator(); iter.hasNext();) {
ConnectorConfigProperty envProp = (ConnectorConfigProperty ) iter.next();
String prop = envProp.getName().toUpperCase();
if ("USER".equals(prop) || "USERNAME".equals(prop)) {
userPassword[0] = envProp.getValue();
} else if ("PASSWORD".equals(prop)) {
userPassword[1] = envProp.getValue();
}
}
if (userPassword[0] != null && !"".equals(userPassword[0].trim())) {
return userPassword;
}
//else read the default username and password from the ra.xml
ManagedConnectionFactory mcf =
connectorRegistry.getManagedConnectionFactory(poolInfo);
userPassword[0] = ConnectionPoolObjectsUtils.getValueFromMCF(
"UserName", poolInfo, mcf);
userPassword[1] = ConnectionPoolObjectsUtils.getValueFromMCF(
"Password", poolInfo, mcf);