Search in sources :

Example 6 with ConnectorRegistry

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

the class ConnectorDeployer method unregisterBeanValidator.

private void unregisterBeanValidator(String rarName) {
    ConnectorRegistry registry = ConnectorRegistry.getInstance();
    registry.removeBeanValidator(rarName);
}
Also used : ConnectorRegistry(com.sun.enterprise.connectors.ConnectorRegistry)

Example 7 with ConnectorRegistry

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

the class ConnectorsRecoveryResourceHandler method getdbUserPasswordOfConnectorConnectionPool.

private String[] getdbUserPasswordOfConnectorConnectionPool(ConnectorConnectionPool connectorConnectionPool) {
    String[] userPassword = new String[2];
    userPassword[0] = null;
    userPassword[1] = null;
    List<Property> properties = connectorConnectionPool.getProperty();
    if (properties != null) {
        boolean foundUserPassword = false;
        for (Property elementProperty : properties) {
            String prop = elementProperty.getName().toUpperCase(locale);
            if ("USERNAME".equals(prop) || "USER".equals(prop)) {
                userPassword[0] = elementProperty.getValue();
                foundUserPassword = true;
            } else if ("PASSWORD".equals(prop)) {
                userPassword[1] = elementProperty.getValue();
                foundUserPassword = true;
            }
        }
        if (foundUserPassword == true) {
            return userPassword;
        }
    }
    PoolInfo poolInfo = ConnectorsUtil.getPoolInfo(connectorConnectionPool);
    String rarName = connectorConnectionPool.getResourceAdapterName();
    String connectionDefName = connectorConnectionPool.getConnectionDefinitionName();
    ConnectorRegistry connectorRegistry = ConnectorRegistry.getInstance();
    ConnectorDescriptor connectorDescriptor = connectorRegistry.getDescriptor(rarName);
    ConnectionDefDescriptor cdd = connectorDescriptor.getConnectionDefinitionByCFType(connectionDefName);
    Set configProps = cdd.getConfigProperties();
    for (Iterator iter = configProps.iterator(); iter.hasNext(); ) {
        ConnectorConfigProperty envProp = (ConnectorConfigProperty) iter.next();
        String prop = envProp.getName().toUpperCase(locale);
        if ("USER".equals(prop) || "USERNAME".equals(prop)) {
            userPassword[0] = envProp.getValue();
        } else if ("PASSWORD".equals(prop)) {
            userPassword[1] = envProp.getValue();
        }
    }
    if (userPassword[0] != null && !"".equals(userPassword[0].trim())) {
        return userPassword;
    }
    // else read the default username and password from the ra.xml
    ManagedConnectionFactory mcf = connectorRegistry.getManagedConnectionFactory(poolInfo);
    userPassword[0] = ConnectionPoolObjectsUtils.getValueFromMCF("UserName", poolInfo, mcf);
    userPassword[1] = ConnectionPoolObjectsUtils.getValueFromMCF("Password", poolInfo, mcf);
    return userPassword;
}
Also used : ConnectionDefDescriptor(com.sun.enterprise.deployment.ConnectionDefDescriptor) ConnectorConfigProperty(com.sun.enterprise.deployment.ConnectorConfigProperty) ConnectorDescriptor(com.sun.enterprise.deployment.ConnectorDescriptor) ManagedConnectionFactory(javax.resource.spi.ManagedConnectionFactory) PoolInfo(org.glassfish.resourcebase.resources.api.PoolInfo) ConnectorRegistry(com.sun.enterprise.connectors.ConnectorRegistry) ConnectorConfigProperty(com.sun.enterprise.deployment.ConnectorConfigProperty) Property(org.jvnet.hk2.config.types.Property)

Example 8 with ConnectorRegistry

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

the class ConnectorsRecoveryResourceHandler method createActiveResourceAdapter.

private void createActiveResourceAdapter(String rarModuleName) throws ConnectorRuntimeException {
    ConnectorRuntime cr = ConnectorRuntime.getRuntime();
    ConnectorRegistry creg = ConnectorRegistry.getInstance();
    if (creg.isRegistered(rarModuleName))
        return;
    if (ConnectorAdminServiceUtils.isEmbeddedConnectorModule(rarModuleName)) {
        cr.createActiveResourceAdapterForEmbeddedRar(rarModuleName);
    } else {
        String moduleDir;
        if (ConnectorsUtil.belongsToSystemRA(rarModuleName)) {
            moduleDir = ConnectorsUtil.getSystemModuleLocation(rarModuleName);
        } else {
            moduleDir = configBeansUtilities.getLocation(rarModuleName);
        }
        ClassLoader loader = cr.createConnectorClassLoader(moduleDir, null, rarModuleName);
        cr.createActiveResourceAdapter(moduleDir, rarModuleName, loader);
    }
}
Also used : ConnectorRegistry(com.sun.enterprise.connectors.ConnectorRegistry) ConnectorRuntime(com.sun.enterprise.connectors.ConnectorRuntime)

Aggregations

ConnectorRegistry (com.sun.enterprise.connectors.ConnectorRegistry)8 ConnectorRuntimeException (com.sun.appserv.connectors.internal.api.ConnectorRuntimeException)4 PoolInfo (org.glassfish.resourcebase.resources.api.PoolInfo)3 ConnectorRuntime (com.sun.appserv.connectors.internal.api.ConnectorRuntime)2 ConnectorDescriptor (com.sun.enterprise.deployment.ConnectorDescriptor)2 ArrayList (java.util.ArrayList)2 ManagedConnectionFactory (javax.resource.spi.ManagedConnectionFactory)2 ResourceInfo (org.glassfish.resourcebase.resources.api.ResourceInfo)2 Application (com.sun.enterprise.config.serverbeans.Application)1 BindableResource (com.sun.enterprise.config.serverbeans.BindableResource)1 ResourcePool (com.sun.enterprise.config.serverbeans.ResourcePool)1 Resources (com.sun.enterprise.config.serverbeans.Resources)1 ConnectionManagerImpl (com.sun.enterprise.connectors.ConnectionManagerImpl)1 ConnectorRuntime (com.sun.enterprise.connectors.ConnectorRuntime)1 SetMethodAction (com.sun.enterprise.connectors.util.SetMethodAction)1 ConnectionDefDescriptor (com.sun.enterprise.deployment.ConnectionDefDescriptor)1 ConnectorConfigProperty (com.sun.enterprise.deployment.ConnectorConfigProperty)1 EjbDescriptor (com.sun.enterprise.deployment.EjbDescriptor)1 EjbMessageBeanDescriptor (com.sun.enterprise.deployment.EjbMessageBeanDescriptor)1 ResourcePool (com.sun.enterprise.resource.pool.ResourcePool)1