| Modifier and Type | Field and Description |
|---|---|
static String |
LS
Line separator (OS specific).
|
| Constructor and Description |
|---|
Cob2XsdMain() |
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
collectOptions(org.apache.commons.cli.Options options,
String[] args)
Take arguments received on the command line and setup corresponding
options.
|
protected org.apache.commons.cli.Options |
createOptions() |
protected void |
execute(File input,
String cobolFileEncoding,
File target,
String targetNamespacePrefix,
String xsltFileName)
Translate a single file or all files from an input folder.
|
void |
execute(String[] args)
Process command line options and run translator.
|
Cob2XsdConfig |
getConfig()
Gather all parameters into a config object.
|
File |
getConfigFile() |
File |
getInput() |
String |
getInputEncoding() |
File |
getOutput() |
String |
getTargetNamespacePrefix() |
protected String |
getVersion()
Pick up the version from the properties file.
|
String |
getXsltFileName() |
protected void |
loadConfig()
A configuration file is expected.
|
static void |
main(String[] args) |
protected boolean |
processLine(org.apache.commons.cli.CommandLine line,
org.apache.commons.cli.Options options)
Process the command line options selected.
|
protected void |
produceHelp(org.apache.commons.cli.Options options) |
void |
setConfigFile(File configFile) |
void |
setConfigFile(String config)
Check the config parameter and keep it only if it is valid.
|
protected void |
setDefaults()
Make sure mandatory parameters have default values.
|
void |
setInput(String input)
Check the input parameter and keep it only if it is valid.
|
void |
setInputEncoding(String inputEncoding) |
void |
setOutput(String output)
Check the output parameter and keep it only if it is valid.
|
void |
setTargetNamespacePrefix(String targetNamespacePrefix) |
void |
setXsltFileName(String xsltFileName) |
protected void |
translate(File cobolFile,
String cobolFileEncoding,
File target,
String targetNamespacePrefix,
String xsltFileName)
Translates a single COBOL source file.
|
public static final String LS
public static void main(String[] args)
args - translator options. Provides help if no arguments passed.public void execute(String[] args)
If no options are passed, prints the help. Help is also printed if the command line options are invalid.
args - translator optionsprotected boolean collectOptions(org.apache.commons.cli.Options options,
String[] args)
throws Exception
No arguments is valid. It means use the defaults.
options - the expected optionsargs - the actual arguments received on the command lineException - if something goes wrong while parsing argumentsprotected void setDefaults()
protected void loadConfig()
throws IOException
IOException - if configuration file missing or file corruptprotected void produceHelp(org.apache.commons.cli.Options options)
throws Exception
options - options availableException - if help cannot be producedprotected org.apache.commons.cli.Options createOptions()
protected boolean processLine(org.apache.commons.cli.CommandLine line,
org.apache.commons.cli.Options options)
throws Exception
line - the parsed command lineoptions - availableException - if line cannot be processedprotected void execute(File input, String cobolFileEncoding, File target, String targetNamespacePrefix, String xsltFileName) throws XsdGenerationException
input - the input COBOL file or foldercobolFileEncoding - the COBOL file character encodingtarget - the output folder or file where XML schema file must gotargetNamespacePrefix - the output XML schemas target namespace
prefixxsltFileName - an optional xslt to apply on the XML SchemaXsdGenerationException - if XML schema cannot be generatedprotected void translate(File cobolFile, String cobolFileEncoding, File target, String targetNamespacePrefix, String xsltFileName) throws XsdGenerationException
cobolFile - COBOL source filecobolFileEncoding - the COBOL file character encodingtarget - target file or foldertargetNamespacePrefix - the output XML schemas target namespace
prefixxsltFileName - an optional xslt to apply on the XML SchemaXsdGenerationException - if parser failsprotected String getVersion() throws IOException
IOException - if version cannot be identifiedpublic File getConfigFile()
public void setConfigFile(String config)
config - a file name (relative or absolute)public void setConfigFile(File configFile)
configFile - the file containing parameters to setpublic void setInput(String input)
input - a file or folder name (relative or absolute)public String getInputEncoding()
public void setInputEncoding(String inputEncoding)
public void setOutput(String output)
output - a file or folder name (relative or absolute)public void setTargetNamespacePrefix(String targetNamespacePrefix)
public void setXsltFileName(String xsltFileName)
public Cob2XsdConfig getConfig()
public File getInput()
public File getOutput()
public String getTargetNamespacePrefix()
public String getXsltFileName()
Copyright © 2021 LegSem. All rights reserved.