Search in sources :

Example 1 with DataSourceDefinitionDescriptor

use of com.sun.enterprise.deployment.DataSourceDefinitionDescriptor in project Payara by payara.

the class DataSourceDefinitionDeployer method deployResource.

@Override
public void deployResource(Object resource) throws Exception {
    final DataSourceDefinitionDescriptor desc = (DataSourceDefinitionDescriptor) resource;
    String poolName = ConnectorsUtil.deriveResourceName(desc.getResourceId(), desc.getName(), DSDPOOL);
    String resourceName = ConnectorsUtil.deriveResourceName(desc.getResourceId(), desc.getName(), desc.getResourceType());
    if (_logger.isLoggable(Level.FINE)) {
        _logger.log(Level.FINE, "DataSourceDefinitionDeployer.deployResource() : pool-name [" + poolName + "], " + " resource-name [" + resourceName + "]");
    }
    JdbcConnectionPool jdbcCp = new MyJdbcConnectionPool(desc, poolName);
    // deploy pool
    getDeployer(jdbcCp).deployResource(jdbcCp);
    // deploy resource
    JdbcResource jdbcResource = new MyJdbcResource(poolName, resourceName);
    getDeployer(jdbcResource).deployResource(jdbcResource);
}
Also used : JdbcResource(org.glassfish.jdbc.config.JdbcResource) JdbcConnectionPool(org.glassfish.jdbc.config.JdbcConnectionPool) DataSourceDefinitionDescriptor(com.sun.enterprise.deployment.DataSourceDefinitionDescriptor)

Example 2 with DataSourceDefinitionDescriptor

use of com.sun.enterprise.deployment.DataSourceDefinitionDescriptor in project Payara by payara.

the class DataSourceDefinitionDeployer method undeployResource.

@Override
public void undeployResource(Object resource) throws Exception {
    final DataSourceDefinitionDescriptor desc = (DataSourceDefinitionDescriptor) resource;
    String poolName = ConnectorsUtil.deriveResourceName(desc.getResourceId(), desc.getName(), DSDPOOL);
    String resourceName = ConnectorsUtil.deriveResourceName(desc.getResourceId(), desc.getName(), desc.getResourceType());
    if (_logger.isLoggable(FINE)) {
        _logger.log(FINE, "DataSourceDefinitionDeployer.undeployResource() : pool-name [" + poolName + "], " + " resource-name [" + resourceName + "]");
    }
    // Undeploy resource
    JdbcResource jdbcResource = new MyJdbcResource(poolName, resourceName);
    getDeployer(jdbcResource).undeployResource(jdbcResource);
    // Undeploy pool
    JdbcConnectionPool jdbcCp = new MyJdbcConnectionPool(desc, poolName);
    getDeployer(jdbcCp).undeployResource(jdbcCp);
    desc.setDeployed(false);
}
Also used : JdbcResource(org.glassfish.jdbc.config.JdbcResource) JdbcConnectionPool(org.glassfish.jdbc.config.JdbcConnectionPool) DataSourceDefinitionDescriptor(com.sun.enterprise.deployment.DataSourceDefinitionDescriptor)

Aggregations

DataSourceDefinitionDescriptor (com.sun.enterprise.deployment.DataSourceDefinitionDescriptor)2 JdbcConnectionPool (org.glassfish.jdbc.config.JdbcConnectionPool)2 JdbcResource (org.glassfish.jdbc.config.JdbcResource)2