}
}
//we configure our connection manager
GerConnectionmanagerType connectionManager = connectionfactoryInstance.getConnectionmanager();
GBeanMBean connectionManagerGBean;
try {
connectionManagerGBean = new GBeanMBean(GBeanInfo.getGBeanInfo("org.apache.geronimo.connector.outbound.GenericConnectionManager", cl), cl);
} catch (InvalidConfigurationException e) {
throw new DeploymentException("Unable to create GMBean", e);
}
TransactionSupport transactionSupport = null;
if (connectionManager.isSetNoTransaction()) {
transactionSupport = NoTransactions.INSTANCE;
} else if (connectionManager.isSetLocalTransaction()) {
transactionSupport = LocalTransactions.INSTANCE;
} else if (connectionManager.isSetTransactionLog()) {
transactionSupport = TransactionLog.INSTANCE;
} else if (connectionManager.isSetXaTransaction()) {
transactionSupport = new XATransactions(connectionManager.getXaTransaction().isSetTransactionCaching(),
connectionManager.getXaTransaction().isSetThreadCaching());
} else if ("NoTransaction".equals(ddTransactionSupport)) {
transactionSupport = NoTransactions.INSTANCE;
} else if ("LocalTransaction".equals(ddTransactionSupport)) {
transactionSupport = LocalTransactions.INSTANCE;
} else if ("XATransaction".equals(ddTransactionSupport)) {
transactionSupport = new XATransactions(defaultXATransactionCaching, defaultXAThreadCaching);
} else {
//this should not happen
throw new DeploymentException("Unexpected transaction support element");
}
PoolingSupport pooling = null;
if (connectionManager.getSinglePool() != null) {
GerSinglepoolType pool = connectionManager.getSinglePool();
pooling = new SinglePool(pool.isSetMaxSize() ? pool.getMaxSize() : defaultMaxSize,
pool.isSetMinSize() ? pool.getMinSize() : defaultMinSize,
pool.isSetBlockingTimeoutMilliseconds() ? pool.getBlockingTimeoutMilliseconds() : defaultBlockingTimeoutMilliseconds,
pool.isSetIdleTimeoutMinutes() ? pool.getIdleTimeoutMinutes() : defaultIdleTimeoutMinutes,
pool.getMatchOne() != null,
pool.getMatchAll() != null,
pool.getSelectOneAssumeMatch() != null);
} else if (connectionManager.getPartitionedPool() != null) {
GerPartitionedpoolType pool = connectionManager.getPartitionedPool();
pooling = new PartitionedPool(pool.isSetMaxSize() ? pool.getMaxSize() : defaultMaxSize,
pool.isSetMinSize() ? pool.getMinSize() : defaultMinSize,
pool.isSetBlockingTimeoutMilliseconds() ? pool.getBlockingTimeoutMilliseconds() : defaultBlockingTimeoutMilliseconds,
pool.isSetIdleTimeoutMinutes() ? pool.getIdleTimeoutMinutes() : defaultIdleTimeoutMinutes,
pool.getMatchOne() != null,
pool.getMatchAll() != null,
pool.getSelectOneAssumeMatch() != null,
pool.isSetPartitionByConnectionrequestinfo(),
pool.isSetPartitionBySubject());
} else if (connectionManager.getNoPool() != null) {
pooling = new NoPool();
} else {
throw new DeploymentException("Unexpected pooling support element");
}
try {
connectionManagerGBean.setAttribute("name", connectionfactoryInstance.getName());
connectionManagerGBean.setAttribute("transactionSupport", transactionSupport);
connectionManagerGBean.setAttribute("pooling", pooling);
connectionManagerGBean.setReferencePattern("ConnectionTracker", earContext.getConnectionTrackerObjectName());
if (connectionManager.getRealmBridge() != null) {
connectionManagerGBean.setReferencePattern("RealmBridge", ObjectName.getInstance(BASE_REALM_BRIDGE_NAME + connectionManager.getRealmBridge()));
}
connectionManagerGBean.setReferencePattern("TransactionContextManager", earContext.getTransactionContextManagerObjectName());
} catch (Exception e) {
throw new DeploymentException("Problem setting up ConnectionManager", e);
}
// add it