KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > java > rmi > activation > ActivationGroupID


1 /*
2  * @(#)ActivationGroupID.java 1.15 03/12/19
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8 package java.rmi.activation;
9
10 import java.rmi.server.UID JavaDoc;
11
12 /**
13  * The identifier for a registered activation group serves several
14  * purposes: <ul>
15  * <li>identifies the group uniquely within the activation system, and
16  * <li>contains a reference to the group's activation system so that the
17  * group can contact its activation system when necessary.</ul><p>
18  *
19  * The <code>ActivationGroupID</code> is returned from the call to
20  * <code>ActivationSystem.registerGroup</code> and is used to identify
21  * the group within the activation system. This group id is passed
22  * as one of the arguments to the activation group's special constructor
23  * when an activation group is created/recreated.
24  *
25  * @author Ann Wollrath
26  * @version 1.15, 12/19/03
27  * @see ActivationGroup
28  * @see ActivationGroupDesc
29  * @since 1.2
30  */

31 public class ActivationGroupID implements java.io.Serializable JavaDoc {
32     /**
33      * @serial The group's activation system.
34      */

35     private ActivationSystem JavaDoc system;
36
37     /**
38      * @serial The group's unique id.
39      */

40     private UID JavaDoc uid = new UID JavaDoc();
41
42     /** indicate compatibility with the Java 2 SDK v1.2 version of class */
43     private static final long serialVersionUID = -1648432278909740833L;
44
45     /**
46      * Constructs a unique group id.
47      *
48      * @param system the group's activation system
49      * @since 1.2
50      */

51     public ActivationGroupID(ActivationSystem JavaDoc system) {
52     this.system = system;
53     }
54
55     /**
56      * Returns the group's activation system.
57      * @return the group's activation system
58      * @since 1.2
59      */

60     public ActivationSystem JavaDoc getSystem() {
61     return system;
62     }
63     
64     /**
65      * Returns a hashcode for the group's identifier. Two group
66      * identifiers that refer to the same remote group will have the
67      * same hash code.
68      *
69      * @see java.util.Hashtable
70      * @since 1.2
71      */

72     public int hashCode() {
73     return uid.hashCode();
74     }
75
76     /**
77      * Compares two group identifiers for content equality.
78      * Returns true if both of the following conditions are true:
79      * 1) the unique identifiers are equivalent (by content), and
80      * 2) the activation system specified in each
81      * refers to the same remote object.
82      *
83      * @param obj the Object to compare with
84      * @return true if these Objects are equal; false otherwise.
85      * @see java.util.Hashtable
86      * @since 1.2
87      */

88     public boolean equals(Object JavaDoc obj) {
89     if (this == obj) {
90         return true;
91     } else if (obj instanceof ActivationGroupID JavaDoc) {
92         ActivationGroupID JavaDoc id = (ActivationGroupID JavaDoc)obj;
93         return (uid.equals(id.uid) && system.equals(id.system));
94     } else {
95         return false;
96     }
97     }
98 }
99
Popular Tags