geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gdam...@apache.org
Subject svn commit: r453238 - in /geronimo/server/trunk/modules: geronimo-clustering-builder-wadi/src/main/java/org/apache/geronimo/clustering/wadi/jetty/ geronimo-clustering-wadi/src/main/java/org/apache/geronimo/clustering/wadi/ geronimo-jetty-builder/src/ma...
Date Thu, 05 Oct 2006 13:50:30 GMT
Author: gdamour
Date: Thu Oct  5 06:50:29 2006
New Revision: 453238

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

Enable WADI ServiceSpace. Also, session timeout is also cascaded to WADISessionManager.

Added:
    geronimo/server/trunk/modules/geronimo-clustering-wadi/src/main/java/org/apache/geronimo/clustering/wadi/WADISessionManagerConfigInfo.java
Modified:
    geronimo/server/trunk/modules/geronimo-clustering-builder-wadi/src/main/java/org/apache/geronimo/clustering/wadi/jetty/WADIJettyClusteringBuilder.java
    geronimo/server/trunk/modules/geronimo-clustering-wadi/src/main/java/org/apache/geronimo/clustering/wadi/BasicWADISessionManager.java
    geronimo/server/trunk/modules/geronimo-jetty-builder/src/main/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java
    geronimo/server/trunk/modules/geronimo-jetty/src/main/java/org/apache/geronimo/jetty/JettyWebAppContext.java

Modified: geronimo/server/trunk/modules/geronimo-clustering-builder-wadi/src/main/java/org/apache/geronimo/clustering/wadi/jetty/WADIJettyClusteringBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-clustering-builder-wadi/src/main/java/org/apache/geronimo/clustering/wadi/jetty/WADIJettyClusteringBuilder.java?view=diff&rev=453238&r1=453237&r2=453238
==============================================================================
--- geronimo/server/trunk/modules/geronimo-clustering-builder-wadi/src/main/java/org/apache/geronimo/clustering/wadi/jetty/WADIJettyClusteringBuilder.java
(original)
+++ geronimo/server/trunk/modules/geronimo-clustering-builder-wadi/src/main/java/org/apache/geronimo/clustering/wadi/jetty/WADIJettyClusteringBuilder.java
Thu Oct  5 06:50:29 2006
@@ -23,32 +23,31 @@
 import javax.xml.namespace.QName;
 
 import org.apache.geronimo.clustering.wadi.BasicWADISessionManager;
-import org.apache.geronimo.jetty.cluster.wadi.WADIClusteredHandleInterceptor;
+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;
-import org.apache.geronimo.deployment.xmlbeans.XmlBeansUtil;
 import org.apache.geronimo.deployment.service.EnvironmentBuilder;
+import org.apache.geronimo.deployment.xmlbeans.XmlBeansUtil;
 import org.apache.geronimo.gbean.AbstractName;
 import org.apache.geronimo.gbean.AbstractNameQuery;
 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.jetty.JettyWebAppContext;
 import org.apache.geronimo.jetty.cluster.ClusteredWebApplicationHandlerFactory;
+import org.apache.geronimo.jetty.cluster.wadi.WADIClusteredHandleInterceptor;
 import org.apache.geronimo.kernel.GBeanAlreadyExistsException;
 import org.apache.geronimo.kernel.GBeanNotFoundException;
 import org.apache.geronimo.kernel.config.Configuration;
 import org.apache.geronimo.kernel.repository.Environment;
 import org.apache.geronimo.naming.deployment.ENCConfigBuilder;
+import org.apache.geronimo.schema.NamespaceElementConverter;
+import org.apache.geronimo.schema.SchemaConversionUtils;
 import org.apache.geronimo.xbeans.geronimo.GerClusteringWadiDocument;
 import org.apache.geronimo.xbeans.geronimo.GerClusteringWadiType;
 import org.apache.geronimo.xbeans.geronimo.naming.GerPatternType;
-import org.apache.geronimo.schema.SchemaConversionUtils;
-import org.apache.geronimo.schema.NamespaceElementConverter;
 import org.apache.xmlbeans.QNameSet;
 import org.apache.xmlbeans.XmlObject;
 
