Package org.oddjob.values
Class VariablesJob
java.lang.Object
org.oddjob.framework.extend.BaseComponent
org.oddjob.framework.extend.BasePrimary
org.oddjob.framework.extend.SimpleJob
org.oddjob.values.VariablesJob
- All Implemented Interfaces:
Runnable,org.apache.commons.beanutils.DynaBean,ArooaContextAware,ArooaSessionAware,Forceable,PropertyChangeNotifier,Iconic,LogEnabled,Resettable,Stateful
- Author:
- rob
Description
This job provides a 'variables' like declaration within Oddjob.The variables job is like a bean where any property can be set with any value.
Because names are properties, they can only be valid simple property
names. 'java.version' is not valid simple property because it is
interpreted as a value 'java' that has a property 'version'. To allow
these type of properties to be referenced in Oddjob use
PropertiesJob.
Example
A simple variable.
<oddjob>
<job>
<sequential>
<jobs>
<variables id="vars">
<greeting>
<value value="Hello World"/>
</greeting>
</variables>
<echo name="Echo a Greeting">${vars.greeting}</echo>
</jobs>
</sequential>
</job>
</oddjob>
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanDoes the specified mapped property contain a value for the specified key value?protected intexecute()Execute this job.Return the value of a simple property with the specified name.Return the value of an indexed property with the specified name.Return the value of a mapped property with the specified name, ornullif there is no value for the specified key.org.apache.commons.beanutils.DynaClassReturn theDynaClassinstance that describes the set of properties available for this DynaBean.protected voidonReset()Allow sub classes to do something on reset.voidRemove any existing value for the specified key on the specified mapped property.voidSet the value of an indexed property with the specified name.voidSet the value of a simple property with the specified name.voidSet the value of a mapped property with the specified name.voidsetValue(String name, ArooaValue value) Add a name value pair.toString()Override toString.Methods inherited from class org.oddjob.framework.extend.SimpleJob
fireDestroyedState, force, getStateChanger, hardReset, iconHelper, isStop, onDestroy, onStop, run, sleep, softReset, stateHandler, stopMethods inherited from class org.oddjob.framework.extend.BasePrimary
configure, getName, logger, logger, loggerName, save, setNameMethods inherited from class org.oddjob.framework.extend.BaseComponent
addIconListener, addPropertyChangeListener, addStateListener, configure, destroy, firePropertyChange, getArooaSession, iconForId, initialise, lastStateEvent, onConfigured, onInitialised, removeIconListener, removePropertyChangeListener, removeStateListener, save, setArooaContext, setArooaSessionMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.oddjob.Stateful
addStateListener, lastStateEvent, removeStateListener
-
Constructor Details
-
VariablesJob
public VariablesJob()
-
-
Method Details
-
setValue
Add a name value pair. This method will be called during parsing.- Parameters:
name- The name of the variable.value- The runtime configurable for the value.
-
execute
Description copied from class:SimpleJobExecute this job. -
onReset
protected void onReset()Description copied from class:SimpleJobAllow sub classes to do something on reset. -
contains
Does the specified mapped property contain a value for the specified key value?- Specified by:
containsin interfaceorg.apache.commons.beanutils.DynaBean- Parameters:
name- Name of the property to checkkey- Name of the key to check- Throws:
IllegalArgumentException- if there is no property of the specified name
-
get
Return the value of a simple property with the specified name.- Specified by:
getin interfaceorg.apache.commons.beanutils.DynaBean- Parameters:
name- Name of the property whose value is to be retrieved- Throws:
IllegalArgumentException- if there is no property of the specified name
-
get
Return the value of an indexed property with the specified name.- Specified by:
getin interfaceorg.apache.commons.beanutils.DynaBean- Parameters:
name- Name of the property whose value is to be retrievedindex- Index of the value to be retrieved- Throws:
IllegalArgumentException- if there is no property of the specified nameIllegalArgumentException- if the specified property exists, but is not indexedIndexOutOfBoundsException- if the specified index is outside the range of the underlying propertyNullPointerException- if no array or List has been initialized for this property
-
get
Return the value of a mapped property with the specified name, ornullif there is no value for the specified key.- Specified by:
getin interfaceorg.apache.commons.beanutils.DynaBean- Parameters:
name- Name of the property whose value is to be retrievedkey- Key of the value to be retrieved- Throws:
IllegalArgumentException- if there is no property of the specified nameIllegalArgumentException- if the specified property exists, but is not mapped
-
getDynaClass
public org.apache.commons.beanutils.DynaClass getDynaClass()Return theDynaClassinstance that describes the set of properties available for this DynaBean.- Specified by:
getDynaClassin interfaceorg.apache.commons.beanutils.DynaBean
-
remove
Remove any existing value for the specified key on the specified mapped property.- Specified by:
removein interfaceorg.apache.commons.beanutils.DynaBean- Parameters:
name- Name of the property for which a value is to be removedkey- Key of the value to be removed- Throws:
IllegalArgumentException- if there is no property of the specified name
-
set
Set the value of a simple property with the specified name.- Specified by:
setin interfaceorg.apache.commons.beanutils.DynaBean- Parameters:
name- Name of the property whose value is to be setvalue- Value to which this property is to be set- Throws:
org.apache.commons.beanutils.ConversionException- if the specified value cannot be converted to the type required for this propertyIllegalArgumentException- if there is no property of the specified nameNullPointerException- if an attempt is made to set a primitive property to null
-
set
Set the value of an indexed property with the specified name.- Specified by:
setin interfaceorg.apache.commons.beanutils.DynaBean- Parameters:
name- Name of the property whose value is to be setindex- Index of the property to be setvalue- Value to which this property is to be set- Throws:
org.apache.commons.beanutils.ConversionException- if the specified value cannot be converted to the type required for this propertyIllegalArgumentException- if there is no property of the specified nameIllegalArgumentException- if the specified property exists, but is not indexedIndexOutOfBoundsException- if the specified index is outside the range of the underlying property
-
set
Set the value of a mapped property with the specified name.- Specified by:
setin interfaceorg.apache.commons.beanutils.DynaBean- Parameters:
name- Name of the property whose value is to be setkey- Key of the property to be setvalue- Value to which this property is to be set- Throws:
org.apache.commons.beanutils.ConversionException- if the specified value cannot be converted to the type required for this propertyIllegalArgumentException- if there is no property of the specified nameIllegalArgumentException- if the specified property exists, but is not mapped
-
toString
Description copied from class:BasePrimaryOverride toString.- Overrides:
toStringin classBasePrimary
-