JdbcConnectionPool adminPool,
ConnectorConnectionPool conConnPool, ConnectorDescriptor connDesc) {
ArrayList propList = new ArrayList();
propList.add(new EnvironmentProperty("ClassName",
adminPool.getDatasourceClassname() == null ? "" :
adminPool.getDatasourceClassname(),
"The datasource class name",
"java.lang.String"));
propList.add(new EnvironmentProperty("ConnectionValidationRequired",
adminPool.isIsConnectionValidationRequired() + "",
"Is connection validation required",
"java.lang.String"));
propList.add(new EnvironmentProperty("ValidationMethod",
adminPool.getConnectionValidationMethod() == null ? "" :
adminPool.getConnectionValidationMethod(),
"How the connection is validated",
"java.lang.String"));
propList.add(new EnvironmentProperty("ValidationTableName",
adminPool.getValidationTableName() == null ?
"" : adminPool.getValidationTableName(),
"Validation Table name",
"java.lang.String"));
propList.add(new EnvironmentProperty("TransactionIsolation",
adminPool.getTransactionIsolationLevel() == null ? "" :
adminPool.getTransactionIsolationLevel(),
"Transaction Isolatin Level",
"java.lang.String"));
propList.add(new EnvironmentProperty("GuaranteeIsolationLevel",
adminPool.isIsIsolationLevelGuaranteed() + "",
"Transaction Isolation Guarantee",
"java.lang.String"));
propList.add(new EnvironmentProperty("StatementWrapping",
adminPool.isWrapJdbcObjects() + "",
"Statement Wrapping",
"java.lang.String"));
propList.add(new EnvironmentProperty("StatementTimeout",
adminPool.getStatementTimeoutInSeconds() + "",
"Statement Timeout",
"java.lang.String"));
//dump user defined poperties into the list
Set connDefDescSet = connDesc.getOutboundResourceAdapter().
getConnectionDefs();
//since this a 1.0 RAR, we will have only 1 connDefDesc
if (connDefDescSet.size() != 1) {
throw new MissingResourceException("Only one connDefDesc present",
null, null);
}
Iterator iter = connDefDescSet.iterator();
//Now get the set of MCF config properties associated with each
//connection-definition . Each element here is an EnviromnentProperty
Set mcfConfigProps = null;
while (iter.hasNext()) {
mcfConfigProps = ((ConnectionDefDescriptor) iter.next()).
getConfigProperties();
}
if (mcfConfigProps != null) {
Map mcfConPropKeys = new HashMap();
Iterator mcfConfigPropsIter = mcfConfigProps.iterator();
while (mcfConfigPropsIter.hasNext()) {
String key = ((EnvironmentProperty) mcfConfigPropsIter.next()).
getName();
mcfConPropKeys.put(key.toUpperCase(), key);
}
String driverProperties = "";
for (ElementProperty rp : adminPool.getElementProperty()) {
if (rp == null) {
continue;
}
String name = rp.getName();
//The idea here is to convert the Environment Properties coming from
//the admin connection pool to standard pool properties thereby
//making it easy to compare in the event of a reconfig
if ("MATCHCONNECTIONS".equals(name.toUpperCase())) {
//JDBC - matchConnections if not set is decided by the ConnectionManager
//so default is false
conConnPool.setMatchConnections(ConnectionPoolObjectsUtils.toBoolean(rp.getValue(), false));
logFine("MATCHCONNECTIONS");
} else if ("CONNECTION-CREATION-THREAD-WAITTIMEOUT-IN-SECONDS".equals(name.toUpperCase())) {
conConnPool.setConnectionCreationThreadWaitTimeout(ConnectionPoolObjectsUtils.toLong(rp.getValue()));
logFine("CONNECTION-CREATION-THREAD-WAITTIMEOUT-IN-SECONDS");
} else if ("LAZYCONNECTIONASSOCIATION".equals(name.toUpperCase())) {
ConnectionPoolObjectsUtils.setLazyEnlistAndLazyAssocProperties(rp.getValue(), adminPool, conConnPool);
logFine("LAZYCONNECTIONASSOCIATION");
} else if ("LAZYCONNECTIONENLISTMENT".equals(name.toUpperCase())) {
conConnPool.setLazyConnectionEnlist(ConnectionPoolObjectsUtils.toBoolean(rp.getValue(), false));
logFine("LAZYCONNECTIONENLISTMENT");
} else if ("ASSOCIATEWITHTHREAD".equals(name.toUpperCase())) {
conConnPool.setAssociateWithThread(ConnectionPoolObjectsUtils.toBoolean(rp.getValue(), false));
logFine("ASSOCIATEWITHTHREAD");
} else if ("USERNAME".equals(name.toUpperCase()) ||
"USER".equals(name.toUpperCase())) {
propList.add(new EnvironmentProperty("User",
rp.getValue(), "user name", "java.lang.String"));
} else if ("PASSWORD".equals(name.toUpperCase())) {
propList.add(new EnvironmentProperty("Password",
rp.getValue(), "Password", "java.lang.String"));
} else if ("JDBC30DATASOURCE".equals(name.toUpperCase())) {
propList.add(new EnvironmentProperty("JDBC30DataSource",
rp.getValue(), "JDBC30DataSource", "java.lang.String"));
} else if ("PREFER-VALIDATE-OVER-RECREATE".equals(name.toUpperCase())) {
conConnPool.setPreferValidateOverRecreate(ConnectionPoolObjectsUtils.toBoolean(rp.getValue(), false));
logFine("PREFER-VALIDATE-OVER-RECREATE");
}
else if (mcfConPropKeys.containsKey(name.toUpperCase())) {
propList.add(new EnvironmentProperty(
(String) mcfConPropKeys.get(name.toUpperCase()),
rp.getValue() == null ? "" : rp.getValue(),
"Some property",
"java.lang.String"));
} else {
driverProperties = driverProperties + "set" + escape(name)
+ "#" + escape(rp.getValue()) + "##";
}
}
if (!driverProperties.equals("")) {
propList.add(new EnvironmentProperty("DriverProperties",
driverProperties,
"some proprietarty properties",
"java.lang.String"));
}
}
propList.add(new EnvironmentProperty("Delimiter",
"#", "delim", "java.lang.String"));
propList.add(new EnvironmentProperty("EscapeCharacter",
"\\", "escapeCharacter", "java.lang.String"));
//create an array of EnvironmentProperties from above list
EnvironmentProperty[] eProps = new EnvironmentProperty[propList.size()];
ListIterator propListIter = propList.listIterator();