Search in sources :

Example 76 with ResourceInfo

use of org.glassfish.resourcebase.resources.api.ResourceInfo in project Payara by payara.

the class ExternalJndiResourceDeployer method undeployResource.

/**
 * {@inheritDoc}
 */
@Override
public synchronized void undeployResource(Object resource) throws Exception {
    ExternalJndiResource jndiRes = (ExternalJndiResource) resource;
    ResourceInfo resourceInfo = ResourceUtil.getResourceInfo(jndiRes);
    deleteResource(jndiRes, resourceInfo);
}
Also used : ResourceInfo(org.glassfish.resourcebase.resources.api.ResourceInfo) ExternalJndiResource(org.glassfish.resources.config.ExternalJndiResource)

Example 77 with ResourceInfo

use of org.glassfish.resourcebase.resources.api.ResourceInfo in project Payara by payara.

the class ExternalJndiResourceDeployer method deployResource.

/**
 * {@inheritDoc}
 */
@Override
public synchronized void deployResource(Object resource, String applicationName, String moduleName) throws Exception {
    ExternalJndiResource jndiRes = (ExternalJndiResource) resource;
    ResourceInfo resourceInfo = new ResourceInfo(jndiRes.getJndiName(), applicationName, moduleName);
    createExternalJndiResource(jndiRes, resourceInfo);
}
Also used : ResourceInfo(org.glassfish.resourcebase.resources.api.ResourceInfo) ExternalJndiResource(org.glassfish.resources.config.ExternalJndiResource)

Example 78 with ResourceInfo

use of org.glassfish.resourcebase.resources.api.ResourceInfo in project Payara by payara.

the class ExternalJndiResourceDeployer method deployResource.

/**
 * {@inheritDoc}
 */
@Override
public synchronized void deployResource(Object resource) throws Exception {
    ExternalJndiResource jndiRes = (ExternalJndiResource) resource;
    ResourceInfo resourceInfo = ResourceUtil.getResourceInfo(jndiRes);
    createExternalJndiResource(jndiRes, resourceInfo);
}
Also used : ResourceInfo(org.glassfish.resourcebase.resources.api.ResourceInfo) ExternalJndiResource(org.glassfish.resources.config.ExternalJndiResource)

Example 79 with ResourceInfo

use of org.glassfish.resourcebase.resources.api.ResourceInfo in project Payara by payara.

the class JdbcConnectionPoolDeployer method handlePoolRecreationForExistingProxies.

private void handlePoolRecreationForExistingProxies(ConnectorConnectionPool connConnPool) {
    recreatePool(connConnPool);
    Collection<BindableResource> resourcesList;
    if (!connConnPool.isApplicationScopedResource()) {
        resourcesList = JdbcResourcesUtil.getResourcesOfPool(domain.getResources(), connConnPool.getName());
    } else {
        PoolInfo poolInfo = connConnPool.getPoolInfo();
        Resources resources = ResourcesUtil.createInstance().getResources(poolInfo);
        resourcesList = JdbcResourcesUtil.getResourcesOfPool(resources, connConnPool.getName());
    }
    for (BindableResource bindableResource : resourcesList) {
        ResourceInfo resourceInfo = ConnectorsUtil.getResourceInfo(bindableResource);
        ConnectorRegistry.getInstance().updateResourceInfoVersion(resourceInfo);
    }
}
Also used : ResourceInfo(org.glassfish.resourcebase.resources.api.ResourceInfo) BindableResource(com.sun.enterprise.config.serverbeans.BindableResource) PoolInfo(org.glassfish.resourcebase.resources.api.PoolInfo) Resources(com.sun.enterprise.config.serverbeans.Resources)

Example 80 with ResourceInfo

use of org.glassfish.resourcebase.resources.api.ResourceInfo in project Payara by payara.

the class JdbcRuntimeExtension method getPoolNameFromResourceJndiName.

