geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jgenen...@apache.org
Subject svn commit: r344006 - in /geronimo/trunk/modules: assembly/ assembly/src/plan/ tomcat-builder/ tomcat-builder/src/java/org/apache/geronimo/tomcat/deployment/ tomcat-builder/src/schema/ tomcat/ tomcat/src/java/org/apache/geronimo/tomcat/ tomcat/src/java...
Date Sun, 13 Nov 2005 23:36:29 GMT
Author: jgenender
Date: Sun Nov 13 15:36:16 2005
New Revision: 344006

URL: http://svn.apache.org/viewcvs?rev=344006&view=rev
Log:
Clustering GBeans and for Tomcat

Added:
    geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/cluster/
    geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/cluster/CatalinaClusterGBean.java
    geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/cluster/ClusterDeployerGBean.java
    geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/cluster/MembershipServiceGBean.java
    geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/cluster/MessageListenerGBean.java
    geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/cluster/ReceiverGBean.java
    geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/cluster/SenderGBean.java
Modified:
    geronimo/trunk/modules/assembly/project.xml
    geronimo/trunk/modules/assembly/src/plan/j2ee-deployer-plan.xml
    geronimo/trunk/modules/assembly/src/plan/j2ee-tomcat-plan.xml
    geronimo/trunk/modules/tomcat-builder/project.xml
    geronimo/trunk/modules/tomcat-builder/src/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java
    geronimo/trunk/modules/tomcat-builder/src/schema/geronimo-tomcat-1.0.xsd
    geronimo/trunk/modules/tomcat-builder/src/schema/geronimo-tomcat-config-1.0.xsd
    geronimo/trunk/modules/tomcat/project.xml
    geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/EngineGBean.java
    geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/GeronimoStandardContext.java
    geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/HostGBean.java
    geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/TomcatContext.java
    geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/TomcatWebAppContext.java

Modified: geronimo/trunk/modules/assembly/project.xml
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/assembly/project.xml?rev=344006&r1=344005&r2=344006&view=diff
==============================================================================
--- geronimo/trunk/modules/assembly/project.xml (original)
+++ geronimo/trunk/modules/assembly/project.xml Sun Nov 13 15:36:16 2005
@@ -975,7 +975,7 @@
         </dependency>
         <dependency>
             <groupId>tomcat</groupId>
-            <artifactId>catalina</artifactId>
+            <artifactId>catalina-cluster</artifactId>
             <version>${tomcat_version}</version>
             <url>http://jakarta.apache.org/tomcat/</url>
             <properties>

Modified: geronimo/trunk/modules/assembly/src/plan/j2ee-deployer-plan.xml
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/assembly/src/plan/j2ee-deployer-plan.xml?rev=344006&r1=344005&r2=344006&view=diff
==============================================================================
--- geronimo/trunk/modules/assembly/src/plan/j2ee-deployer-plan.xml (original)
+++ geronimo/trunk/modules/assembly/src/plan/j2ee-deployer-plan.xml Sun Nov 13 15:36:16 2005
@@ -165,6 +165,9 @@
         <uri>tomcat/jars/catalina-${tomcat_version}.jar</uri>
     </dependency>
     <dependency>
+        <uri>tomcat/jars/catalina-cluster-${tomcat_version}.jar</uri>
+    </dependency>
+    <dependency>
         <uri>tomcat/jars/catalina-optional-${tomcat_version}.jar</uri>
     </dependency>
     <dependency>

Modified: geronimo/trunk/modules/assembly/src/plan/j2ee-tomcat-plan.xml
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/assembly/src/plan/j2ee-tomcat-plan.xml?rev=344006&r1=344005&r2=344006&view=diff
==============================================================================
--- geronimo/trunk/modules/assembly/src/plan/j2ee-tomcat-plan.xml (original)
+++ geronimo/trunk/modules/assembly/src/plan/j2ee-tomcat-plan.xml Sun Nov 13 15:36:16 2005
@@ -34,6 +34,9 @@
         <uri>tomcat/jars/catalina-${tomcat_version}.jar</uri>
     </dependency>
     <dependency>
+        <uri>tomcat/jars/catalina-cluster-${tomcat_version}.jar</uri>
+    </dependency>
+    <dependency>
         <uri>tomcat/jars/catalina-optional-${tomcat_version}.jar</uri>
     </dependency>
     <dependency>

Modified: geronimo/trunk/modules/tomcat-builder/project.xml
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/tomcat-builder/project.xml?rev=344006&r1=344005&r2=344006&view=diff
==============================================================================
--- geronimo/trunk/modules/tomcat-builder/project.xml (original)
+++ geronimo/trunk/modules/tomcat-builder/project.xml Sun Nov 13 15:36:16 2005
@@ -363,6 +363,16 @@
 
        <dependency>
             <groupId>tomcat</groupId>
