org.objectweb.proactive.core.descriptor.data
Class VirtualNodeLookup

java.lang.Object
  |
  +--org.objectweb.proactive.core.descriptor.data.RuntimeDeploymentProperties
        |
        +--org.objectweb.proactive.core.descriptor.data.VirtualNodeLookup
All Implemented Interfaces:
Job, java.io.Serializable, VirtualNode

public class VirtualNodeLookup
extends RuntimeDeploymentProperties
implements VirtualNode

A VirtualNode represents a conceptual entity. After activation a VirtualNode represents one or several nodes. This class represents a remote VirtualNode resulting from a lookup in some registry such as RMIRegistry or JINI Lookup service. Objects of this class will be created when in an XML descriptor a VirtualNode is declared in the virtualNodesAcquisition tag and defined with

 lookup virtualNode="Dispatcher" host="hostname" protocol="rmi or jini"
 

Since:
ProActive 1.0.2
Version:
1.0, 2003/04/01
Author:
ProActive Team
See Also:
Serialized Form

Field Summary
protected  java.lang.String runtimeHostForLookup
           
 
Fields inherited from class org.objectweb.proactive.core.descriptor.data.RuntimeDeploymentProperties
runtimeProperties
 
Fields inherited from interface org.objectweb.proactive.core.descriptor.data.VirtualNode
logger
 
Constructor Summary
VirtualNodeLookup(java.lang.String name)
           
 
Method Summary
 void activate()
          Activates all the Nodes mapped to this VirtualNode in the XML Descriptor
 void addVirtualMachine(VirtualMachine virtualMachine)
          Adds a VirtualMachine entity to this VirtualNode
 int createdNodeCount()
          Returns the number of Nodes already created among the Nodes mapped to this VirtualNode in the XML Descriptor
 void createNodeOnCurrentJvm(java.lang.String protocol)
          Creates a node with the given protocol on the current jvm, ie the jvm that originates the creation of this VirtualNode.
 java.security.cert.X509Certificate getCreatorCertificate()
          // * @return creator certificate
 java.lang.String getJobID()
           
 java.lang.String getName()
          Returns the name of this VirtualNode
 Node getNode()
          Returns the first Node created among Nodes mapped to this VirtualNode in the XML Descriptor Another call to this method will return the following created node if any.
 Node getNode(int index)
          Returns the Node mapped to this VirtualNode with the specified index.
 Node getNode(java.lang.String url)
          Returns the node of the given url among nodes mapped to this VirtualNode in the xml descriptor or null if such node does not exist.
 int getNodeCount()
          Returns the number of Nodes mapped to this VirtualNode in the XML Descriptor
 Node[] getNodes()
          Returns all nodes mapped to this VirtualNode
 java.lang.String[] getNodesURL()
          Returns all nodes url mapped to this VirualNode
 PolicyServer getPolicyServer()
           
 java.lang.String getProperty()
          Returns the value of property attribute.
 java.lang.Object getUniqueAO()
          Returns the unique active object created on the unique node mapped to this VirtualNode.
 VirtualMachine getVirtualMachine()
          Returns the virtualMachine entity linked to this VirtualNode or if cyclic, returns one of the VirtualMachines linked to this VirtualNode with a cyclic manner(internal count incremented each time this method is called).
 boolean isActivated()
          Returns true is this VirtualNode is already activated, false otherwise
 void killAll(boolean softly)
          Kills all nodes mapped to this VirtualNode.
 void setLookupInformations(java.lang.String url, java.lang.String protocol, int port)
           
 void setName(java.lang.String s)
          Sets the name of this VirtualNode
 void setPolicyFile(java.lang.String file)
           
 void setPolicyServer(PolicyServer ps)
           
 void setProperty(java.lang.String property)
          Sets the property attribute to the given value
 void setRuntimeInformations(java.lang.String information, java.lang.String value)
          Allows to set runtime informations for this VirtualNode activation.
 void setTimeout(java.lang.String timeout, boolean waitForTimeout)
          Sets the timeout variable to the given value.
 
Methods inherited from class org.objectweb.proactive.core.descriptor.data.RuntimeDeploymentProperties
checkProperty
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

runtimeHostForLookup

protected java.lang.String runtimeHostForLookup
Constructor Detail

VirtualNodeLookup

