Search in sources :

Example 1 with IronJacamarActivationResourceService

use of org.jboss.as.connector.services.resourceadapters.IronJacamarActivationResourceService in project wildfly by wildfly.

the class ResourceAdapterDeploymentService method start.

@Override
public void start(StartContext context) throws StartException {
    final URL url = connectorXmlDescriptor == null ? null : connectorXmlDescriptor.getUrl();
    deploymentName = connectorXmlDescriptor == null ? null : connectorXmlDescriptor.getDeploymentName();
    connectorServicesRegistrationName = deploymentName;
    final File root = connectorXmlDescriptor == null ? null : connectorXmlDescriptor.getRoot();
    DEPLOYMENT_CONNECTOR_LOGGER.debugf("DEPLOYMENT name = %s", deploymentName);
    final boolean fromModule = duServiceName.getParent().equals(RaOperationUtil.RAR_MODULE);
    final WildFLyRaDeployer raDeployer = new WildFLyRaDeployer(context.getChildTarget(), url, deploymentName, root, classLoader, cmd, activation, deploymentServiceName, fromModule);
    raDeployer.setConfiguration(config.getValue());
    ClassLoader old = WildFlySecurityManager.getCurrentContextClassLoaderPrivileged();
    try {
        try {
            WritableServiceBasedNamingStore.pushOwner(duServiceName);
            WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(classLoader);
            raDeployment = raDeployer.doDeploy();
            deploymentName = raDeployment.getDeploymentName();
        } finally {
            WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(old);
            WritableServiceBasedNamingStore.popOwner();
        }
        if (raDeployer.checkActivation(cmd, activation)) {
            DEPLOYMENT_CONNECTOR_LOGGER.debugf("Activating: %s", deploymentName);
            ServiceName raServiceName = ConnectorServices.getResourceAdapterServiceName(deploymentName);
            value = new ResourceAdapterDeployment(raDeployment, deploymentName, raServiceName);
            managementRepository.getValue().getConnectors().add(value.getDeployment().getConnector());
            registry.getValue().registerResourceAdapterDeployment(value);
            ServiceTarget serviceTarget = context.getChildTarget();
            serviceTarget.addService(raServiceName, new ResourceAdapterService(raServiceName, value.getDeployment().getResourceAdapter())).setInitialMode(Mode.ACTIVE).install();
            final ServiceName deployerServiceName = ConnectorServices.RESOURCE_ADAPTER_DEPLOYER_SERVICE_PREFIX.append(connectorXmlDescriptor.getDeploymentName());
            IronJacamarActivationResourceService ijResourceService = new IronJacamarActivationResourceService(registration, deploymentResource, false);
            serviceTarget.addService(deployerServiceName.append(ConnectorServices.IRONJACAMAR_RESOURCE), ijResourceService).addDependency(ConnectorServices.IRONJACAMAR_MDR, AS7MetadataRepository.class, ijResourceService.getMdrInjector()).addDependency(deployerServiceName, ResourceAdapterDeployment.class, ijResourceService.getResourceAdapterDeploymentInjector()).setInitialMode(Mode.PASSIVE).install();
        } else {
            DEPLOYMENT_CONNECTOR_LOGGER.debugf("Not activating: %s", deploymentName);
        }
    } catch (Throwable t) {
        cleanupStartAsync(context, deploymentName, t, duServiceName, classLoader);
    }
}
Also used : ResourceAdapterDeployment(org.jboss.as.connector.metadata.deployment.ResourceAdapterDeployment) ServiceName(org.jboss.msc.service.ServiceName) ServiceTarget(org.jboss.msc.service.ServiceTarget) ResourceAdapterService(org.jboss.as.connector.services.resourceadapters.ResourceAdapterService) IronJacamarActivationResourceService(org.jboss.as.connector.services.resourceadapters.IronJacamarActivationResourceService) AS7MetadataRepository(org.jboss.as.connector.services.mdr.AS7MetadataRepository) File(java.io.File) URL(java.net.URL)

Aggregations

File (java.io.File)1 URL (java.net.URL)1 ResourceAdapterDeployment (org.jboss.as.connector.metadata.deployment.ResourceAdapterDeployment)1 AS7MetadataRepository (org.jboss.as.connector.services.mdr.AS7MetadataRepository)1 IronJacamarActivationResourceService (org.jboss.as.connector.services.resourceadapters.IronJacamarActivationResourceService)1 ResourceAdapterService (org.jboss.as.connector.services.resourceadapters.ResourceAdapterService)1 ServiceName (org.jboss.msc.service.ServiceName)1 ServiceTarget (org.jboss.msc.service.ServiceTarget)1