org.enhydra.zeus.util
Class ZeusTask

java.lang.Object
  |
  +--org.apache.tools.ant.ProjectComponent
        |
        +--org.apache.tools.ant.Task
              |
              +--org.enhydra.zeus.util.ZeusTask

public class ZeusTask
extends org.apache.tools.ant.Task

ZeusTask is an Ant Task for generating Java source files from a set of constraints. Please refer to the Ant website for more information. The supported tags are as follows:

The zeus element is the top-level element used to initiate data binding using Zeus. It specifies global options for all constraint generation processes initiated within it (each using the constraint element, see below).
    <zeus> Tag
attribute required default value description
srcDir no [Current Working Directory] The base directory for constraint files
destDir yes N/A The directory in which generated Java source files should be placed. Note that this will be the base directory, and directories equivalent to the package-level of the generated source code will be nested within this base.
defaultJavaPackage no "" The Java package to use on all constraint generation processes where an explicit Java package is not supplied (using the javaPackage attribute on the constraint element, see below).

The constraint element can be nested inside the zeus element, one or more times. This is used to specify a single constraint generation process (the conversion from one constraint file to one or more Java source files). All options specified here override the default options specified on the zeus element.
    <constraint> Tag
attribute required default value description
type yes N/A The type of constraint being supplied. Currently, only DTD is supported, with XSD (XML Schema) in an alpha state.
constraintFile yes N/A The path (working from the sourceDir path, specified in the zeus element) to the constraint file to generate source code from.
javaPackage no "" The Java package in which to place generated source code. This overrides any value supplied in the defaultJavaPackage attribute on the zeus element.)
collapseSimpleElements no false Whether or not to collapse simple elements. A simple element is one in which there is only character content; there are no attributes, and no nested elements. Collapsing these elements results in properties that access the simple element's content as get[ElementName]() instead of get[ElementName]().getValue().
ignoreIDAttributes no false Whether or not to ignore ID attributes in deterimining if an element is simple. When IDREFs are used, most elements have ID attributes that have no functional meaning. This allows elements with just an ID attribute to still be collapsed as simple elements.

Author:
J. Matthew Pryor, Brett McLaughlin

Inner Class Summary
 class ZeusTask.Constraint
           Constraint is an inner class used to represent a single constraint element (constraint).
 
Fields inherited from class org.apache.tools.ant.Task
description, location, target, taskName, taskType, wrapper
 
Fields inherited from class org.apache.tools.ant.ProjectComponent
project
 
Constructor Summary
ZeusTask()
           This default constructor sets up task defaults.
 
Method Summary
 ZeusTask.Constraint createConstraint()
           This will create a new Ant Constraint, add it to the list of Ant constraints, and return the newly created Constraint.
 void execute()
           This will handle task execution pre-processing tasks.
 void generateFrom(ZeusTask.Constraint constraint)
          
 java.lang.String getDefaultJavaPackage()
           This will indicate the Java package used for generated source files by default (if no other package is specified for a specific binding).
 java.io.File getDestDir()
           This will return the destination directory in which Java source files are generated.
 java.io.File getSourceDir()
           This will return the Java File object representing the source directory for constraints.
 void setDefaultCollapseSimpleElements(boolean defaultCollapseSimpleElements)
           This will set whether simple elements or collapsed, in the default case (when a specific constraint generation does not override it).
 void setDefaultJavaPackage(java.lang.String defaultJavaPackage)
           This sets the Java package to use for generated source files in the default case (unless overridden by a specific generation process).
 void setDestDir(java.io.File destDir)
           This will set the destination directory to use for outputting Java source files within.
 void setSourceDir(java.io.File sourceDir)
           This sets the source directory to use as a base directory for resolving specified constraints.
 
Methods inherited from class org.apache.tools.ant.Task
getDescription, getLocation, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, handleErrorOutput, handleOutput, init, log, log, maybeConfigure, perform, setDescription, setLocation, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName
 
Methods inherited from class org.apache.tools.ant.ProjectComponent
getProject, setProject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ZeusTask

public ZeusTask()

This default constructor sets up task defaults.

Method Detail

execute

public void execute()
             throws org.apache.tools.ant.BuildException

This will handle task execution pre-processing tasks. It processes these parameters:

Overrides:
execute in class org.apache.tools.ant.Task
Throws:
BuildException - - when errors occur in processing the task.

getSourceDir

public java.io.File getSourceDir()

This will return the Java File object representing the source directory for constraints.

Returns:
File - the source directory for constraints.

setSourceDir

public void setSourceDir(java.io.File sourceDir)

This sets the source directory to use as a base directory for resolving specified constraints.

Parameters:
sourceDir - the File representing the source directory.

getDestDir

public java.io.File getDestDir()

This will return the destination directory in which Java source files are generated.

Returns:
File - the output directory.

setDestDir

public void setDestDir(java.io.File destDir)

This will set the destination directory to use for outputting Java source files within.

Parameters:
destDir - File object for destination directory.

getDefaultJavaPackage

public java.lang.String getDefaultJavaPackage()

This will indicate the Java package used for generated source files by default (if no other package is specified for a specific binding).

Returns:
String - the Java package used by default.

setDefaultJavaPackage

public void setDefaultJavaPackage(java.lang.String defaultJavaPackage)

This sets the Java package to use for generated source files in the default case (unless overridden by a specific generation process).

Parameters:
defaultJavaPackage - the Java package for generated classes.

setDefaultCollapseSimpleElements

public void setDefaultCollapseSimpleElements(boolean defaultCollapseSimpleElements)

This will set whether simple elements or collapsed, in the default case (when a specific constraint generation does not override it).

Parameters:
defaultCollapseSimpleElements - whether to collapse simple elements.

createConstraint

public ZeusTask.Constraint createConstraint()

This will create a new Ant Constraint, add it to the list of Ant constraints, and return the newly created Constraint.

Returns:
Constraint - the created constraint.

generateFrom

public void generateFrom(ZeusTask.Constraint constraint)
                  throws org.apache.tools.ant.BuildException
Parameters:
constraint -
Throws:
org.apache.tools.ant.BuildException -


Copyright © 2002 Enhydra. All Rights Reserved.