[gatein-commits] gatein SVN: r8517 - in portal/tags/3.2.0-GA/packaging/jboss-as7: extension and 6 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Thu Mar 1 04:14:12 EST 2012


Author: bdaw
Date: 2012-03-01 04:14:09 -0500 (Thu, 01 Mar 2012)
New Revision: 8517

Added:
   portal/tags/3.2.0-GA/packaging/jboss-as7/extension/src/main/java/org/gatein/integration/jboss/as7/GateInCleanupDeploymentProcessor.java
   portal/tags/3.2.0-GA/packaging/jboss-as7/extension/src/main/java/org/gatein/integration/jboss/as7/GateInConfiguration.java
   portal/tags/3.2.0-GA/packaging/jboss-as7/extension/src/main/java/org/gatein/integration/jboss/as7/PortletWarDependencyAdd.java
   portal/tags/3.2.0-GA/packaging/jboss-as7/extension/src/main/java/org/gatein/integration/jboss/as7/PortletWarDependencyDefinition.java
   portal/tags/3.2.0-GA/packaging/jboss-as7/extension/src/main/java/org/gatein/integration/jboss/as7/deployment/GateInConfigurationKey.java
Removed:
   portal/tags/3.2.0-GA/packaging/jboss-as7/extension/src/main/java/org/gatein/integration/jboss/as7/GateInExtensionConfiguration.java
   portal/tags/3.2.0-GA/packaging/jboss-as7/extension/src/main/java/org/gatein/integration/jboss/as7/PortletWarDependancyAdd.java
   portal/tags/3.2.0-GA/packaging/jboss-as7/extension/src/main/java/org/gatein/integration/jboss/as7/PortletWarDependancyDefinition.java
Modified:
   portal/tags/3.2.0-GA/packaging/jboss-as7/README.txt
   portal/tags/3.2.0-GA/packaging/jboss-as7/extension/pom.xml
   portal/tags/3.2.0-GA/packaging/jboss-as7/extension/src/main/java/org/gatein/integration/jboss/as7/Constants.java
   portal/tags/3.2.0-GA/packaging/jboss-as7/extension/src/main/java/org/gatein/integration/jboss/as7/DeploymentArchiveAdd.java
   portal/tags/3.2.0-GA/packaging/jboss-as7/extension/src/main/java/org/gatein/integration/jboss/as7/DeploymentArchiveDefinition.java
   portal/tags/3.2.0-GA/packaging/jboss-as7/extension/src/main/java/org/gatein/integration/jboss/as7/GateInExtension.java
   portal/tags/3.2.0-GA/packaging/jboss-as7/extension/src/main/java/org/gatein/integration/jboss/as7/GateInPortalAdd.java
   portal/tags/3.2.0-GA/packaging/jboss-as7/extension/src/main/java/org/gatein/integration/jboss/as7/GateInPortalDefinition.java
   portal/tags/3.2.0-GA/packaging/jboss-as7/extension/src/main/java/org/gatein/integration/jboss/as7/GateInSubsystemAdd.java
   portal/tags/3.2.0-GA/packaging/jboss-as7/extension/src/main/java/org/gatein/integration/jboss/as7/GateInSubsystemDefinition.java
   portal/tags/3.2.0-GA/packaging/jboss-as7/extension/src/main/java/org/gatein/integration/jboss/as7/GateInSubsystemParser.java
   portal/tags/3.2.0-GA/packaging/jboss-as7/extension/src/main/java/org/gatein/integration/jboss/as7/deployment/GateInDependenciesDeploymentProcessor.java
   portal/tags/3.2.0-GA/packaging/jboss-as7/extension/src/main/java/org/gatein/integration/jboss/as7/deployment/GateInInitDeploymentProcessor.java
   portal/tags/3.2.0-GA/packaging/jboss-as7/extension/src/main/java/org/gatein/integration/jboss/as7/deployment/GateInStarterDeploymentProcessor.java
   portal/tags/3.2.0-GA/packaging/jboss-as7/extension/src/main/java/org/gatein/integration/jboss/as7/deployment/GateInStructureDeploymentProcessor.java
   portal/tags/3.2.0-GA/packaging/jboss-as7/extension/src/main/java/org/gatein/integration/jboss/as7/deployment/PortletWarClassloadingDependencyProcessor.java
   portal/tags/3.2.0-GA/packaging/jboss-as7/extension/src/main/java/org/gatein/integration/jboss/as7/deployment/PortletWarDeploymentInitializingProcessor.java
   portal/tags/3.2.0-GA/packaging/jboss-as7/extension/src/main/java/org/gatein/integration/jboss/as7/deployment/WarDependenciesDeploymentProcessor.java
   portal/tags/3.2.0-GA/packaging/jboss-as7/extension/src/main/java/org/gatein/integration/jboss/as7/web/InitService.java
   portal/tags/3.2.0-GA/packaging/jboss-as7/modules/pom.xml
   portal/tags/3.2.0-GA/packaging/jboss-as7/pkg/pom.xml
   portal/tags/3.2.0-GA/packaging/jboss-as7/pkg/src/main/resources/jboss/standalone/configuration/standalone.xml
Log:
AS7 packaging fixes

Modified: portal/tags/3.2.0-GA/packaging/jboss-as7/README.txt
===================================================================
--- portal/tags/3.2.0-GA/packaging/jboss-as7/README.txt	2012-03-01 06:06:47 UTC (rev 8516)
+++ portal/tags/3.2.0-GA/packaging/jboss-as7/README.txt	2012-03-01 09:14:09 UTC (rev 8517)
@@ -35,7 +35,6 @@
 - <distributable/> is not yet supported
 - Sample ears have been repackaged as their current default packaging is not supported
 - Exception occurs, and is ignored when logging out (EXOJCR-1619)
-- 'gatein' subsystem configuration in standalone.xml is ignored
 
 
 
@@ -46,8 +45,8 @@
 
 Checkout the dependencies sources from sandbox:
 
-svn co http://anonsvn.jboss.org/repos/gatein/sandbox/as7_support/tags/AS7-Beta03
-cd AS7-Beta03
+svn co http://anonsvn.jboss.org/repos/gatein/sandbox/as7_support/tags/AS7-Beta03 gatein-sandbox-AS7-Beta03
+cd gatein-sandbox-AS7-Beta03
 
 This will checkout specific versions of wci and exo.kernel.container, and a new gatein-naming component.
 
@@ -63,18 +62,19 @@
 mvn clean install -Dmaven.test.skip
 
 
-Now that we have built the new dependencies let’s checkout GateIn Portal trunk:
+Now that we have built the new dependencies let’s checkout GateIn Portal tag:
 cd ../..
 
-svn co http://anonsvn.jboss.org/repos/gatein/portal/trunk gatein-portal
-cd gatein-portal
+svn co http://anonsvn.jboss.org/repos/gatein/portal/tags/3.2.0-GA gatein-portal-3.2.0-GA
+cd gatein-portal-3.2.0-GA
 
 If you have built gatein portal before, you can skip the tests by adding '-Dmaven.test.skip' to the next command:
 
 mvn clean install
 
 
-Set CONTAINERS_DIR env variable to point to a directory containing your application servers (i.e. export CONTAINERS_DIR=$HOME/devel/containers). If you already have ‘jboss-as-7.1.0.Final’ in your CONTAINERS_DIR, then remove ‘,download’ from the next command:
+Set CONTAINERS_DIR env variable to point to a directory containing your application servers (i.e. export CONTAINERS_DIR=$HOME/devel/containers). 
+If you already have ‘jboss-as-7.1.0.Final’ in your CONTAINERS_DIR, then remove ‘,download’ from the next command:
 
 cd packaging/jboss-as7
 mvn clean install -Ppkg-jbossas7,download -Dexo.projects.directory.dependencies=$CONTAINERS_DIR
@@ -88,7 +88,48 @@
 
 
 
+Access default portal at: http://localhost:8080/portal
 
+Access sample portal at: http://localhost:8080/sample-portal
+
+
+
+
+Customizing
+===========
+
+Packaging deploys a basic GateIn portal (gatein.ear), but also a sample portal extension, a sample portal site bound to a separate context, and a sample skin.
+
+Samples archives can be removed, and custom portal extension archives can be added. Currently GateIn subsystem has to know about extensions in advance.
+This is configured via JBOSS_HOME/standalone/configuration/standalone.xml which contains the following default configuration:
+
+       <subsystem xmlns="urn:jboss:domain:gatein:1.0">
+            <deployment-archives>
+                <archive name="gatein.ear" main="true"/>
+                <archive name="gatein-sample-extension.ear"/>
+                <archive name="gatein-sample-portal.ear"/>
+                <archive name="gatein-sample-skin.war"/>
+            </deployment-archives>
+            <portlet-war-dependencies>
+                <dependency name="org.gatein.wci"/>
+                <dependency name="org.gatein.pc"/>
+                <dependency name="javax.portlet.api"/>
+            </portlet-war-dependencies>
+        </subsystem>
+
+The <deployment-archives> section contains a list of GateIn portal extensions. These are archives constructed specifically to 'plug into' GateIn portal. To that end they contain a special configuration.
+
+The archives in the list have to be deployed in JBOSS_HOME/standalone/deployments, otherwise GateIn portal won't start. So, if you want to remove some or all of the samples, it's not enough to just remove the archives from 'deployments' directory. Archive references also have to be removed from <deployment-archives> section of standalone.xml.
+
+Similarly, when deploying any additional GateIn portal extension archive it has to be referenced via <archive> entry in <deployment-archives> section in standalone.xml.
+
+On the other hand, user applications that only provide portlets, can simply be deployed as any web archive by dropping them into 'deployments' directory WITHOUT having to reference them in 'gatein' subsystem section of standalone.xml.
+
+
+Portlet-war-dependency section allows customizing which modules are automatically made available to portlet archives (.war arhives containing portlet.xml), so that they can be deployed without any explicit JBoss modules configuration (i.e. Dependencies attribute in MANIFEST.MF, or jboss-deployment-structure.xml)
+
+
+
 Help
 ====
 

Modified: portal/tags/3.2.0-GA/packaging/jboss-as7/extension/pom.xml
===================================================================
--- portal/tags/3.2.0-GA/packaging/jboss-as7/extension/pom.xml	2012-03-01 06:06:47 UTC (rev 8516)
+++ portal/tags/3.2.0-GA/packaging/jboss-as7/extension/pom.xml	2012-03-01 09:14:09 UTC (rev 8517)
@@ -92,4 +92,4 @@
          </plugin>
       </plugins>
    </build>
