Oddjob 1.4 Released

Despite the eighteen month gap since Oddjob 1.3 there really isn’t a lot in this release. This is because I’ve been using Oddjob an awful lot, and using it mainly for automating testing. This has lead to some spin-off projects that are Oddjob plugins (Oddballs) and help Oddjob to test stuff. I won’t go into them here but I will be blogging more about them soon.

So what is in Oddjob 1.4?

Some Bug Fixes

And that’s always good thing.

Ant Style ** Wildcard Directory Expansion

Here’s an example of listing every fle in Oddjob’s home directory

<oddjob>
    <job>
        <repeat id="repeat">
            <values>
                <files files="${oddjob.home}/**"/>
            </values>
            <job>
                <echo><![CDATA[${repeat.current}]]></echo>
            </job>
        </repeat>
    </job>
</oddjob>

Some State Name Changes

Services and Timers now have state names to better reflect their nature. Everything in Oddjob is still essentially a Job (a java.lang.Runnable) and the act of starting a Service or Timer is a job (Services and Timers an Runnables) but they don’t COMPLETE like jobs do, They are STARTED. Other state names have changed, and hopefully their meanings become obvious and intuitive with use. There are also some different icons so it is easy to tell a Service and Timer from a Job. Here’s a picture which shows some of the new Icons.

Different States Of Oddjob

Repeat Job and Sequences

The Repeat Job was some of the first code written for Oddjob. In recent releases its lost its place somewhat, sidelined by Timer (that can do repeats with a count schedule). Now Repeat Job has changed to support repeating for the values of any Iterable. This allows repeating over each element of a List (and there is an example of this with a file list above). In this sense it is like ForEach, but it uses a single Child Job to act on the current value, not a new child for each value as ForEach does. This is simpler to configure and will be faster to execute as no extra configuration is needed to be parsed, but it does preclude parallel execution for multiple values at once.

To support existing counting behaviour a new sequence type has been introduced that acts as an Iterable, returning the next number in a sequence.

Here’s an example of a Sequence being used with Repeat

<oddjob>
  <job>
    <repeat id="each">
      <values>
        <sequence from="1" to="3" />
      </values>
      <job>
        <echo><![CDATA[Hello ${each.current}]]></echo>
      </job>
    </repeat>
  </job>
</oddjob>

Here is what it looks like in Oddjob:

Repeat Job Counting 1, 2, 3

The new Sequence type can also be used with For Each and in other situations where an iteration over a sequence of numbers is required.

And That’s Not All Folks

I think it was Steve Jobs that said something like ‘if you build something you want, you are guaranteed at least one customer’ and with Oddjob this is so true. I use Oddjob daily to automate the boring and the tedious and despite continually looking around, I have found nothing that does quite what Oddjob does. So until something else comes along to take Odjdob’s place I will continue to fix and enhance it.

Comments are closed.