List of usage examples for javax.resource.spi ManagedConnectionFactory createConnectionFactory
public Object createConnectionFactory(ConnectionManager cxManager) throws ResourceException;
From source file:org.apache.ode.il.dbutil.InternalDB.java
protected void initInternalDb(String url, String driverClass, String username, String password) throws DatabaseConfigException { __log.debug("Creating connection pool for " + url + " with driver " + driverClass); if (!(_txm instanceof RecoverableTransactionManager)) { throw new RuntimeException("TransactionManager is not recoverable."); }/*from w w w .j av a 2 s . com*/ TransactionSupport transactionSupport = LocalTransactions.INSTANCE; ConnectionTracker connectionTracker = new ConnectionTrackingCoordinator(); PoolingSupport poolingSupport = new SinglePool(_odeConfig.getPoolMaxSize(), _odeConfig.getPoolMinSize(), CONNECTION_MAX_WAIT_MILLIS, CONNECTION_MAX_IDLE_MINUTES, true, // match one false, // match all false); // select one assume match _connectionManager = new GenericConnectionManager(transactionSupport, poolingSupport, null, connectionTracker, (RecoverableTransactionManager) _txm, getClass().getName(), getClass().getClassLoader()); try { javax.resource.spi.ManagedConnectionFactory mcf = null; String mcfClass = _odeConfig.getDbInternalMCFClass(); if (mcfClass != null) { Properties dbInternalMCFProps = _odeConfig.getDbInternalMCFProperties(); if (__log.isDebugEnabled()) { __log.debug("Using internal DB MCF " + mcfClass + " " + dbInternalMCFProps); } mcf = (javax.resource.spi.ManagedConnectionFactory) Class.forName(mcfClass).newInstance(); BeanUtils.copyProperties(mcf, dbInternalMCFProps); } else { if (__log.isDebugEnabled()) { __log.debug("Using internal DB JDBCDriverMCF"); } JDBCDriverMCF mcf2 = new JDBCDriverMCF(); mcf = mcf2; mcf2.setDriver(driverClass); mcf2.setConnectionURL(url); if (username != null) { mcf2.setUserName(username); } if (password != null) { mcf2.setPassword(password); } } _connectionManager.doStart(); _datasource = (DataSource) mcf.createConnectionFactory(_connectionManager); } catch (Exception ex) { String errmsg = __msgs.msgOdeDbPoolStartupFailed(url); __log.error(errmsg, ex); throw new DatabaseConfigException(errmsg, ex); } }
From source file:org.eclipse.ecr.core.storage.sql.ra.PoolingRepositoryFactory.java
@Override public Repository createRepository(RepositoryDescriptor descriptor) throws Exception { log.info("Creating pooling repository: " + descriptor.getName()); ManagedConnectionFactory managedConnectionFactory = new ManagedConnectionFactoryImpl( SQLRepository.getDescriptor(descriptor)); return (Repository) managedConnectionFactory.createConnectionFactory(lookupConnectionManager()); }
From source file:org.nuxeo.ecm.core.storage.sql.PoolingRepositoryFactory.java
public Repository createRepository(RepositoryDescriptor descriptor) throws Exception { log.info("Creating pooling repository: " + descriptor.getName()); ManagedConnectionFactory managedConnectionFactory = new ManagedConnectionFactoryImpl( SQLRepository.getDescriptor(descriptor)); return (Repository) managedConnectionFactory.createConnectionFactory(lookupConnectionManager()); }
From source file:org.nuxeo.ecm.core.storage.sql.ra.PoolingRepositoryFactory.java
@Override public Repository createRepository(RepositoryDescriptor descriptor) throws Exception { String repositoryName = descriptor.getName(); log.info("Creating pooling repository: " + repositoryName); ManagedConnectionFactory managedConnectionFactory = new ManagedConnectionFactoryImpl( SQLRepository.getDescriptor(descriptor)); ConnectionManager connectionManager = lookupConnectionManager(descriptor); return (Repository) managedConnectionFactory.createConnectionFactory(connectionManager); }