-</project>
\ No newline at end of file
+</project>

Modified: portal/tags/3.2.0-GA/packaging/jboss-as7/extension/src/main/java/org/gatein/integration/jboss/as7/Constants.java
===================================================================
--- portal/tags/3.2.0-GA/packaging/jboss-as7/extension/src/main/java/org/gatein/integration/jboss/as7/Constants.java	2012-03-01 06:06:47 UTC (rev 8516)
+++ portal/tags/3.2.0-GA/packaging/jboss-as7/extension/src/main/java/org/gatein/integration/jboss/as7/Constants.java	2012-03-01 09:14:09 UTC (rev 8517)
@@ -39,4 +39,5 @@
    // MDR operations constants 
    String DEPLOYMENT_ARCHIVE = "deployment-archive";
    String PORTLET_WAR_DEPENDENCY = "portlet-war-dependency";
+   String TRUE = "true";
 }

Modified: portal/tags/3.2.0-GA/packaging/jboss-as7/extension/src/main/java/org/gatein/integration/jboss/as7/DeploymentArchiveAdd.java
===================================================================
--- portal/tags/3.2.0-GA/packaging/jboss-as7/extension/src/main/java/org/gatein/integration/jboss/as7/DeploymentArchiveAdd.java	2012-03-01 06:06:47 UTC (rev 8516)
+++ portal/tags/3.2.0-GA/packaging/jboss-as7/extension/src/main/java/org/gatein/integration/jboss/as7/DeploymentArchiveAdd.java	2012-03-01 09:14:09 UTC (rev 8517)
@@ -22,18 +22,27 @@
 package org.gatein.integration.jboss.as7;
 
 import org.jboss.as.controller.AbstractAddStepHandler;
+import org.jboss.as.controller.OperationContext;
 import org.jboss.as.controller.OperationFailedException;
+import org.jboss.as.controller.ServiceVerificationHandler;
 import org.jboss.dmr.ModelNode;
+import org.jboss.dmr.Property;
+import org.jboss.msc.service.ServiceController;
 
+import java.util.List;
+
+import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.OP_ADDR;
+
 /**
  * @author <a href="mailto:mstrukel at redhat.com">Marko Strukelj</a>
  */
 public class DeploymentArchiveAdd extends AbstractAddStepHandler
 {
-   public static final DeploymentArchiveAdd INSTANCE = new DeploymentArchiveAdd();
+   private GateInConfiguration config;
 
-   private DeploymentArchiveAdd()
+   DeploymentArchiveAdd(GateInConfiguration config)
    {
+      this.config = config;
    }
 
    @Override
@@ -41,4 +50,19 @@
    {
       DeploymentArchiveDefinition.MAIN.validateAndSet(operation,model);
    }
+
+   @Override
+   protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model, ServiceVerificationHandler verificationHandler, List<ServiceController<?>> newControllers) throws OperationFailedException
+   {
+      ModelNode addr = operation.get(OP_ADDR);
+      if (!addr.hasDefined(1))
+         throw new IllegalArgumentException("Invalid submodel address: " + addr);
+
+      Property prop = addr.get(1).asProperty();
+      if (!Constants.DEPLOYMENT_ARCHIVE.equals(prop.getName()))
+         throw new IllegalArgumentException("Invalid submodel address: " + addr);
+
+      ModelNode main = operation.get(Constants.MAIN);
+      config.addDeploymentArchive(prop.getValue().asString(), main.isDefined() && main.asBoolean());
+   }
 }

Modified: portal/tags/3.2.0-GA/packaging/jboss-as7/extension/src/main/java/org/gatein/integration/jboss/as7/DeploymentArchiveDefinition.java
===================================================================
--- portal/tags/3.2.0-GA/packaging/jboss-as7/extension/src/main/java/org/gatein/integration/jboss/as7/DeploymentArchiveDefinition.java	2012-03-01 06:06:47 UTC (rev 8516)
+++ portal/tags/3.2.0-GA/packaging/jboss-as7/extension/src/main/java/org/gatein/integration/jboss/as7/DeploymentArchiveDefinition.java	2012-03-01 09:14:09 UTC (rev 8517)
@@ -36,8 +36,6 @@
  */
 public class DeploymentArchiveDefinition extends SimpleResourceDefinition
 {
-   protected static final DeploymentArchiveDefinition INSTANCE = new DeploymentArchiveDefinition();
-
    protected static final SimpleAttributeDefinition MAIN =
       new SimpleAttributeDefinitionBuilder(Constants.MAIN, ModelType.BOOLEAN, true)
          .setAllowExpression(false)
@@ -46,11 +44,11 @@
          .setFlags(AttributeAccess.Flag.RESTART_ALL_SERVICES)
          .build();
 
-   private DeploymentArchiveDefinition()
+   DeploymentArchiveDefinition(GateInConfiguration config)
    {
       super(PathElement.pathElement(Constants.DEPLOYMENT_ARCHIVE),
          GateInExtension.getResourceDescriptionResolver(Constants.DEPLOYMENT_ARCHIVE),
-         DeploymentArchiveAdd.INSTANCE, new ReloadRequiredRemoveStepHandler());
+         new DeploymentArchiveAdd(config), new ReloadRequiredRemoveStepHandler());
    }
 
    @Override

Added: portal/tags/3.2.0-GA/packaging/jboss-as7/extension/src/main/java/org/gatein/integration/jboss/as7/GateInCleanupDeploymentProcessor.java
===================================================================
--- portal/tags/3.2.0-GA/packaging/jboss-as7/extension/src/main/java/org/gatein/integration/jboss/as7/GateInCleanupDeploymentProcessor.java	                        (rev 0)
+++ portal/tags/3.2.0-GA/packaging/jboss-as7/extension/src/main/java/org/gatein/integration/jboss/as7/GateInCleanupDeploymentProcessor.java	2012-03-01 09:14:09 UTC (rev 8517)
@@ -0,0 +1,55 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2012, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.gatein.integration.jboss.as7;
+
+import org.gatein.integration.jboss.as7.deployment.GateInConfigurationKey;
+import org.gatein.integration.jboss.as7.deployment.GateInEarKey;
+import org.gatein.integration.jboss.as7.deployment.GateInExtKey;
+import org.gatein.integration.jboss.as7.deployment.PortletWarKey;
+import org.jboss.as.server.deployment.DeploymentPhaseContext;
+import org.jboss.as.server.deployment.DeploymentUnit;
+import org.jboss.as.server.deployment.DeploymentUnitProcessingException;
+import org.jboss.as.server.deployment.DeploymentUnitProcessor;
+
+/**
+ * @author <a href="mailto:mstrukel at redhat.com">Marko Strukelj</a>
+ */
+public class GateInCleanupDeploymentProcessor implements DeploymentUnitProcessor
+{
+   @Override
+   public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException
+   {
+      final DeploymentUnit du = phaseContext.getDeploymentUnit();
+      Object config = du.removeAttachment(GateInConfigurationKey.KEY);
+      if (config != null)
+      {
+         du.removeAttachment(PortletWarKey.INSTANCE);
+         du.removeAttachment(GateInEarKey.KEY);
+         du.removeAttachment(GateInExtKey.KEY);
+      }
+   }
+
+   @Override
+   public void undeploy(DeploymentUnit context)
+   {
+   }
+}

Added: portal/tags/3.2.0-GA/packaging/jboss-as7/extension/src/main/java/org/gatein/integration/jboss/as7/GateInConfiguration.java
===================================================================
--- portal/tags/3.2.0-GA/packaging/jboss-as7/extension/src/main/java/org/gatein/integration/jboss/as7/GateInConfiguration.java	                        (rev 0)
+++ portal/tags/3.2.0-GA/packaging/jboss-as7/extension/src/main/java/org/gatein/integration/jboss/as7/GateInConfiguration.java	2012-03-01 09:14:09 UTC (rev 8517)
@@ -0,0 +1,144 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.gatein.integration.jboss.as7;
+
+import org.gatein.integration.jboss.as7.deployment.GateInEarKey;
+import org.gatein.integration.jboss.as7.deployment.GateInExtKey;
+import org.gatein.integration.jboss.as7.deployment.PortletWarKey;
+import org.jboss.as.server.deployment.DeploymentUnit;
+import org.jboss.as.server.deployment.module.ModuleDependency;
+import org.jboss.dmr.ModelNode;
+import org.jboss.dmr.Property;
+import org.jboss.modules.Module;
+import org.jboss.modules.ModuleIdentifier;
+import org.jboss.modules.ModuleLoader;
+import org.jboss.msc.service.ServiceName;
+
+import java.util.*;
+
+/**
+ * @author <a href="mailto:mstrukel at redhat.com">Marko Strukelj</a>
+ */
+public class GateInConfiguration
+{
+   private Set<ModuleIdentifier> extModules = new HashSet<ModuleIdentifier>();
+
+   private Set<ModuleDependency> portletWarDependencies = new LinkedHashSet<ModuleDependency>();
+
+   private ModuleIdentifier earModule;
+
+   private final List<ServiceName> childWars = new ArrayList<ServiceName>();
+
+   private final List<ServiceName> childSubUnits = new ArrayList<ServiceName>();
+
+   final ModuleLoader moduleLoader = Module.getBootModuleLoader();
+
+   GateInConfiguration()
+   {
+   }
+   
+   public synchronized void addDeploymentArchive(String archive, boolean main)
+   {
+      String moduleId = "deployment." + archive;
+      extModules.add(ModuleIdentifier.create(moduleId));
+      if (main)
+         earModule = ModuleIdentifier.create(moduleId);
+   }
+   
+   public synchronized void addPortletWarDependency(String dependency, boolean importSvcs)
+   {
+      String [] parts = parseNameSlotPair(dependency);
+      portletWarDependencies.add(new ModuleDependency(moduleLoader, ModuleIdentifier.create(parts[0], parts[1]), false, false, importSvcs, true));
+   }
+
+   public synchronized Set<ModuleIdentifier> getGateInExtModules()
+   {
+      return Collections.unmodifiableSet(new HashSet<ModuleIdentifier>(extModules));
+   }
+
+   public synchronized Set<ModuleDependency> getPortletWarDependencies()
+   {
+      return Collections.unmodifiableSet(new LinkedHashSet<ModuleDependency>(portletWarDependencies));
+   }
+
+   public ModuleIdentifier getGateInEarModule()
+   {
+      return earModule;
+   }
+
+   public synchronized List<ServiceName> getChildWars()
+   {
+      return Collections.unmodifiableList(new ArrayList(childWars));
+   }
+
+   public synchronized void addChildWar(ServiceName deploymentServiceName) {
+      childWars.add(deploymentServiceName);
+   }
+    
+   public synchronized List<ServiceName> getChildSubUnits()
+   {
+      return Collections.unmodifiableList(new ArrayList(childSubUnits));
+   }
+
+   public synchronized List<String> getChildSubUnitComponentPrefixes()
+   {
+      LinkedList<String> ret = new LinkedList<String>();
+      for (ServiceName name : childSubUnits)
+      {
+         ret.add(name.getCanonicalName() + ".component.");
+      }
+      return ret;
+   }
+
+   public synchronized void addChildSubUnit(ServiceName serviceName) {
+      childSubUnits.add(serviceName);
+   }
+
+   private static String[] parseNameSlotPair(String name)
+   {
+      String [] parts = name.split(":");
+      if (parts.length == 2)
+         return parts;
+      return new String[] {parts[0], null};
+   }
+
+   public static boolean isGateInArchive(DeploymentUnit du)
+   {
+      return du.getAttachment(GateInEarKey.KEY) != null
+            || du.getAttachment(GateInExtKey.KEY) != null;
+   }
+
+   public static boolean isPortletArchive(DeploymentUnit du)
+   {
+      return du.getAttachment(PortletWarKey.INSTANCE) != null;
+   }
+
+   public static boolean isNonGateInPortletArchive(DeploymentUnit du)
+   {
+      return !isGateInArchive(du) && isPortletArchive(du);
+   }
+
+   public static boolean isGateInOrPortletArchive(DeploymentUnit du)
+   {
+      return isGateInArchive(du) || isPortletArchive(du);
+   }
+}

