0N/A/*
2362N/A * Copyright (c) 1997, 1999, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
2362N/A * published by the Free Software Foundation. Oracle designates this
0N/A * particular file as subject to the "Classpath" exception as provided
2362N/A * by Oracle in the LICENSE file that accompanied this code.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
0N/A */
0N/A
0N/Apackage java.rmi.activation;
0N/A
0N/Aimport java.rmi.server.UID;
0N/A
0N/A/**
0N/A * The identifier for a registered activation group serves several
0N/A * purposes: <ul>
0N/A * <li>identifies the group uniquely within the activation system, and
0N/A * <li>contains a reference to the group's activation system so that the
0N/A * group can contact its activation system when necessary.</ul><p>
0N/A *
0N/A * The <code>ActivationGroupID</code> is returned from the call to
0N/A * <code>ActivationSystem.registerGroup</code> and is used to identify
0N/A * the group within the activation system. This group id is passed
0N/A * as one of the arguments to the activation group's special constructor
0N/A * when an activation group is created/recreated.
0N/A *
0N/A * @author Ann Wollrath
0N/A * @see ActivationGroup
0N/A * @see ActivationGroupDesc
0N/A * @since 1.2
0N/A */
0N/Apublic class ActivationGroupID implements java.io.Serializable {
0N/A /**
0N/A * @serial The group's activation system.
0N/A */
0N/A private ActivationSystem system;
0N/A
0N/A /**
0N/A * @serial The group's unique id.
0N/A */
0N/A private UID uid = new UID();
0N/A
0N/A /** indicate compatibility with the Java 2 SDK v1.2 version of class */
0N/A private static final long serialVersionUID = -1648432278909740833L;
0N/A
0N/A /**
0N/A * Constructs a unique group id.
0N/A *
0N/A * @param system the group's activation system
0N/A * @since 1.2
0N/A */
0N/A public ActivationGroupID(ActivationSystem system) {
0N/A this.system = system;
0N/A }
0N/A
0N/A /**
0N/A * Returns the group's activation system.
0N/A * @return the group's activation system
0N/A * @since 1.2
0N/A */
0N/A public ActivationSystem getSystem() {
0N/A return system;
0N/A }
0N/A
0N/A /**
0N/A * Returns a hashcode for the group's identifier. Two group
0N/A * identifiers that refer to the same remote group will have the
0N/A * same hash code.
0N/A *
0N/A * @see java.util.Hashtable
0N/A * @since 1.2
0N/A */
0N/A public int hashCode() {
0N/A return uid.hashCode();
0N/A }
0N/A
0N/A /**
0N/A * Compares two group identifiers for content equality.
0N/A * Returns true if both of the following conditions are true:
0N/A * 1) the unique identifiers are equivalent (by content), and
0N/A * 2) the activation system specified in each
0N/A * refers to the same remote object.
0N/A *
0N/A * @param obj the Object to compare with
0N/A * @return true if these Objects are equal; false otherwise.
0N/A * @see java.util.Hashtable
0N/A * @since 1.2
0N/A */
0N/A public boolean equals(Object obj) {
0N/A if (this == obj) {
0N/A return true;
0N/A } else if (obj instanceof ActivationGroupID) {
0N/A ActivationGroupID id = (ActivationGroupID)obj;
0N/A return (uid.equals(id.uid) && system.equals(id.system));
0N/A } else {
0N/A return false;
0N/A }
0N/A }
0N/A}