KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > proactive > core > runtime > ProActiveRuntime


1 /*
2  * ################################################################
3  *
4  * ProActive: The Java(TM) library for Parallel, Distributed,
5  * Concurrent computing with Security and Mobility
6  *
7  * Copyright (C) 1997-2002 INRIA/University of Nice-Sophia Antipolis
8  * Contact: proactive-support@inria.fr
9  *
10  * This library is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU Lesser General Public
12  * License as published by the Free Software Foundation; either
13  * version 2.1 of the License, or any later version.
14  *
15  * This library is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18  * Lesser General Public License for more details.
19  *
20  * You should have received a copy of the GNU Lesser General Public
21  * License along with this library; if not, write to the Free Software
22  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
23  * USA
24  *
25  * Initial developer(s): The ProActive Team
26  * http://www.inria.fr/oasis/ProActive/contacts.html
27  * Contributor(s):
28  *
29  * ################################################################
30  */

31 package org.objectweb.proactive.core.runtime;
32
33 import org.apache.log4j.Logger;
34
35 import org.objectweb.proactive.Body;
36 import org.objectweb.proactive.Job;
37 import org.objectweb.proactive.core.ProActiveException;
38 import org.objectweb.proactive.core.body.UniversalBody;
39 import org.objectweb.proactive.core.descriptor.data.VirtualNode;
40 import org.objectweb.proactive.core.mop.ConstructorCall;
41 import org.objectweb.proactive.core.mop.ConstructorCallExecutionFailedException;
42 import org.objectweb.proactive.core.node.NodeException;
43 import org.objectweb.proactive.core.process.UniversalProcess;
44 import org.objectweb.proactive.ext.security.PolicyServer;
45 import org.objectweb.proactive.ext.security.ProActiveSecurityManager;
46
47 import java.security.cert.X509Certificate JavaDoc;
48
49 import java.util.ArrayList JavaDoc;
50
51
52 /**
53  * <p>
54  * A <code>ProActiveRuntime</code> offers a set of services needed by ProActive to work with
55  * remote JVM. Each JVM that is aimed to hold active objects must contain
56  * one and only one instance of the <code>ProActiveRuntime</code> class. That instance, when
57  * created, will register itself to some registry where it is possible to perform a lookup
58  * (such as the RMI registry).
59  * </p><p>
60  * When ProActive needs to interact with a remote JVM, it will lookup for the <code>ProActiveRuntime</code> associated
61  * with that JVM (using typically the RMI Registry) and use the remote interface of the <code>ProActiveRuntime</code>
62  * to perform the interaction.
63  * </p><p>
64  * Aside the getter giving information about the VM, the 3 services offered are :
65  * <ul>
66  * <li>the creation of local node through the method <code>createLocalNode</code></li>
67  * <li>the creation of another VM(local or remote) through the method <code>createVM</code></li>
68  * </ul>
69  * </p>
70  *
71  * @author ProActive Team
72  * @version 1.0, 2002/08/29
73  * @since ProActive 0.91
74  *
75  */