Modified: portal/tags/3.2.0-GA/packaging/jboss-as7/extension/src/main/java/org/gatein/integration/jboss/as7/GateInExtension.java
===================================================================
--- portal/tags/3.2.0-GA/packaging/jboss-as7/extension/src/main/java/org/gatein/integration/jboss/as7/GateInExtension.java	2012-03-01 06:06:47 UTC (rev 8516)
+++ portal/tags/3.2.0-GA/packaging/jboss-as7/extension/src/main/java/org/gatein/integration/jboss/as7/GateInExtension.java	2012-03-01 09:14:09 UTC (rev 8517)
@@ -70,12 +70,14 @@
    {
       log.debug("Activating GateIn Extension");
       final SubsystemRegistration subsystem = context.registerSubsystem(SUBSYSTEM_NAME);
-      final ManagementResourceRegistration registration = subsystem.registerSubsystemModel(GateInSubsystemDefinition.INSTANCE);
+      final GateInConfiguration config = new GateInConfiguration();
+      final ManagementResourceRegistration registration = subsystem.registerSubsystemModel(new GateInSubsystemDefinition(config));
       registration.registerOperationHandler(DESCRIBE, GenericSubsystemDescribeHandler.INSTANCE, GenericSubsystemDescribeHandler.INSTANCE, false, OperationEntry.EntryType.PRIVATE);
-      registration.registerSubModel(DeploymentArchiveDefinition.INSTANCE);
-      registration.registerSubModel(PortletWarDependancyDefinition.INSTANCE);
-      registration.registerSubModel(new GateInPortalDefinition(DEFAULT_PORTAL_NAME));
 
+      registration.registerSubModel(new DeploymentArchiveDefinition(config));
+      registration.registerSubModel(new PortletWarDependencyDefinition(config));
+      registration.registerSubModel(new GateInPortalDefinition(config, DEFAULT_PORTAL_NAME));
+
       subsystem.registerXMLElementWriter(GateInSubsystemParser.getInstance());
    }
 

Deleted: portal/tags/3.2.0-GA/packaging/jboss-as7/extension/src/main/java/org/gatein/integration/jboss/as7/GateInExtensionConfiguration.java
===================================================================
--- portal/tags/3.2.0-GA/packaging/jboss-as7/extension/src/main/java/org/gatein/integration/jboss/as7/GateInExtensionConfiguration.java	2012-03-01 06:06:47 UTC (rev 8516)
+++ portal/tags/3.2.0-GA/packaging/jboss-as7/extension/src/main/java/org/gatein/integration/jboss/as7/GateInExtensionConfiguration.java	2012-03-01 09:14:09 UTC (rev 8517)
@@ -1,199 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2011, Red Hat, Inc., and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.gatein.integration.jboss.as7;
-
-import org.gatein.integration.jboss.as7.deployment.GateInEarKey;
-import org.gatein.integration.jboss.as7.deployment.GateInExtKey;
-import org.gatein.integration.jboss.as7.deployment.PortletWarKey;
-import org.jboss.as.server.deployment.DeploymentUnit;
-import org.jboss.as.server.deployment.module.ModuleDependency;
-import org.jboss.dmr.ModelNode;
-import org.jboss.dmr.Property;
-import org.jboss.modules.Module;
-import org.jboss.modules.ModuleIdentifier;
-import org.jboss.modules.ModuleLoader;
-import org.jboss.msc.service.ServiceName;
-
-import java.util.*;
-
-/**
- * @author <a href="mailto:mstrukel at redhat.com">Marko Strukelj</a>
- */
-public class GateInExtensionConfiguration
-{
-   public static final GateInExtensionConfiguration INSTANCE = new GateInExtensionConfiguration();
-
-   private Set<ModuleIdentifier> extModules;
-
-   private Set<ModuleDependency> portletWarDependencies;
-
-   private ModuleIdentifier earModule = ModuleIdentifier.create("deployment.gatein.ear");
-
-   private final List<ServiceName> childWars = new LinkedList<ServiceName>();
-
-   private final List<ServiceName> childSubUnits = new LinkedList<ServiceName>();
-
-   final ModuleLoader moduleLoader = Module.getBootModuleLoader();
-
-   private GateInExtensionConfiguration()
-   {
-      Set<ModuleIdentifier> set = new LinkedHashSet<ModuleIdentifier>();
-      set.add(ModuleIdentifier.create("deployment.gatein-sample-extension.ear"));
-      set.add(ModuleIdentifier.create("deployment.gatein-sample-portal.ear"));
-      set.add(ModuleIdentifier.create("deployment.gatein-sample-skin.war"));
-      //set.add(ModuleIdentifier.create("deployment.gatein-wsrp-integration.ear"));
-      extModules = Collections.unmodifiableSet(set);
-
-      Set<ModuleDependency> dset = new LinkedHashSet<ModuleDependency>();
-      dset.add(new ModuleDependency(moduleLoader, ModuleIdentifier.create("org.gatein.wci"), false, false, false, false));
-      dset.add(new ModuleDependency(moduleLoader, ModuleIdentifier.create("org.gatein.pc"), false, false, false, false));
-      dset.add(new ModuleDependency(moduleLoader, ModuleIdentifier.create("javax.portlet.api"), false, false, false, false));
-      portletWarDependencies = Collections.unmodifiableSet(dset);
-   }
-
-   public Set<ModuleIdentifier> getGateInExtModules()
-   {
-      return extModules;
-   }
-
-   public Set<ModuleDependency> getPortletWarDependencies()
-   {
-      return portletWarDependencies;
-   }
-
-   public ModuleIdentifier getGateInEarModule()
-   {
-      return earModule;
-   }
-
-   public void setGateInEarModule(ModuleIdentifier modules)
-   {
-      this.earModule = modules;
-   }
-
-   public synchronized List<ServiceName> getChildWars()
-   {
-      return Collections.unmodifiableList(childWars);
-   }
-
-   public synchronized void addChildWar(ServiceName deploymentServiceName) {
-      childWars.add(deploymentServiceName);
-   }
-    
-   public synchronized List<ServiceName> getChildSubUnits()
-   {
-      return Collections.unmodifiableList(childSubUnits);
-   }
-
-   public synchronized List<String> getChildSubUnitComponentPrefixes()
-   {
-      LinkedList<String> ret = new LinkedList<String>();
-      for (ServiceName name : childSubUnits)
-      {
-         ret.add(name.getCanonicalName() + ".component.");
-      }
-      return ret;
-   }
-
-   public synchronized void addChildSubUnit(ServiceName serviceName) {
-      childSubUnits.add(serviceName);
-   }
-
-   public void setConfigurationFromModel(ModelNode model)
-   {
-      ModelNode archives = model.get(Constants.DEPLOYMENT_ARCHIVES);
-      if (archives.isDefined())
-      {
-         Set<ModuleIdentifier> set = new LinkedHashSet<ModuleIdentifier>();
-
-         for (Property p: archives.asPropertyList())
-         {
-            boolean isMain = false;
-            if (p.getValue().isDefined())
-            {
-               for (Property attr: p.getValue().asPropertyList())
-               {
-                  if (Constants.MAIN.equals(attr.getName()))
-                     isMain = true;
-               }
-            }
-            if (isMain)
-               earModule = ModuleIdentifier.create("deployment." + p.getName());
-            else
-               set.add(ModuleIdentifier.create("deployment." + p.getName()));
-         }
-         extModules = Collections.unmodifiableSet(set);
-      }
-
-      ModelNode deps = model.get(Constants.PORTLET_WAR_DEPENDENCIES);
-      if (deps.isDefined())
-      {
-         Set<ModuleDependency> dset = new LinkedHashSet<ModuleDependency>();
-
-         for (Property p: deps.asPropertyList())
-         {
-            boolean importSvcs = false;
-            if (p.getValue().isDefined())
-            {
-               for (Property attr: p.getValue().asPropertyList())
-               {
-                  if (Constants.IMPORT_SERVICES.equals(attr.getName()))
-                     importSvcs = true;
-               }
-            }
-            String [] parts = parseNameSlotPair(p.getName());
-            dset.add(new ModuleDependency(moduleLoader, ModuleIdentifier.create(parts[0], parts[1]), false, false, importSvcs, true));
-            // TODO: add optional, and exports
-         }
-         portletWarDependencies = Collections.unmodifiableSet(dset);
-      }
-   }
-
-   private String[] parseNameSlotPair(String name)
-   {
-      String [] parts = name.split(":");
-      if (parts.length == 2)
-         return parts;
-      return new String[] {parts[0], null};
-   }
-
-   public boolean isGateInArchive(DeploymentUnit du)
-   {
-      return du.getAttachment(GateInEarKey.KEY) != null
-            || du.getAttachment(GateInExtKey.KEY) != null;
-   }
-
-   public boolean isPortletArchive(DeploymentUnit du)
-   {
-      return du.getAttachment(PortletWarKey.INSTANCE) != null;
-   }
-
-   public boolean isNonGateInPortletArchive(DeploymentUnit du)
-   {
-      return !isGateInArchive(du) && isPortletArchive(du);
-   }
-
-   public boolean isGateInOrPortletArchive(DeploymentUnit du)
-   {
-      return isGateInArchive(du) || isPortletArchive(du);
-   }
-}

