TOP

Library net/mdatools/modelant/util/antlib.xml

Tasks, types and macros of ModelAnt utilities. They are ready for standalone use.
Usage:

<typedef resource="net/mdatools/modelant/util/antlib.xml"/>
Tasks and Macros Description
exclusive Guarantee that the nested tasks will NOT run in parallel with other tasks in another <exclusive>. Task container that guarantees that the nested tasks will NOT run in parallel with other tasks that are nested in another ExclusiveTask. This way, if tasks that would work in parallel are nested in ExclusiveTasks forms critical sections.
 Example:

  <parallel task 1 of thread 1>
  <parallel task 2 of thread 1>
  <parallel task 3 of thread 1>

  <parallel task 1 of thread 2>
  <parallel task 2 of thread 2>
  <parallel task 3 of thread 2>

  <parallel task 1 of thread 3>
  <parallel task 2 of thread 3>
  <parallel task 3 of thread 3>

  The tasks of each thread run sequentially, whereas the threads run in parallel.
  In order to make sure that there are NO  <parallel task 2 of thread X> running
  simultaneously, we just do:

  <parallel task 1 of thread 1>
  <exclusive>
    <parallel task 2 of thread 1>
  </exclusive>
  <parallel task 3 of thread 1>

  <parallel task 1 of thread 2>
  <exclusive>
    <parallel task 2 of thread 2>
  </exclusive>
  <parallel task 3 of thread 2>

  <parallel task 1 of thread 3>
  <exclusive>
    <parallel task 2 of thread 3>
  </exclusive>
  <parallel task 3 of thread 3>
 
filter.output Set a filter on the messages to send to the current logger or any already registered recorders in the ANT project. The filter is expressed as a set of regular expressions. When the message to log matches at least one of them, the message will not be logged. Note that any later registered loggers or recorders will not be filtered.
Usage:
   <filter.output>
     <pattern>^.*?Deleting: .*$</pattern>
   </filter.output>
 
for Execute the nested tasks in a separate temporary environment for each element described in a Selector Iterate over a selector or resources collection and execute the nested tasks in a separate (local) environment for each of them. This way, any environment changes made by one iteration are released and do not affect the other iterations.
By default it iterates on the value of "this" property Note:
 <for property="name"> 
 
 is a shortcut of
 
   <for>
     <propertSelector property="name"/>
 
format Format a string according a naming convention. This task formats the value provided as of the format specified and binds it to the property with the name provided.
if Conditional evaluation Conditional execution statement.
init
       Recommended usage:
         <antlib>
            <init>
              Put initialization code here, like:
              <echo> Library initialized</echo>
            </init>
         </antlib>
      
Initialize an antlib, by setting common properties and executing the nested tasks, while making sure the execution is done one-time, no matter how many times the antlib is loaded. This task could be used only in <antlib> - it deliberately does not run in <project> to avoid proliferation of quite similar in use/meaning ways to do the same things like project's initialization (setup).
Convention:
  • The properties this task sets have a common (unique) prefix, calculated as follows:
    1. take the location of the of the antlib calling this task
    2. strip any references to the jar it might have been found in
    3. strip any line number
    4. strip the trailing .xml
    5. replace / with .
    The result is referred as (unique) namespace of the special properties for the antlib calling this task. Examples:
    • net.mdatools.modelant.util.antlib
    • net.mdatools.modelant.uml13.reverse.antlib
  • The properties this task sets:
    • <namespace>.dir -> the absolute path were the antlib file is loaded from or the .jar containing it is
    • <namespace>.initialized -> true indicating that the initialization of the antib is done and will not be repeated
    • <namespace>.classpath -> the string as CLASSPATH the using library was loaded with.
NOTE: This task allows using <import> tasks, which would not be possible by deafault.
local Contain tasks to run in a separate temporary environment of variable properties. This class is a task container that runs the nested tasks in a separate (local) environment.
method Call a method on a Java object Call the method with the name and parameters provided on the named object and stores the result into the property with the name provided. The result object is stored as an object value of the named property.
method.new Construct a Java object Calls the constructor with the parameters provided on the named class and stores the result into the property with the name provided. The result object is stored as an object value of the named property.
search Starting from the selected objects, execute the nested tasks for them and collect the produced results for iteration upon. The iteration ends when all objects are processed and no new objects are put for collected.
Note:
 <search property="name"> 
 
 is a shortcut of
 
   <search>
     <propertSelector property="name"/>
 
If no selectors specified, it iterates on the value of "this" property
select Iterate among the selected objects and collect all those objects that satisfy the nested condition. In an advanced usage form, state the name of the property to collect in the "collect" property and provide nested tasks to set up the value of the "collect" property for each object that satisfies the nested condition.
Note: 
 <select property="name"> 
 
 is a shortcut of
 
   <select>
     <propertSelector property="name"/>
 
If no selectors specified, it iterates on the value of "this" property
set Assign the (object) value of one property to another property in the current local environment
suppress Suppress the exceptions the nested tasks may throw. Store the caught exception in a property.
while Execute the nested tasks while the condition is true, in a separate environment

Conditions Description
evaluate Evaluate the condition in the environment defined from the outer current environment and the result of the execution of the tasks provided. Note that this makes possible the use of expressions and calculations in the conditions, that are dynamically evaluated (in contrast to ANT), for example in for, select, exists or any other
 Usage:
     <evaluate>
       <tasks>
         define some properties
       </tasks>
       
       a condition using the properties defined in the tasks section
     </evaluate>
     
     The tasks are optional 
 
exists Check if there is at least one element of the collection that satisfies the nested condition. Iterate over the selected objects and verify that there is at least one among them, that satisfies the nested condition.
Note:
 <exists property="name"> 
 
 is a shortcut of
 
   <exists>
     <propertSelector property="name"/>
 
If no selectors specified, it iterates on the value of "this" property
for.each Check if each element of the collection satisfies the nested condition. Iterate over the selected objects and verify that all of them satisfy the nested condition.
Note:
 <for.each property="name"> 
 
 is a shortcut of
 
   <for.each>
     <propertSelector property="name"/>
 
If no selectors specified, it iterates on the value of "this" property
isempty Check if the object to test is null, an empty list or an empty string. This class is a condition checking if a property in the current environment is to an empty value, meaning NULL, an Empty String, an empty collection or an empty array.
isequal Check if the object to test equals to the condition's parameter. Check if the object value of one property is equal to the object value of another property. The comparison is held as of Java objects, by calling their equals() method. Two properties that have no value/they are not defined. are treated as equal.
isin Check if the collection to test contains another value. This class is a condition checking if a property in the current environment is bound to an object among the objects listed in the property provided in list task attribute.
method.condition Call a boolean method on a Java object and use it as a condition Call the boolean method with the name and parameters provided on the named object.

Documentation generated by ant.doc Ant macro from ModelAnt by MDA Tools