PageRenderTime 48ms CodeModel.GetById 22ms RepoModel.GetById 0ms app.codeStats 0ms

/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. package org.jboss.as.ee.component.deployers;
  23. import org.jboss.as.ee.structure.DeploymentType;
  24. import org.jboss.as.ee.structure.DeploymentTypeMarker;
  25. import org.jboss.as.server.deployment.Attachments;
  26. import org.jboss.as.server.deployment.DeploymentPhaseContext;
  27. import org.jboss.as.server.deployment.DeploymentUnit;
  28. import org.jboss.as.server.deployment.DeploymentUnitProcessingException;
  29. import org.jboss.as.server.deployment.DeploymentUnitProcessor;
  30. import org.jboss.as.server.deployment.module.ModuleSpecification;
  31. /**
  32. * {@link DeploymentUnitProcessor} responsible for setting the default ear subdeployments isolation for each .ear
  33. * deployment unit. The default is picked up from the EE subsystem and set on the {@link ModuleSpecification} of the deployment unit.
  34. * Unless, the specific deployment unit overrides the isolation via jboss-deployment-structure.xml, this
  35. * default value will be used to setup isolation of the subdeployments within a .ear.
  36. * <p/>
  37. * <b>Note: This deployer must run before the {@link org.jboss.as.server.deployment.module.descriptor.DeploymentStructureDescriptorParser}</b>
  38. *
  39. * @see {@link org.jboss.as.server.deployment.module.descriptor.DeploymentStructureDescriptorParser}
  40. * <p/>
  41. * User: Jaikiran Pai
  42. */
  43. public class DefaultEarSubDeploymentsIsolationProcessor implements DeploymentUnitProcessor {
  44. private volatile boolean earSubDeploymentsIsolated;
  45. public DefaultEarSubDeploymentsIsolationProcessor() {
  46. }
  47. @Override
  48. public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
  49. final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
  50. // we only process .ear
  51. if (!DeploymentTypeMarker.isType(DeploymentType.EAR, deploymentUnit)) {
  52. return;
  53. }
  54. final ModuleSpecification moduleSpecification = deploymentUnit.getAttachment(Attachments.MODULE_SPECIFICATION);
  55. // set the default ear subdeployment isolation value
  56. moduleSpecification.setSubDeploymentModulesIsolated(earSubDeploymentsIsolated);
  57. }
  58. @Override
  59. public void undeploy(DeploymentUnit context) {
  60. }
  61. public void setEarSubDeploymentsIsolated(boolean earSubDeploymentsIsolated) {
  62. this.earSubDeploymentsIsolated = earSubDeploymentsIsolated;
  63. }
  64. }