public VirtualNodeLookup(java.lang.String name)
Method Detail

setProperty

public void setProperty(java.lang.String property)
Description copied from interface: VirtualNode
Sets the property attribute to the given value

Specified by:
setProperty in interface VirtualNode
Parameters:
property - the value of property attribute, this value can be "unique", "unique_singleAO", "multiple", "multiple_cyclic" or nothing
See Also:
VirtualNode.setProperty(String)

getProperty

public java.lang.String getProperty()
Description copied from interface: VirtualNode
Returns the value of property attribute.

Specified by:
getProperty in interface VirtualNode
Returns:
String
See Also:
VirtualNode.getProperty()

setTimeout

public void setTimeout(java.lang.String timeout,
                       boolean waitForTimeout)
Description copied from interface: VirtualNode
Sets the timeout variable to the given value. Calling this method will force this VirtualNode to wait until the timeout expires before giving access to its nodes.

Specified by:
setTimeout in interface VirtualNode

setName

public void setName(java.lang.String s)
Description copied from interface: VirtualNode
Sets the name of this VirtualNode

Specified by:
setName in interface VirtualNode
Parameters:
s -
See Also:
VirtualNode.setName(String)

getName

public java.lang.String getName()
Description copied from interface: VirtualNode
Returns the name of this VirtualNode

Specified by:
getName in interface VirtualNode
Returns:
String
See Also:
VirtualNode.getName()

addVirtualMachine

public void addVirtualMachine(VirtualMachine virtualMachine)
Description copied from interface: VirtualNode
Adds a VirtualMachine entity to this VirtualNode

Specified by:
addVirtualMachine in interface VirtualNode
Parameters:
virtualMachine -
See Also:
VirtualNode.addVirtualMachine(VirtualMachine)

getVirtualMachine

public VirtualMachine getVirtualMachine()
Description copied from interface: VirtualNode
Returns the virtualMachine entity linked to this VirtualNode or if cyclic, returns one of the VirtualMachines linked to this VirtualNode with a cyclic manner(internal count incremented each time this method is called).

Specified by:
getVirtualMachine in interface VirtualNode
Returns:
VirtualMachine
See Also:
VirtualNode.getVirtualMachine()

activate

public void activate()
Description copied from interface: VirtualNode
Activates all the Nodes mapped to this VirtualNode in the XML Descriptor

Specified by:
activate in interface VirtualNode
See Also:
VirtualNode.activate()

getNodeCount

public int getNodeCount()
Description copied from interface: VirtualNode
Returns the number of Nodes mapped to this VirtualNode in the XML Descriptor

Specified by:
getNodeCount in interface VirtualNode
Returns:
int
See Also:
VirtualNode.getNodeCount()

createdNodeCount

public int createdNodeCount()
Description copied from interface: VirtualNode
Returns the number of Nodes already created among the Nodes mapped to this VirtualNode in the XML Descriptor

Specified by:
createdNodeCount in interface VirtualNode
Returns:
int
See Also:
VirtualNode.createdNodeCount()

getNode

public Node getNode()
             throws NodeException
Description copied from interface: VirtualNode
Returns the first Node created among Nodes mapped to this VirtualNode in the XML Descriptor Another call to this method will return the following created node if any. Note that the order in which Nodes are created has nothing to do with the order defined in the XML descriptor.

Specified by:
getNode in interface VirtualNode
Returns:
Node
NodeException
See Also:
VirtualNode.getNode()

getNode

public Node getNode(int index)
             throws NodeException
Description copied from interface: VirtualNode
Returns the Node mapped to this VirtualNode with the specified index. There is no relationship between, the order in the xml descriptor and the order in the array.

Specified by:
getNode in interface VirtualNode
Parameters:
index -
Returns:
Node the node at the specified index in the array of nodes mapped to this VirtualNode
NodeException
See Also:
VirtualNode.getNode(int)

getNodesURL

public java.lang.String[] getNodesURL()
                               throws NodeException
Description copied from interface: VirtualNode
Returns all nodes url mapped to this VirualNode

Specified by:
getNodesURL in interface VirtualNode
Returns:
String[]. An array of string containing the url of all nodes mapped to this VirtualNode in the XML descriptor.
NodeException
See Also:
VirtualNode.getNodesURL()

getNodes

public Node[] getNodes()
                throws NodeException
