definitions | Definitions for Magic Beans. |
namespace | The namespace for the magic bean element. |
prefix | The element prefix. |
Example 1 | Creating a magic bean that define some file information. |
Configured By | ELEMENT |
Access | READ_WRITE |
Definitions for Magic Beans. This will be a
list of org.oddjob.arooa.beanutils.MagicBeanDefinition
s.
Configured By | ATTRIBUTE |
Access | READ_WRITE |
Required | No. |
The namespace for the magic bean element.
Configured By | ATTRIBUTE |
Access | READ_WRITE |
Required | No. |
The element prefix.
Creating a magic bean that define some file information.
This is an outer Oddjob configuration file that creates the descriptor
that defines properties for a filespec
element.
<oddjob id="this"> <job> <oddjob file="${this.dir}/MagicBeansInner.xml"> <descriptorFactory> <arooa:magic-beans namespace="oddjob:magic" prefix="magic" xmlns:arooa="http://rgordon.co.uk/oddjob/arooa"> <definitions> <is element="filespec"> <properties> <is name="description" type="java.lang.String"/> <is name="file" type="java.io.File" configured="ATTRIBUTE"/> <is name="maxSize" type="java.lang.Long"/> </properties> </is> </definitions> </arooa:magic-beans> </descriptorFactory> </oddjob> </job> </oddjob>The nested inner Oddjob configuration uses a list of
filespec
magic beans to define information for a For Each job.
<oddjob> <job> <foreach> <values> <list> <values> <magic:filespec description="Big File" file="/files/big" maxSize="1000000" xmlns:magic="oddjob:magic"/> <magic:filespec description="Medium File" file="/files/medium" maxSize="20000" xmlns:magic="oddjob:magic"/> <magic:filespec description="Small File" file="/files/small" maxSize="3000" xmlns:magic="oddjob:magic"/> </values> </list> </values> <configuration> <xml> <foreach id="each"> <job> <echo> Checking ${each.current.description} (${each.current.file}) less than ${each.current.maxSize} bytes...</echo> </job> </foreach> </xml> </configuration> </foreach> </job> </oddjob>The example will display the following when ran:
Checking Big File (\files\big) less than 1000000 bytes... Checking Medium File (\files\medium) less than 20000 bytes... Checking Small File (\files\small) less than 3000 bytes...