src/java.rmi/share/classes/java/rmi/activation/ActivationDesc.java
author rriggs
Wed, 02 Oct 2019 13:57:03 -0400
changeset 58446 5c83830390ba
parent 47216 71c04702a3d5
permissions -rw-r--r--
8231663: Incorrect GPL header in some RMI/SQL package-info.java files Reviewed-by: bpb, iris, lancea
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
19829
eb9dea4a724c 8023447: change specification to allow RMI activation to be optional
smarks
parents: 5506
diff changeset
     2
 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
2
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
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
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
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    23
 * questions.
2
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
19829
eb9dea4a724c 8023447: change specification to allow RMI activation to be optional
smarks
parents: 5506
diff changeset
   108
     * @exception UnsupportedOperationException if and only if activation is
eb9dea4a724c 8023447: change specification to allow RMI activation to be optional
smarks
parents: 5506
diff changeset
   109
     * not supported by this implementation
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
     * @since 1.2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
    public ActivationDesc(String className,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
                          String location,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
                          MarshalledObject<?> data)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
        throws ActivationException
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
        this(ActivationGroup.internalCurrentGroupID(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
             className, location, data, false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
     * Constructs an object descriptor for an object whose class name
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
     * is <code>className</code>, that can be loaded from the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
     * code <code>location</code> and whose initialization
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
     * information is <code>data</code>. If this form of the constructor
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
     * is used, the <code>groupID</code> defaults to the current id for
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
     * <code>ActivationGroup</code> for this VM. All objects with the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
     * same <code>ActivationGroupID</code> are activated in the same VM.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
     * <p>This constructor will throw <code>ActivationException</code> if
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
     * there is no current activation group for this VM.  To create an
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
     * <code>ActivationGroup</code> use the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
     * <code>ActivationGroup.createGroup</code> method.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
     * @param className the object's fully package qualified class name
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
     * @param location the object's code location (from where the class is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
     * loaded)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
     * @param data the object's initialization (activation) data contained
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
     * in marshalled form.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
     * @param restart if true, the object is restarted (reactivated) when
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
     * either the activator is restarted or the object's activation group
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
     * is restarted after an unexpected crash; if false, the object is only
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
     * activated on demand.  Specifying <code>restart</code> to be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
     * <code>true</code> does not force an initial immediate activation of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
     * a newly registered object;  initial activation is lazy.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
     * @exception ActivationException if the current group is nonexistent
19829
eb9dea4a724c 8023447: change specification to allow RMI activation to be optional
smarks
parents: 5506
diff changeset
   147
     * @exception UnsupportedOperationException if and only if activation is
eb9dea4a724c 8023447: change specification to allow RMI activation to be optional
smarks
parents: 5506
diff changeset
   148
     * not supported by this implementation
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
     * @since 1.2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
    public ActivationDesc(String className,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
                          String location,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
                          MarshalledObject<?> data,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
                          boolean restart)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
        throws ActivationException
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
        this(ActivationGroup.internalCurrentGroupID(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
             className, location, data, restart);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
     * Constructs an object descriptor for an object whose class name
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
     * is <code>className</code> that can be loaded from the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
     * code <code>location</code> and whose initialization
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
     * information is <code>data</code>. All objects with the same
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
     * <code>groupID</code> are activated in the same Java VM.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
     * <p>Note that objects specified by a descriptor created with this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
     * constructor will only be activated on demand (by default, the restart
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
     * mode is <code>false</code>).  If an activatable object requires restart
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
     * services, use one of the <code>ActivationDesc</code> constructors that
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
     * takes a boolean parameter, <code>restart</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
     * @param groupID the group's identifier (obtained from registering
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
     * <code>ActivationSystem.registerGroup</code> method). The group
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
     * indicates the VM in which the object should be activated.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
     * @param className the object's fully package-qualified class name
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
     * @param location the object's code location (from where the class is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
     * loaded)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
     * @param data  the object's initialization (activation) data contained
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
     * in marshalled form.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
     * @exception IllegalArgumentException if <code>groupID</code> is null
19829
eb9dea4a724c 8023447: change specification to allow RMI activation to be optional
smarks
parents: 5506
diff changeset
   183
     * @exception UnsupportedOperationException if and only if activation is
