Search in sources :

Example 86 with DeploymentUnit

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

the class WSLibraryFilterProcessor method deploy.

@Override
public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
    final DeploymentUnit unit = phaseContext.getDeploymentUnit();
    if (DeploymentTypeMarker.isType(DeploymentType.EAR, unit)) {
        return;
    }
    final CompositeIndex index = unit.getAttachment(Attachments.COMPOSITE_ANNOTATION_INDEX);
    if (index != null) {
        //perform checks on included libraries only if there're actually WS endpoints in the deployment
        if (hasWSEndpoints(index)) {
            AttachmentList<ResourceRoot> resourceRoots = unit.getAttachment(RESOURCE_ROOTS);
            if (resourceRoots != null) {
                for (ResourceRoot root : resourceRoots) {
                    if (hasClassesFromPackage(root.getAttachment(ANNOTATION_INDEX), "org.apache.cxf")) {
                        throw WSLogger.ROOT_LOGGER.invalidLibraryInDeployment("Apache CXF", root.getRootName());
                    }
                }
            }
        }
    } else {
        WSLogger.ROOT_LOGGER.tracef("Skipping WS annotation processing since no composite annotation index found in unit: %s", unit.getName());
    }
}
Also used : ResourceRoot(org.jboss.as.server.deployment.module.ResourceRoot) CompositeIndex(org.jboss.as.server.deployment.annotation.CompositeIndex) DeploymentUnit(org.jboss.as.server.deployment.DeploymentUnit)

Example 87 with DeploymentUnit

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

the class WSModelDeploymentProcessor method internalDeploy.

@Override
public void internalDeploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
    final DeploymentUnit unit = phaseContext.getDeploymentUnit();
    WSDeploymentBuilder.getInstance().build(unit);
    if (isWebServiceDeployment(unit)) {
        //note, this check works only after the WSDeploymentBuilder above has run
        ServerConfigImpl config = (ServerConfigImpl) phaseContext.getServiceRegistry().getRequiredService(WSServices.CONFIG_SERVICE).getValue();
        config.incrementWSDeploymentCount();
    }
}
Also used : ServerConfigImpl(org.jboss.as.webservices.config.ServerConfigImpl) DeploymentUnit(org.jboss.as.server.deployment.DeploymentUnit)

Example 88 with DeploymentUnit

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

the class AspectDeploymentProcessor method deploy.

@Override
public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
    final DeploymentUnit unit = phaseContext.getDeploymentUnit();
    if (isWebServiceDeployment(unit)) {
        ensureAspectInitialized();
        final Deployment dep = ASHelper.getRequiredAttachment(unit, WSAttachmentKeys.DEPLOYMENT_KEY);
        WSLogger.ROOT_LOGGER.tracef("%s start: %s", aspect, unit.getName());
        ClassLoader origClassLoader = WildFlySecurityManager.getCurrentContextClassLoaderPrivileged();
        try {
            WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(aspect.getLoader());
            dep.addAttachment(ServiceTarget.class, phaseContext.getServiceTarget());
            aspect.start(dep);
            dep.removeAttachment(ServiceTarget.class);
        } finally {
            WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(origClassLoader);
        }
    }
}
Also used : Deployment(org.jboss.wsf.spi.deployment.Deployment) DeploymentUnit(org.jboss.as.server.deployment.DeploymentUnit)

Example 89 with DeploymentUnit

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

the class EndpointServiceDeploymentAspect method stop.

@Override
public void stop(Deployment dep) {
    for (final Endpoint ep : dep.getService().getEndpoints()) {
        if (ep.getLifecycleHandler() != null) {
            ep.getLifecycleHandler().stop(ep);
        }
        if (stopServices) {
            final DeploymentUnit unit = getRequiredAttachment(dep, DeploymentUnit.class);
            EndpointService.uninstall(ep, unit);
        }
    }
}
Also used : Endpoint(org.jboss.wsf.spi.deployment.Endpoint) DeploymentUnit(org.jboss.as.server.deployment.DeploymentUnit)

Example 90 with DeploymentUnit

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

the class ModelDeploymentAspect method start.

@Override
public void start(final Deployment dep) {
    final DeploymentUnit unit = dep.getAttachment(DeploymentUnit.class);
    if (unit instanceof WSEndpointDeploymentUnit)
        return;
    final DeploymentResourceSupport deploymentResourceSupport = unit.getAttachment(Attachments.DEPLOYMENT_RESOURCE_SUPPORT);
    for (final Endpoint endpoint : dep.getService().getEndpoints()) {
        final ModelNode endpointModel;
        try {
            endpointModel = deploymentResourceSupport.getDeploymentSubModel(WSExtension.SUBSYSTEM_NAME, PathElement.pathElement(ENDPOINT, URLEncoder.encode(getId(endpoint), "UTF-8")));
        } catch (final UnsupportedEncodingException e) {
            throw new RuntimeException(e);
        }
        endpointModel.get(ENDPOINT_NAME).set(getName(endpoint));
        endpointModel.get(ENDPOINT_CONTEXT).set(getContext(endpoint));
        endpointModel.get(ENDPOINT_CLASS).set(endpoint.getTargetBeanName());
        endpointModel.get(ENDPOINT_TYPE).set(endpoint.getType().toString());
        endpointModel.get(ENDPOINT_WSDL).set(endpoint.getAddress() + "?wsdl");
    }
}
Also used : DeploymentResourceSupport(org.jboss.as.server.deployment.DeploymentResourceSupport) Endpoint(org.jboss.wsf.spi.deployment.Endpoint) WSEndpointDeploymentUnit(org.jboss.as.webservices.publish.WSEndpointDeploymentUnit) UnsupportedEncodingException(java.io.UnsupportedEncodingException) ModelNode(org.jboss.dmr.ModelNode) WSEndpointDeploymentUnit(org.jboss.as.webservices.publish.WSEndpointDeploymentUnit) 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