de.ispsoft.jaxme.generator.ant
Class JaxMeGeneratorTask

java.lang.Object
  extended byorg.apache.tools.ant.ProjectComponent
      extended byorg.apache.tools.ant.Task
          extended byde.ispsoft.jaxme.generator.ant.JaxMeGeneratorTask

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

An Ant task for running a JaxMe generator. Usage is as follows:

   <taskdef name="jaxme"
       classname="de.ispsoft.jaxme.generator.ant.JaxMeGeneratorTask">
     <classpath/>
       <pathelement location="jaxme.jar"/>
       <pathelement location="log4j.jar"/6gt;
     </classpath/>
   </taskdef>
   <jaxme inputFile="myschema.xsd"
       destDir="build/src">
     <sourceWriter className="de.ispsoft.jaxme.generator.JavaSourceWriter"/>
   </jaxme>
 
The jaxme task supports the following attributes:
NameRequiredDescription
inputFileEither of inputFile or inputUrl Name of the XML schema file
inputURLEither of inputFile or inputUrl URL of the XML schema, if it's not a local file.
destDirNo Directory where to generate sources; subdirectories will be creaed to match a package structure
destFileNo If this option is present, then the modification time of the schema file will be compared with the modification time of the given destination file. If the latter is younger, then the JaxMe task does nothing.
logLevelNo Sets the logging level. Valid values are debug, info, warn (default) or error.
forceNo If the task is generating a file which already exists and is different, then by default the modification times of schema file and and destination file are compared. An exception is thrown, if the latter is younger. The force option modifies this behaviour to overwrite the existing file in any case.
The jaxme task supports the following nested elements:
NameAttributesDescription
schemaReaderclassName Sets the schemaReader class; defaults to de.ispsoft.jaxme.generator.XsdSchemaReader.
sourceWriterclassName Adds a SourceWriter, for example de.ispsoft.jaxme.generator.JavaSourceWriter.
optionname, target, value Adds an option with the given name and value. The target is an optional class or interface name. If the target is missing, then the option applies to all objects.

Version:
$Id: JaxMeGeneratorTask.java,v 1.3 2003/04/25 19:58:04 joe Exp $
Author:
Jochen Wiedmann

Field Summary
 
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
JaxMeGeneratorTask()
           
 
Method Summary
 void addOption(OptionType pOption)
          Adds an option.
 void addSourceWriter(SourceWriterType pSourceWriter)
          Adds a SourceWriter.
 void clearOptions()
          Clears the list of Options.
 void clearSourceWriters()
          Clears the list of SourceWriters.
 SchemaReaderType createSchemaReader()
          Sets the SchemaReader.
 void execute()
          Performs the actual task.
 java.lang.String getDescription()
          Returns the tasks description.
 java.io.File getDestDir()
          Returns the destination directory.
 java.io.File getDestFile()
          Returns the destination file.
 boolean getForce()
          Returns whether to overwrite files.
 java.io.File getInputFile()
          Returns the input file.
 java.net.URL getInputURL()
          Returns the input URL.
 org.apache.log4j.Priority getLogLevel()
          Returns the log level.
 java.util.Iterator getOptions()
          Returns an iterator to the list of options.
 SchemaReaderType getSchemaReader()
          Returns the configured SchemaReader.
 java.util.Iterator getSourceWriters()
          Returns an iterator to the list of SourceWriters.
 void initLog4J()
          Initializes the log4j logger, used by the JaxMe generator.
 void reset()
          Resets the task for the next run.
 void setDestDir(java.io.File pDir)
          Sets the destination directory.
 void setDestFile(java.io.File pDestFile)
          Sets the destination file.
 void setForce(boolean pForce)
          Sets whether to overwrite files.
 void setInputFile(java.io.File pInputFile)
          Sets the input file.
 void setInputURL(java.net.URL pInputURL)
          Sets the input URL.
 void setLogLevel(java.lang.String pLevel)
          Sets the log level.
 void verify()
          Verifies the tasks configuration.
 
Methods inherited from class org.apache.tools.ant.Task
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

JaxMeGeneratorTask

public JaxMeGeneratorTask()
Method Detail

getDescription

public java.lang.String getDescription()

Returns the tasks description.


setInputFile

public void setInputFile(java.io.File pInputFile)

Sets the input file.


getInputFile

public java.io.File getInputFile()

Returns the input file.


setLogLevel

public void setLogLevel(java.lang.String pLevel)

Sets the log level.


getLogLevel

public org.apache.log4j.Priority getLogLevel()

Returns the log level.


setInputURL

public void setInputURL(java.net.URL pInputURL)

Sets the input URL.


getInputURL

public java.net.URL getInputURL()

Returns the input URL.


createSchemaReader

public SchemaReaderType createSchemaReader()

Sets the SchemaReader.


getSchemaReader

public SchemaReaderType getSchemaReader()

Returns the configured SchemaReader.


clearSourceWriters

public void clearSourceWriters()

Clears the list of SourceWriters.


addSourceWriter

public void addSourceWriter(SourceWriterType pSourceWriter)

Adds a SourceWriter.


getSourceWriters

public java.util.Iterator getSourceWriters()

Returns an iterator to the list of SourceWriters.


clearOptions

public void clearOptions()

Clears the list of Options.


addOption

public void addOption(OptionType pOption)

Adds an option.


getOptions

public java.util.Iterator getOptions()

Returns an iterator to the list of options.


getForce

public boolean getForce()

Returns whether to overwrite files.


setForce

public void setForce(boolean pForce)

Sets whether to overwrite files.


setDestFile

public void setDestFile(java.io.File pDestFile)

Sets the destination file.


getDestFile

public java.io.File getDestFile()

Returns the destination file.


verify

public void verify()

Verifies the tasks configuration.


setDestDir

public void setDestDir(java.io.File pDir)

Sets the destination directory.


getDestDir

public java.io.File getDestDir()

Returns the destination directory.


reset

public void reset()

Resets the task for the next run.


initLog4J

public void initLog4J()

Initializes the log4j logger, used by the JaxMe generator.


execute

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

Performs the actual task.

Throws:
org.apache.tools.ant.BuildException