Search in sources :

Example 31 with DeploymentUnit

use of org.jboss.as.server.deployment.DeploymentUnit in project wildfly by wildfly.

the class EJBClientDescriptorParsingProcessor method deploy.

@Override
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
    final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
    final XMLMapper mapper = createMapper(deploymentUnit);
    final ResourceRoot resourceRoot = deploymentUnit.getAttachment(org.jboss.as.server.deployment.Attachments.DEPLOYMENT_ROOT);
    final ServiceModuleLoader moduleLoader = deploymentUnit.getAttachment(org.jboss.as.server.deployment.Attachments.SERVICE_MODULE_LOADER);
    VirtualFile descriptorFile = null;
    for (final String loc : EJB_CLIENT_DESCRIPTOR_LOCATIONS) {
        final VirtualFile file = resourceRoot.getRoot().getChild(loc);
        if (file.exists()) {
            descriptorFile = file;
            break;
        }
    }
    if (descriptorFile == null) {
        return;
    }
    if (deploymentUnit.getParent() != null) {
        EeLogger.ROOT_LOGGER.subdeploymentIgnored(descriptorFile.getPathName());
        return;
    }
    final File ejbClientDeploymentDescriptorFile;
    try {
        ejbClientDeploymentDescriptorFile = descriptorFile.getPhysicalFile();
    } catch (IOException e) {
        throw EeLogger.ROOT_LOGGER.failedToProcessEJBClientDescriptor(e);
    }
    final EJBClientDescriptorMetaData ejbClientDescriptorMetaData = parse(ejbClientDeploymentDescriptorFile, mapper);
    EeLogger.ROOT_LOGGER.debugf("Successfully parsed jboss-ejb-client.xml for deployment unit %s", deploymentUnit);
    // attach the metadata
    deploymentUnit.putAttachment(Attachments.EJB_CLIENT_METADATA, ejbClientDescriptorMetaData);
}
Also used : VirtualFile(org.jboss.vfs.VirtualFile) ResourceRoot(org.jboss.as.server.deployment.module.ResourceRoot) XMLMapper(org.jboss.staxmapper.XMLMapper) EJBClientDescriptorMetaData(org.jboss.as.ee.metadata.EJBClientDescriptorMetaData) ServiceModuleLoader(org.jboss.as.server.moduleservice.ServiceModuleLoader) IOException(java.io.IOException) DeploymentUnit(org.jboss.as.server.deployment.DeploymentUnit) File(java.io.File) VirtualFile(org.jboss.vfs.VirtualFile)

Example 32 with DeploymentUnit

use of org.jboss.as.server.deployment.DeploymentUnit in project wildfly by wildfly.

the class EarInitializationProcessor method deploy.

public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
    final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
    // Make sure this is an EAR deployment
    String deploymentName = deploymentUnit.getName().toLowerCase(Locale.ENGLISH);
    if (deploymentName.endsWith(EAR_EXTENSION)) {
        // Let other processors know this is an EAR deployment
        DeploymentTypeMarker.setType(DeploymentType.EAR, deploymentUnit);
    }
}
Also used : DeploymentUnit(org.jboss.as.server.deployment.DeploymentUnit)

Example 33 with DeploymentUnit

use of org.jboss.as.server.deployment.DeploymentUnit in project wildfly by wildfly.

the class AnnotationPropertyReplacementProcessor method deploy.

@Override
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
    final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
    deploymentUnit.putAttachment(attachmentKey, annotationPropertyReplacement);
}
Also used : DeploymentUnit(org.jboss.as.server.deployment.DeploymentUnit)

Example 34 with DeploymentUnit

use of org.jboss.as.server.deployment.DeploymentUnit in project wildfly by wildfly.

the class ComponentAggregationProcessor method deploy.

