public class MagicBeanDescriptorFactory extends Object implements ArooaDescriptorFactory
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...
| Constructor and Description |
|---|
MagicBeanDescriptorFactory() |
| Modifier and Type | Method and Description |
|---|---|
ArooaDescriptor |
createDescriptor(ClassLoader classLoader)
Create an ArooaDesciptor.
|
MagicBeanDefinition |
getDefinitions(int index) |
URI |
getNamespace() |
String |
getPrefix() |
void |
setDefinitions(int index,
MagicBeanDefinition def) |
void |
setNamespace(URI namespace) |
void |
setPrefix(String prefix) |
String |
toString() |
public ArooaDescriptor createDescriptor(ClassLoader classLoader)
ArooaDescriptorFactorycreateDescriptor in interface ArooaDescriptorFactoryclassLoader - The classLoader to use.public void setDefinitions(int index,
MagicBeanDefinition def)
public MagicBeanDefinition getDefinitions(int index)
public URI getNamespace()
public void setNamespace(URI namespace)
public String getPrefix()
public void setPrefix(String prefix)