Search in sources :

Example 1 with ConnectorApplication

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

the class ConnectorRuntime method deployResourcesOfModule.

/**
 * deploy resources of the module
 * @param rarName resource-adapter name
 */
public void deployResourcesOfModule(String rarName) {
    ConnectorApplication app = connectorRegistry.getConnectorApplication(rarName);
    app.deployResources();
}
Also used : ConnectorApplication(com.sun.enterprise.connectors.module.ConnectorApplication)

Example 2 with ConnectorApplication

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

the class ConnectorRuntime method undeployResourcesOfModule.

/**
 * undeploy resources of the module
 * @param rarName resource-adapter name
 */
public void undeployResourcesOfModule(String rarName) {
    ConnectorApplication app = connectorRegistry.getConnectorApplication(rarName);
    app.undeployResources();
}
Also used : ConnectorApplication(com.sun.enterprise.connectors.module.ConnectorApplication)

Example 3 with ConnectorApplication

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

the class ConnectorConfigParserUtils method loadClass.

/**
 * Loads and instantiates the class
 * Throws ConnectorRuntimeException if loading or instantiation fails.
 */
private Class loadClass(String className, String resourceAdapterName) throws ConnectorRuntimeException {
    Class loadedClass = null;
    try {
        if (ConnectorsUtil.belongsToSystemRA(resourceAdapterName)) {
            ClassLoader classLoader = ConnectorRuntime.getRuntime().getConnectorClassLoader();
            loadedClass = classLoader.loadClass(className);
        } else {
            // try loading via ClassLoader of the RAR from ConnectorRegistry
            ConnectorApplication app = ConnectorRegistry.getInstance().getConnectorApplication(resourceAdapterName);
            if (app == null) {
                _logger.log(Level.FINE, "unable to load class [ " + className + " ] of RAR " + "[ " + resourceAdapterName + " ]" + " from server instance, trying other instances' deployments");
                // try loading via RARUtils
                loadedClass = RARUtils.loadClassFromRar(resourceAdapterName, className);
            } else {
                loadedClass = app.getClassLoader().loadClass(className);
            }
        }
    } catch (ClassNotFoundException e1) {
        _logger.log(Level.FINE, "rardeployment.class_not_found", className);
        throw new ConnectorRuntimeException("Class Not Found : " + className);
    }
    return loadedClass;
}
Also used : ConnectorApplication(com.sun.enterprise.connectors.module.ConnectorApplication)

Example 4 with ConnectorApplication

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

the class ResourceAdapterAdminServiceImpl method reCreateActiveResourceAdapter.

/**
 * The ActiveResourceAdapter object which abstract the rar module is
 * recreated in the connector container/registry. All the pools and
 * resources are killed. But the infrastructure to create the pools and and
 * resources is untouched. Only the actual pool is killed.
 *
 * @param moduleName
 *                     rar module Name.
 * @throws ConnectorRuntimeException
 *                      if recreation fails.
 */
public void reCreateActiveResourceAdapter(String moduleName) throws ConnectorRuntimeException {
    ConnectorRuntime runtime = ConnectorRuntime.getRuntime();
    if (isRarDeployed(moduleName)) {
        if (!ConnectorsUtil.belongsToSystemRA(moduleName)) {
            ConnectorApplication app = _registry.getConnectorApplication(moduleName);
            app.undeployResources();
            stopAndRemoveActiveResourceAdapter(moduleName);
            String moduleDir = ConnectorsUtil.getLocation(moduleName);
            createActiveResourceAdapter(moduleDir, moduleName, app.getClassLoader());
            _registry.getConnectorApplication(moduleName).deployResources();
        } else {
            Collection<Resource> resources = getResourcesUtil().filterConnectorResources(getResourcesUtil().getGlobalResources(), moduleName, true);
            runtime.getGlobalResourceManager().undeployResources(resources);
            stopAndRemoveActiveResourceAdapter(moduleName);
            String moduleDir = ConnectorsUtil.getLocation(moduleName);
            createActiveResourceAdapter(moduleDir, moduleName, runtime.getSystemRARClassLoader(moduleName));
            runtime.getGlobalResourceManager().deployResources(resources);
        }
    }
/*   //No need to deploy the .rar, it may be a case where rar is not deployed yet
        //Also, when the rar is started, RA-Config is anyway used
        else {
            ConnectorApplication app = _registry.getConnectorApplication(moduleName);
            createActiveResourceAdapter(moduleDir, moduleName, app.getClassLoader());
            _registry.getConnectorApplication(moduleName).deployResources();
        }*/
}
Also used : ConnectorApplication(com.sun.enterprise.connectors.module.ConnectorApplication) Resource(com.sun.enterprise.config.serverbeans.Resource) ConnectorRuntime(com.sun.enterprise.connectors.ConnectorRuntime)

Aggregations

ConnectorApplication (com.sun.enterprise.connectors.module.ConnectorApplication)4 Resource (com.sun.enterprise.config.serverbeans.Resource)1 ConnectorRuntime (com.sun.enterprise.connectors.ConnectorRuntime)1