Save This Page
Home » openjdk-7 » java » rmi » activation » [javadoc | source]
    1   /*
    2    * Copyright 1997-1999 Sun Microsystems, Inc.  All Rights Reserved.
    3    * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    4    *
    5    * This code is free software; you can redistribute it and/or modify it
    6    * under the terms of the GNU General Public License version 2 only, as
    7    * published by the Free Software Foundation.  Sun designates this
    8    * particular file as subject to the "Classpath" exception as provided
    9    * by Sun in the LICENSE file that accompanied this code.
   10    *
   11    * This code is distributed in the hope that it will be useful, but WITHOUT
   12    * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   13    * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   14    * version 2 for more details (a copy is included in the LICENSE file that
   15    * accompanied this code).
   16    *
   17    * You should have received a copy of the GNU General Public License version
   18    * 2 along with this work; if not, write to the Free Software Foundation,
   19    * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   20    *
   21    * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
   22    * CA 95054 USA or visit www.sun.com if you need additional information or
   23    * have any questions.
   24    */
   25   
   26   package java.rmi.activation;
   27   
   28   import java.rmi.server.UID;
   29   
   30   /**
   31    * The identifier for a registered activation group serves several
   32    * purposes: <ul>
   33    * <li>identifies the group uniquely within the activation system, and
   34    * <li>contains a reference to the group's activation system so that the
   35    * group can contact its activation system when necessary.</ul><p>
   36    *
   37    * The <code>ActivationGroupID</code> is returned from the call to
   38    * <code>ActivationSystem.registerGroup</code> and is used to identify
   39    * the group within the activation system. This group id is passed
   40    * as one of the arguments to the activation group's special constructor
   41    * when an activation group is created/recreated.
   42    *
   43    * @author      Ann Wollrath
   44    * @see         ActivationGroup
   45    * @see         ActivationGroupDesc
   46    * @since       1.2
   47    */
   48   public class ActivationGroupID implements java.io.Serializable {
   49       /**
   50        * @serial The group's activation system.
   51        */
   52       private ActivationSystem system;
   53   
   54       /**
   55        * @serial The group's unique id.
   56        */
   57       private UID uid = new UID();
   58   
   59       /** indicate compatibility with the Java 2 SDK v1.2 version of class */
   60       private  static final long serialVersionUID = -1648432278909740833L;
   61   
   62       /**
   63        * Constructs a unique group id.
   64        *
   65        * @param system the group's activation system
   66        * @since 1.2
   67        */
   68       public ActivationGroupID(ActivationSystem system) {
   69           this.system = system;
   70       }
   71   
   72       /**
   73        * Returns the group's activation system.
   74        * @return the group's activation system
   75        * @since 1.2
   76        */
   77       public ActivationSystem getSystem() {
   78           return system;
   79       }
   80   
   81       /**
   82        * Returns a hashcode for the group's identifier.  Two group
   83        * identifiers that refer to the same remote group will have the
   84        * same hash code.
   85        *
   86        * @see java.util.Hashtable
   87        * @since 1.2
   88        */
   89       public int hashCode() {
   90           return uid.hashCode();
   91       }
   92   
   93       /**
   94        * Compares two group identifiers for content equality.
   95        * Returns true if both of the following conditions are true:
   96        * 1) the unique identifiers are equivalent (by content), and
   97        * 2) the activation system specified in each
   98        *    refers to the same remote object.
   99        *
  100        * @param   obj     the Object to compare with
  101        * @return  true if these Objects are equal; false otherwise.
  102        * @see             java.util.Hashtable
  103        * @since 1.2
  104        */
  105       public boolean equals(Object obj) {
  106           if (this == obj) {
  107               return true;
  108           } else if (obj instanceof ActivationGroupID) {
  109               ActivationGroupID id = (ActivationGroupID)obj;
  110               return (uid.equals(id.uid) && system.equals(id.system));
  111           } else {
  112               return false;
  113           }
  114       }
  115   }

Save This Page
Home » openjdk-7 » java » rmi » activation » [javadoc | source]