Search in sources :

Example 91 with DeploymentUnit

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

the class InjectionDeploymentAspect method setInjectionAwareInstanceProvider.

private void setInjectionAwareInstanceProvider(final Endpoint ep) {
    final InstanceProvider stackInstanceProvider = ep.getInstanceProvider();
    final DeploymentUnit unit = ep.getService().getDeployment().getAttachment(DeploymentUnit.class);
    final InstanceProvider injectionAwareInstanceProvider = new InjectionAwareInstanceProvider(stackInstanceProvider, ep, unit);
    ep.setInstanceProvider(injectionAwareInstanceProvider);
}
Also used : DeploymentUnit(org.jboss.as.server.deployment.DeploymentUnit) InstanceProvider(org.jboss.wsf.spi.deployment.InstanceProvider)

Example 92 with DeploymentUnit

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

the class WebMetaDataCreator method create.

/**
     * Creates web meta data for EJB deployments.
     *
     * @param dep webservice deployment
     */
void create(final Deployment dep) {
    final DeploymentUnit unit = WSHelper.getRequiredAttachment(dep, DeploymentUnit.class);
    WarMetaData warMD = ASHelper.getOptionalAttachment(unit, WarMetaData.ATTACHMENT_KEY);
    JBossWebMetaData jbossWebMD = warMD != null ? warMD.getMergedJBossWebMetaData() : null;
    if (warMD == null) {
        warMD = new WarMetaData();
    }
    if (jbossWebMD == null) {
        jbossWebMD = new JBossWebMetaData();
        warMD.setMergedJBossWebMetaData(jbossWebMD);
        unit.putAttachment(WarMetaData.ATTACHMENT_KEY, warMD);
    }
    createWebAppDescriptor(dep, jbossWebMD);
    createJBossWebAppDescriptor(dep, jbossWebMD);
    dep.addAttachment(JBossWebMetaData.class, jbossWebMD);
}
Also used : JBossWebMetaData(org.jboss.metadata.web.jboss.JBossWebMetaData) WarMetaData(org.jboss.as.web.common.WarMetaData) DeploymentUnit(org.jboss.as.server.deployment.DeploymentUnit)

Example 93 with DeploymentUnit

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

the class ASHelper method getContextRoot.

/**
     * Returns context root associated with webservice deployment.
     *
     * If there's application.xml descriptor provided defining nested web module, then context root defined there will be
     * returned. Otherwise context root defined in jboss-web.xml will be returned.
     *
     * @param dep webservice deployment
     * @param jbossWebMD jboss web meta data
     * @return context root
     */
public static String getContextRoot(final Deployment dep, final JBossWebMetaData jbossWebMD) {
    final DeploymentUnit unit = WSHelper.getRequiredAttachment(dep, DeploymentUnit.class);
    final JBossAppMetaData jbossAppMD = unit.getParent() == null ? null : ASHelper.getOptionalAttachment(unit.getParent(), WSAttachmentKeys.JBOSS_APP_METADATA_KEY);
    String contextRoot = null;
    // prefer context root defined in application.xml over one defined in jboss-web.xml
    if (jbossAppMD != null) {
        final ModuleMetaData moduleMD = jbossAppMD.getModules().get(dep.getSimpleName());
        if (moduleMD != null) {
            final WebModuleMetaData webModuleMD = (WebModuleMetaData) moduleMD.getValue();
            contextRoot = webModuleMD.getContextRoot();
        }
    }
    if (contextRoot == null) {
        contextRoot = jbossWebMD != null ? jbossWebMD.getContextRoot() : null;
    }
    return contextRoot;
}
Also used : JBossAppMetaData(org.jboss.metadata.ear.jboss.JBossAppMetaData) WebModuleMetaData(org.jboss.metadata.ear.spec.WebModuleMetaData) DeploymentUnit(org.jboss.as.server.deployment.DeploymentUnit) WebModuleMetaData(org.jboss.metadata.ear.spec.WebModuleMetaData) ModuleMetaData(org.jboss.metadata.ear.spec.ModuleMetaData)