@@ -96,7 +95,7 @@
         if (clusteringWadiType != null) {
             GBeanData webModuleData = extractWebModule(moduleContext);
             try {
-                AbstractName sessionManagerName = addSessionManager(clusteringWadiType, moduleContext);
+                AbstractName sessionManagerName = addSessionManager(clusteringWadiType, webModuleData,
moduleContext);
                 addHandlerFactory(moduleContext, webModuleData, sessionManagerName);
                 addInterceptor(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);
-        addHandlerFactory(moduleContext, webModuleData, sessionManagerName);
-        addInterceptor(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);
@@ -177,6 +148,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();
         if (clustering.isSetDispatcher()) {
@@ -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 addHandlerFactory(DeploymentContext moduleContext,

Modified: geronimo/server/trunk/modules/geronimo-clustering-wadi/src/main/java/org/apache/geronimo/clustering/wadi/BasicWADISessionManager.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-clustering-wadi/src/main/java/org/apache/geronimo/clustering/wadi/BasicWADISessionManager.java?view=diff&rev=453238&r1=453237&r2=453238
==============================================================================
--- geronimo/server/trunk/modules/geronimo-clustering-wadi/src/main/java/org/apache/geronimo/clustering/wadi/BasicWADISessionManager.java
(original)
+++ geronimo/server/trunk/modules/geronimo-clustering-wadi/src/main/java/org/apache/geronimo/clustering/wadi/BasicWADISessionManager.java
Thu Oct  5 06:50:29 2006
@@ -69,6 +69,9 @@
 import org.codehaus.wadi.replication.manager.ReplicationManagerFactory;
 import org.codehaus.wadi.replication.storage.ReplicaStorageFactory;
 import org.codehaus.wadi.replication.strategy.BackingStrategyFactory;
+import org.codehaus.wadi.servicespace.ServiceName;
+import org.codehaus.wadi.servicespace.ServiceSpaceName;
+import org.codehaus.wadi.servicespace.basic.BasicServiceSpace;
 import org.codehaus.wadi.web.AttributesFactory;
 import org.codehaus.wadi.web.WebSession;
 import org.codehaus.wadi.web.WebSessionPool;
@@ -89,36 +92,35 @@
  */
 public class BasicWADISessionManager implements GBeanLifecycle, SessionManager, WADISessionManager
{
     private static final Log log = LogFactory.getLog(BasicWADISessionManager.class);
-    
-    private final int sweepInterval;
-    private final int numPartitions;
+
+    private final WADISessionManagerConfigInfo configInfo;
     private final ReplicationManagerFactory replicationManagerFactory;
     private final ReplicaStorageFactory replicaStorageFactory;
     private final BackingStrategyFactory backingStrategyFactory;
     private final DispatcherHolder dispatcherHolder;
     private final Set listeners;
-    
+
     private ClusteredManager manager;
+    private BasicServiceSpace serviceSpace;
 
-    public BasicWADISessionManager(int sweepInterval,
-            int numPartitions,
-            ReplicationManagerFactory replicationManagerFactory,
-            ReplicaStorageFactory replicaStorageFactory,
-            BackingStrategyFactory backingStrategyFactory,
-            DispatcherHolder dispatcherHolder) {
-        this.sweepInterval = sweepInterval;
-        this.numPartitions = numPartitions;
+    public BasicWADISessionManager(WADISessionManagerConfigInfo configInfo,
+            ReplicationManagerFactory replicationManagerFactory, ReplicaStorageFactory replicaStorageFactory,
+            BackingStrategyFactory backingStrategyFactory, DispatcherHolder dispatcherHolder)
{
+        this.configInfo = configInfo;
         this.dispatcherHolder = dispatcherHolder;
         this.replicationManagerFactory = replicationManagerFactory;
         this.replicaStorageFactory = replicaStorageFactory;
         this.backingStrategyFactory = backingStrategyFactory;
-        
+
         listeners = new HashSet();
     }
 
     public void doStart() throws Exception {
-        Dispatcher dispatcher = dispatcherHolder.getDispatcher();
-        
+        Dispatcher underlyingDisp = dispatcherHolder.getDispatcher();
+
+        serviceSpace = new BasicServiceSpace(new ServiceSpaceName(configInfo.getServiceSpaceURI()),
underlyingDisp);
+        Dispatcher dispatcher = serviceSpace.getDispatcher();
+
         boolean strictOrdering = true;
         Streamer streamer = new SimpleStreamer();
         Collapser collapser = new HashingCollapser(1024, 10000);
@@ -126,56 +128,47 @@
 
         // end of contextualiser stack
         Contextualiser contextualiser = new DummyContextualiser();
-        
+
         // replica aware contextualiser
-//        ReplicationManager replicationManager = replicationManagerFactory.factory(dispatcher,
-//                replicaStorageFactory,
-//                backingStrategyFactory);
-//        DistributableManagerRehydrater sessionRehydrater = new DistributableManagerRehydrater();
-//        ReplicationManager sessionRepManager = new SessionReplicationManager(replicationManager,
sessionRehydrater);
-//        contextualiser = new ReplicaAwareContextualiser(contextualiser, sessionRepManager);
+        // ReplicationManager replicationManager =
+        // replicationManagerFactory.factory(dispatcher,
+        // replicaStorageFactory,
+        // backingStrategyFactory);
+        // DistributableManagerRehydrater sessionRehydrater = new
+        // DistributableManagerRehydrater();
+        // ReplicationManager sessionRepManager = new
+        // SessionReplicationManager(replicationManager, sessionRehydrater);
+        // contextualiser = new ReplicaAwareContextualiser(contextualiser,
+        // sessionRepManager);
 
         // cluster aware contextualiser
         contextualiser = new ClusterContextualiser(contextualiser, collapser, new HybridRelocater(5000,
5000, true));
 
-        contextualiser = new StatelessContextualiser(contextualiser, Pattern.compile("GET|POST",
2), true, 
-                Pattern.compile(".*\\.(JPG|JPEG|GIF|PNG|ICO|HTML|HTM)", 2), false);
+        contextualiser = new StatelessContextualiser(contextualiser, Pattern.compile("GET|POST",
2), true, Pattern
+                .compile(".*\\.(JPG|JPEG|GIF|PNG|ICO|HTML|HTM)", 2), false);
 
         // serialize invocations bound to the same session id
         contextualiser = new SerialContextualiser(contextualiser, collapser, mmap);
 
-        // in-memory contextualiser 
+        // in-memory contextualiser
         WebSessionPool sessionPool = new SimpleSessionPool(new AtomicallyReplicableSessionFactory());
-        Evicter mevicter = new AbsoluteEvicter(sweepInterval, strictOrdering, 10);
+        Evicter mevicter = new AbsoluteEvicter(configInfo.getSweepInterval(), strictOrdering,
+                configInfo.getSessionTimeoutSeconds());
         SessionPool contextPool = new WebSessionToSessionPoolAdapter(sessionPool);
         PoolableInvocationWrapperPool requestPool = new DummyStatefulHttpServletRequestWrapperPool();
         contextualiser = new MotionTracker(contextualiser, mevicter, mmap, streamer, contextPool,
requestPool);
 
         contextualiser = new SerialContextualiserFrontingMemory(contextualiser, new HashingCollapser(1024,
10000));
-        
+
         // Manager
         AttributesFactory attributesFactory = new DistributableAttributesFactory();
         ValuePool valuePool = new SimpleValuePool(new DistributableValueFactory());
         WebSessionWrapperFactory wrapperFactory = new StandardSessionWrapperFactory();
-        manager = new ClusteredManager(sessionPool, 
-                        attributesFactory,
-                        valuePool, 
-                        wrapperFactory, 
-                        null, 
-                        contextualiser, 
-                        mmap,
-                        new DummyRouter(), 
-                        true, 
-                        streamer, 
-                        true,
-                        new DummyReplicaterFactory(),
-//                        new ReplicaterAdapterFactory(replicationManager), 
-                        null, 
-                        null,
-                        dispatcher, 
-                        numPartitions, 
-                        collapser);
-//        sessionRehydrater.setManager(manager);
+        manager = new ClusteredManager(sessionPool, attributesFactory, valuePool, wrapperFactory,
null, contextualiser,
+                mmap, new DummyRouter(), true, streamer, true, new DummyReplicaterFactory(),
+                // new ReplicaterAdapterFactory(replicationManager),
+                null, null, dispatcher, configInfo.getNumPartitions(), collapser);
+        // sessionRehydrater.setManager(manager);
 
         manager.init(new ManagerConfig() {
             public void callback(Manager manager) {
@@ -185,17 +178,19 @@
                 return null;
             }
         });
-        
-        manager.start();
+
+        serviceSpace.getServiceRegistry().register(new ServiceName("ClusteredManager"), manager);
+
+        serviceSpace.start();
     }
 
     public void doStop() throws Exception {
-        manager.stop();
+        serviceSpace.stop();
     }
 
     public void doFail() {
         try {
-            manager.stop();
+            serviceSpace.stop();
         } catch (Exception e) {
             log.error(e);
         }
@@ -214,11 +209,11 @@
     public ClusteredManager getManager() {
         return manager;
     }
-    
+
     public Node getNode() {
         return dispatcherHolder.getNode();
     }
-    
+
     public void registerListener(SessionListener listener) {
         synchronized (listeners) {
             listeners.add(listener);
@@ -252,12 +247,13 @@
 
     private class MotionTracker extends MemoryContextualiser {
         private final Immoter immoter;
+
         private final Emoter emoter;
-        
+
         public MotionTracker(Contextualiser next, Evicter evicter, Map map, Streamer streamer,
SessionPool pool,
                 PoolableInvocationWrapperPool requestPool) {
             super(next, evicter, map, streamer, pool, requestPool);
-            
+
             Immoter immoterDelegate = super.getImmoter();
             immoter = new InboundSessionTracker(immoterDelegate);
 
@@ -277,7 +273,7 @@
         public Immoter getImmoter() {
             return immoter;
         }
-        
+
         public Emoter getEmoter() {
             return emoter;
         }
@@ -307,7 +303,7 @@
             delegate.rollback(arg0, arg1);
         }
     }
-    
+
     private class InboundSessionTracker implements Immoter {
         private final Immoter delegate;
 
@@ -340,12 +336,10 @@
             delegate.rollback(arg0, arg1);
         }
     }
-    
-    
+
     public static final GBeanInfo GBEAN_INFO;
-    
-    public static final String GBEAN_ATTR_SWEEP_INTERVAL = "sweepInterval";
-    public static final String GBEAN_ATTR_NUM_PARTITIONS = "numPartitions";
+
+    public static final String GBEAN_ATTR_WADI_CONFIG_INFO = "wadiConfigInfo";
 
     public static final String GBEAN_REF_REPLICATION_MANAGER_FACTORY = "ReplicationManagerFactory";
     public static final String GBEAN_REF_REPLICA_STORAGE_FACTORY = "ReplicaStorageFactory";
@@ -353,12 +347,10 @@
     public static final String GBEAN_REF_DISPATCHER_HOLDER = "DispatcherHolder";
 
     static {
-        GBeanInfoBuilder infoBuilder = GBeanInfoBuilder.createStatic("WADI Session Manager",

-                BasicWADISessionManager.class, 
-                NameFactory.GERONIMO_SERVICE);
-        
-        infoBuilder.addAttribute(GBEAN_ATTR_SWEEP_INTERVAL, int.class, true);
-        infoBuilder.addAttribute(GBEAN_ATTR_NUM_PARTITIONS, int.class, true);
+        GBeanInfoBuilder infoBuilder = GBeanInfoBuilder.createStatic("WADI Session Manager",
+                BasicWADISessionManager.class, NameFactory.GERONIMO_SERVICE);
+
+        infoBuilder.addAttribute(GBEAN_ATTR_WADI_CONFIG_INFO, WADISessionManagerConfigInfo.class,
true);
 
         infoBuilder.addReference(GBEAN_REF_REPLICATION_MANAGER_FACTORY, ReplicationManagerFactory.class,
                 NameFactory.GERONIMO_SERVICE);
@@ -367,20 +359,19 @@
         infoBuilder.addReference(GBEAN_REF_BACKING_STRATEGY_FACTORY, BackingStrategyFactory.class,
                 NameFactory.GERONIMO_SERVICE);
         infoBuilder.addReference(GBEAN_REF_DISPATCHER_HOLDER, DispatcherHolder.class, NameFactory.GERONIMO_SERVICE);
-        
+
         infoBuilder.addInterface(SessionManager.class);
         infoBuilder.addInterface(WADISessionManager.class);
-        
-        infoBuilder.setConstructor(new String[]{GBEAN_ATTR_SWEEP_INTERVAL,
-                GBEAN_ATTR_NUM_PARTITIONS,
-                GBEAN_REF_REPLICATION_MANAGER_FACTORY,
+
+        infoBuilder.setConstructor(new String[] { GBEAN_ATTR_WADI_CONFIG_INFO,
+                GBEAN_REF_REPLICATION_MANAGER_FACTORY, 
                 GBEAN_REF_REPLICA_STORAGE_FACTORY,
-                GBEAN_REF_BACKING_STRATEGY_FACTORY,
-                GBEAN_REF_DISPATCHER_HOLDER});
+                GBEAN_REF_BACKING_STRATEGY_FACTORY, 
+                GBEAN_REF_DISPATCHER_HOLDER });
 
         GBEAN_INFO = infoBuilder.getBeanInfo();
     }
-    
+
     public static GBeanInfo getGBeanInfo() {
         return GBEAN_INFO;
     }

Added: geronimo/server/trunk/modules/geronimo-clustering-wadi/src/main/java/org/apache/geronimo/clustering/wadi/WADISessionManagerConfigInfo.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-clustering-wadi/src/main/java/org/apache/geronimo/clustering/wadi/WADISessionManagerConfigInfo.java?view=auto&rev=453238
==============================================================================
--- geronimo/server/trunk/modules/geronimo-clustering-wadi/src/main/java/org/apache/geronimo/clustering/wadi/WADISessionManagerConfigInfo.java
(added)
+++ geronimo/server/trunk/modules/geronimo-clustering-wadi/src/main/java/org/apache/geronimo/clustering/wadi/WADISessionManagerConfigInfo.java
Thu Oct  5 06:50:29 2006
@@ -0,0 +1,65 @@
+/**
+ *
+ * Copyright 2006 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.geronimo.clustering.wadi;
+
+import java.io.Serializable;
+import java.net.URI;
+
+/**
+ * 
+ * @version $Rev$ $Date$
+ */
+public class WADISessionManagerConfigInfo implements Serializable {
+    private final URI serviceSpaceURI;
+    private final int sweepInterval;
+    private final int numPartitions;
+    private final int sessionTimeoutSeconds;
+    
+    public WADISessionManagerConfigInfo(URI serviceSpaceURI, int sweepInterval, int numPartitions,
+            int sessionTimeoutSeconds) {
+        if (null == serviceSpaceURI) {
+            throw new IllegalArgumentException("serviceSpaceURI is required");
+        } else if (1 > sweepInterval) {
+            throw new IllegalArgumentException("sweepInterval must be greater than 0");
+        } else if (1 > numPartitions) {
+            throw new IllegalArgumentException("numPartitions must be greater than 0");
+        } else if (1 > sessionTimeoutSeconds) {
+            throw new IllegalArgumentException("sessionTimeoutSeconds must be greater than
0");
+        }
+        this.serviceSpaceURI = serviceSpaceURI;
+        this.sweepInterval = sweepInterval;
+        this.numPartitions = numPartitions;
+        this.sessionTimeoutSeconds = sessionTimeoutSeconds;
+    }
+
+    public int getNumPartitions() {
+        return numPartitions;
+    }
+
+    public URI getServiceSpaceURI() {
+        return serviceSpaceURI;
+    }
+
+    public int getSessionTimeoutSeconds() {
+        return sessionTimeoutSeconds;
+    }
+
+    public int getSweepInterval() {
+        return sweepInterval;
+    }
+    
+}

Modified: geronimo/server/trunk/modules/geronimo-jetty-builder/src/main/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-jetty-builder/src/main/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java?view=diff&rev=453238&r1=453237&r2=453238
==============================================================================
--- geronimo/server/trunk/modules/geronimo-jetty-builder/src/main/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java
(original)
+++ geronimo/server/trunk/modules/geronimo-jetty-builder/src/main/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java
Thu Oct  5 06:50:29 2006
@@ -389,6 +389,11 @@
             // configure listeners.
             configureListeners(webApp, webModuleData);
 
+            webModuleData.setAttribute(JettyWebAppContext.GBEAN_ATTR_SESSION_TIMEOUT,
+                    (webApp.getSessionConfigArray().length == 1 && webApp.getSessionConfigArray(0).getSessionTimeout()
!= null) ?
+                            new Integer(webApp.getSessionConfigArray(0).getSessionTimeout().getBigIntegerValue().intValue()
* 60) :
+                                defaultSessionTimeoutSeconds);
+            
             Boolean distributable = webApp.getDistributableArray().length == 1 ? Boolean.TRUE
: Boolean.FALSE;
             webModuleData.setAttribute("distributable", distributable);
             if (Boolean.TRUE == distributable) {
@@ -401,10 +406,6 @@
                 configureNoClustering(moduleContext, webModuleData);
             }
             
-            webModuleData.setAttribute("sessionTimeoutSeconds",
-                    (webApp.getSessionConfigArray().length == 1 && webApp.getSessionConfigArray(0).getSessionTimeout()
!= null) ?
-                            new Integer(webApp.getSessionConfigArray(0).getSessionTimeout().getBigIntegerValue().intValue()
* 60) :
-                            defaultSessionTimeoutSeconds);
 
             // configure mime mappings.
             configureMimeMappings(webApp, webModuleData);

Modified: geronimo/server/trunk/modules/geronimo-jetty/src/main/java/org/apache/geronimo/jetty/JettyWebAppContext.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-jetty/src/main/java/org/apache/geronimo/jetty/JettyWebAppContext.java?view=diff&rev=453238&r1=453237&r2=453238
==============================================================================
--- geronimo/server/trunk/modules/geronimo-jetty/src/main/java/org/apache/geronimo/jetty/JettyWebAppContext.java
(original)
+++ geronimo/server/trunk/modules/geronimo-jetty/src/main/java/org/apache/geronimo/jetty/JettyWebAppContext.java
Thu Oct  5 06:50:29 2006
@@ -557,6 +557,9 @@
     }
     
     public static final GBeanInfo GBEAN_INFO;
+    
+    public static final String GBEAN_ATTR_SESSION_TIMEOUT = "sessionTimeoutSeconds";
+    
     public static final String GBEAN_REF_WEB_APPLICATION_HANDLER_FACTORY = "WebApplicationHandlerFactory";
     public static final String GBEAN_REF_HANDLE_INTERCEPTOR = "HandleInterceptor";
 
@@ -577,7 +580,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_WEB_APPLICATION_HANDLER_FACTORY, WebApplicationHandlerFactory.class,
                 NameFactory.GERONIMO_SERVICE);
         infoBuilder.addReference(GBEAN_REF_HANDLE_INTERCEPTOR, HandleInterceptor.class, NameFactory.GERONIMO_SERVICE);
@@ -636,7 +639,7 @@
                 "authenticator",
                 "realmName",
                 "tagLibMap",
-                "sessionTimeoutSeconds",
+                GBEAN_ATTR_SESSION_TIMEOUT,
                 GBEAN_REF_WEB_APPLICATION_HANDLER_FACTORY,
                 GBEAN_REF_HANDLE_INTERCEPTOR,
 



Mime
View raw message