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

java.lang.Object
  extended byorg.objectweb.proactive.core.descriptor.data.ProActiveDescriptorImpl
All Implemented Interfaces:
ProActiveDescriptor, java.io.Serializable

public class ProActiveDescriptorImpl
extends java.lang.Object
implements ProActiveDescriptor

A ProactiveDescriptor is an internal representation of XML Descriptor. It offers a set of services to access/activate/desactivate VirtualNode.

Since:
ProActive 0.9.3
Version:
1.0, 2002/09/20
Author:
ProActive Team
See Also:
VirtualNode, VirtualMachine, Serialized Form

Field Summary
protected static org.apache.log4j.Logger logger
           
 PolicyServer policyServer
           
protected  ProActiveSecurityManager proactiveSecurityManager
          security rules
 java.lang.String securityFile
           
 
Constructor Summary
ProActiveDescriptorImpl(java.lang.String url)
          Contructs a new intance of ProActiveDescriptor
 
Method Summary
 void activateMain(java.lang.String mainDefinitionId)
          activates the main of the id-th mainDefinition
 void activateMains()
          activates all mains of mainDefinitions defined
 void activateMapping(java.lang.String virtualNodeName)
          Activates the specified VirtualNode defined in the XML Descriptor
 void activateMappings()
          Activates all VirtualNodes defined in the XML Descriptor.
 void addService(java.lang.String serviceID, UniversalService service)
          Updates with the effective service, all objects that are mapped with the serviceID.
protected  FileTransfer createFileTransferDefinition(java.lang.String fileTransferID)
          Creates a new FileTransfer definition, and maps this definition in the PAD internal mapping.
 void createMainDefinition(java.lang.String id)
          create a new mainDefintion with a unique id defined by the append of "mainDefinition:" + lastMainDefinitionID
 void createProActiveSecurityManager(java.lang.String file)
          Initialize application security policy
 ExternalProcess createProcess(java.lang.String processClassName)
          Returns a new instance of ExternalProcess from processClassName
 ExternalProcess createProcess(java.lang.String processID, java.lang.String processClassName)
          Creates an ExternalProcess of the given className with the specified ProcessID
 VirtualMachine createVirtualMachine(java.lang.String vmName)
          Creates a VirtualMachine of the given name
 VirtualNode createVirtualNode(java.lang.String vnName, boolean lookup)
          Creates a VirtualNode with the given name If the VirtualNode with the given name has previously been created, this method returns it.
 VirtualNode createVirtualNode(java.lang.String vnName, boolean lookup, boolean isMainNode)
          Creates a VirtualNode with the given name If the VirtualNode with the given name has previously been created, this method returns it.
 FileTransfer getFileTransfer(java.lang.String fileTransferID)
          Gets an instance of the FileTransfer description.
 ExternalProcess getHierarchicalProcess(java.lang.String vmname)
          Returns the process to deploy hierarchically
 java.util.Map getMainDefinitionMapping()
          return the main definitions mapping
 MainDefinition[] getMainDefinitions()
          Returns a table containing all mainDefinitions conserving order
 PolicyServer getPolicyServer()
           
 ExternalProcess getProcess(java.lang.String name)
          Returns the Process of the given name
 java.lang.String getSecurityFilePath()
           
 UniversalService getService(java.lang.String serviceID)
          Returns the Service of the given name
 java.lang.String getUrl()
          Returns the Url of the pad
 VirtualMachine getVirtualMachine(java.lang.String name)
          Returns the VitualMachine of the given name
 VirtualNode getVirtualNode(java.lang.String name)
          Returns the specified VirtualNode
 java.util.Map getVirtualNodeMapping()
          return the virtual nodes mapping
 int getVirtualNodeMappingSize()
          Returns the size of virualNodeMapping HashMap
 VirtualNode[] getVirtualNodes()
          Returns all VirtualNodes described in the XML Descriptor
 boolean isMainDefined()
          return true if at least one mainDefinition is defined
 void killall(boolean softly)
          Kills all Nodes and JVMs(local or remote) created when activating the descriptor
 void mainDefinitionAddParameter(java.lang.String parameter)
          add the parameter parameter to the parameters of the last defined mainDefinition
 void mainDefinitionAddVirtualNode(VirtualNode virtualNode)
          add a VirtualNode virtualNode to the last defined mainDefinition
 java.lang.String[] mainDefinitionGetParameters(java.lang.String mainDefinitionId)
          return an array that contains all the parameters of the last defined mainDefinition
 void mainDefinitionSetMainClass(java.lang.String mainClass)
          set the mainClass attribute of the last defined mainDefinition
 void mapToExtendedJVM(JVMProcess jvmProcess, java.lang.String processID)
          Maps the given jvmProcess with the extended JVMProcess defined with processID.
 void registerHierarchicalProcess(HierarchicalProcess hp, java.lang.String processID)
          Registers the specified hierarchical process with the specified processID.
 void registerProcess(ExternalProcessDecorator compositeProcess, java.lang.String processID)
          Registers the specified composite process with the specified processID.
 void registerProcess(VirtualMachine virtualMachine, java.lang.String processID)
          Maps the process given by the specified processID with the specified virtualMachine.
 void registerService(ServiceUser serviceUser, java.lang.String serviceID)
          Maps the service given by the specified serviceID with the specified virtualMachine.
 void setMainDefined(boolean mainDefined)
           
 void setMainDefinitionMapping(java.util.HashMap newMapping)
           
 void setVirtualNodeMapping(java.util.HashMap newMapping)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected static org.apache.log4j.Logger logger