Description copied from interface: VirtualNode
Returns all nodes mapped to this VirtualNode

Specified by:
getNodes in interface VirtualNode
Returns:
Node[] An array of Node conataining all the nodes mapped to this VirtualNode in the XML descriptor
NodeException
See Also:
VirtualNode.getNodes()

getNode

public Node getNode(java.lang.String url)
             throws NodeException
Description copied from interface: VirtualNode
Returns the node of the given url among nodes mapped to this VirtualNode in the xml descriptor or null if such node does not exist.

Specified by:
getNode in interface VirtualNode
Returns:
Node the node of the given url or null if such node does not exist
NodeException
See Also:
VirtualNode.getNode(String)

killAll

public void killAll(boolean softly)
Description copied from interface: VirtualNode
Kills all nodes mapped to this VirtualNode. It is in fact the runtime(so the jvm) on which the node is running that is killed. Nodes are previously unregistered from any registry.

Specified by:
killAll in interface VirtualNode
Parameters:
softly - if false, all jvms created when activating this VirtualNode are killed abruptely if true a jvm that originates the creation of a rmi registry waits until registry is empty before dying. To be more precise a thraed is created to ask periodically the registry if objects are still registered.

createNodeOnCurrentJvm

public void createNodeOnCurrentJvm(java.lang.String protocol)
Description copied from interface: VirtualNode
Creates a node with the given protocol on the current jvm, ie the jvm that originates the creation of this VirtualNode. This newly created node will is mapped on this VirtualNode

Specified by:
createNodeOnCurrentJvm in interface VirtualNode
Parameters:
protocol - the protocol to create the node. It has to be rmi or jini.
See Also:
VirtualNode.createNodeOnCurrentJvm(String)

getUniqueAO

public java.lang.Object getUniqueAO()
                             throws ProActiveException
Description copied from interface: VirtualNode
Returns the unique active object created on the unique node mapped to this VirtualNode. 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 warning is generated, and the first active object found is returned

Specified by:
getUniqueAO in interface VirtualNode
Returns:
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
Throws:
ProActiveException - if no active objects are created on this VirtualNode.

isActivated

public boolean isActivated()
Description copied from interface: VirtualNode
Returns true is this VirtualNode is already activated, false otherwise

Specified by:
isActivated in interface VirtualNode

getJobID

public java.lang.String getJobID()
Specified by:
getJobID in interface Job
Returns:
the jobID associated with this object

setRuntimeInformations

public void setRuntimeInformations(java.lang.String information,
                                   java.lang.String value)
                            throws ProActiveException
Description copied from interface: VirtualNode
Allows to set runtime informations for this VirtualNode activation. This method allows to give to this VirtualNode some informations retrieved at runtime and not defined in the XML descriptor. In the current release, this method can be called on a VirtualNode resulting from a lookup. The only one information that can be set is LOOKUP_HOST. This information has a sense if in the XML descriptor this VirtualNode is defined with the line:
 lookup virtualNode="vnName" host="*" protocol="rmi or jini", ie the name of the host where to perform the lookup
 will be known at runtime.
 
We expect to implement several runtime informations. 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 from a lookup, an exception will be thrown but the application will carry on.

Specified by:
setRuntimeInformations in interface VirtualNode
Parameters:
information - the information to be set at runtime
value - the value of the information
Throws:
ProActiveException - if the given information does not exist or has alredy been set
See Also:
At the moment the only property that can be set at runtime is LOOKUP_HOST.

setLookupInformations

public void setLookupInformations(java.lang.String url,
                                  java.lang.String protocol,
                                  int port)

getCreatorCertificate

public java.security.cert.X509Certificate getCreatorCertificate()
                                                         throws ProActiveException
Description copied from interface: VirtualNode
// * @return creator certificate

Specified by:
getCreatorCertificate in interface VirtualNode
ProActiveException

getPolicyServer

public PolicyServer getPolicyServer()
Specified by:
getPolicyServer in interface VirtualNode
Returns:
policy server

setPolicyServer

public void setPolicyServer(PolicyServer ps)
Specified by:
setPolicyServer in interface VirtualNode

setPolicyFile

public void setPolicyFile(java.lang.String file)
Specified by:
setPolicyFile in interface VirtualNode


Copyright © April 2004 INRIA All Rights Reserved.