Modified: portal/tags/3.2.0-GA/packaging/jboss-as7/extension/src/main/java/org/gatein/integration/jboss/as7/GateInPortalAdd.java
===================================================================
--- portal/tags/3.2.0-GA/packaging/jboss-as7/extension/src/main/java/org/gatein/integration/jboss/as7/GateInPortalAdd.java	2012-03-01 06:06:47 UTC (rev 8516)
+++ portal/tags/3.2.0-GA/packaging/jboss-as7/extension/src/main/java/org/gatein/integration/jboss/as7/GateInPortalAdd.java	2012-03-01 09:14:09 UTC (rev 8517)
@@ -25,6 +25,7 @@
 import org.jboss.as.controller.OperationContext;
 import org.jboss.as.controller.OperationFailedException;
 import org.jboss.as.controller.ServiceVerificationHandler;
+import org.jboss.as.controller.registry.Resource;
 import org.jboss.dmr.ModelNode;
 import org.jboss.msc.service.ServiceController;
 
@@ -35,22 +36,17 @@
  */
 public class GateInPortalAdd extends AbstractAddStepHandler
 {
-   protected static final GateInPortalAdd INSTANCE = new GateInPortalAdd();
+   private GateInConfiguration config;
 
-   private GateInPortalAdd()
+   GateInPortalAdd(GateInConfiguration config)
    {
+      this.config = config;
    }
 
    @Override
    protected void populateModel(ModelNode operation, ModelNode model) throws OperationFailedException
    {
-      /* noop */
+      // DO NOTHING
    }
-
-   @Override
-   protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model, ServiceVerificationHandler verificationHandler, List<ServiceController<?>> newControllers) throws OperationFailedException
-   {
-      super.performRuntime(context, operation, model, verificationHandler, newControllers);
-   }
 }
 

Modified: portal/tags/3.2.0-GA/packaging/jboss-as7/extension/src/main/java/org/gatein/integration/jboss/as7/GateInPortalDefinition.java
===================================================================
--- portal/tags/3.2.0-GA/packaging/jboss-as7/extension/src/main/java/org/gatein/integration/jboss/as7/GateInPortalDefinition.java	2012-03-01 06:06:47 UTC (rev 8516)
+++ portal/tags/3.2.0-GA/packaging/jboss-as7/extension/src/main/java/org/gatein/integration/jboss/as7/GateInPortalDefinition.java	2012-03-01 09:14:09 UTC (rev 8517)
@@ -31,11 +31,11 @@
 public class GateInPortalDefinition extends SimpleResourceDefinition
 {
 
-   protected GateInPortalDefinition(String portalName)
+   GateInPortalDefinition(GateInConfiguration config, String portalName)
    {
       super(PathElement.pathElement(Constants.PORTAL, portalName),
          GateInExtension.getResourceDescriptionResolver(Constants.PORTAL),
-         GateInPortalAdd.INSTANCE, new ReloadRequiredRemoveStepHandler()
+         new GateInPortalAdd(config), new ReloadRequiredRemoveStepHandler()
       );
    }
 }

Modified: portal/tags/3.2.0-GA/packaging/jboss-as7/extension/src/main/java/org/gatein/integration/jboss/as7/GateInSubsystemAdd.java
===================================================================
--- portal/tags/3.2.0-GA/packaging/jboss-as7/extension/src/main/java/org/gatein/integration/jboss/as7/GateInSubsystemAdd.java	2012-03-01 06:06:47 UTC (rev 8516)
+++ portal/tags/3.2.0-GA/packaging/jboss-as7/extension/src/main/java/org/gatein/integration/jboss/as7/GateInSubsystemAdd.java	2012-03-01 09:14:09 UTC (rev 8517)
@@ -53,14 +53,18 @@
    static final int INSTALL_GATEIN_CHILD_WARS = 0x4000;
    static final int INSTALL_GATEIN_START = 0x4000;
    static final int MANIFEST_DEPENDENCIES_GATEIN = 0x4000;
+   static final int CLEANUP_ATTACHMENTS = 0x4000;
 
-   protected GateInSubsystemAdd()
+   private GateInConfiguration config;
+
+   protected GateInSubsystemAdd(GateInConfiguration config)
    {
+      this.config = config;
    }
 
    protected void populateModel(ModelNode operation, ModelNode model)
    {
-      /* noop */
+      // DO NOTHING
    }
 
    protected void performBoottime(OperationContext context, ModelNode operation, ModelNode model,
@@ -73,14 +77,15 @@
          {
             final SharedPortletTldsMetaDataBuilder tldsBuilder = new SharedPortletTldsMetaDataBuilder();
 
-            processorTarget.addDeploymentProcessor(Phase.STRUCTURE, STRUCTURE_GATEIN, new GateInStructureDeploymentProcessor());
-            processorTarget.addDeploymentProcessor(Phase.PARSE, STRUCTURE_PORTLET_WAR_DEPLOYMENT_INIT, new PortletWarDeploymentInitializingProcessor());
+            processorTarget.addDeploymentProcessor(Phase.STRUCTURE, STRUCTURE_GATEIN, new GateInStructureDeploymentProcessor(config));
+            processorTarget.addDeploymentProcessor(Phase.PARSE, STRUCTURE_PORTLET_WAR_DEPLOYMENT_INIT, new PortletWarDeploymentInitializingProcessor(config));
             processorTarget.addDeploymentProcessor(Phase.PARSE, MANIFEST_DEPENDENCIES_GATEIN, new GateInDependenciesDeploymentProcessor());
             processorTarget.addDeploymentProcessor(Phase.PARSE, INSTALL_GATEIN_CHILD_WARS, new WarDependenciesDeploymentProcessor());
 
             processorTarget.addDeploymentProcessor(Phase.DEPENDENCIES, DEPENDENCIES_PORTLET_MODULE, new PortletWarClassloadingDependencyProcessor(tldsBuilder.create()));
             processorTarget.addDeploymentProcessor(Phase.POST_MODULE, POST_MODULE_GATEIN_INIT, new GateInInitDeploymentProcessor());
             processorTarget.addDeploymentProcessor(Phase.INSTALL, INSTALL_GATEIN_START, new GateInStarterDeploymentProcessor());
+            processorTarget.addDeploymentProcessor(Phase.CLEANUP, CLEANUP_ATTACHMENTS, new GateInCleanupDeploymentProcessor());
          }
       }, OperationContext.Stage.RUNTIME);
    }

Modified: portal/tags/3.2.0-GA/packaging/jboss-as7/extension/src/main/java/org/gatein/integration/jboss/as7/GateInSubsystemDefinition.java
===================================================================
--- portal/tags/3.2.0-GA/packaging/jboss-as7/extension/src/main/java/org/gatein/integration/jboss/as7/GateInSubsystemDefinition.java	2012-03-01 06:06:47 UTC (rev 8516)
+++ portal/tags/3.2.0-GA/packaging/jboss-as7/extension/src/main/java/org/gatein/integration/jboss/as7/GateInSubsystemDefinition.java	2012-03-01 09:14:09 UTC (rev 8517)
@@ -42,19 +42,20 @@
  */
 public class GateInSubsystemDefinition extends SimpleResourceDefinition
 {
-   protected static GateInSubsystemDefinition INSTANCE = new GateInSubsystemDefinition();
+   private GateInConfiguration config;
 
-   private GateInSubsystemDefinition()
+   GateInSubsystemDefinition(GateInConfiguration config)
    {
       super(PathElement.pathElement(ModelDescriptionConstants.SUBSYSTEM, GateInExtension.SUBSYSTEM_NAME),
          GateInExtension.getResourceDescriptionResolver(GateInExtension.SUBSYSTEM_NAME));
+      this.config = config;
    }
 
    @Override
    public void registerOperations(final ManagementResourceRegistration registration)
    {
-      final GateInSubsystemAdd subsystemAdd = new GateInSubsystemAdd();
-      final ResourceDescriptionResolver rootResolver = GateInSubsystemDefinition.INSTANCE.getResourceDescriptionResolver();
+      final GateInSubsystemAdd subsystemAdd = new GateInSubsystemAdd(config);
+      final ResourceDescriptionResolver rootResolver = getResourceDescriptionResolver();
       final DescriptionProvider subsystemAddDescription = new DefaultResourceAddDescriptionProvider(registration, rootResolver);
       registration.registerOperationHandler(ADD, subsystemAdd, subsystemAddDescription, EnumSet.of(OperationEntry.Flag.RESTART_ALL_SERVICES));
       registration.registerOperationHandler(REMOVE, ReloadRequiredRemoveStepHandler.INSTANCE, new DefaultResourceRemoveDescriptionProvider(rootResolver), EnumSet.of(OperationEntry.Flag.RESTART_ALL_SERVICES));

Modified: portal/tags/3.2.0-GA/packaging/jboss-as7/extension/src/main/java/org/gatein/integration/jboss/as7/GateInSubsystemParser.java
===================================================================
--- portal/tags/3.2.0-GA/packaging/jboss-as7/extension/src/main/java/org/gatein/integration/jboss/as7/GateInSubsystemParser.java	2012-03-01 06:06:47 UTC (rev 8516)
+++ portal/tags/3.2.0-GA/packaging/jboss-as7/extension/src/main/java/org/gatein/integration/jboss/as7/GateInSubsystemParser.java	2012-03-01 09:14:09 UTC (rev 8517)
@@ -108,7 +108,7 @@
             writer.writeStartElement(Element.DEPENDENCY.getLocalName());
             writer.writeAttribute(Attribute.NAME.getLocalName(), dependency.getName());
             ModelNode model = dependency.getValue();
-            PortletWarDependancyDefinition.IMPORT_SERVICES.marshallAsAttribute(model, false, writer);
+            PortletWarDependencyDefinition.IMPORT_SERVICES.marshallAsAttribute(model, false, writer);
             writer.writeEndElement();
          }
          writer.writeEndElement();
@@ -142,6 +142,9 @@
       }
       list.add(subsystem);
 
