public class Configurator {
private Configurator() {
ConfigSingleton config = ConfigSingleton.getInstance();
_parameterConnectionPoolDescriptors = new HashMap();
_parameterRegisteredConnectionPoolNames = new ArrayList();
SourceBean dataAccess = (SourceBean)config.getAttribute(DATA_ACCESS);
List connectionPools = dataAccess.getAttributeAsList("CONNECTION-POOL");
ConnectionPoolDescriptor connectionPoolDescriptor = null;
SourceBean connectionPool = null;
List poolParameters = null;
String poolName = null;
if (connectionPools != null) {
for (int i = 0; i < connectionPools.size(); i++) {
connectionPoolDescriptor = new ConnectionPoolDescriptor();
connectionPool = (SourceBean)connectionPools.get(i);
poolName = (String)connectionPool.getAttribute("connectionPoolName");
connectionPoolDescriptor.setConnectionPoolName(poolName);
connectionPoolDescriptor.setConnectionPoolFactory((String)connectionPool.getAttribute("connectionPoolFactoryClass"));
poolParameters = connectionPool.getAttributeAsList("CONNECTION-POOL-PARAMETER");
String parameterName = null;
String parameterValue = null;
if (poolParameters != null) {
for (int j = 0; j < poolParameters.size(); j++) {
parameterName = (String)(((SourceBean)poolParameters.get(j)).getAttribute("parameterName"));
parameterValue = (String)(((SourceBean)poolParameters.get(j)).getAttribute("parameterValue"));
ConnectionPoolParameter parameter = new ConnectionPoolParameter(parameterName, parameterValue);
connectionPoolDescriptor.addConnectionPoolParameter(parameter);
}
}
_parameterConnectionPoolDescriptors.put(poolName, connectionPoolDescriptor);
}
}
else
TracerSingleton.log(
Constants.NOME_MODULO,
TracerSingleton.INFORMATION,
"Configurator::Configurator: nessuna definizione di CONNECTION-POOL");
List registerPools= dataAccess.getAttributeAsList("CONNECTION-MANAGER.REGISTER-POOL");
SourceBean poolRegister = null;
if (registerPools != null) {
for (int i = 0; i < registerPools.size(); i++) {
poolRegister = (SourceBean)registerPools.get(i);
_parameterRegisteredConnectionPoolNames.add((String)poolRegister.getAttribute("registeredPoolName"));
}
}
else
TracerSingleton.log(
Constants.NOME_MODULO,