Version: 0.1

org.apache.tools.ant.taskdefs.optional.javarec
Class RecordTask

org.apache.tools.ant.taskdefs.optional.javarec.RecordTask

public class RecordTask

Generate a record class from a record type class. This Ant task calls the Generator command to create Record classes from RecordType classes. There are no nested tags for this task, only attributes.

Parameters

AttributeDescriptionRequired
targetDir The directory into which record source will be generated. Yes
pkgName The package in which to place the record class. Yes
className The name of the record class. Yes
outputType
  • 0 - Custom Record (default)
  • 1 - Dynamic Record
No
layout The access mode of the record.
  • 0 - Direct Access (default)
  • 1 - Hierarchical Access
  • 2 - Direct access with inner classes
  • 3 - Hierachical access with inner classes
No
style
  • 0 - Notification Support
  • 1 - No Notification Support (default)
No
namingScheme Only used when layout = "2" or "3"
  • 0 - Long names (for VAJ 2.0 compatibility)
  • 1 - Short names (default)
No
j2ee Generate J2EE style record (implements javax.resource.cci.Streamable). Default = "no". No
recAttrType Record Attribute Type. Default = com.ibm.ivj.eab.record.cobol.CobolRecordAttributes. No
genPrimArrTypes Whether to generate accessors using primitive Java types or their corresponding object wrappers. Default is false, to not generate primitive type accessors. No

Author:
Paul Glezen

Field Summary
static java.lang.String DEFAULT_REC_ATTR_TYPE
          Default record attribute type - currently set to "com.ibm.ivj.eab.record.cobol.CobolRecordAttributes";
static java.lang.String RECORD_GENERATOR
          The name of the program that generates record source - currently set to com.ibm.ivj.eab.record.generator.codegen.Generator.
 
Constructor Summary
RecordTask()
           
 
Method Summary
 org.apache.tools.ant.types.Path createClasspath()
          Create a Path object to be populated with path elements.
 void execute()
          Execute an EAB command RECORD_GENERATOR to generate a record type class.
 org.apache.tools.ant.types.Path getClasspath()
          Return a reference to this object's classpath element.
 void setClassName(java.lang.String name)
          Set the class name of the record to be generated.
 void setClasspath(org.apache.tools.ant.types.Path src)
          Set the classpath for finding dependent record type classes.
 void setClasspathRef(org.apache.tools.ant.types.Reference ref)
          Add a reference to another classpath element.
 void setGenPrimArrTypes(boolean type)
          Generate accessors that return primitive data types.
 void setJ2ee(boolean j2ee)
          Determine whether to generate J2EE style records or CCF style records.
 void setLayout(java.lang.String layout)
          Set the record layout for record generation.
 void setNamingScheme(java.lang.String scheme)
          Determine whether short or long names are to be used for attributes.
 void setOutputType(java.lang.String type)
          Set the output type for the record generation.
 void setPkgName(java.lang.String name)
          Set the package name of the record to be generated.
 void setRecAttrType(java.lang.String type)
          Set the name of the record type attribute class used by the generated record class.
 void setRecType(java.lang.String type)
          Set the fully-qualified class name of the record type class used to generate the record class.
 void setStyle(java.lang.String style)
          Determine whether notification support is incorporated into the generated record.
 void setTargetDir(java.io.File dir)
          Set the target directory in which the record package heirarchy will be generated.
 

Field Detail

DEFAULT_REC_ATTR_TYPE

public static final java.lang.String DEFAULT_REC_ATTR_TYPE
Default record attribute type - currently set to "com.ibm.ivj.eab.record.cobol.CobolRecordAttributes";

RECORD_GENERATOR

public static final java.lang.String RECORD_GENERATOR
The name of the program that generates record source - currently set to com.ibm.ivj.eab.record.generator.codegen.Generator.
Constructor Detail

RecordTask

public RecordTask()
Method Detail

setTargetDir

public void setTargetDir(java.io.File dir)
Set the target directory in which the record package heirarchy will be generated.

setPkgName

public void setPkgName(java.lang.String name)
Set the package name of the record to be generated.

setClassName

public void setClassName(java.lang.String name)
Set the class name of the record to be generated.

setRecType

public void setRecType(java.lang.String type)
Set the fully-qualified class name of the record type class used to generate the record class.

setOutputType

public void setOutputType(java.lang.String type)
Set the output type for the record generation. The input is expected to be either "0" or "1" representing a custom record or dynamic record respectively.

Parameters:
type - the record type

setLayout

public void setLayout(java.lang.String layout)
Set the record layout for record generation. The input is expected to be one of the following:

Parameters:
layout - the layout

setStyle

public void setStyle(java.lang.String style)
Determine whether notification support is incorporated into the generated record. The input is expected to be either "0" or "1" indicating no notification support or no notification support respectively.

Parameters:
style - the style

setRecAttrType

public void setRecAttrType(java.lang.String type)
Set the name of the record type attribute class used by the generated record class. It is initialized by default to be DEFAULT_REC_ATTR_TYPE.

Parameters:
type - the attribute type

setNamingScheme

public void setNamingScheme(java.lang.String scheme)
Determine whether short or long names are to be used for attributes. The expected input is "0" for long names; "1" for short names.

Parameters:
scheme - the naming scheme

setJ2ee

public void setJ2ee(boolean j2ee)
Determine whether to generate J2EE style records or CCF style records. J2EE style records implement the javax.resource.cci.Streamable interface.

Parameters:
j2ee - use j2ee style records if set to true

setGenPrimArrTypes

public void setGenPrimArrTypes(boolean type)
Generate accessors that return primitive data types. Otherwise, wrappers such as Integer are returned instead of int.

Parameters:
type - accessor return type

setClasspath

public void setClasspath(org.apache.tools.ant.types.Path src)
Set the classpath for finding dependent record type classes. If there is already a classpath set internally, append rather than replace the input to the existing path.

Parameters:
src - - the path to add

createClasspath

public org.apache.tools.ant.types.Path createClasspath()
Create a Path object to be populated with path elements.

Returns:
a sub-path of this object's Path instance.

getClasspath

public org.apache.tools.ant.types.Path getClasspath()
Return a reference to this object's classpath element.

Returns:
the classpath

setClasspathRef

public void setClasspathRef(org.apache.tools.ant.types.Reference ref)
Add a reference to another classpath element.

Parameters:
ref - a reference to another Path instance

execute

public void execute()
             throws org.apache.tools.ant.BuildException
Execute an EAB command RECORD_GENERATOR to generate a record type class. The command is forked rather than run in the same JVM since some EAB commands have exit coded in their main method.

Version: 0.1

Paul Glezen
pglezen@us.ibm.com