76 public interface ProActiveRuntime extends Job {
77     static Logger runtimeLogger = Logger.getLogger(ProActiveRuntime.class.getName());
78
79     /**
80      * Creates a new Node in the same VM as this ProActiveRuntime
81      * @param nodeName the name of the node to create localy
82      * @param replacePreviousBinding
83      * @return the url of the newly created node in the target VM
84      * @exception NodeException if the new node cannot be created
85      */

86     public String JavaDoc createLocalNode(String JavaDoc nodeName,
87         boolean replacePreviousBinding, PolicyServer policyServer,
88         String JavaDoc vnName, String JavaDoc jobId) throws NodeException;
89
90     /**
91      * <i><font size="-1" color="#FF0000">**Under development** </font></i>
92      * Kills all Nodes in this ProActiveRuntime
93      */

94     public void killAllNodes() throws ProActiveException;
95
96     /**
97      * <i><font size="-1" color="#FF0000">**Under development** </font></i>
98      * Kills the Node of the given name and all Active Objects deployed on it.
99      * @param nodeName the name of the node to kill
100      */

101     public void killNode(String JavaDoc nodeName) throws ProActiveException;
102
103     /**
104      * Creates a new ProActiveRuntime associated with a new VM on the host defined in the given process.
105      * @param remoteProcess the process that will originate the creation of the runtime
106      * @exception java.io.IOException if the new VM cannot be created
107      * @exception ProActiveException if a problem occurs due to the remote nature of this ProActiveRuntime
108      */

109     public void createVM(UniversalProcess remoteProcess)
110         throws java.io.IOException JavaDoc, ProActiveException;
111
112     /**
113      * Returns the name of all nodes known by this ProActiveRuntime on this VM
114      * @return the name of all nodes known by this ProActiveRuntime on this VM
115      * @exception ProActiveException if a problem occurs due to the remote nature of this ProActiveRuntime
116      */

117     public String JavaDoc[] getLocalNodeNames() throws ProActiveException;
118
119     /**
120      * Returns the JVM information as one object. This method allows to
121      * retrieve all JVM information in one call to optimize performance.
122      * @return the JVM information as one object
123      */

124     public VMInformation getVMInformation();
125
126     /**
127      * <i><font size="-1" color="#FF0000">**For internal use only** </font></i>
128      * Allows this ProactiveRuntime on this VM to register another ProActiveRuntime
129      * @param proActiveRuntimeDist the remote ProactiveRuntime to register
130      * @param proActiveRuntimeName the name of the remote ProActiveRuntime
131      * @param creatorID the name of the creator of the remote ProActiveRuntime
132      * @param creationProtocol the protocol used to register the remote ProActiveRuntime when created
133      */

134     public void register(ProActiveRuntime proActiveRuntimeDist,
135         String JavaDoc proActiveRuntimeName, String JavaDoc creatorID, String JavaDoc creationProtocol,
136         String JavaDoc vmName);
137
138     /**
139      * Returns all the ProActiveRuntime registered on this ProActiveRuntime on this VM
140      * @return all the ProActiveRuntime registered on this ProActiveRuntime on this VM
141      * @exception ProActiveException if a problem occurs due to the remote nature of this ProActiveRuntime
142      */

143     public ProActiveRuntime[] getProActiveRuntimes() throws ProActiveException;
144
145     /**
146      * Returns the ProActiveRuntime of specified name
147      * @param proActiveRuntimeName the name of the ProActiveruntime to return
148      * @return the ProActiveRuntime of specified name
149      * @exception ProActiveException if a problem occurs due to the remote nature of this ProActiveRuntime
150      */

151     public ProActiveRuntime getProActiveRuntime(String JavaDoc proActiveRuntimeName)
152         throws ProActiveException;
153
154     /**
155      * Kills this ProActiveRuntime and this VM
156      * @param softly if false, this Runtime is killed abruptely
157      * if true, if that runtime originates the creation of a rmi registry, it waits until the registry is empty before
158      * dying. To be more precise a thread is created to ask periodically the registry if objects are still
159      * registered.
160      */

161     public void killRT(boolean softly) throws Exception JavaDoc;
162
163     /**
164      * Returns the url of this ProActiveRuntime on the local or remote VM
165      */

166     public String JavaDoc getURL() throws ProActiveException;
167
168     /**
169      * Returns all Active Objects deployed on the node with the given name on
170      * this ProActiveRuntime
171      * @param nodeName the name of the node
172      * @return Object[] Active Objects deployed on this ProactiveRuntime
173      */

174     public ArrayList JavaDoc getActiveObjects(String JavaDoc nodeName)
175         throws ProActiveException;
176
177     /**
178      * Returns all Active Objects with the specified class name, deployed on the node with the given name on
179      * this ProActiveRuntime
180      * @param nodeName the name of the node
181      * @param classname class of the Active Objects to look for
182      * @return Object[] Active Objects of the specified class name deployed on this ProactiveRuntime
183      */

184     public ArrayList JavaDoc getActiveObjects(String JavaDoc nodeName, String JavaDoc className)
185         throws ProActiveException;
186
187     /**
188      * Returns the VirtualNode with the given name
189      * @param VirtualNodeName the name of the VirtualNode to be acquired
190      * @return VirtualNode the virtualnode of the given name or null if such virtualNode
191      * does not exist.
192      */

193     public VirtualNode getVirtualNode(String JavaDoc virtualNodeName)
194         throws ProActiveException;
195
196     /**
197      * Registers the virtualNode of the given name in a registry such RMIRegistry or Jini Service Lookup
198      * @param virtualNodeName
199      */

200     public void registerVirtualNode(String JavaDoc virtualNodeName,
201         boolean replacePreviousBinding) throws ProActiveException;
202
203     /**
204      * Unregisters the VirtualNode of the given name from the local runtime.
205      * @param virtualNodeName the virtualNode to unregister.
206      * @throws ProActiveException if a problem occurs when trying to unregister the virtualNode
207      */

208     public void unregisterVirtualNode(String JavaDoc virtualNodeName)
209         throws ProActiveException;
210
211     /**
212      * Unregisters all VirtualNodes from the local runtime
213      * @throws ProActiveException
214      */

215     public void unregisterAllVirtualNodes() throws ProActiveException;
216
217     /**
218      * @param nodeName
219      * @return the jobId of the node with the given name
220      * @throws ProActiveException
221      */

222     public String JavaDoc getJobID(String JavaDoc nodeUrl) throws ProActiveException;
223
224     /**
225      * <p>
226      * This method is the basis for creating remote active objects.
227      * It receives a <code>ConstructorCall</code> that is the constructor call of the body
228      * of the active object to create. Inside the parameters of this constructor call is
229      * the constructor call of the reified object. Upon execution of the constructor call of the
230      * body, the body holding a reference on the reified object will get created and returned.
231      * </p><p>
232      * The method returns a reference on the RMI stub of the newly created body.
233      * </p>
234      * @param nodeName the name of the node the newly created active object will be associated to
235      * @param bodyConstructorCall the Constructor call allowing to create the body
236      * @param isNodeLocal boolean. True if proxy and body are on the same vm, false otherwise
237      * @return a stub on the newly created body.
238      * @exception ProActiveException if a problem occurs due to the remote nature of this ProactiveRuntime
239      * @exception ConstructorCallExecutionFailedException if the constructor call cannot be executed
240      * @exception java.lang.reflect.InvocationTargetException if the java constructor execution failed
241      */

242     public UniversalBody createBody(String JavaDoc nodeName,
243         ConstructorCall bodyConstructorCall, boolean isNodeLocal)
244         throws ProActiveException, ConstructorCallExecutionFailedException,
245             java.lang.reflect.InvocationTargetException JavaDoc;
246
247     /**
248      * <p>
249      * This method is the basis for migrating active objects.
250      * It receives a <code>Body</code> that embbeds the reified object and its graph of
251      * passive objects. Once transfered remotely using serialization, the body should restart
252      * itself and perform all updates needed to be functionning.
253      * </p><p>
254      * The method returns a reference on the RMI stub of the migrated body.
255      * </p>
256      * @param nodeName the name of the node the newly created active object will be associated to
257      * @param body the body of the active object migrating to this node.
258      * @return a RMI stub on the migrated body.
259      * @exception ProActiveException if a problem occurs due to the remote nature of this ProActiveRuntime
260      */

261     public UniversalBody receiveBody(String JavaDoc nodeName, Body body)
262         throws ProActiveException;
263
264     // SECURITY
265

266     /**
267      * @return creator's certificate if exists
268      */

269     public X509Certificate JavaDoc getCreatorCertificate() throws ProActiveException;
270
271     /**
272      * @return Policy server
273      */

274     public PolicyServer getPolicyServer() throws ProActiveException;
275
276     public void setProActiveSecurityManager(ProActiveSecurityManager ps)
277         throws ProActiveException;
278
279     public String JavaDoc getVNName(String JavaDoc Nodename) throws ProActiveException;
280
281     public void setDefaultNodeVirtualNodeName(String JavaDoc s)
282         throws ProActiveException;
283
284     public void listVirtualNodes() throws ProActiveException;
285
286     public PolicyServer getNodePolicyServer(String JavaDoc nodeName)
287         throws ProActiveException;
288
289     /**
290      * sets all needed modifications to enable security components
291      * MUST be called when the descriptor is ready
292      */

293     public void enableSecurityIfNeeded() throws ProActiveException;
294
295     /**
296      * @param nodeName
297      * @return return certificate associated to the node designed by nodeName
298      */

299     public X509Certificate JavaDoc getNodeCertificate(String JavaDoc nodeName)
300         throws ProActiveException;
301
302     /**
303      * @param nodeName
304      * @return returns all entities associated to the node
305      */

306     public ArrayList JavaDoc getEntities(String JavaDoc nodeName) throws ProActiveException;
307
308     /**
309      * @param nodeName
310      * @return returns all entities associated to the node
311      */

312     public ArrayList JavaDoc getEntities(UniversalBody uBody) throws ProActiveException;
313
314     /**
315      * @return returns all entities associated to this runtime
316      */

317     public ArrayList JavaDoc getEntities() throws ProActiveException;
318
319     /**
320      * @param PART
321      */

322
323     //public void setUpSecurityForRemoteLauch(ProActiveRuntime PART)throws ProActiveException;
324
}
325
Popular Tags