proactiveSecurityManager

protected ProActiveSecurityManager proactiveSecurityManager
security rules


policyServer

public PolicyServer policyServer

securityFile

public java.lang.String securityFile
Constructor Detail

ProActiveDescriptorImpl

public ProActiveDescriptorImpl(java.lang.String url)
Contructs a new intance of ProActiveDescriptor

Method Detail

getUrl

public java.lang.String getUrl()
Description copied from interface: ProActiveDescriptor
Returns the Url of the pad

Specified by:
getUrl in interface ProActiveDescriptor
Returns:
String in fact it is an identifire for the pad that is returned. This identifier is build from the pad url appended with the pad's jobId.

createMainDefinition

public void createMainDefinition(java.lang.String id)
create a new mainDefintion with a unique id defined by the append of "mainDefinition:" + lastMainDefinitionID

Specified by:
createMainDefinition in interface ProActiveDescriptor

mainDefinitionSetMainClass

public void mainDefinitionSetMainClass(java.lang.String mainClass)
set the mainClass attribute of the last defined mainDefinition

Specified by:
mainDefinitionSetMainClass in interface ProActiveDescriptor
Parameters:
mainClass - fully qualified name of the mainclass

mainDefinitionAddParameter

public void mainDefinitionAddParameter(java.lang.String parameter)
add the parameter parameter to the parameters of the last defined mainDefinition

Specified by:
mainDefinitionAddParameter in interface ProActiveDescriptor
Parameters:
parameter - parameter to add

mainDefinitionGetParameters

public java.lang.String[] mainDefinitionGetParameters(java.lang.String mainDefinitionId)
return an array that contains all the parameters of the last defined mainDefinition

Specified by:
mainDefinitionGetParameters in interface ProActiveDescriptor
Parameters:
mainDefinitionId - key identifying a mainDefinition
Returns:
a table of String containing all the parameters of the mainDefinition

mainDefinitionAddVirtualNode

public void mainDefinitionAddVirtualNode(VirtualNode virtualNode)
add a VirtualNode virtualNode to the last defined mainDefinition

Specified by:
mainDefinitionAddVirtualNode in interface ProActiveDescriptor
Parameters:
virtualNode - VirtualNode to add

isMainDefined

public boolean isMainDefined()
return true if at least one mainDefinition is defined

Specified by:
isMainDefined in interface ProActiveDescriptor
Returns:
true if at least one mainDefinition is defined

setMainDefined

public void setMainDefined(boolean mainDefined)
Specified by:
setMainDefined in interface ProActiveDescriptor

activateMains

public void activateMains()
activates all mains of mainDefinitions defined

Specified by:
activateMains in interface ProActiveDescriptor

activateMain

public void activateMain(java.lang.String mainDefinitionId)
activates the main of the id-th mainDefinition

Specified by:
activateMain in interface ProActiveDescriptor
Parameters:
mainDefinitionId - key identifying a mainDefinition

getMainDefinitionMapping

public java.util.Map getMainDefinitionMapping()
return the main definitions mapping

Specified by:
getMainDefinitionMapping in interface ProActiveDescriptor
Returns:
Map

setMainDefinitionMapping

public void setMainDefinitionMapping(java.util.HashMap newMapping)
Specified by:
setMainDefinitionMapping in interface ProActiveDescriptor

getVirtualNodeMapping

public java.util.Map getVirtualNodeMapping()
return the virtual nodes mapping

Specified by:
getVirtualNodeMapping in interface ProActiveDescriptor
Returns:
Map

setVirtualNodeMapping

public void setVirtualNodeMapping(java.util.HashMap newMapping)
Specified by:
setVirtualNodeMapping in interface ProActiveDescriptor

