geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gdam...@apache.org
Subject svn commit: r453239 - in /geronimo/sandbox/javaee5/modules-jee5: geronimo-jetty6-clustering-builder-wadi/src/main/java/org/apache/geronimo/jetty6/cluster/wadi/builder/ geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/
Date Thu, 05 Oct 2006 13:50:52 GMT
Author: gdamour
Date: Thu Oct  5 06:50:51 2006
New Revision: 453239

URL: http://svn.apache.org/viewvc?view=rev&rev=453239
Log:
Mirror GERONIMO-2469 - Allow sharing of a single WADI group communication instance between
multiple Web-app updates.

Modified:
    geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6-clustering-builder-wadi/src/main/java/org/apache/geronimo/jetty6/cluster/wadi/builder/WADIJettyClusteringBuilder.java
    geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/JettyWebAppContext.java

Modified: geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6-clustering-builder-wadi/src/main/java/org/apache/geronimo/jetty6/cluster/wadi/builder/WADIJettyClusteringBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6-clustering-builder-wadi/src/main/java/org/apache/geronimo/jetty6/cluster/wadi/builder/WADIJettyClusteringBuilder.java?view=diff&rev=453239&r1=453238&r2=453239
==============================================================================
--- geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6-clustering-builder-wadi/src/main/java/org/apache/geronimo/jetty6/cluster/wadi/builder/WADIJettyClusteringBuilder.java
(original)
+++ geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6-clustering-builder-wadi/src/main/java/org/apache/geronimo/jetty6/cluster/wadi/builder/WADIJettyClusteringBuilder.java
Thu Oct  5 06:50:51 2006
@@ -23,6 +23,7 @@
 import javax.xml.namespace.QName;
 
 import org.apache.geronimo.clustering.wadi.BasicWADISessionManager;
+import org.apache.geronimo.clustering.wadi.WADISessionManagerConfigInfo;
 import org.apache.geronimo.common.DeploymentException;
 import org.apache.geronimo.deployment.DeploymentContext;
 import org.apache.geronimo.deployment.NamespaceDrivenBuilder;
@@ -33,8 +34,6 @@
 import org.apache.geronimo.gbean.GBeanData;
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
-import org.apache.geronimo.j2ee.deployment.EARContext;
-import org.apache.geronimo.j2ee.deployment.WebModule;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
 import org.apache.geronimo.jetty6.JettyWebAppContext;
 import org.apache.geronimo.jetty6.cluster.ClusteredSessionHandlerFactory;