Example 94 with DeploymentUnit

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

the class WeldBeanValidationDependencyProcessor method deploy.

@Override
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
    final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
    final ModuleSpecification moduleSpecification = deploymentUnit.getAttachment(Attachments.MODULE_SPECIFICATION);
    final ModuleLoader moduleLoader = Module.getBootModuleLoader();
    if (!WeldDeploymentMarker.isPartOfWeldDeployment(deploymentUnit)) {
        // Skip if there are no beans.xml files in the deployment
        return;
    }
    ModuleDependency cdiBeanValidationDep = new ModuleDependency(moduleLoader, CDI_BEAN_VALIDATION_ID, false, false, true, false);
    moduleSpecification.addSystemDependency(cdiBeanValidationDep);
}
Also used : ModuleLoader(org.jboss.modules.ModuleLoader) ModuleDependency(org.jboss.as.server.deployment.module.ModuleDependency) ModuleSpecification(org.jboss.as.server.deployment.module.ModuleSpecification) DeploymentUnit(org.jboss.as.server.deployment.DeploymentUnit)

Example 95 with DeploymentUnit

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

the class EndpointDeployService method install.

public static DeploymentUnit install(final ServiceTarget serviceTarget, final String context, final ClassLoader loader, final String hostName, final Map<String, String> urlPatternToClassName, JBossWebMetaData jbwmd, WebservicesMetaData wsmd, JBossWebservicesMetaData jbwsmd, Map<Class<?>, Object> deploymentAttachments) {
    final DeploymentUnit unit = EndpointPublisherHelper.doPrepareStep(context, loader, urlPatternToClassName, jbwmd, wsmd, jbwsmd);
    if (deploymentAttachments != null) {
        Deployment dep = unit.getAttachment(WSAttachmentKeys.DEPLOYMENT_KEY);
        for (Entry<Class<?>, Object> e : deploymentAttachments.entrySet()) {
            dep.addAttachment(e.getKey(), e.getValue());
        }
    }
    final EndpointDeployService service = new EndpointDeployService(context, unit);
    final ServiceBuilder<DeploymentUnit> builder = serviceTarget.addService(service.getName(), service);
    builder.addDependency(DependencyType.REQUIRED, WSServices.CONFIG_SERVICE);
    builder.setInitialMode(Mode.ACTIVE);
    builder.install();
    return unit;
}
Also used : Deployment(org.jboss.wsf.spi.deployment.Deployment) DeploymentUnit(org.jboss.as.server.deployment.DeploymentUnit)

Aggregations

DeploymentUnit (org.jboss.as.server.deployment.DeploymentUnit)271 EEModuleDescription (org.jboss.as.ee.component.EEModuleDescription)77 Module (org.jboss.modules.Module)58 ResourceRoot (org.jboss.as.server.deployment.module.ResourceRoot)49 DeploymentUnitProcessingException (org.jboss.as.server.deployment.DeploymentUnitProcessingException)44 ServiceName (org.jboss.msc.service.ServiceName)44 ComponentDescription (org.jboss.as.ee.component.ComponentDescription)43 ArrayList (java.util.ArrayList)33 ModuleSpecification (org.jboss.as.server.deployment.module.ModuleSpecification)32 VirtualFile (org.jboss.vfs.VirtualFile)30 CompositeIndex (org.jboss.as.server.deployment.annotation.CompositeIndex)29 WarMetaData (org.jboss.as.web.common.WarMetaData)25 ServiceTarget (org.jboss.msc.service.ServiceTarget)25 HashMap (java.util.HashMap)24 HashSet (java.util.HashSet)24 ModuleDependency (org.jboss.as.server.deployment.module.ModuleDependency)24 ModuleLoader (org.jboss.modules.ModuleLoader)24 DeploymentReflectionIndex (org.jboss.as.server.deployment.reflect.DeploymentReflectionIndex)20 EEApplicationClasses (org.jboss.as.ee.component.EEApplicationClasses)19 EJBComponentDescription (org.jboss.as.ejb3.component.EJBComponentDescription)17