com.legstar.cob2xsd
Class Cob2XsdTask

java.lang.Object
  extended by org.apache.tools.ant.ProjectComponent
      extended by org.apache.tools.ant.Task
          extended by com.legstar.cob2xsd.Cob2XsdTask

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

COBOL Structure to XSD ANT Task. Usage:
<project ...>
<taskdef name="cob2xsd" classname="com.legstar.cob2xsd.Cob2XsdTask" />
<property name="cobol.dir" value="../cobol"/>
<property name="xsd.dir" value="../xsd"/>
<target name="generate">
<cob2xsd targetDir="${xsd.dir}">
<fileset dir="${cobol.dir}">
<include name="*.cob" />
</fileset>
</cob2xsd>
</target>
</project>


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
Cob2XsdTask()
           
 
Method Summary
 boolean addLegStarAnnotations()
           
 org.apache.tools.ant.types.FileSet createFileset()
           
 boolean decimalPointIsComma()
           
 boolean elementNamesStartWithUppercase()
           
 void execute()
          The ant execution method.
 String getCobolSourceFileEncoding()
           
 Cob2XsdModel.CodeFormat getCodeFormat()
           
 String getCurrencySign()
           
 String getCurrencySymbol()
           
 String getCustomXsltFileName()
           
 int getEndColumn()
           
 int getStartColumn()
           
 File getTarget()
           
 String getTargetNamespace()
           
 String getXsdEncoding()
           
 boolean ignoreOrphanPrimitiveElements()
          Ignore primitive data items which are not attached to a parent group.
 boolean isAppendBaseFileNameToNamespace()
           
 boolean mapConditionsToFacets()
           
 boolean nameConflictPrependParentName()
           
 boolean nSymbolDbcs()
           
 boolean quoteIsQuote()
          The COBOL QUOTE|APOST compiler option.
 void setAddLegStarAnnotations(boolean addLegStarAnnotations)
           
 void setAppendBaseFileNameToNamespace(boolean _appendBaseFileNameToNamespace)
           
 void setCobolSourceFileEncoding(String cobolSourceFileEncoding)
           
 void setCodeFormat(Cob2XsdModel.CodeFormat cobolFormat)
           
 void setCodeFormat(String cobolFormat)
           
 void setCurrencySign(String currencySign)
           
 void setCurrencySymbol(String currencySymbol)
           
 void setCustomXsltFileName(String customXsltFileName)
           
 void setDecimalPointIsComma(boolean decimalPointIsComma)
           
 void setElementNamesStartWithUppercase(boolean elementNamesStartWithUppercase)
           
 void setEndColumn(int endColumn)
           
 void setIgnoreOrphanPrimitiveElements(boolean ignoreOrphanPrimitiveElements)
          Ignore primitive data items which are not attached to a parent group.
 void setMapConditionsToFacets(boolean mapConditionsToFacets)
           
 void setNameConflictPrependParentName(boolean nameConflictPrependParentName)
           
 void setNSymbolDbcs(boolean nSymbolDbcs)
           
 void setQuoteIsQuote(boolean quoteIsQuote)
           
 void setStartColumn(int startColumn)
           
 void setTarget(File target)
           
 void setTargetNamespace(String targetNamespace)
           
 void setXsdEncoding(String xsdEncoding)
           
protected  void translate(File cobolFile, File target)
          Translates a single COBOL source file.
 
Methods inherited from class org.apache.tools.ant.Task
getDescription, getLocation, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, maybeConfigure, perform, reconfigure, setDescription, setLocation, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType
 
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

Cob2XsdTask

public Cob2XsdTask()
Method Detail

execute

public final void execute()
The ant execution method. Check parameters and produce XSD files.

Overrides:
execute in class org.apache.tools.ant.Task

translate

protected void translate(File cobolFile,
                         File target)
                  throws RecognizerException,
                         XsdGenerationException
Translates a single COBOL source file.

When requested the file base name is appended to the target namespace.

Parameters:
cobolFile - COBOL source file
target - target file or folder
Throws:
RecognizerException - if parser fails
XsdGenerationException - if COBOL model interpretation fails

getCodeFormat

public Cob2XsdModel.CodeFormat getCodeFormat()
Returns:
the Fixed or Free format COBOL source

setCodeFormat

public void setCodeFormat(Cob2XsdModel.CodeFormat cobolFormat)
Parameters:
cobolFormat - the Fixed or Free format COBOL source to set

setCodeFormat

public void setCodeFormat(String cobolFormat)
Parameters:
cobolFormat - the Fixed or Free format COBOL source to set

getStartColumn

public int getStartColumn()
Returns:
the position of the indicator area for fixed format COBOL

setStartColumn

public void setStartColumn(int startColumn)
Parameters:
startColumn - the position of the indicator area for fixed format COBOL

getEndColumn

public int getEndColumn()
Returns:
the position of the right margin for fixed format COBOL

setEndColumn

public void setEndColumn(int endColumn)
Parameters:
endColumn - the position of the right margin for fixed format COBOL

getCobolSourceFileEncoding

public String getCobolSourceFileEncoding()
Returns:
the character set used to encode the input COBOL source files

setCobolSourceFileEncoding

public void setCobolSourceFileEncoding(String cobolSourceFileEncoding)
Parameters:
cobolSourceFileEncoding - the character set used to encode the input COBOL source files

getXsdEncoding

public String getXsdEncoding()
Returns:
the character set used to encode the output XML Schema

setXsdEncoding