@@ -96,7 +95,7 @@
         if (clusteringWadiType != null) {
             GBeanData webModuleData = extractWebModule(moduleContext);
             try {
-                AbstractName sessionManagerName = addSessionManager(clusteringWadiType, moduleContext);
+                AbstractName sessionManagerName = addSessionManager(clusteringWadiType, webModuleData,
moduleContext);
                 addSessionHandlerFactory(moduleContext, webModuleData, sessionManagerName);
                 addPreHandlerFactory(moduleContext, webModuleData, sessionManagerName);
             } catch (GBeanAlreadyExistsException e) {
@@ -131,42 +130,14 @@
         return null;
     }
 
-    public boolean canConfigure(XmlObject clusteringXmlObject) {
-        return null == clusteringXmlObject || clusteringXmlObject instanceof GerClusteringWadiType;
-    }
-
-    public void configureEnvironment(XmlObject clusteringXmlObject, Environment environment)
throws DeploymentException {
-        if (false == canConfigure(clusteringXmlObject)) {
-            throw new DeploymentException("Builder does not support [" + clusteringXmlObject
+ "]");
-        }
-
-        EnvironmentBuilder.mergeEnvironments(environment, defaultEnvironment);
-    }
-
-    public void configureJettyWebAppContext(XmlObject clusteringXmlObject, WebModule module,
GBeanData webModuleData)
-        throws DeploymentException, GBeanAlreadyExistsException {
-        if (null == clusteringXmlObject) {
-            clusteringXmlObject = GerClusteringWadiType.Factory.newInstance();
-        }
-        if (!(clusteringXmlObject instanceof GerClusteringWadiType)) {
-            throw new DeploymentException("Builder does not support [" + clusteringXmlObject
+ "]");
-        }
-        GerClusteringWadiType clustering = (GerClusteringWadiType) clusteringXmlObject;
-
-        EARContext moduleContext = module.getEarContext();
-
-        AbstractName sessionManagerName = addSessionManager(clustering, moduleContext);
-        addSessionHandlerFactory(moduleContext, webModuleData, sessionManagerName);
-        addPreHandlerFactory(moduleContext, webModuleData, sessionManagerName);
-    }
-
-    private AbstractName addSessionManager(GerClusteringWadiType clustering, DeploymentContext
moduleContext) throws GBeanAlreadyExistsException {
+    private AbstractName addSessionManager(GerClusteringWadiType clustering, GBeanData webModuleData,
+            DeploymentContext moduleContext) throws GBeanAlreadyExistsException {
         AbstractName name = moduleContext.getNaming().createChildName(moduleContext.getModuleName(),
                 "WADISessionManager", NameFactory.GERONIMO_SERVICE);
 
         GBeanData beanData = new GBeanData(name, BasicWADISessionManager.GBEAN_INFO);
-        setSweepInterval(clustering, beanData);
-        setNumPartitions(clustering, beanData);
+
+        setConfigInfo(clustering, webModuleData, beanData);
         setReplicationManagerFactory(clustering, beanData);
         setReplicaStorageFactory(clustering, beanData);
         setBackingStrategyFactory(clustering, beanData);
@@ -176,6 +147,28 @@
 
         return name;
     }
+    
+    private void setConfigInfo(GerClusteringWadiType clustering, GBeanData webModuleData,
GBeanData beanData) {
+        int sweepInterval = defaultSweepInterval;
+        if (clustering.isSetSweepInterval()) {
+            sweepInterval = clustering.getSweepInterval().intValue();
+        }
+        int numPartitions = defaultNumPartitions;
+        if (clustering.isSetNumPartitions()) {
+            numPartitions = clustering.getNumPartitions().intValue();
+        }
+        Integer sessionTimeout = (Integer) webModuleData.getAttribute(JettyWebAppContext.GBEAN_ATTR_SESSION_TIMEOUT);
+        if (null == sessionTimeout) {
+            throw new AssertionError();
+        }
+        
+        WADISessionManagerConfigInfo configInfo = new WADISessionManagerConfigInfo(
+                beanData.getAbstractName().toURI(),
+                sweepInterval,
+                numPartitions,
+                sessionTimeout.intValue());
+        beanData.setAttribute(BasicWADISessionManager.GBEAN_ATTR_WADI_CONFIG_INFO, configInfo);
+    }
 
     private void setDispatcher(GerClusteringWadiType clustering, GBeanData beanData) {
         Set patterns = new HashSet();
@@ -215,22 +208,6 @@
             patterns.add(defaultRepManagerFactoryName);
         }
         beanData.setReferencePatterns(BasicWADISessionManager.GBEAN_REF_REPLICATION_MANAGER_FACTORY,
patterns);
-    }
-
-    private void setNumPartitions(GerClusteringWadiType clustering, GBeanData beanData) {
-        int numPartitions = defaultNumPartitions;
-        if (clustering.isSetNumPartitions()) {
-            numPartitions = clustering.getNumPartitions().intValue();
-        }
-        beanData.setAttribute(BasicWADISessionManager.GBEAN_ATTR_NUM_PARTITIONS, new Integer(numPartitions));
-    }
-
-    private void setSweepInterval(GerClusteringWadiType clustering, GBeanData beanData) {
-        int sweepInterval = defaultSweepInterval;
-        if (clustering.isSetSweepInterval()) {
-            sweepInterval = clustering.getSweepInterval().intValue();
-        }
-        beanData.setAttribute(BasicWADISessionManager.GBEAN_ATTR_SWEEP_INTERVAL, new Integer(sweepInterval));
     }
 
     private AbstractName addPreHandlerFactory(DeploymentContext moduleContext,

Modified: geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/JettyWebAppContext.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/JettyWebAppContext.java?view=diff&rev=453239&r1=453238&r2=453239
==============================================================================
--- geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/JettyWebAppContext.java
(original)
+++ geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/JettyWebAppContext.java
Thu Oct  5 06:50:51 2006
@@ -491,6 +491,9 @@
     }
 
     public static final GBeanInfo GBEAN_INFO;
+    
+    public static final String GBEAN_ATTR_SESSION_TIMEOUT = "sessionTimeoutSeconds";
+    
     public static final String GBEAN_REF_SESSION_HANDLER_FACTORY = "SessionHandlerFactory";
     public static final String GBEAN_REF_PRE_HANDLER_FACTORY = "PreHandlerFactory";
 
@@ -511,7 +514,7 @@
         infoBuilder.addAttribute("authenticator", Authenticator.class, true);
         infoBuilder.addAttribute("realmName", String.class, true);
         infoBuilder.addAttribute("tagLibMap", Map.class, true);
-        infoBuilder.addAttribute("sessionTimeoutSeconds", int.class, true);
+        infoBuilder.addAttribute(GBEAN_ATTR_SESSION_TIMEOUT, int.class, true);
         infoBuilder.addReference(GBEAN_REF_SESSION_HANDLER_FACTORY, SessionHandlerFactory.class,
                 NameFactory.GERONIMO_SERVICE);
         infoBuilder.addReference(GBEAN_REF_PRE_HANDLER_FACTORY, PreHandlerFactory.class,
NameFactory.GERONIMO_SERVICE);
@@ -569,7 +572,7 @@
                 "authenticator",
                 "realmName",
                 "tagLibMap",
-                "sessionTimeoutSeconds",
+                GBEAN_ATTR_SESSION_TIMEOUT,
                 GBEAN_REF_SESSION_HANDLER_FACTORY,
                 GBEAN_REF_PRE_HANDLER_FACTORY,
 



Mime
View raw message