[Index]

state:watch


Evaluate a state expression that becomes an event source for triggering other jobs. used with events:trigger and events:when.

Expressions are of the form:

 [NOT] job-id IS job-condition
 

And can be chained with AND and OR and nested with parenthesis. Examples are:

 		job1 is success
 		not job1 is success
 		job1 is success or ( job2 is success and job3 is success)
 

Property Summary

expression The state expression to evaluate.

Example Summary

Example 1 Runs a job when two other jobs complete, but only if one of the jobs hasn't been run.

Property Detail

expression

Configured ByTEXT
AccessREAD_WRITE
RequiredYes.

The state expression to evaluate.


Examples

Example 1

Runs a job when two other jobs complete, but only if one of the jobs hasn't been run.

<oddjob>
    <job>
        <sequential>
            <jobs>
                <events:when id="when" xmlns:events="oddjob:events">
                    <jobs>
                        <events:watch name="Watch Jobs 1 and 2">
                            <eventSource>
                                <state:watch xmlns:state="http://rgordon.co.uk/oddjob/state">
                                    job1 is COMPLETE 
AND 
job2 is COMPLETE

                                </state:watch>
                            </eventSource>
                        </events:watch>
                        <state:if xmlns:state="http://rgordon.co.uk/oddjob/state">
                            <jobs>
                                <sequential>
                                    <jobs>
                                        <state:evaluate id="check-job3" name="Is Job 3 Complete">
                                            job3 is complete
                                        </state:evaluate>
                                        <check gt="${check-job3.evaluation.time}" value="${when.trigger.time}"/>
                                    </jobs>
                                </sequential>
                                <state:flag/>
                                <run job="${job3}" name="Run Job 3"/>
                            </jobs>
                        </state:if>
                    </jobs>
                </events:when>
                <folder>
                    <jobs>
                        <echo id="job1" name="Job 1">
                            Hello
                        </echo>
                        <echo id="job2" name="Job 2">
                            World
                        </echo>
                        <echo id="job3" name="Job 3">
                            It's Done!
                        </echo>
                    </jobs>
                </folder>
            </jobs>
        </sequential>
    </job>
</oddjob>


(c) R Gordon Ltd 2005 - Present