use of org.glassfish.jdbc.config.JdbcConnectionPool in project Payara by payara.
the class JdbcConnectionPoolDeployer method deployResource.
/**
* {@inheritDoc}
*/
@Override
public void deployResource(Object resource) throws Exception {
JdbcConnectionPool jcp = (JdbcConnectionPool) resource;
PoolInfo poolInfo = ConnectorsUtil.getPoolInfo(jcp);
actualDeployResource(resource, poolInfo);
}
use of org.glassfish.jdbc.config.JdbcConnectionPool in project Payara by payara.
the class JDBCConnectionPoolManager method createConfigBean.
private JdbcConnectionPool createConfigBean(Resources param, Properties properties) throws PropertyVetoException, TransactionFailure {
JdbcConnectionPool newResource = param.createChild(JdbcConnectionPool.class);
newResource.setWrapJdbcObjects(wrapJDBCObjects);
if (validationtable != null)
newResource.setValidationTableName(validationtable);
newResource.setValidateAtmostOncePeriodInSeconds(validateAtmostOncePeriod);
if (isolationlevel != null) {
newResource.setTransactionIsolationLevel(isolationlevel);
}
newResource.setSteadyPoolSize(steadypoolsize);
if (statementTimeout != null) {
newResource.setStatementTimeoutInSeconds(statementTimeout);
}
if (restype != null) {
newResource.setResType(restype);
}
newResource.setPoolResizeQuantity(poolresize);
newResource.setNonTransactionalConnections(nontransactionalconnections);
newResource.setMaxWaitTimeInMillis(maxwait);
newResource.setMaxPoolSize(maxpoolsize);
if (maxConnectionUsageCount != null) {
newResource.setMaxConnectionUsageCount(maxConnectionUsageCount);
}
if (matchConnections != null) {
newResource.setMatchConnections(matchConnections);
}
if (lazyConnectionEnlistment != null) {
newResource.setLazyConnectionEnlistment(lazyConnectionEnlistment);
}
if (lazyConnectionAssociation != null) {
newResource.setLazyConnectionAssociation(lazyConnectionAssociation);
}
newResource.setIsIsolationLevelGuaranteed(isisolationguaranteed);
newResource.setIsConnectionValidationRequired(isconnectvalidatereq);
newResource.setIdleTimeoutInSeconds(idletimeout);
newResource.setFailAllConnections(failconnection);
if (datasourceclassname != null) {
newResource.setDatasourceClassname(datasourceclassname);
}
newResource.setConnectionValidationMethod(validationmethod);
if (connectionLeakTimeout != null) {
newResource.setConnectionLeakTimeoutInSeconds(connectionLeakTimeout);
}
if (connectionLeakReclaim != null) {
newResource.setConnectionLeakReclaim(connectionLeakReclaim);
}
if (connectionCreationRetryInterval != null) {
newResource.setConnectionCreationRetryIntervalInSeconds(connectionCreationRetryInterval);
}
if (connectionCreationRetryAttempts != null) {
newResource.setConnectionCreationRetryAttempts(connectionCreationRetryAttempts);
}
if (associateWithThread != null) {
newResource.setAssociateWithThread(associateWithThread);
}
if (allownoncomponentcallers != null) {
newResource.setAllowNonComponentCallers(allownoncomponentcallers);
}
if (statementcachesize != null) {
newResource.setStatementCacheSize(statementcachesize);
}
if (validationclassname != null) {
newResource.setValidationClassname(validationclassname);
}
if (initsql != null) {
newResource.setInitSql(initsql);
}
if (sqltracelisteners != null) {
newResource.setSqlTraceListeners(sqltracelisteners);
}
if (pooling != null) {
newResource.setPooling(pooling);
}
if (ping != null) {
newResource.setPing(ping);
}
if (logJDBCCalls != null) {
newResource.setLogJdbcCalls(logJDBCCalls);
}
if (driverclassname != null) {
newResource.setDriverClassname(driverclassname);
}
if (description != null) {
newResource.setDescription(description);
}
newResource.setName(jdbcconnectionpoolid);
if (properties != null) {
for (Map.Entry e : properties.entrySet()) {
Property prop = newResource.createChild(Property.class);
prop.setName((String) e.getKey());
prop.setValue((String) e.getValue());
newResource.getProperty().add(prop);
}
}
return newResource;
}
use of org.glassfish.jdbc.config.JdbcConnectionPool in project Payara by payara.
the class ListJdbcConnectionPools method execute.
/**
* Executes the command with the command parameters passed as Properties
* where the keys are the paramter names and the values the parameter values
*
* @param context information
*/
public void execute(AdminCommandContext context) {
final ActionReport report = context.getActionReport();
try {
Collection<JdbcConnectionPool> connPools = domain.getResources().getResources(JdbcConnectionPool.class);
for (JdbcConnectionPool pool : connPools) {
final ActionReport.MessagePart part = report.getTopMessagePart().addChild();
part.setMessage(pool.getName());
}
} catch (Exception e) {
report.setMessage(localStrings.getLocalString("list.jdbc.connection.pools.failed", "List JDBC connection pools failed"));
report.setActionExitCode(ActionReport.ExitCode.FAILURE);
report.setFailureCause(e);
return;
}
report.setActionExitCode(ActionReport.ExitCode.SUCCESS);
}
use of org.glassfish.jdbc.config.JdbcConnectionPool in project Payara by payara.
the class ManagedConnectionImpl method getJdbcConnectionPool.
private static JdbcConnectionPool getJdbcConnectionPool(javax.resource.spi.ManagedConnectionFactory mcf) {
if (Globals.getDefaultHabitat().getService(ProcessEnvironment.class).getProcessType() != ProcessEnvironment.ProcessType.Server) {
// otherwise we bave no domain to draw upon
return null;
}
ManagedConnectionFactoryImpl spiMCF = (ManagedConnectionFactoryImpl) mcf;
Resources resources = Globals.getDefaultHabitat().getService(Domain.class).getResources();
ResourcePool pool = (ResourcePool) ConnectorsUtil.getResourceByName(resources, ResourcePool.class, spiMCF.getPoolName());
if (pool instanceof JdbcConnectionPool) {
return (JdbcConnectionPool) pool;
}
return null;
}
use of org.glassfish.jdbc.config.JdbcConnectionPool in project Payara by payara.
the class JdbcConnectionPoolValidatorTest method uninitialized.
@Test
public void uninitialized() {
final JdbcConnectionPool pool = createMock();
assertTrue("everything OK", this.validator.isValid(pool, null));
}
Aggregations