Search in sources :

Example 36 with DeploymentUnit

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

the class JaccEjbDeploymentProcessor method getJaccServiceName.

private ServiceName getJaccServiceName(DeploymentUnit deploymentUnit) {
    final DeploymentUnit parentDU = deploymentUnit.getParent();
    // Jakarta Enterprise Beans maybe included directly in war deployment
    ServiceName jaccServiceName = deploymentUnit.getServiceName().append(JaccService.SERVICE_NAME).append("ejb");
    // Qualify the service name properly with parent DU
    if (parentDU != null) {
        jaccServiceName = jaccServiceName.append(parentDU.getName());
    }
    return jaccServiceName;
}
Also used : ServiceName(org.jboss.msc.service.ServiceName) DeploymentUnit(org.jboss.as.server.deployment.DeploymentUnit)

Example 37 with DeploymentUnit

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

the class JaccEjbDeploymentProcessor method deploy.

@Override
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
    final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
    if (deploymentContainsEjbs(deploymentUnit) == false) {
        return;
    }
    AbstractSecurityDeployer<?> deployer = null;
    deployer = new EjbSecurityDeployer();
    JaccService<?> service = deployer.deploy(deploymentUnit);
    if (service != null) {
        final DeploymentUnit parentDU = deploymentUnit.getParent();
        // Jakarta Enterprise Beans maybe included directly in war deployment
        ServiceName jaccServiceName = getJaccServiceName(deploymentUnit);
        final ServiceTarget serviceTarget = phaseContext.getServiceTarget();
        ServiceBuilder<?> builder = serviceTarget.addService(jaccServiceName, service);
        if (parentDU != null) {
            // add dependency to parent policy
            builder.addDependency(parentDU.getServiceName().append(JaccService.SERVICE_NAME), PolicyConfiguration.class, service.getParentPolicyInjector());
        }
        CapabilityServiceSupport capabilitySupport = deploymentUnit.getAttachment(Attachments.CAPABILITY_SERVICE_SUPPORT);
        builder.addDependencies(capabilitySupport.getCapabilityServiceName(jaccCapabilityName));
        builder.setInitialMode(Mode.ACTIVE).install();
    }
}
Also used : EjbSecurityDeployer(org.jboss.as.ejb3.deployment.EjbSecurityDeployer) ServiceName(org.jboss.msc.service.ServiceName) ServiceTarget(org.jboss.msc.service.ServiceTarget) DeploymentUnit(org.jboss.as.server.deployment.DeploymentUnit) CapabilityServiceSupport(org.jboss.as.controller.capability.CapabilityServiceSupport)

Example 38 with DeploymentUnit

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

the class SingletonDeploymentDependencyProcessor method deploy.

@Override
public void deploy(DeploymentPhaseContext context) throws DeploymentUnitProcessingException {
    DeploymentUnit unit = context.getDeploymentUnit();
    if (unit.getParent() == null) {
        SingletonDeploymentConfiguration config = unit.getAttachment(CONFIGURATION_KEY);
        if (config != null) {
            CapabilityServiceSupport support = unit.getAttachment(Attachments.CAPABILITY_SERVICE_SUPPORT);
            context.addDependency(SingletonServiceNameFactory.SINGLETON_POLICY.getServiceName(support, config.getPolicy()), SingletonDeploymentProcessor.POLICY_KEY);
        }
    }
}
Also used : DeploymentUnit(org.jboss.as.server.deployment.DeploymentUnit) CapabilityServiceSupport(org.jboss.as.controller.capability.CapabilityServiceSupport)

Example 39 with DeploymentUnit

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

the class SingletonDeploymentProcessor method deploy.

@Override
public void deploy(DeploymentPhaseContext context) throws DeploymentUnitProcessingException {
    DeploymentUnit unit = context.getDeploymentUnit();
    if (unit.getParent() == null) {
        SingletonPolicy policy = context.getAttachment(POLICY_KEY);
        if (policy != null) {
            CapabilityServiceSupport support = unit.getAttachment(Attachments.CAPABILITY_SERVICE_SUPPORT);
            // Restart the deployment using the attached phase builder, but only if a builder was not already attached
            if (unit.putAttachment(Attachments.DEPLOYMENT_UNIT_PHASE_BUILDER, new SingletonDeploymentUnitPhaseBuilder(support, policy)) == null) {
                SingletonLogger.ROOT_LOGGER.singletonDeploymentDetected(policy);
                ServiceController<?> controller = context.getServiceRegistry().getRequiredService(unit.getServiceName());
                controller.addListener(this);
                controller.setMode(Mode.NEVER);
            }
        }
    }
}
Also used : SingletonPolicy(org.wildfly.clustering.singleton.SingletonPolicy) DeploymentUnit(org.jboss.as.server.deployment.DeploymentUnit) CapabilityServiceSupport(org.jboss.as.controller.capability.CapabilityServiceSupport)

Example 40 with DeploymentUnit

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

the class StaticInterceptorsDependenciesDeploymentUnitProcessor method deploy.

@Override
public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
    final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
    final ModuleLoader moduleLoader = Module.getBootModuleLoader();
    final ModuleSpecification deploymentModuleSpec = deploymentUnit.getAttachment(Attachments.MODULE_SPECIFICATION);
    for (final String interceptorModule : interceptorModules) {
        final ModuleIdentifier interceptorModuleId = ModuleIdentifier.create(interceptorModule);
        deploymentModuleSpec.addSystemDependency(new ModuleDependency(moduleLoader, interceptorModuleId, false, false, true, false));
    }
}
Also used : ModuleLoader(org.jboss.modules.ModuleLoader) ModuleDependency(org.jboss.as.server.deployment.module.ModuleDependency) ModuleSpecification(org.jboss.as.server.deployment.module.ModuleSpecification) ModuleIdentifier(org.jboss.modules.ModuleIdentifier) 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