+            <artifactId>catalina-cluster</artifactId>
+            <version>${tomcat_version}</version>
+            <url>http://jakarta.apache.org/tomcat/</url>
+            <properties>
+                <repository>true</repository>
+            </properties>
+        </dependency>
+
+       <dependency>
+            <groupId>tomcat</groupId>
             <artifactId>catalina-optional</artifactId>
             <version>${tomcat_version}</version>
             <url>http://jakarta.apache.org/tomcat/</url>

Modified: geronimo/trunk/modules/tomcat-builder/src/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/tomcat-builder/src/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java?rev=344006&r1=344005&r2=344006&view=diff
==============================================================================
--- geronimo/trunk/modules/tomcat-builder/src/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java
(original)
+++ geronimo/trunk/modules/tomcat-builder/src/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java
Sun Nov 13 15:36:16 2005
@@ -84,6 +84,7 @@
 import org.apache.geronimo.tomcat.TomcatClassLoader;
 import org.apache.geronimo.tomcat.TomcatWebAppContext;
 import org.apache.geronimo.tomcat.ValveGBean;
+import org.apache.geronimo.tomcat.cluster.CatalinaClusterGBean;
 import org.apache.geronimo.tomcat.util.SecurityHolder;
 import org.apache.geronimo.transaction.context.OnlineUserTransaction;
 import org.apache.geronimo.web.deployment.GenericToSpecificPlanConverter;
@@ -467,7 +468,12 @@
                 ObjectName valveName = NameFactory.getComponentName(null, null, null, null,
valveChain, ValveGBean.J2EE_TYPE, moduleJ2eeContext);
                 webModuleData.setReferencePattern("TomcatValveChain", valveName);
             }
-
+            
+            if (tomcatWebApp.isSetCluster()) {
+                String cluster = tomcatWebApp.getCluster().trim();
+                ObjectName clusterName = NameFactory.getComponentName(null, null, null, null,
cluster, CatalinaClusterGBean.J2EE_TYPE, moduleJ2eeContext);
+                webModuleData.setReferencePattern("Cluster", clusterName);
+            }
 
             Map portMap = webModule.getPortMap();
 

Modified: geronimo/trunk/modules/tomcat-builder/src/schema/geronimo-tomcat-1.0.xsd
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/tomcat-builder/src/schema/geronimo-tomcat-1.0.xsd?rev=344006&r1=344005&r2=344006&view=diff
==============================================================================
--- geronimo/trunk/modules/tomcat-builder/src/schema/geronimo-tomcat-1.0.xsd (original)
+++ geronimo/trunk/modules/tomcat-builder/src/schema/geronimo-tomcat-1.0.xsd Sun Nov 13 15:36:16
2005
@@ -48,7 +48,8 @@
             <xs:element name="cross-context" type="tomcat:emptyType" minOccurs="0"/>
             <xs:element name="valve-chain" type="xs:string" minOccurs="0"/>
             <xs:element name="tomcat-realm" type="xs:string" minOccurs="0"/>
-
+            <xs:element name="cluster" type="xs:string" minOccurs="0"/>
+            
             <xs:group ref="naming:jndiEnvironmentRefsGroup"/>
             <xs:element ref="naming:message-destination" minOccurs="0" maxOccurs="unbounded"/>
 

Modified: geronimo/trunk/modules/tomcat-builder/src/schema/geronimo-tomcat-config-1.0.xsd
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/tomcat-builder/src/schema/geronimo-tomcat-config-1.0.xsd?rev=344006&r1=344005&r2=344006&view=diff
==============================================================================
--- geronimo/trunk/modules/tomcat-builder/src/schema/geronimo-tomcat-config-1.0.xsd (original)
+++ geronimo/trunk/modules/tomcat-builder/src/schema/geronimo-tomcat-config-1.0.xsd Sun Nov
13 15:36:16 2005
@@ -32,6 +32,7 @@
             <xs:element name="cross-context" type="tomcat:emptyType" minOccurs="0"/>
             <xs:element name="valve-chain" type="xs:string" minOccurs="0"/>
             <xs:element name="tomcat-realm" type="xs:string" minOccurs="0"/>
+            <xs:element name="cluster" type="xs:string" minOccurs="0"/>
         </xs:sequence>
     </xs:complexType>
 

Modified: geronimo/trunk/modules/tomcat/project.xml
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/tomcat/project.xml?rev=344006&r1=344005&r2=344006&view=diff
==============================================================================
--- geronimo/trunk/modules/tomcat/project.xml (original)
+++ geronimo/trunk/modules/tomcat/project.xml Sun Nov 13 15:36:16 2005
@@ -194,6 +194,15 @@
                  <geronimo.dependency>true</geronimo.dependency>
              </properties>
         </dependency>
+        <dependency>
+            <groupId>tomcat</groupId>
+            <artifactId>catalina-cluster</artifactId>
+            <version>${tomcat_version}</version>
+            <url>http://jakarta.apache.org/tomcat/</url>
+            <properties>
+                 <geronimo.dependency>true</geronimo.dependency>
+             </properties>
+        </dependency>
         <!--
            - Required until any realm is provided to Tomcat
            - See StandardEngine::getRealm()

