1 /*
2 * Copyright 1997-2005 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.MarshalledObject;
29 import java.rmi.Remote;
30 import java.rmi.RemoteException;
31
32 /**
33 * An <code>ActivationInstantiator</code> is responsible for creating
34 * instances of "activatable" objects. A concrete subclass of
35 * <code>ActivationGroup</code> implements the <code>newInstance</code>
36 * method to handle creating objects within the group.
37 *
38 * @author Ann Wollrath
39 * @see ActivationGroup
40 * @since 1.2
41 */
42 public interface ActivationInstantiator extends Remote {
43
44 /**
45 * The activator calls an instantiator's <code>newInstance</code>
46 * method in order to recreate in that group an object with the
47 * activation identifier, <code>id</code>, and descriptor,
48 * <code>desc</code>. The instantiator is responsible for: <ul>
49 *
50 * <li> determining the class for the object using the descriptor's
51 * <code>getClassName</code> method,
52 *
53 * <li> loading the class from the code location obtained from the
54 * descriptor (using the <code>getLocation</code> method),
55 *
56 * <li> creating an instance of the class by invoking the special
57 * "activation" constructor of the object's class that takes two
58 * arguments: the object's <code>ActivationID</code>, and the
59 * <code>MarshalledObject</code> containing object specific
60 * initialization data, and
61 *
62 * <li> returning a MarshalledObject containing the stub for the
63 * remote object it created </ul>
64 *
65 * @param id the object's activation identifier
66 * @param desc the object's descriptor
67 * @return a marshalled object containing the serialized
68 * representation of remote object's stub
69 * @exception ActivationException if object activation fails
70 * @exception RemoteException if remote call fails
71 * @since 1.2
72 */
73 public MarshalledObject<? extends Remote> newInstance(ActivationID id,
74 ActivationDesc desc)
75 throws ActivationException, RemoteException;
76 }