geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject cvs commit: incubator-geronimo/modules/clustering/src/java/org/apache/geronimo/clustering MBeanImpl.java Tier.java Node.java LocalCluster.java Cluster.java
Date Sun, 04 Jan 2004 14:35:06 GMT
jules       2004/01/04 06:35:06

  Modified:    modules/clustering/src/java/org/apache/geronimo/clustering
                        Tier.java Node.java LocalCluster.java Cluster.java
  Added:       modules/clustering/src/java/org/apache/geronimo/clustering
                        MBeanImpl.java
  Log:
  abstracted code common to Clustering MBeans into ...clustering.MBeanImpl.java
  
  Revision  Changes    Path
  1.3       +4 -35     incubator-geronimo/modules/clustering/src/java/org/apache/geronimo/clustering/Tier.java
  
  Index: Tier.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/clustering/src/java/org/apache/geronimo/clustering/Tier.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Tier.java	4 Jan 2004 14:18:06 -0000	1.2
  +++ Tier.java	4 Jan 2004 14:35:06 -0000	1.3
  @@ -78,12 +78,10 @@
    */
   public abstract class
     Tier
  -  implements GeronimoMBeanTarget
  +  extends MBeanImpl
   {
  -  protected static Log  _log=LogFactory.getLog(Tier.class);
  -  protected ObjectName  _objectName;
  +  protected Log         _log=LogFactory.getLog(Tier.class);
     protected Node        _node;
  -  protected MBeanServer _server;
     protected Data        _data;
     protected Map         _tiers;
     protected Object      _tier;
  @@ -107,14 +105,6 @@
       return new ObjectName("geronimo.clustering:role=Tier,name="+tierName+",node="+nodeName+",cluster="+clusterName);
     }
   
  -  /**
  -   * Return a local reference to this Object. For tight coupling via
  -   * JMX (bad idea?).
  -   *
  -   * @return a <code>Tier</code> value
  -   */
  -  public Tier getReference(){return this;}
  -
     //----------------------------------------
     // GeronimoMBeanTarget
     //----------------------------------------
  @@ -153,8 +143,6 @@
       return true;
     }
   
  -  public boolean canStop() {return true;}
  -
     public synchronized void
       doStart()
     {
  @@ -177,34 +165,15 @@
       }
     }
   
  -  public void
  -    doStop()
  -  {
  -    // TODO
  -  }
  -
  -  public void doFail() {}
  -
  -  public void
  -    setMBeanContext(GeronimoMBeanContext context)
  -  {
  -    _objectName=(context==null)?null:context.getObjectName();
  -    _server    =(context==null)?null:context.getServer();
  -  }
  -
     public static GeronimoMBeanInfo
       getGeronimoMBeanInfo()
     {
  -    GeronimoMBeanInfo mbeanInfo=new GeronimoMBeanInfo();
  +    GeronimoMBeanInfo mbeanInfo=MBeanImpl.getGeronimoMBeanInfo();
       //set target class in concrete subclass
       mbeanInfo.addAttributeInfo(new GeronimoAttributeInfo("Reference",   true, false, "a
local reference to this Tier"));
       mbeanInfo.addAttributeInfo(new GeronimoAttributeInfo("Name",        true, false, "Name
of this Tier"));
       mbeanInfo.addAttributeInfo(new GeronimoAttributeInfo("NodeName",    true, false, "Name
of this Tier's Node"));
       mbeanInfo.addAttributeInfo(new GeronimoAttributeInfo("ClusterName", true, false, "Name
of this Tier's Node's Cluster"));
  -    mbeanInfo.addOperationInfo(new GeronimoOperationInfo("registerData",
  -							 new GeronimoParameterInfo[] {new GeronimoParameterInfo("uid", String.class, "uid
of webapp"),new GeronimoParameterInfo("data", Object.class, "data to be held")},
  -							 MBeanOperationInfo.ACTION,
  -							 "Register data with Tier state manager"));
       return mbeanInfo;
     }
   }
  
  
  
  1.3       +4 -22     incubator-geronimo/modules/clustering/src/java/org/apache/geronimo/clustering/Node.java
  
  Index: Node.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/clustering/src/java/org/apache/geronimo/clustering/Node.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Node.java	4 Jan 2004 14:18:06 -0000	1.2
  +++ Node.java	4 Jan 2004 14:35:06 -0000	1.3
  @@ -72,11 +72,10 @@
    */
   public class
     Node
  -  implements GeronimoMBeanTarget, MetaDataListener, DataListener, DataDeltaListener
  +  extends MBeanImpl
  +  implements MetaDataListener, DataListener, DataDeltaListener
   {
     protected static Log 	_log=LogFactory.getLog(Node.class);
  -  protected ObjectName 	_objectName;
  -  protected MBeanServer _server;
     protected Cluster     _cluster;
   
     //----------------------------------------
  @@ -117,14 +116,6 @@
       return new ObjectName("geronimo.clustering:role=Node,name="+nodeName+",cluster="+clusterName);
     }
   
  -  /**
  -   * Return a local reference to this Object. For tight coupling via
  -   * JMX (bad idea?).
  -   *
  -   * @return a <code>Node</code> value
  -   */
  -  public Node getReference(){return this;}
  -
     //----------------------------------------
     // MetaDataListener
     //----------------------------------------
  @@ -204,8 +195,6 @@
       return true;
     }
   
  -  public boolean canStop() {return true;}
  -
     public void
       doStart()
     {
  @@ -235,17 +224,10 @@
       _cluster.leave(this);	// TODO - ??
     }
   
  -  public void
  -    setMBeanContext(GeronimoMBeanContext context)
  -  {
  -    _objectName=(context==null)?null:context.getObjectName();
  -    _server    =(context==null)?null:context.getServer();
  -  }
  -
     public static GeronimoMBeanInfo
       getGeronimoMBeanInfo()
     {
  -    GeronimoMBeanInfo mbeanInfo=new GeronimoMBeanInfo();
  +    GeronimoMBeanInfo mbeanInfo=MBeanImpl.getGeronimoMBeanInfo();
       mbeanInfo.setTargetClass(Node.class);
       mbeanInfo.addAttributeInfo(new GeronimoAttributeInfo("Reference", true, false, "a local
reference to this Node"));
       mbeanInfo.addAttributeInfo(new GeronimoAttributeInfo("Name",      true, false, "unique
identifier for this Node (within it's Cluster)"));
  
  
  
  1.12      +3 -12     incubator-geronimo/modules/clustering/src/java/org/apache/geronimo/clustering/LocalCluster.java
  
  Index: LocalCluster.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/clustering/src/java/org/apache/geronimo/clustering/LocalCluster.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- LocalCluster.java	4 Jan 2004 14:18:06 -0000	1.11
  +++ LocalCluster.java	4 Jan 2004 14:35:06 -0000	1.12
  @@ -79,18 +79,9 @@
     LocalCluster
     extends Cluster
   {
  -  // class
  -  protected static Log _log=LogFactory.getLog(LocalCluster.class);
  +  protected Log  _log=LogFactory.getLog(LocalCluster.class);
  +  protected List _members=new Vector();
   
  -  // instance
  -  protected List   _members=new Vector();
  -
  -
  -  /**
  -   * Creates a new <code>LocalCluster</code> instance.
  -   *
  -   * @param name a <code>String</code> value
  -   */
     public List getMembers(){synchronized (_members){return Collections.unmodifiableList(_members);}}
   
     // MetaData
  
  
  
  1.7       +3 -24     incubator-geronimo/modules/clustering/src/java/org/apache/geronimo/clustering/Cluster.java
  
  Index: Cluster.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/clustering/src/java/org/apache/geronimo/clustering/Cluster.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- Cluster.java	4 Jan 2004 14:18:06 -0000	1.6
  +++ Cluster.java	4 Jan 2004 14:35:06 -0000	1.7
  @@ -77,7 +77,7 @@
    */
   public abstract class
     Cluster
  -  implements GeronimoMBeanTarget
  +  extends MBeanImpl
   {
     protected Log _log=LogFactory.getLog(Cluster.class);
   
  @@ -88,9 +88,6 @@
       return new ObjectName("geronimo.clustering:role=Cluster,name="+clusterName);
     }
   
  -  protected ObjectName 	_objectName;
  -  protected MBeanServer _server;
  -
     /**
      * Return current Cluster members.
      *
  @@ -114,14 +111,6 @@
      */
     public abstract void leave(Object member);
   
  -  /**
  -   * Return a local reference to this Object. For tight coupling via
  -   * JMX (bad idea?).
  -   *
  -   * @return a <code>Cluster</code> value
  -   */
  -  public Cluster getReference(){return this;}
  -
     //----------------------------------------
     // GeronimoMBeanTarget
     //----------------------------------------
  @@ -138,8 +127,6 @@
       return true;
     }
   
  -  public boolean canStop(){return true;}
  -
     public void
       doStart()
     {
  @@ -159,19 +146,11 @@
       _log.debug("failing");
     }
   
  -  public void
  -    setMBeanContext(GeronimoMBeanContext context)
  -  {
  -    _objectName=(context==null)?null:context.getObjectName();
  -    _server    =(context==null)?null:context.getServer();
  -  }
  -
     public static GeronimoMBeanInfo
       getGeronimoMBeanInfo()
     {
  -    GeronimoMBeanInfo mbeanInfo=new GeronimoMBeanInfo();
  +    GeronimoMBeanInfo mbeanInfo=MBeanImpl.getGeronimoMBeanInfo();
       // set target class in concrete subclasses...
  -    mbeanInfo.addAttributeInfo(new GeronimoAttributeInfo("Reference", true, false, "a local
reference to this Cluster"));
       return mbeanInfo;
     }
   }
  
  
  
  1.1                  incubator-geronimo/modules/clustering/src/java/org/apache/geronimo/clustering/MBeanImpl.java
  
  Index: MBeanImpl.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2003 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" and
   *    "Apache Geronimo" must not be used to endorse or promote products
   *    derived from this software without prior written permission. For
   *    written permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    "Apache Geronimo", nor may "Apache" appear in their name, without
   *    prior written permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * ====================================================================
   */
  package org.apache.geronimo.clustering;
  
  import javax.management.MBeanServer;
  import javax.management.ObjectName;
  import org.apache.commons.logging.Log;
  import org.apache.commons.logging.LogFactory;
  import org.apache.geronimo.kernel.service.GeronimoAttributeInfo;
  import org.apache.geronimo.kernel.service.GeronimoMBeanContext;
  import org.apache.geronimo.kernel.service.GeronimoMBeanInfo;
  import org.apache.geronimo.kernel.service.GeronimoMBeanTarget;
  
  /**
   * A base class containing fnality useful to the MBeans of the
   * Clustering module.
   *
   * @version $Revision: 1.1 $ $Date: 2004/01/04 14:35:06 $
   */
  public abstract class
    MBeanImpl
    implements GeronimoMBeanTarget
  {
    protected Log         _log=LogFactory.getLog(MBeanImpl.class);
    protected ObjectName  _objectName;
    protected MBeanServer _server;
  
    /**
     * Return a local reference to this Object. For tight coupling via
     * JMX (bad idea?).
     *
     * @return a <code>Object</code> value
     */
    public Object getReference(){return this;}
  
    //----------------------------------------
    // GeronimoMBeanTarget
    //----------------------------------------
  
    public boolean canStart(){return true;}
    public boolean canStop(){return true;}
  
    public void doStart(){}
    public void doStop(){}
    public void doFail(){}
  
    public void
      setMBeanContext(GeronimoMBeanContext context)
    {
      _objectName=(context==null)?null:context.getObjectName();
      _server    =(context==null)?null:context.getServer();
    }
  
    public static GeronimoMBeanInfo
      getGeronimoMBeanInfo()
    {
      GeronimoMBeanInfo mbeanInfo=new GeronimoMBeanInfo();
      // set target class in concrete subclasses...
      mbeanInfo.addAttributeInfo(new GeronimoAttributeInfo("Reference", true, false, "a local
reference to this Object"));
      return mbeanInfo;
    }
  }
  
  
  

Mime
View raw message