org.objectweb.proactive.core.xml
Class VariableContract

java.lang.Object
  extended byorg.objectweb.proactive.core.xml.VariableContract
All Implemented Interfaces:
java.io.Serializable

public class VariableContract
extends java.lang.Object
implements java.io.Serializable

This class provides a Variable Contract between the deployment descriptor and the application program. Variables can be defined of different types, thus inforcing different requirements to the contract.

Author:
The ProActive Team
See Also:
Serialized Form

Nested Class Summary
static class VariableContract.Lock
          Class used for exclusive acces to global static variable: org.objectweb.proactive.core.xml.XMLProperties.xmlproperties
 
Field Summary
static VariableContract.Lock lock
           
static VariableContract xmlproperties
           
 
Constructor Summary
VariableContract()
          Constructor of the class.
 
Method Summary
 boolean checkContract()
          Checks if there are empty values in the contract.
 void close()
          Marks the contract as closed.
 java.lang.String getValue(java.lang.String name)
          Returns the value of the variable name passed as parameter.
 boolean isClosed()
          Tells wether this contract is closed or not.
 void load(java.lang.String file)
          Loads the variable contract from a Java Properties file format
 void loadXML(java.lang.String file)
          Loads a file with Variable Contract tags into the this instance.
 void setDescriptorVariable(java.lang.String name, java.lang.String value, VariableContractType type)
          Method for setting variables value from the deploying application.
 void setDescriptorVariableOLD(java.lang.String name, java.lang.String value, VariableContractType type)
           
 void setVariableFromProgram(java.util.HashMap map, VariableContractType type)
          Method for setting a group of variables from the program.
 void setVariableFromProgram(java.lang.String name, java.lang.String value, VariableContractType type)
          Method for setting variables value from the deploying application.
 void setVariableFromProgramOLD(java.lang.String name, java.lang.String value, VariableContractType type)
           
 java.lang.String toString()
           
 java.lang.String transform(java.lang.String text)
          TODO Method to transform a variable to it's value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

xmlproperties

public static VariableContract xmlproperties

lock

public static final VariableContract.Lock lock
Constructor Detail

VariableContract

public VariableContract()
Constructor of the class. Creates a new instance.

Method Detail

close

public void close()
Marks the contract as closed. No more variables can be defined or set.


isClosed

public boolean isClosed()
Tells wether this contract is closed or not.

Returns:
True if it is closed, false otherwise.

setVariableFromProgram

public void setVariableFromProgram(java.lang.String name,
                                   java.lang.String value,
                                   VariableContractType type)
Method for setting variables value from the deploying application.

Parameters:
name - The name of the variable.
value - Value of the variable
Throws:
java.lang.NullPointerException - if the arguments are null.
java.lang.IllegalArgumentException - if setting the value breaches the variable (contract) type

setVariableFromProgram

public void setVariableFromProgram(java.util.HashMap map,
                                   VariableContractType type)
                            throws java.lang.NullPointerException
Method for setting a group of variables from the program.

Throws:
java.lang.NullPointerException - if the arguments are null.
java.lang.IllegalArgumentException - if setting the value breaches the variable (contract) type
See Also:
setVariableFromProgram(String name, String value, VariableContractType type)

setDescriptorVariable

public void setDescriptorVariable(java.lang.String name,
                                  java.lang.String value,
                                  VariableContractType type)
Method for setting variables value from the deploying application.

Parameters:
name - The name of the variable.
value - Value of the variable
Throws:
java.lang.NullPointerException - if the arguments are null.
java.lang.IllegalArgumentException - if setting the value breaches the variable (contract) type

load

public void load(java.lang.String file)
          throws org.xml.sax.SAXException
Loads the variable contract from a Java Properties file format

Parameters:
file - The file location.
Throws:
org.xml.sax.SAXException

loadXML

public void loadXML(java.lang.String file)
Loads a file with Variable Contract tags into the this instance.

Parameters:
file -

getValue

public java.lang.String getValue(java.lang.String name)
Returns the value of the variable name passed as parameter.

Parameters:
name - The name of the variable.
Returns:
The value of the variable.

transform

public java.lang.String transform(java.lang.String text)
TODO Method to transform a variable to it's value.

Parameters:
text - Text with properties inside to translates.
Returns:
string with properties swapped to their text value.

checkContract

public boolean checkContract()
Checks if there are empty values in the contract. All errors are printed through the logger.

Returns:
True if the contract has no empty values.

toString

public java.lang.String toString()

setDescriptorVariableOLD

public void setDescriptorVariableOLD(java.lang.String name,
                                     java.lang.String value,
                                     VariableContractType type)

setVariableFromProgramOLD

public void setVariableFromProgramOLD(java.lang.String name,
                                      java.lang.String value,
                                      VariableContractType type)
                               throws java.lang.NullPointerException,
                                      java.lang.IllegalArgumentException
Throws:
java.lang.NullPointerException
java.lang.IllegalArgumentException


Copyright 2001-2005 INRIA All Rights Reserved.