getMainDefinitions

public MainDefinition[] getMainDefinitions()
Description copied from interface: ProActiveDescriptor
Returns a table containing all mainDefinitions conserving order

Specified by:
getMainDefinitions in interface ProActiveDescriptor
Returns:
an array containing all mainDefinitions conserving order

getVirtualNodes

public VirtualNode[] getVirtualNodes()
Description copied from interface: ProActiveDescriptor
Returns all VirtualNodes described in the XML Descriptor

Specified by:
getVirtualNodes in interface ProActiveDescriptor
Returns:
VirtualNode[] all the VirtualNodes described in the XML Descriptor

getVirtualNode

public VirtualNode getVirtualNode(java.lang.String name)
Description copied from interface: ProActiveDescriptor
Returns the specified VirtualNode

Specified by:
getVirtualNode in interface ProActiveDescriptor
Parameters:
name - name of the VirtualNode
Returns:
VirtualNode VirtualNode of the given name

getVirtualMachine

public VirtualMachine getVirtualMachine(java.lang.String name)
Description copied from interface: ProActiveDescriptor
Returns the VitualMachine of the given name

Specified by:
getVirtualMachine in interface ProActiveDescriptor
Parameters:
name -
Returns:
VirtualMachine

getProcess

public ExternalProcess getProcess(java.lang.String name)
Description copied from interface: ProActiveDescriptor
Returns the Process of the given name

Specified by:
getProcess in interface ProActiveDescriptor
Parameters:
name -
Returns:
ExternalProcess

getHierarchicalProcess

public ExternalProcess getHierarchicalProcess(java.lang.String vmname)
Description copied from interface: ProActiveDescriptor
Returns the process to deploy hierarchically

Specified by:
getHierarchicalProcess in interface ProActiveDescriptor
Parameters:
vmname -
Returns:
the process to deploy hierarchically

getService

public UniversalService getService(java.lang.String serviceID)
Description copied from interface: ProActiveDescriptor
Returns the Service of the given name

Specified by:
getService in interface ProActiveDescriptor
Parameters:
serviceID -
Returns:
an UniversalService

createFileTransferDefinition

protected FileTransfer createFileTransferDefinition(java.lang.String fileTransferID)
Creates a new FileTransfer definition, and maps this definition in the PAD internal mapping. Direct usage of this function is discouraged, since no pre-existance checking of the definition is made. Instead use the public method getFileTransfer(String) factory.

Parameters:
fileTransferID -
Returns:
a new FileTransfer definition

createVirtualNode

public VirtualNode createVirtualNode(java.lang.String vnName,
                                     boolean lookup)
Description copied from interface: ProActiveDescriptor
Creates a VirtualNode with the given name If the VirtualNode with the given name has previously been created, this method returns it.

Specified by:
createVirtualNode in interface ProActiveDescriptor
Parameters:
vnName -
lookup - if true, at creation time the VirtualNode will be a VirtualNodeLookup. If false the created VirtualNode is a VirtualNodeImpl. Once the VirtualNode created this field has no more influence when calling this method
Returns:
VirtualNode

createVirtualNode

public VirtualNode createVirtualNode(java.lang.String vnName,
                                     boolean lookup,
                                     boolean isMainNode)
Description copied from interface: ProActiveDescriptor
Creates a VirtualNode with the given name If the VirtualNode with the given name has previously been created, this method returns it.

Specified by:
createVirtualNode in interface ProActiveDescriptor
Parameters:
vnName -
lookup - if true, at creation time the VirtualNode will be a VirtualNodeLookup.
isMainNode - true if the virtual node is linked to a main definition
Returns:
VirtualNode

createVirtualMachine

public VirtualMachine createVirtualMachine(java.lang.String vmName)
Description copied from interface: ProActiveDescriptor
Creates a VirtualMachine of the given name

Specified by:
createVirtualMachine in interface ProActiveDescriptor
Parameters:
vmName -
Returns:
VirtualMachine

createProcess

public ExternalProcess createProcess(java.lang.String processID,
                                     java.lang.String processClassName)
                              throws ProActiveException
Description copied from interface: ProActiveDescriptor
Creates an ExternalProcess of the given className with the specified ProcessID

Specified by:
createProcess in interface ProActiveDescriptor
Parameters:
processID -
processClassName -
Throws:
ProActiveException - if a problem occurs during process creation

createProcess

public ExternalProcess createProcess(java.lang.String processClassName)
                              throws ProActiveException
Description copied from interface: ProActiveDescriptor
Returns a new instance of ExternalProcess from processClassName

