connector/src/main/java/org/jboss/as/connector/deployers/ra/processors/RaXmlDeploymentProcessor.java
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
        final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
        final ManagementResourceRegistration baseRegistration = deploymentUnit.getAttachment(DeploymentModelUtils.MUTABLE_REGISTRATION_ATTACHMENT);
        final ManagementResourceRegistration registration;
        final Resource deploymentResource = deploymentUnit.getAttachment(DeploymentModelUtils.DEPLOYMENT_RESOURCE);
        final ConnectorXmlDescriptor connectorXmlDescriptor = deploymentUnit.getAttachment(ConnectorXmlDescriptor.ATTACHMENT_KEY);
        final CapabilityServiceSupport support = deploymentUnit.getAttachment(CAPABILITY_SERVICE_SUPPORT);

        if (connectorXmlDescriptor == null) {
            return; // Skip non ra deployments
        }
        if (deploymentUnit.getParent() != null) {
            registration = baseRegistration.getSubModel(PathAddress.pathAddress(PathElement.pathElement("subdeployment")));
        } else {
            registration = baseRegistration;
        }
        ResourceAdaptersService.ModifiableResourceAdaptors raxmls = null;
        final ServiceController<?> raService = phaseContext.getServiceRegistry().getService(
                ConnectorServices.RESOURCEADAPTERS_SERVICE);
        if (raService != null)
            raxmls = ((ResourceAdaptersService.ModifiableResourceAdaptors) raService.getValue());

        ROOT_LOGGER.tracef("processing Raxml");
        Module module = deploymentUnit.getAttachment(Attachments.MODULE);

        try {
            final ServiceTarget serviceTarget = phaseContext.getServiceTarget();
            String deploymentUnitPrefix = "";

            if (deploymentUnit.getParent() != null) {
                deploymentUnitPrefix = deploymentUnit.getParent().getName() + "#";
            }

            final String deploymentUnitName = deploymentUnitPrefix + deploymentUnit.getName();

            if (raxmls != null) {
                for (Activation raxml : raxmls.getActivations()) {

                    String rarName = raxml.getArchive();

                    if (deploymentUnitName.equals(rarName)) {
                        RaServicesFactory.createDeploymentService(registration, connectorXmlDescriptor, module, serviceTarget, deploymentUnitName, deploymentUnit.getServiceName(), deploymentUnitName, raxml, deploymentResource, phaseContext.getServiceRegistry(), support);

                    }
                }
            }

            //create service pointing to rar for other future activations
            ServiceName serviceName = ConnectorServices.INACTIVE_RESOURCE_ADAPTER_SERVICE.append(deploymentUnitName);
            InactiveResourceAdapterDeploymentService service = new InactiveResourceAdapterDeploymentService(connectorXmlDescriptor, module, deploymentUnitName, deploymentUnitName, deploymentUnit.getServiceName(), registration, serviceTarget, deploymentResource);
            ServiceBuilder builder = serviceTarget
                    .addService(serviceName, service);
            builder.setInitialMode(Mode.ACTIVE).install();

        } catch (Throwable t) {
            throw new DeploymentUnitProcessingException(t);
        }
    }
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
        final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
        final ManagementResourceRegistration baseRegistration = deploymentUnit.getAttachment(DeploymentModelUtils.MUTABLE_REGISTRATION_ATTACHMENT);
        final ManagementResourceRegistration registration;
        final Resource deploymentResource = deploymentUnit.getAttachment(DeploymentModelUtils.DEPLOYMENT_RESOURCE);
        final ConnectorXmlDescriptor connectorXmlDescriptor = deploymentUnit.getAttachment(ConnectorXmlDescriptor.ATTACHMENT_KEY);
        final CapabilityServiceSupport support = deploymentUnit.getAttachment(CAPABILITY_SERVICE_SUPPORT);

        if (connectorXmlDescriptor == null) {
            return; // Skip non ra deployments
        }
        if (deploymentUnit.getParent() != null) {
            registration = baseRegistration.getSubModel(PathAddress.pathAddress(PathElement.pathElement("subdeployment")));
        } else {
            registration = baseRegistration;
        }
        ResourceAdaptersService.ModifiableResourceAdaptors raxmls = null;
        final ServiceController<?> raService = phaseContext.getServiceRegistry().getService(
                ConnectorServices.RESOURCEADAPTERS_SERVICE);
        if (raService != null)
            raxmls = ((ResourceAdaptersService.ModifiableResourceAdaptors) raService.getValue());

        ROOT_LOGGER.tracef("processing Raxml");
        Module module = deploymentUnit.getAttachment(Attachments.MODULE);

        try {
            final ServiceTarget serviceTarget = phaseContext.getServiceTarget();
            String deploymentUnitPrefix = "";

            if (deploymentUnit.getParent() != null) {
                deploymentUnitPrefix = deploymentUnit.getParent().getName() + "#";
            }

            final String deploymentUnitName = deploymentUnitPrefix + deploymentUnit.getName();

            if (raxmls != null) {
                for (Activation raxml : raxmls.getActivations()) {

                    String rarName = raxml.getArchive();

                    if (deploymentUnitName.equals(rarName)) {
                        RaServicesFactory.createDeploymentService(registration, connectorXmlDescriptor, module, serviceTarget, deploymentUnitName, deploymentUnit.getServiceName(), deploymentUnitName, raxml, deploymentResource, phaseContext.getServiceRegistry(), support);

                    }
                }
            }

            //create service pointing to rar for other future activations
            ServiceName serviceName = ConnectorServices.INACTIVE_RESOURCE_ADAPTER_SERVICE.append(deploymentUnitName);
            InactiveResourceAdapterDeploymentService service = new InactiveResourceAdapterDeploymentService(connectorXmlDescriptor, module, deploymentUnitName, deploymentUnitName, deploymentUnit.getServiceName(), registration, serviceTarget, deploymentResource);
            ServiceBuilder builder = serviceTarget
                    .addService(serviceName, service);
            builder.setInitialMode(Mode.ACTIVE).install();

        } catch (Throwable t) {
            throw new DeploymentUnitProcessingException(t);
        }
    }
Process a deployment for a Connector. Will install a {@Code
JBossService} for this ResourceAdapter.

@param phaseContext the deployment unit context
@throws DeploymentUnitProcessingException