/jboss-as-7.1.1.Final/ee/src/main/java/org/jboss/as/ee/component/deployers/DefaultEarSubDeploymentsIsolationProcessor.java
Java | 75 lines | 29 code | 11 blank | 35 comment | 1 complexity | 761bd31205417660ad1c9f25bb662ed3 MD5 | raw file
Possible License(s): LGPL-2.1, Apache-2.0
1/*
2 * JBoss, Home of Professional Open Source.
3 * Copyright 2011, Red Hat, Inc., and individual contributors
4 * as indicated by the @author tags. See the copyright.txt file in the
5 * distribution for a full listing of individual contributors.
6 *
7 * This is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU Lesser General Public License as
9 * published by the Free Software Foundation; either version 2.1 of
10 * the License, or (at your option) any later version.
11 *
12 * This software is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this software; if not, write to the Free
19 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21 */
22
23package org.jboss.as.ee.component.deployers;
24
25import org.jboss.as.ee.structure.DeploymentType;
26import org.jboss.as.ee.structure.DeploymentTypeMarker;
27import org.jboss.as.server.deployment.Attachments;
28import org.jboss.as.server.deployment.DeploymentPhaseContext;
29import org.jboss.as.server.deployment.DeploymentUnit;
30import org.jboss.as.server.deployment.DeploymentUnitProcessingException;
31import org.jboss.as.server.deployment.DeploymentUnitProcessor;
32import org.jboss.as.server.deployment.module.ModuleSpecification;
33
34/**
35 * {@link DeploymentUnitProcessor} responsible for setting the default ear subdeployments isolation for each .ear
36 * deployment unit. The default is picked up from the EE subsystem and set on the {@link ModuleSpecification} of the deployment unit.
37 * Unless, the specific deployment unit overrides the isolation via jboss-deployment-structure.xml, this
38 * default value will be used to setup isolation of the subdeployments within a .ear.
39 * <p/>
40 * <b>Note: This deployer must run before the {@link org.jboss.as.server.deployment.module.descriptor.DeploymentStructureDescriptorParser}</b>
41 *
42 * @see {@link org.jboss.as.server.deployment.module.descriptor.DeploymentStructureDescriptorParser}
43 * <p/>
44 * User: Jaikiran Pai
45 */
46public class DefaultEarSubDeploymentsIsolationProcessor implements DeploymentUnitProcessor {
47
48 private volatile boolean earSubDeploymentsIsolated;
49
50 public DefaultEarSubDeploymentsIsolationProcessor() {
51 }
52
53 @Override
54 public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
55 final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
56 // we only process .ear
57 if (!DeploymentTypeMarker.isType(DeploymentType.EAR, deploymentUnit)) {
58 return;
59 }
60 final ModuleSpecification moduleSpecification = deploymentUnit.getAttachment(Attachments.MODULE_SPECIFICATION);
61 // set the default ear subdeployment isolation value
62 moduleSpecification.setSubDeploymentModulesIsolated(earSubDeploymentsIsolated);
63 }
64
65 @Override
66 public void undeploy(DeploymentUnit context) {
67
68 }
69
70 public void setEarSubDeploymentsIsolated(boolean earSubDeploymentsIsolated) {
71 this.earSubDeploymentsIsolated = earSubDeploymentsIsolated;
72 }
73
74
75}