geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xuhaih...@apache.org
Subject svn commit: r881668 - in /geronimo/server/branches/2.1/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/cluster: CatalinaClusterGBean.java ClusterManagerGBean.java
Date Wed, 18 Nov 2009 04:40:39 GMT
Author: xuhaihong
Date: Wed Nov 18 04:40:39 2009
New Revision: 881668

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

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

Modified: geronimo/server/branches/2.1/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/cluster/CatalinaClusterGBean.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.1/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/cluster/CatalinaClusterGBean.java?rev=881668&r1=881667&r2=881668&view=diff
==============================================================================
--- geronimo/server/branches/2.1/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/cluster/CatalinaClusterGBean.java
(original)
+++ geronimo/server/branches/2.1/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/cluster/CatalinaClusterGBean.java
Wed Nov 18 04:40:39 2009
@@ -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.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -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/branches/2.1/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/cluster/ClusterManagerGBean.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.1/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/cluster/ClusterManagerGBean.java?rev=881668&view=auto
==============================================================================
--- geronimo/server/branches/2.1/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/cluster/ClusterManagerGBean.java
(added)
+++ geronimo/server/branches/2.1/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/cluster/ClusterManagerGBean.java
Wed Nov 18 04:40:39 2009
@@ -0,0 +1,89 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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.ha.ClusterManager;
+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 ClusterManagerGBean extends BaseGBean implements GBeanLifecycle, ObjectRetriever
{
+
+    private static final Log log = LogFactory.getLog(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;
+    }
+}
\ No newline at end of file

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

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

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



Mime
View raw message