Modified: geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/EngineGBean.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/EngineGBean.java?rev=344006&r1=344005&r2=344006&view=diff
==============================================================================
--- geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/EngineGBean.java (original)
+++ geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/EngineGBean.java Sun
Nov 13 15:36:16 2005
@@ -20,10 +20,12 @@
 import java.util.Iterator;
 import java.util.Map;
 
+import org.apache.catalina.Cluster;
 import org.apache.catalina.Engine;
 import org.apache.catalina.Host;
 import org.apache.catalina.Realm;
 import org.apache.catalina.Valve;
+import org.apache.catalina.cluster.CatalinaCluster;
 import org.apache.catalina.core.StandardEngine;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -34,6 +36,7 @@
 import org.apache.geronimo.gbean.ReferenceCollectionListener;
 import org.apache.geronimo.gbean.ReferenceCollectionEvent;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
+import org.apache.geronimo.tomcat.cluster.CatalinaClusterGBean;
 
 /**
  * @version $Rev$ $Date$
@@ -51,7 +54,8 @@
             Map initParams,
             Collection hosts,
             ObjectRetriever realmGBean,
-            ValveGBean tomcatValveChain) throws Exception {
+            ValveGBean tomcatValveChain,
+            CatalinaClusterGBean clusterGBean) throws Exception {
         super(); // TODO: make it an attribute
 
         if (className == null){
@@ -114,6 +118,11 @@
             addHost(objRetriever);
 
         }
+        
+        //Add clustering
+        if (clusterGBean != null){
+            engine.setCluster((Cluster)clusterGBean.getInternalObject());
+        }
     }
 
     private void removeHost(ObjectRetriever objRetriever) {
@@ -156,8 +165,15 @@
         infoFactory.addReference("Hosts", ObjectRetriever.class, HostGBean.J2EE_TYPE);
         infoFactory.addReference("RealmGBean", ObjectRetriever.class, NameFactory.GERONIMO_SERVICE);
         infoFactory.addReference("TomcatValveChain", ValveGBean.class, ValveGBean.J2EE_TYPE);
+        infoFactory.addReference("CatalinaCluster", CatalinaClusterGBean.class, CatalinaClusterGBean.J2EE_TYPE);
         infoFactory.addOperation("getInternalObject");
-        infoFactory.setConstructor(new String[] { "className", "initParams", "Hosts", "RealmGBean",
"TomcatValveChain" });
+        infoFactory.setConstructor(new String[] { 
+                "className", 
+                "initParams", 
+                "Hosts", 
+                "RealmGBean", 
+                "TomcatValveChain",
+                "CatalinaCluster" });
         GBEAN_INFO = infoFactory.getBeanInfo();
     }
 

Modified: geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/GeronimoStandardContext.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/GeronimoStandardContext.java?rev=344006&r1=344005&r2=344006&view=diff
==============================================================================
--- geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/GeronimoStandardContext.java
(original)
+++ geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/GeronimoStandardContext.java
Sun Nov 13 15:36:16 2005
@@ -31,6 +31,7 @@
 import org.apache.catalina.Valve;
 import org.apache.catalina.Wrapper;
 import org.apache.catalina.Pipeline;
+import org.apache.catalina.cluster.CatalinaCluster;
 import org.apache.catalina.connector.Request;
 import org.apache.catalina.connector.Response;
 import org.apache.catalina.valves.ValveBase;
@@ -165,6 +166,11 @@
                 addValve(valve);
             }
         }
+        
+        CatalinaCluster cluster = ctx.getCluster();
+        if (cluster != null)
+            this.setCluster(cluster);
+        
         pipelineInitialized = true;
         this.webServiceMap = ctx.getWebServices();
 

Modified: geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/HostGBean.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/HostGBean.java?rev=344006&r1=344005&r2=344006&view=diff
==============================================================================
--- geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/HostGBean.java (original)
+++ geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/HostGBean.java Sun Nov
13 15:36:16 2005
@@ -21,6 +21,7 @@
 import java.util.Iterator;
 import java.util.Map;
 
+import org.apache.catalina.Cluster;
 import org.apache.catalina.Host;
 import org.apache.catalina.Realm;
 import org.apache.catalina.Valve;
@@ -31,6 +32,7 @@
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
 import org.apache.geronimo.gbean.GBeanLifecycle;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
+import org.apache.geronimo.tomcat.cluster.CatalinaClusterGBean;
 
 /**
  * @version $Rev$ $Date$
@@ -49,7 +51,8 @@
             Map initParams, 
             ArrayList aliases,
             ObjectRetriever realmGBean,            
-            ValveGBean tomcatValveChain) throws Exception {
+            ValveGBean tomcatValveChain,
+            CatalinaClusterGBean clusterGBean) throws Exception {
         super(); // TODO: make it an attribute
         
         //Validate
@@ -98,7 +101,11 @@
                 }
             }
         }
-        
+
+        //Add clustering
+        if (clusterGBean != null){
+            host.setCluster((Cluster)clusterGBean.getInternalObject());
+        }
     }
 
     public Object getInternalObject() {
@@ -126,8 +133,15 @@
         infoFactory.addAttribute("aliases", ArrayList.class, true);
         infoFactory.addReference("RealmGBean", ObjectRetriever.class, NameFactory.GERONIMO_SERVICE);
         infoFactory.addReference("TomcatValveChain", ValveGBean.class, ValveGBean.J2EE_TYPE);
+        infoFactory.addReference("CatalinaCluster", CatalinaClusterGBean.class, CatalinaClusterGBean.J2EE_TYPE);
         infoFactory.addOperation("getInternalObject");
-        infoFactory.setConstructor(new String[] { "className", "initParams", "aliases", "RealmGBean",
"TomcatValveChain" });
+        infoFactory.setConstructor(new String[] { 
+                "className", 
+                "initParams", 
+                "aliases", 
+                "RealmGBean", 
+                "TomcatValveChain",
+                "CatalinaCluster" });
         GBEAN_INFO = infoFactory.getBeanInfo();
     }
 

Modified: geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/TomcatContext.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/TomcatContext.java?rev=344006&r1=344005&r2=344006&view=diff
==============================================================================
--- geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/TomcatContext.java (original)
+++ geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/TomcatContext.java Sun
Nov 13 15:36:16 2005
@@ -22,6 +22,7 @@
 
 import org.apache.catalina.Context;
 import org.apache.catalina.Realm;
+import org.apache.catalina.cluster.CatalinaCluster;
 import org.apache.geronimo.kernel.Kernel;
 import org.apache.geronimo.tomcat.util.SecurityHolder;
 import org.apache.geronimo.transaction.TrackedConnectionAssociator;
@@ -61,6 +62,8 @@
     public Realm getRealm();
     
     public List getValveChain();    
+    
+    public CatalinaCluster getCluster();
     
     public boolean isCrossContext();
     

Modified: geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/TomcatWebAppContext.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/TomcatWebAppContext.java?rev=344006&r1=344005&r2=344006&view=diff
==============================================================================
--- geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/TomcatWebAppContext.java
(original)
+++ geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/TomcatWebAppContext.java
Sun Nov 13 15:36:16 2005
@@ -30,6 +30,7 @@
 import org.apache.catalina.Context;
 import org.apache.catalina.Realm;
 import org.apache.catalina.Valve;
+import org.apache.catalina.cluster.CatalinaCluster;
 import org.apache.catalina.core.StandardContext;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -37,13 +38,14 @@
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
 import org.apache.geronimo.gbean.GBeanLifecycle;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
-import org.apache.geronimo.management.J2EEApplication;
-import org.apache.geronimo.management.J2EEServer;
-import org.apache.geronimo.management.geronimo.WebModule;
 import org.apache.geronimo.j2ee.management.impl.InvalidObjectNameException;
 import org.apache.geronimo.kernel.Kernel;
 import org.apache.geronimo.kernel.jmx.JMXUtil;
+import org.apache.geronimo.management.J2EEApplication;
+import org.apache.geronimo.management.J2EEServer;
+import org.apache.geronimo.management.geronimo.WebModule;
 import org.apache.geronimo.security.jacc.RoleDesignateSource;
+import org.apache.geronimo.tomcat.cluster.CatalinaClusterGBean;
 import org.apache.geronimo.tomcat.util.SecurityHolder;
 import org.apache.geronimo.transaction.TrackedConnectionAssociator;
 import org.apache.geronimo.transaction.context.OnlineUserTransaction;
@@ -75,6 +77,8 @@
     private final Realm realm;
 
     private final List valveChain;
+    
+    private final CatalinaCluster catalinaCluster;
 
     private final boolean crossContext;
 
@@ -124,6 +128,7 @@
             RoleDesignateSource roleDesignateSource,
             ObjectRetriever tomcatRealm,
             ValveGBean tomcatValveChain,
+            CatalinaClusterGBean cluster,
             boolean crossContext,
             Map webServices,
             J2EEServer server,
@@ -188,6 +193,12 @@
         } else {
             valveChain = null;
         }
+        
+        //Add the cluster
+        if (cluster != null)
+           catalinaCluster = (CatalinaCluster)cluster.getInternalObject(); 
+        else
+            catalinaCluster = null;
 
         this.crossContext = crossContext;
 
@@ -311,6 +322,10 @@
         return valveChain;
     }
 
+    public CatalinaCluster getCluster() {
+        return catalinaCluster;
+    }
+    
     public boolean isCrossContext() {
         return crossContext;
     }
@@ -429,6 +444,7 @@
         infoBuilder.addReference("RoleDesignateSource", RoleDesignateSource.class, NameFactory.JACC_MANAGER);
         infoBuilder.addReference("TomcatRealm", ObjectRetriever.class);
         infoBuilder.addReference("TomcatValveChain", ValveGBean.class);
+        infoBuilder.addReference("Cluster", CatalinaClusterGBean.class);
         infoBuilder.addAttribute("crossContext", boolean.class, true);
         infoBuilder.addAttribute("webServices", Map.class, true);
         infoBuilder.addReference("J2EEServer", J2EEServer.class);
@@ -457,6 +473,7 @@
                 "RoleDesignateSource",
                 "TomcatRealm",
                 "TomcatValveChain",
+                "Cluster",
                 "crossContext",
                 "webServices",
                 "J2EEServer",

Added: geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/cluster/CatalinaClusterGBean.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/cluster/CatalinaClusterGBean.java?rev=344006&view=auto
==============================================================================
--- geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/cluster/CatalinaClusterGBean.java
(added)
+++ geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/cluster/CatalinaClusterGBean.java
Sun Nov 13 15:36:16 2005
@@ -0,0 +1,153 @@
+/**
+*
+* Copyright 2003-2005 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.tomcat.cluster;
+
+import java.util.Map;
+
+import org.apache.catalina.Valve;
+import org.apache.catalina.cluster.CatalinaCluster;
+import org.apache.catalina.cluster.ClusterDeployer;
+import org.apache.catalina.cluster.ClusterReceiver;
+import org.apache.catalina.cluster.ClusterSender;
+import org.apache.catalina.cluster.MembershipService;
+import org.apache.catalina.cluster.MessageListener;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.gbean.GBeanInfoBuilder;
+import org.apache.geronimo.gbean.GBeanLifecycle;
+import org.apache.geronimo.tomcat.BaseGBean;
+import org.apache.geronimo.tomcat.ObjectRetriever;
+import org.apache.geronimo.tomcat.ValveGBean;
+
+/**
+* @version $Rev: 233391 $ $Date: 2005-08-18 16:38:47 -0600 (Thu, 18 Aug 2005) $
+*/
+public class CatalinaClusterGBean extends BaseGBean implements GBeanLifecycle, ObjectRetriever
{
+
+   private static final Log log = LogFactory.getLog(CatalinaClusterGBean.class);
+   
+   public static final String J2EE_TYPE = "Cluster";
+   
+   private final CatalinaCluster cluster;
+
+   public CatalinaClusterGBean(String className, 
+           Map initParams,            
+           MembershipServiceGBean membership,
+           ReceiverGBean receiver,
+           SenderGBean sender,
+           MessageListenerGBean messageListenerChain,
+           ValveGBean tomcatValveChain,
+           ClusterDeployerGBean deployer) throws Exception {
+       
+       super(); // TODO: make it an attribute
+       
+       //Validate
+       if (className == null){
+           throw new IllegalArgumentException("Must have a 'className' attribute.");
+       }
+              
+       //Create the CatalinaCluster object
+       cluster = (CatalinaCluster)Class.forName(className).newInstance();
+       
+       //Set the parameters
+       setParameters(cluster, initParams);
+       
+       //Add the MembershipService
+       if (membership != null){
+           cluster.setMembershipService((MembershipService)membership.getInternalObject());
+       }
+       
+       //Add Receiver
+       if (receiver != null){
+           cluster.setClusterReceiver((ClusterReceiver)receiver.getInternalObject());
+       }
+       
+       //Add Sender
+       if (sender != null){
+           cluster.setClusterSender((ClusterSender)sender.getInternalObject());
+       }
+
+       //Add the message listeners list
+       if (messageListenerChain != null){
+           MessageListenerGBean messageListenerGBean = messageListenerChain;
+           while(messageListenerGBean != null){
+               cluster.addClusterListener((MessageListener)messageListenerGBean.getInternalObject());
+               messageListenerGBean = messageListenerGBean.getNextValve();
+           }
+       }
+
+       //Add the valve list
+       if (tomcatValveChain != null){
+           ValveGBean valveGBean = tomcatValveChain;
+           while(valveGBean != null){
+               cluster.addValve((Valve)valveGBean.getInternalObject());
+               valveGBean = valveGBean.getNextValve();
+           }
+       }
+       
+       //Add deployer
+       if (deployer != null){
+           cluster.setClusterDeployer((ClusterDeployer)deployer.getInternalObject());
+       }
+   }
+
+   public Object getInternalObject() {
+       return cluster;
+   }
+
+   public void doFail() {
+       log.info("Failed");
+   }
+
+   public void doStart() throws Exception {
+       log.info("Started cluster gbean.");
+   }
+
+   public void doStop() throws Exception {
+       log.info("Stopped cluster gbean.");
+   }
+
+   public static final GBeanInfo GBEAN_INFO;
+
+   static {
+       GBeanInfoBuilder infoFactory = new GBeanInfoBuilder("CatalinaCluster", CatalinaClusterGBean.class,
J2EE_TYPE);
+       infoFactory.addAttribute("className", String.class, true);
+       infoFactory.addAttribute("initParams", Map.class, true);
+       infoFactory.addReference("Membership", MembershipServiceGBean.class, MembershipServiceGBean.J2EE_TYPE);
+       infoFactory.addReference("Receiver", ReceiverGBean.class, ReceiverGBean.J2EE_TYPE);
+       infoFactory.addReference("Sender", SenderGBean.class, SenderGBean.J2EE_TYPE);
+       infoFactory.addReference("MessageListenerChain", MessageListenerGBean.class, MessageListenerGBean.J2EE_TYPE);
+       infoFactory.addReference("TomcatValveChain", ValveGBean.class, ValveGBean.J2EE_TYPE);
+       infoFactory.addReference("ClusterDeployer", ClusterDeployerGBean.class, ClusterDeployerGBean.J2EE_TYPE);
+       infoFactory.addOperation("getInternalObject");
+       infoFactory.setConstructor(new String[] { 
+               "className", 
+               "initParams", 
+               "Membership", 
+               "Receiver",
+               "Sender",
+               "MessageListenerChain",
+               "TomcatValveChain",
+               "ClusterDeployer" });
+       GBEAN_INFO = infoFactory.getBeanInfo();
+   }
+
+   public static GBeanInfo getGBeanInfo() {
+       return GBEAN_INFO;
+   }
+}