+      boolean hasArchives = false;
+      boolean hasDependencies = false;
+
       // elements
       while (reader.hasNext() && reader.nextTag() != END_ELEMENT)
       {
@@ -153,11 +156,13 @@
                case DEPLOYMENT_ARCHIVES:
                {
                   parseDeploymentArchives(reader, address, list);
+                  hasArchives = true;
                   break;
                }
                case PORTLET_WAR_DEPENDENCIES:
                {
                   parsePortletWarDependencies(reader, address, list);
+                  hasDependencies = true;
                   break;
                }
                default:
@@ -170,13 +175,21 @@
             throw unexpectedElement(reader);
          }
       }
+
+      if (!hasArchives)
+         addDefaultDeploymentArchivesOperations(reader, address, list);
+
+      if (!hasDependencies)
+         addDefaultPortletWarDependencies(reader, address, list);
    }
 
    static void parseDeploymentArchives(XMLExtendedStreamReader reader, ModelNode parent, List<ModelNode> operations) throws XMLStreamException
    {
-
       // no attributes
       requireNoAttributes(reader);
+
+      boolean gotArchives = false;
+
       // elements
       while (reader.hasNext() && reader.nextTag() != END_ELEMENT)
       {
@@ -186,29 +199,23 @@
             case ARCHIVE:
             {
                parseArchive(reader, parent, operations);
+               gotArchives = true;
                break;
             }
             default:
                throw unexpectedElement(reader);
          }
       }
+      
+      if (!gotArchives)
+         addDefaultDeploymentArchivesOperations(reader, parent, operations);
+   }
 
-      // validate archives
-      //TODO: this must go in DeploymentArchiveAdd
-      /*int mainCount = 0;
-     for (Property p : model.asPropertyList()) {
-         if (p.getValue().isDefined()) {
-             List<Property> props = p.getValue().asPropertyList();
-             if (props.size() > 0 && MAIN.equals(props.get(0).getName())) {
-                 mainCount++;
-             }
-         }
-     }
-
-     if (mainCount != 1) {
-         throw new RuntimeException("Exactly one archive has to be marked as a main archive (found: " + mainCount + ")");
-     } */
-
+   private static void addDefaultDeploymentArchivesOperations(XMLExtendedStreamReader reader, ModelNode parent, List<ModelNode> operations) throws XMLStreamException
+   {
+      ModelNode model = new ModelNode();
+      DeploymentArchiveDefinition.MAIN.parseAndSetParameter(Constants.TRUE, model, reader);
+      addDeploymentArchiveOperation(parent, model, "gatein.ear", operations);
    }
 
    static void parseArchive(XMLExtendedStreamReader reader, ModelNode parent, List<ModelNode> operations) throws XMLStreamException
@@ -246,21 +253,29 @@
             + "' of '" + Element.ARCHIVE.getLocalName() + "' element can not be null!");
       }
 
+      addDeploymentArchiveOperation(parent, model, name, operations);
+
+      requireNoContent(reader);
+   }
+
+   private static void addDeploymentArchiveOperation(ModelNode parent, ModelNode model, String name, List<ModelNode> operations)
+   {
       ModelNode address = parent.clone();
       address.add(Constants.DEPLOYMENT_ARCHIVE, name);
 
       model.get(OP).set(ADD);
       model.get(OP_ADDR).set(address);
       operations.add(model);
-
-      requireNoContent(reader);
    }
 
    static void parsePortletWarDependencies(XMLExtendedStreamReader reader, ModelNode parent, List<ModelNode> operations) throws XMLStreamException
    {
       // no attributes
       requireNoAttributes(reader);
-      // elements
+
+      boolean gotDependencies = false;
+
+      // elements      
       while (reader.hasNext() && reader.nextTag() != END_ELEMENT)
       {
          final Element element = Element.forName(reader.getLocalName());
@@ -269,14 +284,25 @@
             case DEPENDENCY:
             {
                parseDependency(reader, parent, operations);
+               gotDependencies = true;
                break;
             }
             default:
                throw unexpectedElement(reader);
          }
       }
+      
+      if (!gotDependencies)
+         addDefaultPortletWarDependencies(reader, parent, operations);
    }
 
+   private static void addDefaultPortletWarDependencies(XMLExtendedStreamReader reader, ModelNode parent, List<ModelNode> operations) throws XMLStreamException
+   {
+      addPortletWarDependencyOperation(parent, new ModelNode(), "org.gatein.wci", operations);
+      addPortletWarDependencyOperation(parent, new ModelNode(), "org.gatein.pc", operations);
+      addPortletWarDependencyOperation(parent, new ModelNode(), "javax.portlet.api", operations);
+   }
+
    static void parseDependency(XMLExtendedStreamReader reader, ModelNode parent, List<ModelNode> operations) throws XMLStreamException
    {
 
@@ -298,9 +324,7 @@
             }
             case IMPORT_SERVICES:
             {
-               PortletWarDependancyDefinition.IMPORT_SERVICES.parseAndSetParameter(value, model, reader);
-               /*requireTrueOrFalse(value);
-             importSvcs = Boolean.parseBoolean(value);*/
+               PortletWarDependencyDefinition.IMPORT_SERVICES.parseAndSetParameter(value, model, reader);
                break;
             }
             default:
@@ -313,13 +337,18 @@
          throw ParseUtils.missingRequired(reader, EnumSet.of(Attribute.NAME));
       }
 
+      addPortletWarDependencyOperation(parent, model, name, operations);
+
+      requireNoContent(reader);
+   }
+
+   private static void addPortletWarDependencyOperation(ModelNode parent, ModelNode model, String name, List<ModelNode> operations)
+   {
       ModelNode address = parent.clone();
       address.add(Constants.PORTLET_WAR_DEPENDENCY, name);
 
       model.get(OP).set(ADD);
       model.get(OP_ADDR).set(address);
       operations.add(model);
-
-      requireNoContent(reader);
    }
 }

Deleted: portal/tags/3.2.0-GA/packaging/jboss-as7/extension/src/main/java/org/gatein/integration/jboss/as7/PortletWarDependancyAdd.java
===================================================================
--- portal/tags/3.2.0-GA/packaging/jboss-as7/extension/src/main/java/org/gatein/integration/jboss/as7/PortletWarDependancyAdd.java	2012-03-01 06:06:47 UTC (rev 8516)
+++ portal/tags/3.2.0-GA/packaging/jboss-as7/extension/src/main/java/org/gatein/integration/jboss/as7/PortletWarDependancyAdd.java	2012-03-01 09:14:09 UTC (rev 8517)
@@ -1,41 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2011, Red Hat, Inc., and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.gatein.integration.jboss.as7;
-
-import org.jboss.as.controller.AbstractAddStepHandler;
-import org.jboss.as.controller.OperationFailedException;
-import org.jboss.dmr.ModelNode;
-
-/**
- * @author <a href="mailto:mstrukel at redhat.com">Marko Strukelj</a>
- */
-public class PortletWarDependancyAdd extends AbstractAddStepHandler {
-    public static final PortletWarDependancyAdd INSTANCE = new PortletWarDependancyAdd();
-
-    private PortletWarDependancyAdd() {
-    }
-
-    @Override
-    protected void populateModel(ModelNode operation, ModelNode model) throws OperationFailedException {
-        PortletWarDependancyDefinition.IMPORT_SERVICES.validateAndSet(operation,model);
-    }
-}

Deleted: portal/tags/3.2.0-GA/packaging/jboss-as7/extension/src/main/java/org/gatein/integration/jboss/as7/PortletWarDependancyDefinition.java
===================================================================
--- portal/tags/3.2.0-GA/packaging/jboss-as7/extension/src/main/java/org/gatein/integration/jboss/as7/PortletWarDependancyDefinition.java	2012-03-01 06:06:47 UTC (rev 8516)
+++ portal/tags/3.2.0-GA/packaging/jboss-as7/extension/src/main/java/org/gatein/integration/jboss/as7/PortletWarDependancyDefinition.java	2012-03-01 09:14:09 UTC (rev 8517)
@@ -1,61 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2012, Red Hat, Inc., and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.gatein.integration.jboss.as7;
-
-import org.jboss.as.controller.PathElement;
-import org.jboss.as.controller.ReloadRequiredRemoveStepHandler;
-import org.jboss.as.controller.SimpleAttributeDefinition;
-import org.jboss.as.controller.SimpleAttributeDefinitionBuilder;
-import org.jboss.as.controller.SimpleResourceDefinition;
-import org.jboss.as.controller.registry.AttributeAccess;
-import org.jboss.as.controller.registry.ManagementResourceRegistration;
-import org.jboss.dmr.ModelNode;
-import org.jboss.dmr.ModelType;
-
-/**
- * @author Tomaz Cerar
- */
-public class PortletWarDependancyDefinition extends SimpleResourceDefinition
-{
-   protected static final PortletWarDependancyDefinition INSTANCE = new PortletWarDependancyDefinition();
-
-   protected static final SimpleAttributeDefinition IMPORT_SERVICES =
-      new SimpleAttributeDefinitionBuilder(Constants.IMPORT_SERVICES, ModelType.BOOLEAN, true)
-         .setAllowExpression(false)
-         .setDefaultValue(new ModelNode(false))
-         .setXmlName(Constants.IMPORT_SERVICES)
-         .setFlags(AttributeAccess.Flag.RESTART_ALL_SERVICES)
-         .build();
-
-   private PortletWarDependancyDefinition()
-   {
-      super(PathElement.pathElement(Constants.PORTLET_WAR_DEPENDENCY), GateInExtension.getResourceDescriptionResolver(Constants.PORTLET_WAR_DEPENDENCY),
-         PortletWarDependancyAdd.INSTANCE, new ReloadRequiredRemoveStepHandler()
-      );
-   }
-
-   @Override
-   public void registerAttributes(ManagementResourceRegistration resourceRegistration)
-   {
-      resourceRegistration.registerReadOnlyAttribute(IMPORT_SERVICES, null);
-   }
-}