eb9dea4a724c 8023447: change specification to allow RMI activation to be optional
smarks
parents: 5506
diff changeset
   184
     * not supported by this implementation
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
     * @since 1.2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
    public ActivationDesc(ActivationGroupID groupID,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
                          String className,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
                          String location,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
                          MarshalledObject<?> data)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
        this(groupID, className, location, data, false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
     * Constructs an object descriptor for an object whose class name
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
     * is <code>className</code> that can be loaded from the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
     * code <code>location</code> and whose initialization
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
     * information is <code>data</code>. All objects with the same
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
     * <code>groupID</code> are activated in the same Java VM.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
     * @param groupID the group's identifier (obtained from registering
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
     * <code>ActivationSystem.registerGroup</code> method). The group
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
     * indicates the VM in which the object should be activated.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
     * @param className the object's fully package-qualified class name
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
     * @param location the object's code location (from where the class is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
     * loaded)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
     * @param data  the object's initialization (activation) data contained
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
     * in marshalled form.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
     * @param restart if true, the object is restarted (reactivated) when
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
     * either the activator is restarted or the object's activation group
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
     * is restarted after an unexpected crash; if false, the object is only
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
     * activated on demand.  Specifying <code>restart</code> to be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
     * <code>true</code> does not force an initial immediate activation of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
     * a newly registered object;  initial activation is lazy.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
     * @exception IllegalArgumentException if <code>groupID</code> is null
19829
eb9dea4a724c 8023447: change specification to allow RMI activation to be optional
smarks
parents: 5506
diff changeset
   217
     * @exception UnsupportedOperationException if and only if activation is
eb9dea4a724c 8023447: change specification to allow RMI activation to be optional
smarks
parents: 5506
diff changeset
   218
     * not supported by this implementation
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
     * @since 1.2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
    public ActivationDesc(ActivationGroupID groupID,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
                          String className,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
                          String location,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
                          MarshalledObject<?> data,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
                          boolean restart)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
        if (groupID == null)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
            throw new IllegalArgumentException("groupID can't be null");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
        this.groupID = groupID;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
        this.className = className;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
        this.location = location;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
        this.data = data;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
        this.restart = restart;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
     * Returns the group identifier for the object specified by this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
     * descriptor. A group provides a way to aggregate objects into a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
     * single Java virtual machine. RMI creates/activates objects with
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
     * the same <code>groupID</code> in the same virtual machine.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
     * @return the group identifier
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
     * @since 1.2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
    public ActivationGroupID getGroupID() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
        return groupID;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
     * Returns the class name for the object specified by this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
     * descriptor.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
     * @return the class name
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
     * @since 1.2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
    public String getClassName() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
        return className;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
     * Returns the code location for the object specified by
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
     * this descriptor.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
     * @return the code location
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
     * @since 1.2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
    public String getLocation() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
        return location;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
     * Returns a "marshalled object" containing intialization/activation
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
     * data for the object specified by this descriptor.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
     * @return the object specific "initialization" data
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
     * @since 1.2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
    public MarshalledObject<?> getData() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
        return data;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
     * Returns the "restart" mode of the object associated with
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
     * this activation descriptor.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
     * @return true if the activatable object associated with this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
     * activation descriptor is restarted via the activation
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
     * daemon when either the daemon comes up or the object's group
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
     * is restarted after an unexpected crash; otherwise it returns false,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
     * meaning that the object is only activated on demand via a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
     * method call.  Note that if the restart mode is <code>true</code>, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
     * activator does not force an initial immediate activation of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
     * a newly registered object;  initial activation is lazy.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
     * @since 1.2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
    public boolean getRestartMode() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
        return restart;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
     * Compares two activation descriptors for content equality.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
     * @param   obj     the Object to compare with
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
     * @return  true if these Objects are equal; false otherwise.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
     * @see             java.util.Hashtable
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
     * @since 1.2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
    public boolean equals(Object obj) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
        if (obj instanceof ActivationDesc) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
            ActivationDesc desc = (ActivationDesc) obj;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
            return
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
                ((groupID == null ? desc.groupID == null :
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
                  groupID.equals(desc.groupID)) &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
                 (className == null ? desc.className == null :
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
                  className.equals(desc.className)) &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
                 (location == null ? desc.location == null:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
                  location.equals(desc.location)) &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
                 (data == null ? desc.data == null :
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
                  data.equals(desc.data)) &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
                 (restart == desc.restart));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
            return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
     * Return the same hashCode for similar <code>ActivationDesc</code>s.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
     * @return an integer
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
     * @see java.util.Hashtable
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
    public int hashCode() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
        return ((location == null
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
                    ? 0
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
                    : location.hashCode() << 24) ^
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
                (groupID == null
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
                    ? 0
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
                    : groupID.hashCode() << 16) ^
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
                (className == null
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
                    ? 0
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
                    : className.hashCode() << 9) ^
90ce3da70b43 Initial load
duke
parents:
diff changeset
   340
                (data == null
90ce3da70b43 Initial load
duke
parents:
diff changeset
   341
                    ? 0
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
                    : data.hashCode() << 1) ^
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
                (restart
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
                    ? 1
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
                    : 0));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
}