Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Oddjob 1.2 New Features – Part 3

DZone's Guide to

Oddjob 1.2 New Features – Part 3

· Java Zone
Free Resource

The single app analytics solutions to take your web and mobile apps to the next level.  Try today!  Brought to you in partnership with CA Technologies

Properties in Oddjob

Two cool things have happened to properties in Oddjob 1.2. First is that nested property expansion is now supported. This allows us to resolve expressions like

${somesys.${our.profile}.host}


with properties such as:

somesys.dev.host=dev1234.somewhere.com
somesys.prod.host=prod1234.somewhere.com

and

our.profile=dev

Let’s see it working:
Properties Demo Running From Console
First running from the console, and now below running in Oddjob Explorer:

Properties Demo Running in Oddjob Explorer

Here’s the configuration:

<oddjob>
  <job>
    <sequential>
      <jobs>
        <properties>
          <input>
            <file file="somesys.properties" />
          </input>
        </properties>
        <input>
          <requests>
            <input-text prompt="Profile" property="our.profile" />
          </requests>
        </input>
        <echo><![CDATA[Host is: ${somesys.${our.profile}.host}]]></echo>
      </jobs>
    </sequential>
  </job>
</oddjob>

The demo is made up of three jobs

properties
Loads the properties file into Oddjob.
input
Creates a text field prompt that sets the property our.profile

When running from Oddjob Explorer the prompt looks like this:
Profile Property Prompt

echo
Displays the message on the console. Oddjob resolves the property before it is injected into the echo job bean.

The properties job displays all the properties it’s loaded in the properties tab:
Properties Job PropertiesThis brings us nicely on to the second cool feature for properties in Oddjob 1.2, which is that a properties job without any input displays all the properties available at that point in an Oddjob configuration and where they have come from.

If I copy this configuration:

<properties/>

 

And drop it onto our sequential job in the above example, and then run it. We see:
All Properties
In addition to all the System Properties availble we see our two somesys properties, and our our.profile property. The square brackets show us where the property has come from, which is the name of the job. In our case we did not provide the properties and input jobs with a name and so the default name is used.

And that is two cool new property features in Oddjob 1.2.

 

CA App Experience Analytics, a whole new level of visibility. Learn more. Brought to you in partnership with CA Technologies.

Topics:

Published at DZone with permission of Rob Gordon, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}