Search in sources :

Example 1 with DeferredResourceConfig

use of com.sun.enterprise.connectors.DeferredResourceConfig in project Payara by payara.

the class ResourcesUtil method getDeferredResourceConfig.

/*    public DeferredResourceConfig getDeferredResourceConfig(ResourceInfo resourceInfo) {
        DeferredResourceConfig resConfig = getDeferredConnectorResourceConfigs(resourceInfo);
        if(resConfig != null) {
            return resConfig;
        }

        resConfig = getDeferredJdbcResourceConfigs(resourceInfo);

        if(resConfig != null) {
            return resConfig;
        }

        resConfig = getDeferredAdminObjectConfigs(resourceInfo);

        return resConfig;
    }
*/
/*    public DeferredResourceConfig getDeferredPoolConfig(PoolInfo poolInfo) {

        DeferredResourceConfig resConfig = getDeferredConnectorPoolConfigs(poolInfo);
        if(resConfig != null) {
            return resConfig;
        }

        if(poolInfo == null){
            return null;
        }

        resConfig = getDeferredJdbcPoolConfigs(poolInfo);

        return resConfig;
    }
*/
public DeferredResourceConfig getDeferredResourceConfig(Object resource, Object pool, String resType, String raName) throws ConnectorRuntimeException {
    String resourceAdapterName;
    DeferredResourceConfig resConfig = null;
    // TODO V3 (not to hold specific resource types)
    if (resource instanceof ConnectorResource || pool instanceof ConnectorConnectionPool) {
        ConnectorConnectionPool connPool = (ConnectorConnectionPool) pool;
        ConnectorResource connResource = (ConnectorResource) resource;
        resourceAdapterName = connPool.getResourceAdapterName();
        // TODO V3 need to get AOR & RA-Config later
        resConfig = new DeferredResourceConfig(resourceAdapterName, null, connPool, connResource, null);
        Resource[] resourcesToload = new Resource[] { connPool, connResource };
        resConfig.setResourcesToLoad(resourcesToload);
    } else {
        Collection<ConnectorRuntimeExtension> extensions = Globals.getDefaultHabitat().getAllServices(ConnectorRuntimeExtension.class);
        for (ConnectorRuntimeExtension extension : extensions) {
            return extension.getDeferredResourceConfig(resource, pool, resType, raName);
        }
    }
    return resConfig;
}
Also used : DeferredResourceConfig(com.sun.enterprise.connectors.DeferredResourceConfig) ConnectorRuntimeExtension(com.sun.enterprise.connectors.ConnectorRuntimeExtension)

Example 2 with DeferredResourceConfig

use of com.sun.enterprise.connectors.DeferredResourceConfig in project Payara by payara.

the class ConnectorService method checkAndLoadPool.

public boolean checkAndLoadPool(PoolInfo poolInfo) {
    boolean status = false;
    try {
        ResourcePool pool = _runtime.getConnectionPoolConfig(poolInfo);
        // DeferredResourceConfig defResConfig = resutil.getDeferredPoolConfig(poolName);
        DeferredResourceConfig defResConfig = getResourcesUtil().getDeferredResourceConfig(null, pool, null, null);
        status = loadResourcesAndItsRar(defResConfig);
    } catch (ConnectorRuntimeException cre) {
        Object[] params = new Object[] { poolInfo, cre };
        _logger.log(Level.WARNING, "unable.to.load.connection.pool", params);
    }
    return status;
}
Also used : ConnectorRuntimeException(com.sun.appserv.connectors.internal.api.ConnectorRuntimeException) DeferredResourceConfig(com.sun.enterprise.connectors.DeferredResourceConfig) ResourcePool(com.sun.enterprise.config.serverbeans.ResourcePool)

Example 3 with DeferredResourceConfig

use of com.sun.enterprise.connectors.DeferredResourceConfig in project Payara by payara.

the class JdbcRuntimeExtension method getDeferredResourceConfig.

@Override
public DeferredResourceConfig getDeferredResourceConfig(Object resource, Object pool, String resType, String raName) throws ConnectorRuntimeException {
    String resourceAdapterName;
    DeferredResourceConfig resConfig = null;
    // TODO V3 (not to hold specific resource types)
    if (resource instanceof JdbcResource || pool instanceof JdbcConnectionPool) {
        JdbcConnectionPool jdbcPool = (JdbcConnectionPool) pool;
        JdbcResource jdbcResource = (JdbcResource) resource;
        resourceAdapterName = getRANameofJdbcConnectionPool((JdbcConnectionPool) pool);
        resConfig = new DeferredResourceConfig(resourceAdapterName, null, jdbcPool, jdbcResource, null);
        Resource[] resourcesToload = new Resource[] { jdbcPool, jdbcResource };
        resConfig.setResourcesToLoad(resourcesToload);
    } else {
        throw new ConnectorRuntimeException("unsupported resource type : " + resource);
    }
    return resConfig;
}
Also used : ConnectorRuntimeException(com.sun.appserv.connectors.internal.api.ConnectorRuntimeException) JdbcResource(org.glassfish.jdbc.config.JdbcResource) DeferredResourceConfig(com.sun.enterprise.connectors.DeferredResourceConfig) JdbcConnectionPool(org.glassfish.jdbc.config.JdbcConnectionPool) Resource(com.sun.enterprise.config.serverbeans.Resource) JdbcResource(org.glassfish.jdbc.config.JdbcResource)

Aggregations

DeferredResourceConfig (com.sun.enterprise.connectors.DeferredResourceConfig)3 ConnectorRuntimeException (com.sun.appserv.connectors.internal.api.ConnectorRuntimeException)2 Resource (com.sun.enterprise.config.serverbeans.Resource)1 ResourcePool (com.sun.enterprise.config.serverbeans.ResourcePool)1 ConnectorRuntimeExtension (com.sun.enterprise.connectors.ConnectorRuntimeExtension)1 JdbcConnectionPool (org.glassfish.jdbc.config.JdbcConnectionPool)1 JdbcResource (org.glassfish.jdbc.config.JdbcResource)1