Added: portal/tags/3.2.0-GA/packaging/jboss-as7/extension/src/main/java/org/gatein/integration/jboss/as7/PortletWarDependencyAdd.java
===================================================================
--- portal/tags/3.2.0-GA/packaging/jboss-as7/extension/src/main/java/org/gatein/integration/jboss/as7/PortletWarDependencyAdd.java	                        (rev 0)
+++ portal/tags/3.2.0-GA/packaging/jboss-as7/extension/src/main/java/org/gatein/integration/jboss/as7/PortletWarDependencyAdd.java	2012-03-01 09:14:09 UTC (rev 8517)
@@ -0,0 +1,68 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2012, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.gatein.integration.jboss.as7;
+
+import org.jboss.as.controller.AbstractAddStepHandler;
+import org.jboss.as.controller.OperationContext;
+import org.jboss.as.controller.OperationFailedException;
+import org.jboss.as.controller.ServiceVerificationHandler;
+import org.jboss.dmr.ModelNode;
+import org.jboss.dmr.Property;
+import org.jboss.msc.service.ServiceController;
+
+import java.util.List;
+
+import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.OP_ADDR;
+
+/**
+ * @author <a href="mailto:mstrukel at redhat.com">Marko Strukelj</a>
+ */
+public class PortletWarDependencyAdd extends AbstractAddStepHandler
+{
+   private GateInConfiguration config;
+
+   PortletWarDependencyAdd(GateInConfiguration config)
+   {
+      this.config = config;
+   }
+
+   @Override
+   protected void populateModel(ModelNode operation, ModelNode model) throws OperationFailedException
+   {
+      PortletWarDependencyDefinition.IMPORT_SERVICES.validateAndSet(operation, model);
+   }
+
+   @Override
+   protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model, ServiceVerificationHandler verificationHandler, List<ServiceController<?>> newControllers) throws OperationFailedException
+   {
+      ModelNode addr = operation.get(OP_ADDR);
+      if (!addr.hasDefined(1))
+         throw new IllegalArgumentException("Invalid submodel address: " + addr);
+
+      Property prop = addr.get(1).asProperty();
+      if (!Constants.PORTLET_WAR_DEPENDENCY.equals(prop.getName()))
+         throw new IllegalArgumentException("Invalid submodel address: " + addr);
+
+      ModelNode importSvcs = operation.get(Constants.IMPORT_SERVICES);
+      config.addPortletWarDependency(prop.getValue().asString(), importSvcs.isDefined() && importSvcs.asBoolean());
+   }
+}

Added: portal/tags/3.2.0-GA/packaging/jboss-as7/extension/src/main/java/org/gatein/integration/jboss/as7/PortletWarDependencyDefinition.java
===================================================================
--- portal/tags/3.2.0-GA/packaging/jboss-as7/extension/src/main/java/org/gatein/integration/jboss/as7/PortletWarDependencyDefinition.java	                        (rev 0)
+++ portal/tags/3.2.0-GA/packaging/jboss-as7/extension/src/main/java/org/gatein/integration/jboss/as7/PortletWarDependencyDefinition.java	2012-03-01 09:14:09 UTC (rev 8517)
@@ -0,0 +1,59 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2012, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.gatein.integration.jboss.as7;
+
+import org.jboss.as.controller.PathElement;
+import org.jboss.as.controller.ReloadRequiredRemoveStepHandler;
+import org.jboss.as.controller.SimpleAttributeDefinition;
+import org.jboss.as.controller.SimpleAttributeDefinitionBuilder;
+import org.jboss.as.controller.SimpleResourceDefinition;
+import org.jboss.as.controller.registry.AttributeAccess;
+import org.jboss.as.controller.registry.ManagementResourceRegistration;
+import org.jboss.dmr.ModelNode;
+import org.jboss.dmr.ModelType;
+
+/**
+ * @author Tomaz Cerar
+ */
+public class PortletWarDependencyDefinition extends SimpleResourceDefinition
+{
+   protected static final SimpleAttributeDefinition IMPORT_SERVICES =
+      new SimpleAttributeDefinitionBuilder(Constants.IMPORT_SERVICES, ModelType.BOOLEAN, true)
+         .setAllowExpression(false)
+         .setDefaultValue(new ModelNode(false))
+         .setXmlName(Constants.IMPORT_SERVICES)
+         .setFlags(AttributeAccess.Flag.RESTART_ALL_SERVICES)
+         .build();
+
+   PortletWarDependencyDefinition(GateInConfiguration config)
+   {
+      super(PathElement.pathElement(Constants.PORTLET_WAR_DEPENDENCY), GateInExtension.getResourceDescriptionResolver(Constants.PORTLET_WAR_DEPENDENCY),
+         new PortletWarDependencyAdd(config), new ReloadRequiredRemoveStepHandler()
+      );
+   }
+
+   @Override
+   public void registerAttributes(ManagementResourceRegistration resourceRegistration)
+   {
+      resourceRegistration.registerReadOnlyAttribute(IMPORT_SERVICES, null);
+   }
+}

Added: portal/tags/3.2.0-GA/packaging/jboss-as7/extension/src/main/java/org/gatein/integration/jboss/as7/deployment/GateInConfigurationKey.java
===================================================================
--- portal/tags/3.2.0-GA/packaging/jboss-as7/extension/src/main/java/org/gatein/integration/jboss/as7/deployment/GateInConfigurationKey.java	                        (rev 0)
+++ portal/tags/3.2.0-GA/packaging/jboss-as7/extension/src/main/java/org/gatein/integration/jboss/as7/deployment/GateInConfigurationKey.java	2012-03-01 09:14:09 UTC (rev 8517)
@@ -0,0 +1,34 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2012, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.gatein.integration.jboss.as7.deployment;
+
+import org.gatein.integration.jboss.as7.GateInConfiguration;
+import org.jboss.as.server.deployment.AttachmentKey;
+
+/**
+ * @author <a href="mailto:mstrukel at redhat.com">Marko Strukelj</a>
+ */
+public class GateInConfigurationKey
+{
+   public static final AttachmentKey<GateInConfiguration> KEY = AttachmentKey.create(GateInConfiguration.class);
+   public static final GateInConfigurationKey INSTANCE = new GateInConfigurationKey();
+}

Modified: portal/tags/3.2.0-GA/packaging/jboss-as7/extension/src/main/java/org/gatein/integration/jboss/as7/deployment/GateInDependenciesDeploymentProcessor.java
===================================================================
--- portal/tags/3.2.0-GA/packaging/jboss-as7/extension/src/main/java/org/gatein/integration/jboss/as7/deployment/GateInDependenciesDeploymentProcessor.java	2012-03-01 06:06:47 UTC (rev 8516)
+++ portal/tags/3.2.0-GA/packaging/jboss-as7/extension/src/main/java/org/gatein/integration/jboss/as7/deployment/GateInDependenciesDeploymentProcessor.java	2012-03-01 09:14:09 UTC (rev 8517)
@@ -21,7 +21,7 @@
  */
 package org.gatein.integration.jboss.as7.deployment;
 
-import org.gatein.integration.jboss.as7.GateInExtensionConfiguration;
+import org.gatein.integration.jboss.as7.GateInConfiguration;
 import org.jboss.as.server.deployment.Attachments;
 import org.jboss.as.server.deployment.DeploymentPhaseContext;
 import org.jboss.as.server.deployment.DeploymentUnit;
@@ -42,13 +42,11 @@
 
    final ModuleIdentifier gateInLibId = ModuleIdentifier.fromString("org.gatein.lib");
 
