jdk/src/share/classes/java/rmi/activation/ActivationDesc.java
author duke
Sat, 01 Dec 2007 00:00:00 +0000
changeset 2 90ce3da70b43
child 5506 202f599c92aa
permissions -rw-r--r--
Initial load
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
     2
 * Copyright 1997-2005 Sun Microsystems, Inc.  All Rights Reserved.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
90ce3da70b43 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Sun designates this
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
90ce3da70b43 Initial load
duke
parents:
diff changeset
     9
 * by Sun in the LICENSE file that accompanied this code.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    21
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    22
 * CA 95054 USA or visit www.sun.com if you need additional information or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    23
 * have any questions.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
package java.rmi.activation;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
import java.io.Serializable;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
import java.rmi.MarshalledObject;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
 * An activation descriptor contains the information necessary to
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
 * activate an object: <ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
 * <li> the object's group identifier,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
 * <li> the object's fully-qualified class name,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
 * <li> the object's code location (the location of the class), a codebase URL
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 * path,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 * <li> the object's restart "mode", and,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 * <li> a "marshalled" object that can contain object specific
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 * initialization data. </ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 * <p>A descriptor registered with the activation system can be used to
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 * recreate/activate the object specified by the descriptor. The
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 * <code>MarshalledObject</code> in the object's descriptor is passed
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 * as the second argument to the remote object's constructor for
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 * object to use during reinitialization/activation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
 * @author      Ann Wollrath
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
 * @since       1.2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
 * @see         java.rmi.activation.Activatable
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
public final class ActivationDesc implements Serializable {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
     * @serial the group's identifier
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
    private ActivationGroupID groupID;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
     * @serial the object's class name
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
    private String className;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
     * @serial the object's code location
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
    private String location;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
     * @serial the object's initialization data
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
    private MarshalledObject<?> data;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
     * @serial indicates whether the object should be restarted
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
    private boolean restart;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
    /** indicate compatibility with the Java 2 SDK v1.2 version of class */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
    private static final long serialVersionUID = 7455834104417690957L;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
     * Constructs an object descriptor for an object whose class name
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
     * is <code>className</code>, that can be loaded from the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
     * code <code>location</code> and whose initialization
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
     * information is <code>data</code>. If this form of the constructor
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
     * is used, the <code>groupID</code> defaults to the current id for
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
     * <code>ActivationGroup</code> for this VM. All objects with the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
     * same <code>ActivationGroupID</code> are activated in the same VM.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
     * <p>Note that objects specified by a descriptor created with this
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
     * constructor will only be activated on demand (by default, the restart
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
     * mode is <code>false</code>).  If an activatable object requires restart
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
     * services, use one of the <code>ActivationDesc</code> constructors that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
     * takes a boolean parameter, <code>restart</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
     * <p> This constructor will throw <code>ActivationException</code> if
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
     * there is no current activation group for this VM.  To create an
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
     * <code>ActivationGroup</code> use the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
     * <code>ActivationGroup.createGroup</code> method.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
     * @param className the object's fully package qualified class name
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
     * @param location the object's code location (from where the class is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
     * loaded)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
     * @param data the object's initialization (activation) data contained
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
     * in marshalled form.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
     * @exception ActivationException if the current group is nonexistent
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
     * @since 1.2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
    public ActivationDesc(String className,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
                          String location,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
                          MarshalledObject<?> data)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
        throws ActivationException
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
        this(ActivationGroup.internalCurrentGroupID(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
             className, location, data, false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
     * Constructs an object descriptor for an object whose class name
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
     * is <code>className</code>, that can be loaded from the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
     * code <code>location</code> and whose initialization
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
     * information is <code>data</code>. If this form of the constructor
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
     * is used, the <code>groupID</code> defaults to the current id for
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
     * <code>ActivationGroup</code> for this VM. All objects with the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
     * same <code>ActivationGroupID</code> are activated in the same VM.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
     * <p>This constructor will throw <code>ActivationException</code> if
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
     * there is no current activation group for this VM.  To create an
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
     * <code>ActivationGroup</code> use the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
     * <code>ActivationGroup.createGroup</code> method.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
     * @param className the object's fully package qualified class name
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
     * @param location the object's code location (from where the class is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
     * loaded)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
     * @param data the object's initialization (activation) data contained
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
     * in marshalled form.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
     * @param restart if true, the object is restarted (reactivated) when
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
     * either the activator is restarted or the object's activation group
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
     * is restarted after an unexpected crash; if false, the object is only
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
     * activated on demand.  Specifying <code>restart</code> to be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
     * <code>true</code> does not force an initial immediate activation of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
     * a newly registered object;  initial activation is lazy.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
     * @exception ActivationException if the current group is nonexistent
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
     * @since 1.2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
    public ActivationDesc(String className,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
                          String location,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
                          MarshalledObject<?> data,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
                          boolean restart)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
        throws ActivationException
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
        this(ActivationGroup.internalCurrentGroupID(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
             className, location, data, restart);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
     * Constructs an object descriptor for an object whose class name
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
     * is <code>className</code> that can be loaded from the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
     * code <code>location</code> and whose initialization
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
     * information is <code>data</code>. All objects with the same
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
     * <code>groupID</code> are activated in the same Java VM.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
     * <p>Note that objects specified by a descriptor created with this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
     * constructor will only be activated on demand (by default, the restart
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
     * mode is <code>false</code>).  If an activatable object requires restart
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
     * services, use one of the <code>ActivationDesc</code> constructors that
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
     * takes a boolean parameter, <code>restart</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
     * @param groupID the group's identifier (obtained from registering
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
     * <code>ActivationSystem.registerGroup</code> method). The group
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
     * indicates the VM in which the object should be activated.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
     * @param className the object's fully package-qualified class name
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
     * @param location the object's code location (from where the class is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
     * loaded)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
     * @param data  the object's initialization (activation) data contained
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
     * in marshalled form.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
     * @exception IllegalArgumentException if <code>groupID</code> is null
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
     * @since 1.2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
    public ActivationDesc(ActivationGroupID groupID,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
                          String className,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
                          String location,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
                          MarshalledObject<?> data)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
        this(groupID, className, location, data, false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
     * Constructs an object descriptor for an object whose class name
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
     * is <code>className</code> that can be loaded from the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
     * code <code>location</code> and whose initialization
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
     * information is <code>data</code>. All objects with the same
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
     * <code>groupID</code> are activated in the same Java VM.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
     * @param groupID the group's identifier (obtained from registering
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
     * <code>ActivationSystem.registerGroup</code> method). The group
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
     * indicates the VM in which the object should be activated.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
     * @param className the object's fully package-qualified class name
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
     * @param location the object's code location (from where the class is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
     * loaded)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
     * @param data  the object's initialization (activation) data contained
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
     * in marshalled form.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
     * @param restart if true, the object is restarted (reactivated) when
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
     * either the activator is restarted or the object's activation group
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
     * is restarted after an unexpected crash; if false, the object is only
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
     * activated on demand.  Specifying <code>restart</code> to be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
     * <code>true</code> does not force an initial immediate activation of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
     * a newly registered object;  initial activation is lazy.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
     * @exception IllegalArgumentException if <code>groupID</code> is null
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
     * @since 1.2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
    public ActivationDesc(ActivationGroupID groupID,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
                          String className,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
                          String location,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
                          MarshalledObject<?> data,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
                          boolean restart)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
        if (groupID == null)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
            throw new IllegalArgumentException("groupID can't be null");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
        this.groupID = groupID;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
        this.className = className;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
        this.location = location;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
        this.data = data;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
        this.restart = restart;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
     * Returns the group identifier for the object specified by this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
     * descriptor. A group provides a way to aggregate objects into a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
     * single Java virtual machine. RMI creates/activates objects with
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
     * the same <code>groupID</code> in the same virtual machine.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
     * @return the group identifier
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
     * @since 1.2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
    public ActivationGroupID getGroupID() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
        return groupID;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
     * Returns the class name for the object specified by this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
     * descriptor.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
     * @return the class name
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
     * @since 1.2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
    public String getClassName() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
        return className;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
     * Returns the code location for the object specified by
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
     * this descriptor.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
     * @return the code location
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
     * @since 1.2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
    public String getLocation() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
        return location;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
     * Returns a "marshalled object" containing intialization/activation
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
     * data for the object specified by this descriptor.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
     * @return the object specific "initialization" data
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
     * @since 1.2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
    public MarshalledObject<?> getData() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
        return data;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
     * Returns the "restart" mode of the object associated with
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
     * this activation descriptor.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
     * @return true if the activatable object associated with this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
     * activation descriptor is restarted via the activation
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
     * daemon when either the daemon comes up or the object's group
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
     * is restarted after an unexpected crash; otherwise it returns false,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
     * meaning that the object is only activated on demand via a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
     * method call.  Note that if the restart mode is <code>true</code>, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
     * activator does not force an initial immediate activation of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
     * a newly registered object;  initial activation is lazy.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
     * @since 1.2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
    public boolean getRestartMode() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
        return restart;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
     * Compares two activation descriptors for content equality.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
     * @param   obj     the Object to compare with
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
     * @return  true if these Objects are equal; false otherwise.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
     * @see             java.util.Hashtable
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
     * @since 1.2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
    public boolean equals(Object obj) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
        if (obj instanceof ActivationDesc) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
            ActivationDesc desc = (ActivationDesc) obj;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
            return
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
                ((groupID == null ? desc.groupID == null :
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
                  groupID.equals(desc.groupID)) &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
                 (className == null ? desc.className == null :
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
                  className.equals(desc.className)) &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
                 (location == null ? desc.location == null:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
                  location.equals(desc.location)) &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
                 (data == null ? desc.data == null :
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
                  data.equals(desc.data)) &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
                 (restart == desc.restart));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
            return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
     * Return the same hashCode for similar <code>ActivationDesc</code>s.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
     * @return an integer
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
     * @see java.util.Hashtable
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
    public int hashCode() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
        return ((location == null
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
                    ? 0
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
                    : location.hashCode() << 24) ^
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
                (groupID == null
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
                    ? 0
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
                    : groupID.hashCode() << 16) ^
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
                (className == null
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
                    ? 0
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
                    : className.hashCode() << 9) ^
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
                (data == null
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
                    ? 0
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
                    : data.hashCode() << 1) ^
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
                (restart
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
                    ? 1
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
                    : 0));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
}