public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
    DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
    final ComponentRegistry componentRegistry = new ComponentRegistry(phaseContext.getServiceRegistry());
    final EEModuleDescription moduleDescription = deploymentUnit.getAttachment(EE_MODULE_DESCRIPTION);
    if (moduleDescription == null) {
        return;
    }
    phaseContext.getServiceTarget().addService(ComponentRegistry.serviceName(deploymentUnit), new ValueService<>(new ImmediateValue<Object>(componentRegistry))).addDependency(moduleDescription.getDefaultClassIntrospectorServiceName(), EEClassIntrospector.class, componentRegistry.getClassIntrospectorInjectedValue()).install();
    deploymentUnit.putAttachment(COMPONENT_REGISTRY, componentRegistry);
    if (deploymentUnit.getAttachment(Attachments.DEPLOYMENT_TYPE) == DeploymentType.EAR) {
        final EEApplicationDescription applicationDescription = new EEApplicationDescription();
        deploymentUnit.putAttachment(org.jboss.as.ee.component.Attachments.EE_APPLICATION_DESCRIPTION, applicationDescription);
        for (final Map.Entry<String, String> messageDestination : moduleDescription.getMessageDestinations().entrySet()) {
            applicationDescription.addMessageDestination(messageDestination.getKey(), messageDestination.getValue(), deploymentUnit.getAttachment(org.jboss.as.server.deployment.Attachments.DEPLOYMENT_ROOT).getRoot());
        }
        /*
            * We are an EAR, so we must inspect all of our subdeployments and aggregate all their component views
            * into a single index, so that inter-module resolution will work.
            */
        // Add the application description
        final List<DeploymentUnit> subdeployments = deploymentUnit.getAttachmentList(SUB_DEPLOYMENTS);
        for (final DeploymentUnit subdeployment : subdeployments) {
            final EEModuleDescription subDeploymentModuleDescription = subdeployment.getAttachment(EE_MODULE_DESCRIPTION);
            final ResourceRoot deploymentRoot = subdeployment.getAttachment(org.jboss.as.server.deployment.Attachments.DEPLOYMENT_ROOT);
            if (subDeploymentModuleDescription == null) {
                // Not an EE deployment.
                continue;
            }
            for (final ComponentDescription componentDescription : subDeploymentModuleDescription.getComponentDescriptions()) {
                applicationDescription.addComponent(componentDescription, deploymentRoot.getRoot());
            }
            for (final Map.Entry<String, String> messageDestination : subDeploymentModuleDescription.getMessageDestinations().entrySet()) {
                applicationDescription.addMessageDestination(messageDestination.getKey(), messageDestination.getValue(), deploymentRoot.getRoot());
            }
            for (final ComponentDescription componentDescription : subdeployment.getAttachmentList(org.jboss.as.ee.component.Attachments.ADDITIONAL_RESOLVABLE_COMPONENTS)) {
                applicationDescription.addComponent(componentDescription, deploymentRoot.getRoot());
            }
            subdeployment.putAttachment(EE_APPLICATION_DESCRIPTION, applicationDescription);
        }
    } else if (deploymentUnit.getParent() == null) {
        final EEApplicationDescription applicationDescription = new EEApplicationDescription();
        deploymentUnit.putAttachment(org.jboss.as.ee.component.Attachments.EE_APPLICATION_DESCRIPTION, applicationDescription);
        /*
             * We are a top-level EE deployment, or a non-EE deployment.  Our "aggregate" index is just a copy of
             * our local EE module index.
             */
        final ResourceRoot deploymentRoot = deploymentUnit.getAttachment(org.jboss.as.server.deployment.Attachments.DEPLOYMENT_ROOT);
        for (final ComponentDescription componentDescription : moduleDescription.getComponentDescriptions()) {
            applicationDescription.addComponent(componentDescription, deploymentRoot.getRoot());
        }
        for (final Map.Entry<String, String> messageDestination : moduleDescription.getMessageDestinations().entrySet()) {
            applicationDescription.addMessageDestination(messageDestination.getKey(), messageDestination.getValue(), deploymentRoot.getRoot());
        }
        for (final ComponentDescription componentDescription : deploymentUnit.getAttachmentList(org.jboss.as.ee.component.Attachments.ADDITIONAL_RESOLVABLE_COMPONENTS)) {
            applicationDescription.addComponent(componentDescription, deploymentRoot.getRoot());
        }
    }
}
Also used : EEApplicationDescription(org.jboss.as.ee.component.EEApplicationDescription) ComponentDescription(org.jboss.as.ee.component.ComponentDescription) ImmediateValue(org.jboss.msc.value.ImmediateValue) ResourceRoot(org.jboss.as.server.deployment.module.ResourceRoot) EEModuleDescription(org.jboss.as.ee.component.EEModuleDescription) ComponentRegistry(org.jboss.as.ee.component.ComponentRegistry) DeploymentUnit(org.jboss.as.server.deployment.DeploymentUnit) Map(java.util.Map) EEClassIntrospector(org.jboss.as.ee.component.EEClassIntrospector)

Example 35 with DeploymentUnit

use of org.jboss.as.server.deployment.DeploymentUnit in project wildfly by wildfly.

the class IIOPMarkerProcessor method deploy.

@Override
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
    final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
    // for now we mark all subsystems as using IIOP if the IIOP subsystem is installed
    IIOPDeploymentMarker.mark(deploymentUnit);
}
Also used : DeploymentUnit(org.jboss.as.server.deployment.DeploymentUnit)

Aggregations

DeploymentUnit (org.jboss.as.server.deployment.DeploymentUnit)359 EEModuleDescription (org.jboss.as.ee.component.EEModuleDescription)84 Module (org.jboss.modules.Module)70 ServiceName (org.jboss.msc.service.ServiceName)62 DeploymentUnitProcessingException (org.jboss.as.server.deployment.DeploymentUnitProcessingException)56 ResourceRoot (org.jboss.as.server.deployment.module.ResourceRoot)56 ComponentDescription (org.jboss.as.ee.component.ComponentDescription)47 ModuleSpecification (org.jboss.as.server.deployment.module.ModuleSpecification)45 CapabilityServiceSupport (org.jboss.as.controller.capability.CapabilityServiceSupport)40 VirtualFile (org.jboss.vfs.VirtualFile)39 ArrayList (java.util.ArrayList)37 CompositeIndex (org.jboss.as.server.deployment.annotation.CompositeIndex)37 ModuleLoader (org.jboss.modules.ModuleLoader)35 ServiceTarget (org.jboss.msc.service.ServiceTarget)34 ModuleDependency (org.jboss.as.server.deployment.module.ModuleDependency)33 WarMetaData (org.jboss.as.web.common.WarMetaData)31 HashMap (java.util.HashMap)30 HashSet (java.util.HashSet)30 EEApplicationClasses (org.jboss.as.ee.component.EEApplicationClasses)20 DeploymentReflectionIndex (org.jboss.as.server.deployment.reflect.DeploymentReflectionIndex)20