KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > proactive > core > descriptor > data > VirtualNode


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.descriptor.data;
32
33 import java.security.cert.X509Certificate JavaDoc;
34
35 import org.apache.log4j.Logger;
36 import org.objectweb.proactive.Job;
37 import org.objectweb.proactive.core.ProActiveException;
38 import org.objectweb.proactive.core.node.Node;
39 import org.objectweb.proactive.core.node.NodeException;
40 import org.objectweb.proactive.ext.security.PolicyServer;
41
42
43 /**
44  * A <code>VirtualNode</code> is a conceptual entity that represents one or several nodes. After activation
45  * a <code>VirtualNode</code> represents one or several nodes.
46  *
47  * @author ProActive Team
48  * @version 1.0, 2002/09/20
49  * @since ProActive 0.9.3
50  * @see ProActiveDescriptor
51  * @see VirtualMachine
52  */

53 public interface VirtualNode extends java.io.Serializable JavaDoc, Job {
54     static Logger logger = Logger.getLogger(VirtualNode.class.getName());
55
56     /**
57      * Sets the property attribute to the given value
58      * @param property the value of property attribute, this value can be "unique", "unique_singleAO", "multiple", "multiple_cyclic" or nothing
59      */

60     public void setProperty(String JavaDoc property);
61
62     /**
63      * Sets the timeout variable to the given value.
64      * Calling this method will force this VirtualNode to wait until the timeout expires
65      * before giving access to its nodes.
66      */

67     public void setTimeout(String JavaDoc timeout, boolean waitForTimeout);
68
69     /**
70      * Returns the value of property attribute.
71      * @return String
72      */

73     public String JavaDoc getProperty();
74
75     /**
76      * Sets the name of this VirtualNode
77      * @param s
78      */

79     public void setName(String JavaDoc s);
80
81     /**
82      * Returns the name of this VirtualNode
83      * @return String
84      */

85     public String JavaDoc getName();
86
87     /**
88      * Adds a VirtualMachine entity to this VirtualNode
89      * @param virtualMachine
90      */

91     public void addVirtualMachine(VirtualMachine virtualMachine);
92
93     /**
94      * Returns the virtualMachine entity linked to this VirtualNode or if cyclic, returns
95      * one of the VirtualMachines linked to this VirtualNode with a cyclic manner(internal count incremented each time this method is called).
96      * @return VirtualMachine
97      */

98     public VirtualMachine getVirtualMachine();
99
100     /**
101      * Activates all the Nodes mapped to this VirtualNode in the XML Descriptor
102      */

103     public void activate();
104
105     /**
106      * Returns the number of Nodes mapped to this VirtualNode in the XML Descriptor
107      * @return int
108      */

109     public int getNodeCount();
110
111     /**
112      * Returns the number of Nodes already created among the Nodes mapped to this VirtualNode in the XML Descriptor
113      * @return int
114      */

115     public int createdNodeCount();
116
117     /**
118      * Returns the first Node created among Nodes mapped to this VirtualNode in the XML Descriptor
119      * Another call to this method will return the following created node if any. Note that the order
120      * in which Nodes are created has nothing to do with the order defined in the XML descriptor.
121      * @return Node
122      */

123     public Node getNode() throws NodeException;
124
125     /**
126      * Returns the Node mapped to this VirtualNode with the specified index. There is no relationship between,
127      * the order in the xml descriptor and the order in the array.
128      * @param index
129      * @return Node the node at the specified index in the array of nodes mapped to this VirtualNode
130      */

131     public Node getNode(int index) throws NodeException;
132
133     /**
134      * Returns all nodes url mapped to this VirualNode
135      * @return String[]. An array of string containing the url of all nodes mapped to
136      * this VirtualNode in the XML descriptor.
137      */

138     public String JavaDoc[] getNodesURL() throws NodeException;
139
140     /**
141      * Returns all nodes mapped to this VirtualNode
142      * @return Node[] An array of Node conataining all the nodes mapped to this
143      * VirtualNode in the XML descriptor
144      */

145     public Node[] getNodes() throws NodeException;
146
147     /**
148      * Returns the node of the given url among nodes mapped to this VirtualNode in the xml
149      * descriptor or null if such node does not exist.
150      * @param name
151      * @return Node the node of the given url or null if such node does not exist
152      */

153     public Node getNode(String JavaDoc url) throws NodeException;
154
155     /**
156      * Creates a node with the given protocol on the current jvm, ie the jvm that originates the creation of this VirtualNode.
157      * This newly created node will is mapped on this VirtualNode
158      * @param protocol the protocol to create the node. It has to be rmi or jini.
159      */

160     public void createNodeOnCurrentJvm(String JavaDoc protocol);
161
162     /**
163      * Kills all nodes mapped to this VirtualNode.
164      * It is in fact the runtime(so the jvm) on which the node is running that is killed.
165      * Nodes are previously unregistered from any registry.
166      * @param softly if false, all jvms created when activating this VirtualNode are killed abruptely
167      * if true a jvm that originates the creation of a rmi registry waits until registry is empty before
168      * dying. To be more precise a thraed is created to ask periodically the registry if objects are still
169      * registered.
170      */

171     public void killAll(boolean softly);
172
173     /**
174      * Returns the unique active object created on the unique node mapped to this VirtualNode.
175      * This method should be called on a virtualNode, with unique_singleAO property defined in the XML descriptor. If more than one active object are found, a
176      * warning is generated, and the first active object found is returned
177      * @return Object the unique active object created on the unique node mapped to this VirtualNode. If many active objects are found, the first one is returned
178      * @throws ProActiveException if no active objects are created on this VirtualNode.
179      */

180     public Object JavaDoc getUniqueAO() throws ProActiveException;
181
182     /**
183      * Returns true is this VirtualNode is already activated, false otherwise
184      */

185     public boolean isActivated();
186
187     /**
188      * Allows to set runtime informations for this VirtualNode activation.
189      * This method allows to give to this VirtualNode some informations retrieved at runtime and
190      * not defined in the XML descriptor.
191      * In the current release, this method can be called on a VirtualNode resulting from a lookup. The only
192      * one information that can be set is LOOKUP_HOST. This information has a sense if in the XML descriptor
193      * this VirtualNode is defined with the line:
194      * <pre>
195      * lookup virtualNode="vnName" host="*" protocol="rmi or jini", ie the name of the host where to perform the lookup
196      * will be known at runtime.
197      * </pre>
198      * We expect to implement several runtime informations.
199      * If this method fails, for instance, if the property does not exist or has already been set, or is performed on a VirtualNode not resulting
200      * from a lookup, an exception will be thrown but the application will carry on.
201      * @param information the information to be set at runtime
202      * @param value the value of the information
203      * @throws ProActiveException if the given information does not exist or has alredy been set
204      */

205     public void setRuntimeInformations(String JavaDoc information, String JavaDoc value)
206         throws ProActiveException;
207         
208     // SECURITY
209
/**
210 // * @return creator certificate
211        */

212       public X509Certificate JavaDoc getCreatorCertificate() throws ProActiveException;
213
214       /**
215        * @return policy server
216        */

217       public PolicyServer getPolicyServer();
218
219       public void setPolicyServer(PolicyServer server);
220       public void setPolicyFile(String JavaDoc file);
221 }
222
Popular Tags