geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jawar...@apache.org
Subject svn commit: r677382 - in /geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/cluster: CatalinaClusterGBean.java ClusterManagerGBean.java
Date Wed, 16 Jul 2008 19:18:37 GMT
Author: jawarner
Date: Wed Jul 16 12:18:37 2008
New Revision: 677382

URL: http://svn.apache.org/viewvc?rev=677382&view=rev
Log:
GERONIMO-4187 : setManagerClassName has been deprecated for the SimpleTCPCluster class in
Tomcat Clustering

Added:
    geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/cluster/ClusterManagerGBean.java
  (with props)
Modified:
    geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/cluster/CatalinaClusterGBean.java

Modified: geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/cluster/CatalinaClusterGBean.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/cluster/CatalinaClusterGBean.java?rev=677382&r1=677381&r2=677382&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/cluster/CatalinaClusterGBean.java
(original)
+++ geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/cluster/CatalinaClusterGBean.java
Wed Jul 16 12:18:37 2008
@@ -22,6 +22,7 @@
 import org.apache.catalina.ha.CatalinaCluster;
 import org.apache.catalina.ha.ClusterDeployer;
 import org.apache.catalina.ha.ClusterListener;
+import org.apache.catalina.ha.ClusterManager;
 import org.apache.catalina.tribes.Channel;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -52,7 +53,8 @@
            ClusterListenerGBean clusterListenerChain,
            ValveGBean tomcatValveChain,
            ClusterDeployerGBean deployer,
-           ChannelGBean channel) throws Exception {
+           ChannelGBean channel,
+           ClusterManagerGBean manager) throws Exception {
        
        super(); // TODO: make it an attribute
        
@@ -94,6 +96,11 @@
        if (channel != null){
            cluster.setChannel((Channel)channel.getInternalObject());
        }
+       
+       //Add manager
+       if (manager != null) {
+           cluster.registerManager((ClusterManager)manager.getInternalObject());
+       }
    }
 
    public Object getInternalObject() {
@@ -122,6 +129,7 @@
        infoFactory.addReference("TomcatValveChain", ValveGBean.class, ValveGBean.J2EE_TYPE);
        infoFactory.addReference("ClusterDeployer", ClusterDeployerGBean.class, ClusterDeployerGBean.J2EE_TYPE);
        infoFactory.addReference("Channel", ChannelGBean.class, ChannelGBean.J2EE_TYPE);
+       infoFactory.addReference("ClusterManager", ClusterManagerGBean.class, ClusterManagerGBean.J2EE_TYPE);
        infoFactory.addOperation("getInternalObject", "Object");
        infoFactory.setConstructor(new String[] { 
                "className", 
@@ -129,7 +137,8 @@
                "ClusterListenerChain",
                "TomcatValveChain",
                "ClusterDeployer",
-               "Channel"});
+               "Channel",
+               "ClusterManager"});
        GBEAN_INFO = infoFactory.getBeanInfo();
    }
 

Added: geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/cluster/ClusterManagerGBean.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/cluster/ClusterManagerGBean.java?rev=677382&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/cluster/ClusterManagerGBean.java
(added)
+++ geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/cluster/ClusterManagerGBean.java
Wed Jul 16 12:18:37 2008
@@ -0,0 +1,79 @@
+package org.apache.geronimo.tomcat.cluster;
+
+import java.util.Map;
+
+import org.apache.catalina.ha.ClusterManager;
+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.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class ClusterManagerGBean extends BaseGBean implements GBeanLifecycle, ObjectRetriever
{
+
+    private static final Logger log = LoggerFactory.getLogger(ClusterManagerGBean.class);
+
+    public static final String J2EE_TYPE = "ClusterManager";
+
+    protected final ClusterManager manager;
+
+    public ClusterManagerGBean() {
+        manager = null;
+    }
+    
+    protected ClusterManagerGBean(String className) throws Exception{
+        super();     
+        manager = (ClusterManager)Class.forName(className).newInstance();
+     }
+     
+     public ClusterManagerGBean(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
+         manager = (ClusterManager) Class.forName(className).newInstance();
+
+         // Set the parameters
+         setParameters(manager, initParams);
+
+     }
+
+    public void doFail() {
+        log.warn("Failed: " + manager.getClass().getName());
+    }
+
+    public void doStart() throws Exception {
+        log.debug("Started: " + manager.getClass().getName() + " gbean");
+    }
+
+    public void doStop() throws Exception {
+        log.debug("Stopped: " + manager.getClass().getName() + " gbean");
+    }
+
+    public Object getInternalObject() {
+        return manager;
+    }
+
+    public static final GBeanInfo GBEAN_INFO;
+    
+    static {
+        GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic("ClusterManager", ClusterManagerGBean.class,
J2EE_TYPE);
+        infoFactory.addAttribute("className", String.class, true);
+        infoFactory.addAttribute("initParams", Map.class, true);
+        infoFactory.addOperation("getInternalObject", "Object");
+        infoFactory.setConstructor(new String[] { "className", "initParams" });
+        GBEAN_INFO = infoFactory.getBeanInfo();
+    }
+    
+    public static GBeanInfo getGBeanInfo() {
+        return GBEAN_INFO;
+    }
+}

Propchange: geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/cluster/ClusterManagerGBean.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/cluster/ClusterManagerGBean.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/cluster/ClusterManagerGBean.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message