You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by ju...@apache.org on 2003/12/30 16:32:20 UTC

cvs commit: incubator-geronimo/modules/clustering/src/java/org/apache/geronimo/clustering DataDelta.java Data.java LocalCluster.java LocalChannel.java DataListener.java DataDeltaListener.java

jules       2003/12/30 07:32:20

  Modified:    modules/clustering/src/java/org/apache/geronimo/clustering
                        LocalCluster.java LocalChannel.java
                        DataListener.java DataDeltaListener.java
  Added:       modules/clustering/src/java/org/apache/geronimo/clustering
                        DataDelta.java Data.java
  Log:
  add types to express Cluster state and changes made to it,
  update listener APIs to deal in terms of these classes
  
  Revision  Changes    Path
  1.5       +6 -6      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.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- LocalCluster.java	30 Dec 2003 14:54:38 -0000	1.4
  +++ LocalCluster.java	30 Dec 2003 15:32:20 -0000	1.5
  @@ -128,14 +128,14 @@
     }
   
     // DataListener
  -  protected Object _data;
  +  protected Data _data;
   
     // TODO - should probably return byte[] - needs renaming
  -  public Object getData() {return _data;}
  +  public Data getData() {return _data;}
   
     // TODO - should probably expect byte[] - needs renaming
     public void
  -    setData(Object data)
  +    setData(Data data)
     {
       String xtra="we must be the first node up";
   
  @@ -146,7 +146,7 @@
       }
       else
       {
  -      _data=new Object();
  +      _data=new Data();
       }
   
       _log.debug("initialising data - "+xtra);
  @@ -154,7 +154,7 @@
   
     // DataDeltaListener
     public void
  -    applyDataDelta(Object delta)
  +    applyDataDelta(DataDelta delta)
     {
       _log.trace("applying data delta - "+delta);
     }
  
  
  
  1.3       +2 -2      incubator-geronimo/modules/clustering/src/java/org/apache/geronimo/clustering/LocalChannel.java
  
  Index: LocalChannel.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/clustering/src/java/org/apache/geronimo/clustering/LocalChannel.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- LocalChannel.java	30 Dec 2003 14:54:38 -0000	1.2
  +++ LocalChannel.java	30 Dec 2003 15:32:20 -0000	1.3
  @@ -150,7 +150,7 @@
   
     // Data
   
  -  public synchronized Object
  +  public synchronized Data
       getData()
     {
       // TODO - we need a pluggable election policy to decide who will
  
  
  
  1.2       +3 -3      incubator-geronimo/modules/clustering/src/java/org/apache/geronimo/clustering/DataListener.java
  
  Index: DataListener.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/clustering/src/java/org/apache/geronimo/clustering/DataListener.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DataListener.java	30 Dec 2003 14:54:38 -0000	1.1
  +++ DataListener.java	30 Dec 2003 15:32:20 -0000	1.2
  @@ -72,12 +72,12 @@
      * @param state an <code>Object</code> to be used as the
      * node's initial state.
      */
  -  public Object getData();
  +  public Data getData();
     /**
      * Called by Cluster to initialise the state of a [new] node.
      *
      * @param state an <code>Object</code> to be used as the
      * node's initial state.
      */
  -  public void setData(Object state);
  +  public void setData(Data state);
   }
  
  
  
  1.2       +4 -4      incubator-geronimo/modules/clustering/src/java/org/apache/geronimo/clustering/DataDeltaListener.java
  
  Index: DataDeltaListener.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/clustering/src/java/org/apache/geronimo/clustering/DataDeltaListener.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DataDeltaListener.java	30 Dec 2003 14:54:38 -0000	1.1
  +++ DataDeltaListener.java	30 Dec 2003 15:32:20 -0000	1.2
  @@ -58,8 +58,8 @@
   import java.util.List;
   
   /**
  - * An interface implemented by components that wish to have their
  - * state initialised from the Cluster.
  + * An interface implemented by components that wish to be notified
  + * about changes to Cluster state.
    *
    * @version $Revision$ $Date$
    */
  @@ -72,5 +72,5 @@
      * @param delta a <code>Object</code> delta to be applied to the
      * nodes current state.
      */
  -  public void applyDataDelta(Object delta);
  +  public void applyDataDelta(DataDelta delta);
   }
  
  
  
  1.1                  incubator-geronimo/modules/clustering/src/java/org/apache/geronimo/clustering/DataDelta.java
  
  Index: DataDelta.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;
  
  /**
   * An object capable of holding a Data change (Delta) and applying it
   * to said Data.
   *
   * @version $Revision: 1.1 $ $Date: 2003/12/30 15:32:20 $
   */
  public abstract class
    DataDelta
  {
    public abstract void apply(Data data);
  }
  
  
  
  1.1                  incubator-geronimo/modules/clustering/src/java/org/apache/geronimo/clustering/Data.java
  
  Index: Data.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 java.util.HashMap;
  import java.util.Map;
  import org.apache.commons.logging.Log;
  import org.apache.commons.logging.LogFactory;
  
  /**
   * An object capable of holding the state of multiple applications and
   * tiers.
   *
   * @version $Revision: 1.1 $ $Date: 2003/12/30 15:32:20 $
   */
  public class
    Data
  {
    protected static  Log _log=LogFactory.getLog(Data.class);
  
    protected Map    _web=new HashMap(); // Map of webapps context:sessioms
    protected Map    _ejb=new HashMap(); // Map of ejb ?type?:[stateful]sessions
    protected Object _jndi;	// ???
    //...
  }