Search in sources :

Example 6 with ResourcesUtil

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

the class JdbcDataSource method validateResource.

private void validateResource(ResourceInfo resourceInfo) throws ConnectorRuntimeException {
    ResourcesUtil resourcesUtil = ResourcesUtil.createInstance();
    String jndiName = resourceInfo.getName();
    String suffix = ConnectorsUtil.getValidSuffix(jndiName);
    if (suffix != null) {
        // Typically, resource is created without suffix. Try without suffix.
        String tmpJndiName = jndiName.substring(0, jndiName.lastIndexOf(suffix));
        if (resourcesUtil.getResource(tmpJndiName, resourceInfo.getApplicationName(), resourceInfo.getModuleName(), JdbcResource.class) != null) {
            return;
        }
    }
    if (resourcesUtil.getResource(resourceInfo, JdbcResource.class) == null) {
        throw new ConnectorRuntimeException("Invalid resource : " + resourceInfo);
    }
}
Also used : ConnectorRuntimeException(com.sun.appserv.connectors.internal.api.ConnectorRuntimeException) JdbcResource(org.glassfish.jdbc.config.JdbcResource) ResourcesUtil(com.sun.enterprise.connectors.util.ResourcesUtil)

Aggregations

ResourcesUtil (com.sun.enterprise.connectors.util.ResourcesUtil)6 ConnectorRuntimeException (com.sun.appserv.connectors.internal.api.ConnectorRuntimeException)2 com.sun.enterprise.config.serverbeans (com.sun.enterprise.config.serverbeans)1 ResourcePool (com.sun.enterprise.config.serverbeans.ResourcePool)1 Resources (com.sun.enterprise.config.serverbeans.Resources)1 ConnectorDescriptor (com.sun.enterprise.deployment.ConnectorDescriptor)1 PoolLifeCycleListenerRegistry (com.sun.enterprise.resource.pool.PoolLifeCycleListenerRegistry)1 ResourceException (javax.resource.ResourceException)1 DeploymentContext (org.glassfish.api.deployment.DeploymentContext)1 UndeployCommandParameters (org.glassfish.api.deployment.UndeployCommandParameters)1 JdbcResource (org.glassfish.jdbc.config.JdbcResource)1 ResourceInfo (org.glassfish.resourcebase.resources.api.ResourceInfo)1