Child pages
  • Simple Code Examples

This is the documentation of the latest development version of automaIT. The documentation of the latest stable release can be found at AUTOMAIT.

Skip to end of metadata
Go to start of metadata

Plans or components can be used to write code for automaIT. Both of them are XML files of the model namespace. The root element of a plan is named plan and the root element of a component is component.

To create the content of a plan, install, uninstall, or control method of a component, it is necessary to be familiar with so called block statements. Block statements are a sequence of steps and the content of the following elements:

  • Body of a Plan
  • Install method of a component (installSteps)
  • Uninstall method of a component (uninstallSteps)
  • Controls of a component (control)
  • Body of if blocks
  • Body of switch resp. case blocks
  • Body of try blocks

The complete model schema reference is documented in the Model Schema Reference .

Block statements can contain single elements such as an execNative, an echo, an if, try, etc.

Simple Example
<plan name="SimpleExample" description="Says 'Hello World!'"
    xsi:schemaLocation=" plan.xsd ">
    <echo message="Hello World!" />


The elements if, switch and try are nestable, too. In the following example the block and catch elements are examples for elements that can contain all block statements again.

Example with try/catch statement
<plan name="SimpleExample" description="Lists the content of the /etc directory."
    xsi:schemaLocation=" plan.xsd ">

                <exec cmd="ls">
                    <arg value="/etc" />
            <echo message="This directory does not exist, but I don't care." />
Example with if statement
<plan name="SimpleExample" description="says 'Hello'"
    xsi:schemaLocation=" plan.xsd ">

                    <installedComponent name="MyComponent" />
            <echo message="Component is not installed." />
            <uninstall blockName="default">
                <installedComponent name="MyComponent" />
Example with swith-case statement
<switch value="java_:[java_version]_vendor_:[vendor]_:[architecture]_bit" caseSensitive="false" executeMultiple="true">
    <case matches="^java_6_vendor_oracle_32_bit$">
        <echo message="Installing Java Version 6 on 32 bit system. Vendor Oracle." />
    <case matches="^java_7_vendor_ibm_(32|64)_bit$">
        <echo message="Configure installation. Java Version 7 on :[architecture] bit system. Vendor IBM." />
    <case matches="^java_7_vendor_ibm_32_bit$">
        <echo message="Installing Java Version 7 on 32 bit system. Vendor IBM." />
    <case matches="^java_7_vendor_ibm_64_bit$">
        <echo message="Installing Java Version 7 on 64 bit system. Vendor IBM." />
        <raise message="Unknown java/vendor/architecture combination : Java version: :[java_version], Vendor :[vendor], Architecture: :[architecture] bit" />

Writing code gets much easier by using code completion of Eclipse (documentation).

  • No labels