public void setXsdEncoding(String xsdEncoding)
Parameters:
xsdEncoding - the character set used to encode the output XML Schema to set

getTargetNamespace

public String getTargetNamespace()
Returns:
the target namespace for generated XML schema

setTargetNamespace

public void setTargetNamespace(String targetNamespace)
Parameters:
targetNamespace - the target namespace for generated XML schema

mapConditionsToFacets

public boolean mapConditionsToFacets()
Returns:
whether COBOL conditions (level 88) should be mapped to facets. Facets restrict the content which might not be desirable

setMapConditionsToFacets

public void setMapConditionsToFacets(boolean mapConditionsToFacets)
Parameters:
mapConditionsToFacets - Whether COBOL conditions (level 88) should be mapped to facets. Facets restrict the content which might not be desirable

getCustomXsltFileName

public String getCustomXsltFileName()
Returns:
an optional XSLT transform for XML schema customization

setCustomXsltFileName

public void setCustomXsltFileName(String customXsltFileName)
Parameters:
customXsltFileName - an optional XSLT transform for XML schema customization

nameConflictPrependParentName

public boolean nameConflictPrependParentName()
Returns:
true if parent complex type name should be prepended in case of name conflict (otherwise, the COBOL source line will be appended)

setNameConflictPrependParentName

public void setNameConflictPrependParentName(boolean nameConflictPrependParentName)
Parameters:
nameConflictPrependParentName - true if parent complex type name should be prepended in case of name conflict (otherwise, the COBOL source line will be appended)

elementNamesStartWithUppercase

public boolean elementNamesStartWithUppercase()
Returns:
true if XSD element names should start with an uppercase (compatible with LegStar 1.2)

setElementNamesStartWithUppercase

public void setElementNamesStartWithUppercase(boolean elementNamesStartWithUppercase)
Parameters:
elementNamesStartWithUppercase - true if XSD element names should start with an uppercase (compatible with LegStar 1.2)

ignoreOrphanPrimitiveElements

public boolean ignoreOrphanPrimitiveElements()
Ignore primitive data items which are not attached to a parent group.

Returns:
true if primitive data items without a parent group are ignored

setIgnoreOrphanPrimitiveElements

public void setIgnoreOrphanPrimitiveElements(boolean ignoreOrphanPrimitiveElements)
Ignore primitive data items which are not attached to a parent group.

Parameters:
ignoreOrphanPrimitiveElements - set to true to ignore primitive data items without a parent group item

addLegStarAnnotations

public boolean addLegStarAnnotations()
Returns:
whether we should generate COBOL/JAXB annotations

setAddLegStarAnnotations

public void setAddLegStarAnnotations(boolean addLegStarAnnotations)
Parameters:
addLegStarAnnotations - whether we should generate COBOL/JAXB annotations

getCurrencySign

public String getCurrencySign()
Returns:
the currency sign used (CURRENCY SIGN clause in the SPECIAL-NAMES)

setCurrencySign

public void setCurrencySign(String currencySign)
Parameters:
currencySign - the currency sign used (CURRENCY SIGN clause in the SPECIAL-NAMES)

getCurrencySymbol

public String getCurrencySymbol()
Returns:
the currency symbol used (CURRENCY PICTURE SYMBOL clause in the SPECIAL-NAMES)

setCurrencySymbol

public void setCurrencySymbol(String currencySymbol)
Parameters:
currencySymbol - the currency symbol used (CURRENCY PICTURE SYMBOL clause in the SPECIAL-NAMES)

nSymbolDbcs

public boolean nSymbolDbcs()
Returns:
the NSYMBOL(DBCS) compiler option. Assume NSYMBOL(NATIONAL) if false

setNSymbolDbcs

public void setNSymbolDbcs(boolean nSymbolDbcs)
Parameters:
nSymbolDbcs - the NSYMBOL(DBCS) compiler option. Assume NSYMBOL(NATIONAL) if false

decimalPointIsComma

public boolean decimalPointIsComma()
Returns:
whether comma is the decimal point (DECIMAL-POINT IS COMMA clause in the SPECIAL-NAMES)

setDecimalPointIsComma

public void setDecimalPointIsComma(boolean decimalPointIsComma)
Parameters:
decimalPointIsComma - whether comma is the decimal point (DECIMAL-POINT IS COMMA clause in the SPECIAL-NAMES)

quoteIsQuote

public boolean quoteIsQuote()
The COBOL QUOTE|APOST compiler option. False means APOST.

Returns:
the COBOL QUOTE|APOST compiler option. False means APOST

setQuoteIsQuote

public void setQuoteIsQuote(boolean quoteIsQuote)
Parameters:
quoteIsQuote - the COBOL QUOTE|APOST compiler option. False means APOST

createFileset

public org.apache.tools.ant.types.FileSet createFileset()
Returns:
a new FileSet

getTarget

public File getTarget()
Returns:
the current folder or file to receive the XML schema(s)

setTarget

public void setTarget(File target)
Parameters:
target - the folder or file to receive the XML schema(s)

isAppendBaseFileNameToNamespace

public boolean isAppendBaseFileNameToNamespace()
Returns:
whether the target namespace from the model should be appended the input file base file name

setAppendBaseFileNameToNamespace

public void setAppendBaseFileNameToNamespace(boolean _appendBaseFileNameToNamespace)
Parameters:
whether - the target namespace from the model should be appended the input file base file name


Copyright © 2015 LegSem. All rights reserved.