Search in sources :

Example 1 with ModifiableResourceAdapter

use of org.jboss.as.connector.subsystems.resourceadapters.ModifiableResourceAdapter in project wildfly by wildfly.

the class ResourceAdapterXmlDeploymentService method start.

/**
     * Start
     */
@Override
public void start(StartContext context) throws StartException {
    try {
        Connector cmd = mdr.getValue().getResourceAdapter(deployment);
        File root = mdr.getValue().getRoot(deployment);
        Activation localRaXml = getRaxml();
        cmd = (new Merger()).mergeConnectorWithCommonIronJacamar(localRaXml, cmd);
        String id = ((ModifiableResourceAdapter) raxml).getId();
        final ServiceName raServiceName;
        if (id == null || id.trim().isEmpty()) {
            raServiceName = ConnectorServices.getResourceAdapterServiceName(raName);
            this.connectorServicesRegistrationName = raName;
        } else {
            raServiceName = ConnectorServices.getResourceAdapterServiceName(id);
            this.connectorServicesRegistrationName = id;
        }
        final WildFlyRaXmlDeployer raDeployer = new WildFlyRaXmlDeployer(context.getChildTarget(), connectorXmlDescriptor.getUrl(), raName, root, module.getClassLoader(), cmd, localRaXml, deploymentServiceName);
        raDeployer.setConfiguration(config.getValue());
        WritableServiceBasedNamingStore.pushOwner(duServiceName);
        ClassLoader old = WildFlySecurityManager.getCurrentContextClassLoaderPrivileged();
        try {
            WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(module.getClassLoader());
            raxmlDeployment = raDeployer.doDeploy();
        } finally {
            WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(old);
            WritableServiceBasedNamingStore.popOwner();
        }
        value = new ResourceAdapterDeployment(raxmlDeployment, raName, raServiceName);
        managementRepository.getValue().getConnectors().add(value.getDeployment().getConnector());
        registry.getValue().registerResourceAdapterDeployment(value);
        context.getChildTarget().addService(raServiceName, new ResourceAdapterService(raServiceName, value.getDeployment().getResourceAdapter())).addDependency(deploymentServiceName).setInitialMode(ServiceController.Mode.ACTIVE).install();
    } catch (Throwable t) {
        cleanupStartAsync(context, raName, deploymentServiceName, t);
    }
}
Also used : ResourceAdapterDeployment(org.jboss.as.connector.metadata.deployment.ResourceAdapterDeployment) Connector(org.jboss.jca.common.api.metadata.spec.Connector) Merger(org.jboss.jca.common.metadata.merge.Merger) ServiceName(org.jboss.msc.service.ServiceName) ResourceAdapterService(org.jboss.as.connector.services.resourceadapters.ResourceAdapterService) Activation(org.jboss.jca.common.api.metadata.resourceadapter.Activation) ModifiableResourceAdapter(org.jboss.as.connector.subsystems.resourceadapters.ModifiableResourceAdapter) File(java.io.File)

Example 2 with ModifiableResourceAdapter

use of org.jboss.as.connector.subsystems.resourceadapters.ModifiableResourceAdapter in project wildfly by wildfly.

the class ConnectorServices method getDeploymentServiceName.

// resource-adapter DMR resource
public static synchronized ServiceName getDeploymentServiceName(final String raName, final Activation raxml) {
    if (raName == null)
        throw ConnectorLogger.ROOT_LOGGER.undefinedVar("RaName");
    ServiceName serviceName = null;
    ModifiableResourceAdapter ra = (ModifiableResourceAdapter) raxml;
    if (ra != null && ra.getId() != null) {
        serviceName = getDeploymentServiceName(raName, ra.getId());
    } else {
        serviceName = getDeploymentServiceName(raName, (String) null);
    }
    ROOT_LOGGER.tracef("ConnectorServices: getDeploymentServiceName(%s,%s) -> %s", raName, raxml, serviceName);
    return serviceName;
}
Also used : ServiceName(org.jboss.msc.service.ServiceName) ModifiableResourceAdapter(org.jboss.as.connector.subsystems.resourceadapters.ModifiableResourceAdapter)

Aggregations

ModifiableResourceAdapter (org.jboss.as.connector.subsystems.resourceadapters.ModifiableResourceAdapter)2 ServiceName (org.jboss.msc.service.ServiceName)2 File (java.io.File)1 ResourceAdapterDeployment (org.jboss.as.connector.metadata.deployment.ResourceAdapterDeployment)1 ResourceAdapterService (org.jboss.as.connector.services.resourceadapters.ResourceAdapterService)1 Activation (org.jboss.jca.common.api.metadata.resourceadapter.Activation)1 Connector (org.jboss.jca.common.api.metadata.spec.Connector)1 Merger (org.jboss.jca.common.metadata.merge.Merger)1