com.legstar.xsd
Class XsdWriter

java.lang.Object
  extended by com.legstar.xsd.XsdWriter

public final class XsdWriter
extends Object

Writes results to the file system.


Field Summary
static String COBOL_FILE_EXTENSION
          Extension to add on generated COBOL copybooks.
static String XSD_FILE_EXTENSION
          Extension to add on generated XML schema file names.
 
Method Summary
static void check(File targetXsdFile, File targetCobolFile)
          Check the output files in which we are supposed to write.
static File getFile(File file, String fileName)
          If the file has no extension, it is considered a folder.
static void writeResults(String defaultName, File targetXsdFile, File targetCobolFile, String targetCobolEncoding, XsdToCobolStringResult results, org.apache.commons.logging.Log log)
          Write the results to file system.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

XSD_FILE_EXTENSION

public static final String XSD_FILE_EXTENSION
Extension to add on generated XML schema file names.

See Also:
Constant Field Values

COBOL_FILE_EXTENSION

public static final String COBOL_FILE_EXTENSION
Extension to add on generated COBOL copybooks.

See Also:
Constant Field Values
Method Detail

check

public static void check(File targetXsdFile,
                         File targetCobolFile)
                  throws InvalidParameterException
Check the output files in which we are supposed to write.

Parameters:
targetXsdFile - the output XML schema file or folder
targetCobolFile - the output COBOL copybook file or folder
Throws:
InvalidParameterException - if the file or folders are invalid

writeResults

public static void writeResults(String defaultName,
                                File targetXsdFile,
                                File targetCobolFile,
                                String targetCobolEncoding,
                                XsdToCobolStringResult results,
                                org.apache.commons.logging.Log log)
                         throws IOException
Write the results to file system.

Parameters:
defaultName - the base name to use if output files are folders
targetXsdFile - the XSD file or folder
targetCobolFile - the COBOL file or folder
targetCobolEncoding - the target COBOL file content encoding
results - the translation results
log - a logger to print out the results
Throws:
IOException - if writing fails

getFile

public static File getFile(File file,
                           String fileName)
                    throws IOException
If the file has no extension, it is considered a folder.

The folder is created and new file, using the proposed fineName is created in there.

If the file has an extension, then the containing folder is created and the fileName is ignored.

Parameters:
file - a folder or file
fileName - a file name to use if file is a folder
Returns:
a file in an existing folder
Throws:
IOException - if folders cannot be created


Copyright © 2012 LegSem. All Rights Reserved.