-   private GateInExtensionConfiguration config =GateInExtensionConfiguration.INSTANCE;
-
    public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException
    {
       final DeploymentUnit du = phaseContext.getDeploymentUnit();
 
-      if (config.isGateInOrPortletArchive(du))
+      if (GateInConfiguration.isGateInOrPortletArchive(du))
       {
          // add dependency on org.gatein.lib
          List<ModuleDependency> dependencies = du.getAttachmentList(Attachments.MANIFEST_DEPENDENCIES);
@@ -62,8 +60,9 @@
          // add gatein deployment modules cross-dependencies
          ModuleIdentifier moduleId = du.getAttachment(Attachments.MODULE_IDENTIFIER);
 
-         if (config.isGateInArchive(du))
+         if (GateInConfiguration.isGateInArchive(du))
          {
+            final GateInConfiguration config = du.getAttachment(GateInConfigurationKey.KEY);
             final ServiceModuleLoader deploymentModuleLoader = du.getAttachment(Attachments.SERVICE_MODULE_LOADER);
 
             if (!moduleId.equals(config.getGateInEarModule()))

Modified: portal/tags/3.2.0-GA/packaging/jboss-as7/extension/src/main/java/org/gatein/integration/jboss/as7/deployment/GateInInitDeploymentProcessor.java
===================================================================
--- portal/tags/3.2.0-GA/packaging/jboss-as7/extension/src/main/java/org/gatein/integration/jboss/as7/deployment/GateInInitDeploymentProcessor.java	2012-03-01 06:06:47 UTC (rev 8516)
+++ portal/tags/3.2.0-GA/packaging/jboss-as7/extension/src/main/java/org/gatein/integration/jboss/as7/deployment/GateInInitDeploymentProcessor.java	2012-03-01 09:14:09 UTC (rev 8517)
@@ -22,7 +22,7 @@
 package org.gatein.integration.jboss.as7.deployment;
 
 import org.gatein.integration.jboss.as7.GateInExtension;
-import org.gatein.integration.jboss.as7.GateInExtensionConfiguration;
+import org.gatein.integration.jboss.as7.GateInConfiguration;
 import org.gatein.integration.jboss.as7.web.InitService;
 import org.jboss.as.server.deployment.Attachments;
 import org.jboss.as.server.deployment.DeploymentPhaseContext;
@@ -44,25 +44,24 @@
 {
    private final Logger log = Logger.getLogger(GateInInitDeploymentProcessor.class);
 
-   private GateInExtensionConfiguration config = GateInExtensionConfiguration.INSTANCE;
-
    @Override
    public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException
    {
       final DeploymentUnit du = phaseContext.getDeploymentUnit();
 
-      if (config.isGateInArchive(du))
+      if (GateInConfiguration.isGateInArchive(du))
       {
          log.info("Module is on GateIn Extension modules list");
+         final GateInConfiguration config = du.getAttachment(GateInConfigurationKey.KEY);
 
-         ServiceName initSvcName = GateInExtension.deploymentUnitName(config.getGateInEarModule(), "gatein", "init");
-         ServiceTarget target = phaseContext.getServiceTarget();
+         final ServiceName initSvcName = GateInExtension.deploymentUnitName(config.getGateInEarModule(), "gatein", "init");
+         final ServiceTarget target = phaseContext.getServiceTarget();
 
          if (du.getAttachment(GateInEarKey.KEY) != null)
          {
-            // install InitService with dependency on all the deployment modules reaching POST_MODULE
+            // Install InitService with dependency on all the deployment modules reaching POST_MODULE
             // TODO: we are starting up InitService before child modules (jboss.deployment.subunit.*) have gone through POST_MODULE
-            ServiceBuilder<InitService> builder = target.addService(initSvcName, new InitService())
+            final ServiceBuilder<InitService> builder = target.addService(initSvcName, new InitService(config))
                   .addDependency(GateInExtension.deploymentUnitName(config.getGateInEarModule(), Phase.POST_MODULE));
 
             for (ModuleIdentifier module : config.getGateInExtModules())

Modified: portal/tags/3.2.0-GA/packaging/jboss-as7/extension/src/main/java/org/gatein/integration/jboss/as7/deployment/GateInStarterDeploymentProcessor.java
===================================================================
--- portal/tags/3.2.0-GA/packaging/jboss-as7/extension/src/main/java/org/gatein/integration/jboss/as7/deployment/GateInStarterDeploymentProcessor.java	2012-03-01 06:06:47 UTC (rev 8516)
+++ portal/tags/3.2.0-GA/packaging/jboss-as7/extension/src/main/java/org/gatein/integration/jboss/as7/deployment/GateInStarterDeploymentProcessor.java	2012-03-01 09:14:09 UTC (rev 8517)
@@ -22,7 +22,7 @@
 package org.gatein.integration.jboss.as7.deployment;
 
 import org.gatein.integration.jboss.as7.GateInExtension;
-import org.gatein.integration.jboss.as7.GateInExtensionConfiguration;
+import org.gatein.integration.jboss.as7.GateInConfiguration;
 import org.gatein.integration.jboss.as7.web.StartupService;
 import org.jboss.as.server.deployment.Attachments;
 import org.jboss.as.server.deployment.DeploymentPhaseContext;
@@ -42,19 +42,24 @@
  */
 public class GateInStarterDeploymentProcessor implements DeploymentUnitProcessor
 {
-   private ConcurrentHashMap<ModuleIdentifier, ModuleIdentifier> deploymentModules;
+   private volatile ConcurrentHashMap<ModuleIdentifier, ModuleIdentifier> deploymentModules;
 
-   private GateInExtensionConfiguration config = GateInExtensionConfiguration.INSTANCE;
-
-   private synchronized ConcurrentHashMap<ModuleIdentifier, ModuleIdentifier> getDeploymentModules()
+   private ConcurrentHashMap<ModuleIdentifier, ModuleIdentifier> getDeploymentModules(GateInConfiguration config)
    {
       if (deploymentModules == null)
       {
-         deploymentModules = new ConcurrentHashMap<ModuleIdentifier, ModuleIdentifier>();
-         deploymentModules.put(config.getGateInEarModule(), config.getGateInEarModule());
-         for (ModuleIdentifier id : config.getGateInExtModules())
+         synchronized (this)
          {
-            deploymentModules.put(id, id);
+            if (deploymentModules == null)
+            {
+               final ConcurrentHashMap<ModuleIdentifier, ModuleIdentifier> dms = new ConcurrentHashMap<ModuleIdentifier, ModuleIdentifier>();
+               dms.put(config.getGateInEarModule(), config.getGateInEarModule());
+               for (ModuleIdentifier id : config.getGateInExtModules())
+               {
+                  dms.put(id, id);
+               }
+               this.deploymentModules = dms;
+            }
          }
       }
       return deploymentModules;
@@ -63,23 +68,25 @@
    @Override
    public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException
    {
-      DeploymentUnit du = phaseContext.getDeploymentUnit();
+      final DeploymentUnit du = phaseContext.getDeploymentUnit();
 
       // Wait to the last GateIn archive deployment unit install
       // Then enumerate all the child components which should all be scheduled for startup at that point
       // to get the dependencies for StartupService
 
-      if (config.isGateInArchive(du))
+      if (GateInConfiguration.isGateInArchive(du))
       {
-         ModuleIdentifier moduleId = du.getAttachment(Attachments.MODULE_IDENTIFIER);
-         getDeploymentModules().remove(moduleId);
+         final GateInConfiguration config = du.getAttachment(GateInConfigurationKey.KEY);
 
+         final ModuleIdentifier moduleId = du.getAttachment(Attachments.MODULE_IDENTIFIER);
+         getDeploymentModules(config).remove(moduleId);
+
          if (deploymentModules.size() == 0)
          {
-            StartupService startup = new StartupService();
+            final StartupService startup = new StartupService();
             startup.setGateInModule(du.getAttachment(Attachments.MODULE));
 
-            ServiceBuilder<StartupService> builder = phaseContext.getServiceTarget()
+            final ServiceBuilder<StartupService> builder = phaseContext.getServiceTarget()
                   .addService(StartupService.SERVICE_NAME, startup);
 
             builder.addDependency(GateInExtension.deploymentUnitName(config.getGateInEarModule(), Phase.CLEANUP));

Modified: portal/tags/3.2.0-GA/packaging/jboss-as7/extension/src/main/java/org/gatein/integration/jboss/as7/deployment/GateInStructureDeploymentProcessor.java
===================================================================
--- portal/tags/3.2.0-GA/packaging/jboss-as7/extension/src/main/java/org/gatein/integration/jboss/as7/deployment/GateInStructureDeploymentProcessor.java	2012-03-01 06:06:47 UTC (rev 8516)
+++ portal/tags/3.2.0-GA/packaging/jboss-as7/extension/src/main/java/org/gatein/integration/jboss/as7/deployment/GateInStructureDeploymentProcessor.java	2012-03-01 09:14:09 UTC (rev 8517)
@@ -21,8 +21,8 @@
  */
 package org.gatein.integration.jboss.as7.deployment;
 
+import org.gatein.integration.jboss.as7.GateInConfiguration;
 import org.gatein.integration.jboss.as7.GateInExtension;
-import org.gatein.integration.jboss.as7.GateInExtensionConfiguration;
 import org.jboss.as.server.deployment.Attachments;
 import org.jboss.as.server.deployment.DeploymentPhaseContext;
 import org.jboss.as.server.deployment.DeploymentUnit;
@@ -67,17 +67,17 @@
       }
    };
 
+   private GateInConfiguration config;
 
-   private GateInExtensionConfiguration config = GateInExtensionConfiguration.INSTANCE;
-
-   public GateInStructureDeploymentProcessor()
+   public GateInStructureDeploymentProcessor(GateInConfiguration config)
    {
+      this.config = config;
    }
 
    @Override
    public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException
    {
-      DeploymentUnit du = phaseContext.getDeploymentUnit();
+      final DeploymentUnit du = phaseContext.getDeploymentUnit();
       log.debug("Deploy: " + du.getName() + " [" + phaseContext.getPhase() + "]");
       if (du.getParent() != null)
       {
@@ -85,11 +85,12 @@
       }
       else
       {
-         ModuleIdentifier moduleId = du.getAttachment(Attachments.MODULE_IDENTIFIER);
+         final ModuleIdentifier moduleId = du.getAttachment(Attachments.MODULE_IDENTIFIER);
          if (config.getGateInEarModule().equals(moduleId))
          {
             log.debugf("Recognized %s as main GateIn deployment archive", moduleId);
             du.putAttachment(GateInEarKey.KEY, GateInEarKey.INSTANCE);
+            du.putAttachment(GateInConfigurationKey.KEY, config);
             if (log.isTraceEnabled())
             {
                installListener(phaseContext, moduleId);
@@ -99,6 +100,7 @@
          {
             log.debugf("Recognized %s as part of GateIn deployment", moduleId);
             du.putAttachment(GateInExtKey.KEY, GateInExtKey.INSTANCE);
+            du.putAttachment(GateInConfigurationKey.KEY, config);
             if (log.isTraceEnabled())
             {
                installListener(phaseContext, moduleId);
@@ -111,12 +113,13 @@
    {
       DeploymentUnit du = phaseContext.getDeploymentUnit();
       DeploymentUnit parent = du.getParent();
-      if (config.isGateInArchive(parent))
+      if (GateInConfiguration.isGateInArchive(parent))
       {
          //if (DeploymentTypeMarker.isType(DeploymentType.WAR, du))
          //{
          //   config.getChildWars().add(WebSubsystemServices.JBOSS_WEB.append(du.getName()));
          //}
+         du.putAttachment(GateInConfigurationKey.KEY, config);
          config.addChildSubUnit(Services.deploymentUnitName(parent.getName(), du.getName()));
       }
    }

Modified: portal/tags/3.2.0-GA/packaging/jboss-as7/extension/src/main/java/org/gatein/integration/jboss/as7/deployment/PortletWarClassloadingDependencyProcessor.java
===================================================================
--- portal/tags/3.2.0-GA/packaging/jboss-as7/extension/src/main/java/org/gatein/integration/jboss/as7/deployment/PortletWarClassloadingDependencyProcessor.java	2012-03-01 06:06:47 UTC (rev 8516)
+++ portal/tags/3.2.0-GA/packaging/jboss-as7/extension/src/main/java/org/gatein/integration/jboss/as7/deployment/PortletWarClassloadingDependencyProcessor.java	2012-03-01 09:14:09 UTC (rev 8517)
@@ -21,7 +21,7 @@
  */
 package org.gatein.integration.jboss.as7.deployment;
 
-import org.gatein.integration.jboss.as7.GateInExtensionConfiguration;
+import org.gatein.integration.jboss.as7.GateInConfiguration;
 import org.jboss.as.server.deployment.Attachments;
 import org.jboss.as.server.deployment.DeploymentPhaseContext;
 import org.jboss.as.server.deployment.DeploymentUnit;
@@ -43,8 +43,6 @@
 
    private List<TldMetaData> tldMetas;
 
-   private GateInExtensionConfiguration conf = GateInExtensionConfiguration.INSTANCE;
-
    public PortletWarClassloadingDependencyProcessor(List<TldMetaData> tldMetaData)
    {
       this.tldMetas = tldMetaData;
@@ -54,15 +52,19 @@
    public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException
    {
       final DeploymentUnit du = phaseContext.getDeploymentUnit();
-      if (!conf.isPortletArchive(du))
+
+      if (!GateInConfiguration.isPortletArchive(du))
       {
          return; // Skip non portlet deployments
       }
 
       final ModuleSpecification moduleSpecification = du.getAttachment(Attachments.MODULE_SPECIFICATION);
 
+
+      GateInConfiguration config = du.getAttachment(GateInConfigurationKey.KEY);
+
       // Add module dependencies
-      for (ModuleDependency dep: conf.getPortletWarDependencies())
+      for (ModuleDependency dep: config.getPortletWarDependencies())
       {
          moduleSpecification.addSystemDependency(dep);
       }

Modified: portal/tags/3.2.0-GA/packaging/jboss-as7/extension/src/main/java/org/gatein/integration/jboss/as7/deployment/PortletWarDeploymentInitializingProcessor.java
===================================================================
--- portal/tags/3.2.0-GA/packaging/jboss-as7/extension/src/main/java/org/gatein/integration/jboss/as7/deployment/PortletWarDeploymentInitializingProcessor.java	2012-03-01 06:06:47 UTC (rev 8516)
+++ portal/tags/3.2.0-GA/packaging/jboss-as7/extension/src/main/java/org/gatein/integration/jboss/as7/deployment/PortletWarDeploymentInitializingProcessor.java	2012-03-01 09:14:09 UTC (rev 8517)
@@ -21,6 +21,7 @@
  */
 package org.gatein.integration.jboss.as7.deployment;
 
+import org.gatein.integration.jboss.as7.GateInConfiguration;
 import org.jboss.as.ee.structure.DeploymentType;
 import org.jboss.as.ee.structure.DeploymentTypeMarker;
 import org.jboss.as.server.deployment.Attachments;
@@ -38,21 +39,27 @@
 {
    private static final String PORTLET_XML = "WEB-INF/portlet.xml";
 
+   private GateInConfiguration config;
 
+   public PortletWarDeploymentInitializingProcessor(GateInConfiguration config) {
+      this.config = config;
+   }
+
    @Override
    public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException
    {
-      final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
-      if (!DeploymentTypeMarker.isType(DeploymentType.WAR, deploymentUnit))
+      final DeploymentUnit du = phaseContext.getDeploymentUnit();
+      if (!DeploymentTypeMarker.isType(DeploymentType.WAR, du))
       {
          return; // Skip non web deployments
       }
-      final ResourceRoot deploymentRoot = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT);
+      final ResourceRoot deploymentRoot = du.getAttachment(Attachments.DEPLOYMENT_ROOT);
       final VirtualFile portletXml = deploymentRoot.getRoot().getChild(PORTLET_XML);
       if (portletXml.exists())
       {
          // we don't care about the contents, its existence is enough to mark it as a portlet app
-         deploymentUnit.putAttachment(PortletWarKey.INSTANCE, Boolean.TRUE);
+         du.putAttachment(PortletWarKey.INSTANCE, Boolean.TRUE);
+         du.putAttachment(GateInConfigurationKey.KEY, config);
       }
    }
 

Modified: portal/tags/3.2.0-GA/packaging/jboss-as7/extension/src/main/java/org/gatein/integration/jboss/as7/deployment/WarDependenciesDeploymentProcessor.java
===================================================================
--- portal/tags/3.2.0-GA/packaging/jboss-as7/extension/src/main/java/org/gatein/integration/jboss/as7/deployment/WarDependenciesDeploymentProcessor.java	2012-03-01 06:06:47 UTC (rev 8516)
+++ portal/tags/3.2.0-GA/packaging/jboss-as7/extension/src/main/java/org/gatein/integration/jboss/as7/deployment/WarDependenciesDeploymentProcessor.java	2012-03-01 09:14:09 UTC (rev 8517)
@@ -21,7 +21,7 @@
  */
 package org.gatein.integration.jboss.as7.deployment;
 
-import org.gatein.integration.jboss.as7.GateInExtensionConfiguration;
+import org.gatein.integration.jboss.as7.GateInConfiguration;
 import org.jboss.as.server.deployment.DeploymentPhaseContext;
 import org.jboss.as.server.deployment.DeploymentUnit;
 import org.jboss.as.server.deployment.DeploymentUnitProcessingException;
@@ -39,7 +39,6 @@
  */
 public class WarDependenciesDeploymentProcessor implements DeploymentUnitProcessor
 {
-   private GateInExtensionConfiguration config = GateInExtensionConfiguration.INSTANCE;
 
    private void processWarDeployment(DeploymentUnit du)
    {
@@ -66,7 +65,9 @@
          }
       }
 
-      final ServiceName deploymentServiceName = WebSubsystemServices.deploymentServiceName("default-host", pathName);
+      GateInConfiguration config = du.getAttachment(GateInConfigurationKey.KEY);
+      ServiceName deploymentServiceName = WebSubsystemServices.deploymentServiceName("default-host", pathName);
+
       config.addChildWar(deploymentServiceName);
    }
 
@@ -78,12 +79,12 @@
 
       if (parent != null)
       {
-         if (config.isGateInArchive(parent))
+         if (GateInConfiguration.isGateInArchive(parent))
          {
             processWarDeployment(du);
          }
       }
-      else if (config.isGateInArchive(du))
+      else if (GateInConfiguration.isGateInArchive(du))
       {
          processWarDeployment(du);
       }

Modified: portal/tags/3.2.0-GA/packaging/jboss-as7/extension/src/main/java/org/gatein/integration/jboss/as7/web/InitService.java
===================================================================
--- portal/tags/3.2.0-GA/packaging/jboss-as7/extension/src/main/java/org/gatein/integration/jboss/as7/web/InitService.java	2012-03-01 06:06:47 UTC (rev 8516)
+++ portal/tags/3.2.0-GA/packaging/jboss-as7/extension/src/main/java/org/gatein/integration/jboss/as7/web/InitService.java	2012-03-01 09:14:09 UTC (rev 8517)
@@ -22,8 +22,7 @@
 package org.gatein.integration.jboss.as7.web;
 
 import org.exoplatform.container.RootContainer;
-import org.gatein.integration.jboss.as7.GateInExtension;
-import org.gatein.integration.jboss.as7.GateInExtensionConfiguration;
+import org.gatein.integration.jboss.as7.GateInConfiguration;
 import org.jboss.as.server.moduleservice.ModuleLoadService;
 import org.jboss.as.server.moduleservice.ServiceModuleLoader;
 import org.jboss.modules.Module;
@@ -39,7 +38,12 @@
 public class InitService implements Service<InitService>
 {
 
-   private GateInExtensionConfiguration config = GateInExtensionConfiguration.INSTANCE;
+   private GateInConfiguration config;
+      
+   public InitService(GateInConfiguration config)
+   {
+      this.config = config;
+   }
 
    @Override
    public void start(StartContext context) throws StartException

Modified: portal/tags/3.2.0-GA/packaging/jboss-as7/modules/pom.xml
===================================================================
--- portal/tags/3.2.0-GA/packaging/jboss-as7/modules/pom.xml	2012-03-01 06:06:47 UTC (rev 8516)
+++ portal/tags/3.2.0-GA/packaging/jboss-as7/modules/pom.xml	2012-03-01 09:14:09 UTC (rev 8517)
@@ -1402,4 +1402,4 @@
    </build>
 
 
-</project>
\ No newline at end of file
+</project>

Modified: portal/tags/3.2.0-GA/packaging/jboss-as7/pkg/pom.xml
===================================================================
--- portal/tags/3.2.0-GA/packaging/jboss-as7/pkg/pom.xml	2012-03-01 06:06:47 UTC (rev 8516)
+++ portal/tags/3.2.0-GA/packaging/jboss-as7/pkg/pom.xml	2012-03-01 09:14:09 UTC (rev 8517)
@@ -418,5 +418,35 @@
             </plugins>
          </build>
       </profile>
+      <profile>
+         <id>bundle</id>
+         <properties>
+            <release.version>3.2.0-FINAL</release.version>
+         </properties>
+         <build>
+            <plugins>
+               <plugin>
+                  <groupId>org.apache.maven.plugins</groupId>
+                  <artifactId>maven-antrun-plugin</artifactId>
+                  <version>1.6</version>
+                  <executions>
+                     <execution>
+                        <id>package</id>
+                        <phase>package</phase>
+                        <goals>
+                           <goal>run</goal>
+                        </goals>
+                        <configuration>
+                           <target>
+                              <zip destfile="${project.build.directory}/GateIn-${release.version}-jbossas7-preview.zip" basedir="${jbossas.target.dir}" />
+                              <attachartifact file="${project.build.directory}/GateIn-${release.version}-jbossas7-preview.zip" classifier="bundle" type="zip" />
+                           </target>
+                        </configuration>
+                     </execution>
+                  </executions>
+               </plugin>
+            </plugins>
+         </build>
+      </profile>
    </profiles>
 </project>

Modified: portal/tags/3.2.0-GA/packaging/jboss-as7/pkg/src/main/resources/jboss/standalone/configuration/standalone.xml
===================================================================
--- portal/tags/3.2.0-GA/packaging/jboss-as7/pkg/src/main/resources/jboss/standalone/configuration/standalone.xml	2012-03-01 06:06:47 UTC (rev 8516)
+++ portal/tags/3.2.0-GA/packaging/jboss-as7/pkg/src/main/resources/jboss/standalone/configuration/standalone.xml	2012-03-01 09:14:09 UTC (rev 8517)
@@ -320,8 +320,9 @@
                 <archive name="gatein-sample-skin.war"/>
             </deployment-archives>
             <portlet-war-dependencies>
-                <dependency name="org.gatein.lib" import-services="true"/>
+                <!--dependency name="org.gatein.lib" import-services="true"/-->
                 <dependency name="org.gatein.wci"/>
+                <dependency name="org.gatein.pc"/>
                 <dependency name="javax.portlet.api"/>
             </portlet-war-dependencies>
         </subsystem>



More information about the gatein-commits mailing list