Added: geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/cluster/ClusterDeployerGBean.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/cluster/ClusterDeployerGBean.java?rev=344006&view=auto
==============================================================================
--- geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/cluster/ClusterDeployerGBean.java
(added)
+++ geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/cluster/ClusterDeployerGBean.java
Sun Nov 13 15:36:16 2005
@@ -0,0 +1,89 @@
+/**
+*
+* Copyright 2003-2005 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.tomcat.cluster;
+
+import java.util.Map;
+
+import org.apache.catalina.cluster.ClusterDeployer;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.gbean.GBeanInfoBuilder;
+import org.apache.geronimo.gbean.GBeanLifecycle;
+import org.apache.geronimo.tomcat.BaseGBean;
+import org.apache.geronimo.tomcat.ObjectRetriever;
+
+public class ClusterDeployerGBean  extends BaseGBean implements
+        GBeanLifecycle, ObjectRetriever {
+
+    private static final Log log = LogFactory
+            .getLog(MembershipServiceGBean.class);
+
+    public static final String J2EE_TYPE = "MembershipService";
+
+    private final ClusterDeployer deployer;
+
+    public ClusterDeployerGBean(String className, Map initParams) throws Exception {
+
+        super(); // TODO: make it an attribute
+
+        // Validate
+        if (className == null) {
+            throw new IllegalArgumentException(
+                    "Must have a 'className' attribute.");
+        }
+
+        // Create the CatalinaCluster object
+        deployer = (ClusterDeployer) Class.forName(className).newInstance();
+
+        // Set the parameters
+        setParameters(deployer, initParams);
+
+    }
+
+    public Object getInternalObject() {
+        return deployer;
+    }
+
+    public void doFail() {
+        log.info("Failed");
+    }
+
+    public void doStart() throws Exception {
+        log.info("Started ClusterDeployer gbean.");
+    }
+
+    public void doStop() throws Exception {
+        log.info("Stopped ClusterDeployer gbean.");
+    }
+
+    public static final GBeanInfo GBEAN_INFO;
+
+    static {
+        GBeanInfoBuilder infoFactory = new GBeanInfoBuilder("ClusterDeployer",
+                ClusterDeployerGBean.class, J2EE_TYPE);
+        infoFactory.addAttribute("className", String.class, true);
+        infoFactory.addAttribute("initParams", Map.class, true);
+        infoFactory.addOperation("getInternalObject");
+        infoFactory.setConstructor(new String[] { "className", "initParams" });
+        GBEAN_INFO = infoFactory.getBeanInfo();
+    }
+
+    public static GBeanInfo getGBeanInfo() {
+        return GBEAN_INFO;
+    }
+}

Added: geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/cluster/MembershipServiceGBean.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/cluster/MembershipServiceGBean.java?rev=344006&view=auto
==============================================================================
--- geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/cluster/MembershipServiceGBean.java
(added)
+++ geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/cluster/MembershipServiceGBean.java
Sun Nov 13 15:36:16 2005
@@ -0,0 +1,89 @@
+/**
+*
+* Copyright 2003-2005 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.tomcat.cluster;
+
+import java.util.Map;
+
+import org.apache.catalina.cluster.MembershipService;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.gbean.GBeanInfoBuilder;
+import org.apache.geronimo.gbean.GBeanLifecycle;
+import org.apache.geronimo.tomcat.BaseGBean;
+import org.apache.geronimo.tomcat.ObjectRetriever;
+
+public class MembershipServiceGBean extends BaseGBean implements
+        GBeanLifecycle, ObjectRetriever {
+
+    private static final Log log = LogFactory
+            .getLog(MembershipServiceGBean.class);
+
+    public static final String J2EE_TYPE = "MembershipService";
+
+    private final MembershipService membership;
+
+    public MembershipServiceGBean(String className, Map initParams) throws Exception {
+
+        super(); // TODO: make it an attribute
+
+        // Validate
+        if (className == null) {
+            throw new IllegalArgumentException(
+                    "Must have a 'className' attribute.");
+        }
+
+        // Create the CatalinaCluster object
+        membership = (MembershipService) Class.forName(className).newInstance();
+
+        // Set the parameters
+        setParameters(membership, initParams);
+
+    }
+
+    public Object getInternalObject() {
+        return membership;
+    }
+
+    public void doFail() {
+        log.info("Failed");
+    }
+
+    public void doStart() throws Exception {
+        log.info("Started membership service gbean.");
+    }
+
+    public void doStop() throws Exception {
+        log.info("Stopped MembershipService gbean.");
+    }
+
+    public static final GBeanInfo GBEAN_INFO;
+
+    static {
+        GBeanInfoBuilder infoFactory = new GBeanInfoBuilder("MembershipService",
+                MembershipServiceGBean.class, J2EE_TYPE);
+        infoFactory.addAttribute("className", String.class, true);
+        infoFactory.addAttribute("initParams", Map.class, true);
+        infoFactory.addOperation("getInternalObject");
+        infoFactory.setConstructor(new String[] { "className", "initParams" });
+        GBEAN_INFO = infoFactory.getBeanInfo();
+    }
+
+    public static GBeanInfo getGBeanInfo() {
+        return GBEAN_INFO;
+    }
+}

Added: geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/cluster/MessageListenerGBean.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/cluster/MessageListenerGBean.java?rev=344006&view=auto
==============================================================================
--- geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/cluster/MessageListenerGBean.java
(added)
+++ geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/cluster/MessageListenerGBean.java
Sun Nov 13 15:36:16 2005
@@ -0,0 +1,98 @@
+package org.apache.geronimo.tomcat.cluster;
+
+import java.util.Map;
+
+import org.apache.catalina.cluster.MessageListener;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.gbean.GBeanInfoBuilder;
+import org.apache.geronimo.gbean.GBeanLifecycle;
+import org.apache.geronimo.tomcat.BaseGBean;
+import org.apache.geronimo.tomcat.ObjectRetriever;
+
+public class MessageListenerGBean extends BaseGBean implements GBeanLifecycle, ObjectRetriever
{
+
+    private static final Log log = LogFactory.getLog(MessageListenerGBean.class);
+
+    public static final String J2EE_TYPE = "MessageListener";
+        
+    private final MessageListener listener;
+    private final MessageListenerGBean nextListener;
+    private final String className;
+ 
+    
+    public MessageListenerGBean(){      
+        listener = null;
+        nextListener = null;
+        className = null;
+    }
+    
+    public MessageListenerGBean(String className, Map initParams, MessageListenerGBean nextListener)
throws Exception{
+
+        //Validate
+        if (className == null){
+            throw new IllegalArgumentException("className cannot be null.");
+        }
+        
+        if (nextListener != null){
+            if (!(nextListener.getInternalObject() instanceof MessageListener)){
+                throw new IllegalArgumentException("nextListener is not of type MessageListener.");
               
+            }
+            
+            this.nextListener = nextListener;
+        } else {
+            this.nextListener = null;
+        }
+        
+        this.className = className;
+        
+        //Create the Valve object
+        listener = (MessageListener)Class.forName(className).newInstance();
+
+        //Set the parameters
+        setParameters(listener, initParams);
+        
+    }
+    
+    public void doStart() throws Exception {
+        log.info(className + " started.");
+    }
+
+    public void doStop() throws Exception {
+        log.info(className + " stopped.");
+    }
+
+    public void doFail() {
+        log.info(className + " failed.");
+    }
+
+    public Object getInternalObject() {
+        return listener;
+    }
+
+    public MessageListenerGBean getNextValve() {
+        return nextListener;
+    }
+    
+    public static final GBeanInfo GBEAN_INFO;
+
+    static {
+        GBeanInfoBuilder infoFactory = new GBeanInfoBuilder(MessageListenerGBean.class, J2EE_TYPE);
+        infoFactory.addAttribute("className", String.class, true);
+        infoFactory.addAttribute("initParams", Map.class, true);
+        infoFactory.addReference("NextListener", MessageListenerGBean.class, J2EE_TYPE);
+        infoFactory.addOperation("getInternalObject");
+        infoFactory.addOperation("getNextValve");
+        infoFactory.setConstructor(new String[] { 
+                "className", 
+                "initParams", 
+                "NextListener" });
+        GBEAN_INFO = infoFactory.getBeanInfo();
+    }
+
+    public static GBeanInfo getGBeanInfo() {
+        return GBEAN_INFO;
+    }
+
+}

Added: geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/cluster/ReceiverGBean.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/cluster/ReceiverGBean.java?rev=344006&view=auto
==============================================================================
--- geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/cluster/ReceiverGBean.java
(added)
+++ geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/cluster/ReceiverGBean.java
Sun Nov 13 15:36:16 2005
@@ -0,0 +1,89 @@
+/**
+*
+* Copyright 2003-2005 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.tomcat.cluster;
+
+import java.util.Map;
+
+import org.apache.catalina.cluster.ClusterReceiver;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.gbean.GBeanInfoBuilder;
+import org.apache.geronimo.gbean.GBeanLifecycle;
+import org.apache.geronimo.tomcat.BaseGBean;
+import org.apache.geronimo.tomcat.ObjectRetriever;
+
+public class ReceiverGBean  extends BaseGBean implements
+        GBeanLifecycle, ObjectRetriever {
+
+    private static final Log log = LogFactory
+            .getLog(MembershipServiceGBean.class);
+
+    public static final String J2EE_TYPE = "Receiver";
+
+    private final ClusterReceiver receiver;
+
+    public ReceiverGBean(String className, Map initParams) throws Exception {
+
+        super(); // TODO: make it an attribute
+
+        // Validate
+        if (className == null) {
+            throw new IllegalArgumentException(
+                    "Must have a 'className' attribute.");
+        }
+
+        // Create the CatalinaCluster object
+        receiver = (ClusterReceiver) Class.forName(className).newInstance();
+
+        // Set the parameters
+        setParameters(receiver, initParams);
+
+    }
+
+    public Object getInternalObject() {
+        return receiver;
+    }
+
+    public void doFail() {
+        log.info("Failed");
+    }
+
+    public void doStart() throws Exception {
+        log.info("Started Receiver service gbean.");
+    }
+
+    public void doStop() throws Exception {
+        log.info("Stopped Receiver gbean.");
+    }
+
+    public static final GBeanInfo GBEAN_INFO;
+
+    static {
+        GBeanInfoBuilder infoFactory = new GBeanInfoBuilder("Receiver",
+                ReceiverGBean.class, J2EE_TYPE);
+        infoFactory.addAttribute("className", String.class, true);
+        infoFactory.addAttribute("initParams", Map.class, true);
+        infoFactory.addOperation("getInternalObject");
+        infoFactory.setConstructor(new String[] { "className", "initParams" });
+        GBEAN_INFO = infoFactory.getBeanInfo();
+    }
+
+    public static GBeanInfo getGBeanInfo() {
+        return GBEAN_INFO;
+    }
+}

Added: geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/cluster/SenderGBean.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/cluster/SenderGBean.java?rev=344006&view=auto
==============================================================================
--- geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/cluster/SenderGBean.java
(added)
+++ geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/cluster/SenderGBean.java
Sun Nov 13 15:36:16 2005
@@ -0,0 +1,89 @@
+/**
+*
+* Copyright 2003-2005 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.tomcat.cluster;
+
+import java.util.Map;
+
+import org.apache.catalina.cluster.ClusterSender;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.gbean.GBeanInfoBuilder;
+import org.apache.geronimo.gbean.GBeanLifecycle;
+import org.apache.geronimo.tomcat.BaseGBean;
+import org.apache.geronimo.tomcat.ObjectRetriever;
+
+public class SenderGBean extends BaseGBean implements
+        GBeanLifecycle, ObjectRetriever {
+
+    private static final Log log = LogFactory
+            .getLog(MembershipServiceGBean.class);
+
+    public static final String J2EE_TYPE = "Sender";
+
+    private final ClusterSender sender;
+
+    public SenderGBean(String className, Map initParams) throws Exception {
+
+        super(); // TODO: make it an attribute
+
+        // Validate
+        if (className == null) {
+            throw new IllegalArgumentException(
+                    "Must have a 'className' attribute.");
+        }
+
+        // Create the CatalinaCluster object
+        sender = (ClusterSender) Class.forName(className).newInstance();
+
+        // Set the parameters
+        setParameters(sender, initParams);
+
+    }
+
+    public Object getInternalObject() {
+        return sender;
+    }
+
+    public void doFail() {
+        log.info("Failed");
+    }
+
+    public void doStart() throws Exception {
+        log.info("Started Sender service gbean.");
+    }
+
+    public void doStop() throws Exception {
+        log.info("Stopped Sender gbean.");
+    }
+
+    public static final GBeanInfo GBEAN_INFO;
+
+    static {
+        GBeanInfoBuilder infoFactory = new GBeanInfoBuilder("Sender",
+                SenderGBean.class, J2EE_TYPE);
+        infoFactory.addAttribute("className", String.class, true);
+        infoFactory.addAttribute("initParams", Map.class, true);
+        infoFactory.addOperation("getInternalObject");
+        infoFactory.setConstructor(new String[] { "className", "initParams" });
+        GBEAN_INFO = infoFactory.getBeanInfo();
+    }
+
+    public static GBeanInfo getGBeanInfo() {
+        return GBEAN_INFO;
+    }
+}



Mime
View raw message