/**
 * Gets the Pool name that this JDBC resource points to. In case of a PMF resource
 * gets the pool name of the pool pointed to by jdbc resource being pointed to by
 * the PMF resource
 *
 * @param resourceInfo the jndi name of the resource being used to get Connection from
 *                 This resource can either be a pmf resource or a jdbc resource
 * @return poolName of the pool that this resource directly/indirectly points to
 */
@Override
public PoolInfo getPoolNameFromResourceJndiName(ResourceInfo resourceInfo) {
    PoolInfo poolInfo = null;
    JdbcResource jdbcResource = null;
    String jndiName = resourceInfo.getName();
    ResourceInfo actualResourceInfo = new ResourceInfo(jndiName, resourceInfo.getApplicationName(), resourceInfo.getModuleName());
    ConnectorRuntime runtime = ConnectorRuntime.getRuntime();
    jdbcResource = (JdbcResource) ConnectorsUtil.getResourceByName(runtime.getResources(actualResourceInfo), JdbcResource.class, actualResourceInfo.getName());
    if (jdbcResource == null) {
        String suffix = ConnectorsUtil.getValidSuffix(jndiName);
        if (suffix != null) {
            jndiName = jndiName.substring(0, jndiName.lastIndexOf(suffix));
            actualResourceInfo = new ResourceInfo(jndiName, resourceInfo.getApplicationName(), resourceInfo.getModuleName());
        }
    }
    jdbcResource = (JdbcResource) ConnectorsUtil.getResourceByName(runtime.getResources(actualResourceInfo), JdbcResource.class, actualResourceInfo.getName());
    if (jdbcResource != null) {
        if (logger.isLoggable(Level.FINE)) {
            logger.fine("jdbcRes is ---: " + jdbcResource.getJndiName());
            logger.fine("poolName is ---: " + jdbcResource.getPoolName());
        }
    }
    if (jdbcResource != null) {
        poolInfo = new PoolInfo(jdbcResource.getPoolName(), actualResourceInfo.getApplicationName(), actualResourceInfo.getModuleName());
    }
    return poolInfo;
}
Also used : ResourceInfo(org.glassfish.resourcebase.resources.api.ResourceInfo) JdbcResource(org.glassfish.jdbc.config.JdbcResource) PoolInfo(org.glassfish.resourcebase.resources.api.PoolInfo) ConnectorRuntime(com.sun.enterprise.connectors.ConnectorRuntime)

Aggregations

ResourceInfo (org.glassfish.resourcebase.resources.api.ResourceInfo)81 PoolInfo (org.glassfish.resourcebase.resources.api.PoolInfo)15 NamingException (javax.naming.NamingException)14 JdbcResource (org.glassfish.jdbc.config.JdbcResource)9 Test (org.junit.Test)9 ContextServiceImpl (org.glassfish.enterprise.concurrent.ContextServiceImpl)8 ConnectorRuntimeException (com.sun.appserv.connectors.internal.api.ConnectorRuntimeException)7 ConnectorResource (org.glassfish.connectors.config.ConnectorResource)6 RefAddr (javax.naming.RefAddr)5 SerializableObjectRefAddr (org.glassfish.resources.naming.SerializableObjectRefAddr)5 Resources (com.sun.enterprise.config.serverbeans.Resources)4 ResourceException (javax.resource.ResourceException)4 ContextService (org.glassfish.concurrent.config.ContextService)4 ManagedThreadFactory (org.glassfish.concurrent.config.ManagedThreadFactory)4 AdminObjectResource (org.glassfish.connectors.config.AdminObjectResource)4 CustomResource (org.glassfish.resources.config.CustomResource)4 MailResource (org.glassfish.resources.javamail.config.MailResource)4 ManagedConnectionFactory (javax.resource.spi.ManagedConnectionFactory)3 ManagedExecutorService (org.glassfish.concurrent.config.ManagedExecutorService)3 ManagedScheduledExecutorService (org.glassfish.concurrent.config.ManagedScheduledExecutorService)3