Specified by:
createProcess in interface ProActiveDescriptor
Parameters:
processClassName -
Throws:
ProActiveException - if a problem occurs during process creation

registerProcess

public void registerProcess(VirtualMachine virtualMachine,
                            java.lang.String processID)
Description copied from interface: ProActiveDescriptor
Maps the process given by the specified processID with the specified virtualMachine.

Specified by:
registerProcess in interface ProActiveDescriptor
Parameters:
virtualMachine -
processID -

getFileTransfer

public FileTransfer getFileTransfer(java.lang.String fileTransferID)
Description copied from interface: ProActiveDescriptor
Gets an instance of the FileTransfer description. If an instance for this ID was already exists inside the pad then this one is returned, else a new one is created.

Specified by:
getFileTransfer in interface ProActiveDescriptor
Parameters:
fileTransferID - The ID of the filetransfer
Returns:
New or existing instance for the ID

registerProcess

public void registerProcess(ExternalProcessDecorator compositeProcess,
                            java.lang.String processID)
Description copied from interface: ProActiveDescriptor
Registers the specified composite process with the specified processID.

Specified by:
registerProcess in interface ProActiveDescriptor
Parameters:
compositeProcess -
processID -

mapToExtendedJVM

public void mapToExtendedJVM(JVMProcess jvmProcess,
                             java.lang.String processID)
                      throws ProActiveException
Description copied from interface: ProActiveDescriptor
Maps the given jvmProcess with the extended JVMProcess defined with processID.

Specified by:
mapToExtendedJVM in interface ProActiveDescriptor
Parameters:
jvmProcess - the jvm defined in the descriptor that contains the extendedJvm clause
processID - id of the extended jvm
Throws:
ProActiveException - if the jvm with the given id does not exist. In fact, it means that if the extended jvm is defined later on in the descriptor the exception is thrown. The extended jvm must be defined before every other jvms that extend it.

registerHierarchicalProcess

public void registerHierarchicalProcess(HierarchicalProcess hp,
                                        java.lang.String processID)
Description copied from interface: ProActiveDescriptor
Registers the specified hierarchical process with the specified processID.

Specified by:
registerHierarchicalProcess in interface ProActiveDescriptor
Parameters:
hp -
processID -

addService

public void addService(java.lang.String serviceID,
                       UniversalService service)
Description copied from interface: ProActiveDescriptor
Updates with the effective service, all objects that are mapped with the serviceID. It updates the table where is stored the mapping serviceID/service and link the VirtualMachine that references the serviceID with the effective service

Specified by:
addService in interface ProActiveDescriptor
Parameters:
serviceID -
service -

registerService

public void registerService(ServiceUser serviceUser,
                            java.lang.String serviceID)
Description copied from interface: ProActiveDescriptor
Maps the service given by the specified serviceID with the specified virtualMachine.

Specified by:
registerService in interface ProActiveDescriptor
Parameters:
serviceUser -
serviceID -

activateMappings

public void activateMappings()
Description copied from interface: ProActiveDescriptor
Activates all VirtualNodes defined in the XML Descriptor.

Specified by:
activateMappings in interface ProActiveDescriptor

activateMapping

public void activateMapping(java.lang.String virtualNodeName)
Description copied from interface: ProActiveDescriptor
Activates the specified VirtualNode defined in the XML Descriptor

Specified by:
activateMapping in interface ProActiveDescriptor
Parameters:
virtualNodeName - name of the VirtulNode to be activated

killall

public void killall(boolean softly)
             throws ProActiveException
Description copied from interface: ProActiveDescriptor
Kills all Nodes and JVMs(local or remote) created when activating the descriptor

Specified by:
killall in interface ProActiveDescriptor
Parameters:
softly - if false, all jvms created when activating the descriptor 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 thread is created to ask periodically the registry if objects are still registered.
Throws:
ProActiveException - if a problem occurs when terminating all jvms

getVirtualNodeMappingSize

public int getVirtualNodeMappingSize()
Returns the size of virualNodeMapping HashMap

Specified by:
getVirtualNodeMappingSize in interface ProActiveDescriptor
Returns:
int

createProActiveSecurityManager

public void createProActiveSecurityManager(java.lang.String file)
Initialize application security policy

Specified by:
createProActiveSecurityManager in interface ProActiveDescriptor
Parameters:
file - link to the XML security policy file

getPolicyServer

public PolicyServer getPolicyServer()
Specified by:
getPolicyServer in interface ProActiveDescriptor

getSecurityFilePath

public java.lang.String getSecurityFilePath()
Specified by:
getSecurityFilePath in interface ProActiveDescriptor


Copyright 2001-2005 INRIA All Rights Reserved.