public Map < String, String > translate(File xsdInput,
            String avroNamespacePrefix) throws IOException {

        log.info("COBOL to Avro translator started");
        Map < String, String > mapSchemas = new HashMap < String, String >();

        if (!xsdInput.exists()) {
            throw new IOException("Specified input '" + xsdInput.getName()
                    + "' does not exist");
        }

        log.info("Reading legstar xsd files from " + xsdInput.getName());

        if (xsdInput.isDirectory()) {
            Collection < File > xsdFiles = FileUtils.listFiles(xsdInput,
                    new String[] { "xsd" }, true);
            for (File xsdFile : xsdFiles) {
                translate(xsdFile, mapSchemas, avroNamespacePrefix);
            }
        } else {
            translate(xsdInput, mapSchemas, avroNamespacePrefix);
        }

        log.info("COBOL to Avro translator ended");
        return mapSchemas;
    }
public Map < String , String > translate ( File xsdInput , String avroNamespacePrefix ) throws IOException { log . info ( "COBOL to Avro translator started" ) ; Map < String , String > mapSchemas = new HashMap < String , String > ( ) ; if ( ! xsdInput . exists ( ) ) { throw new IOException ( "Specified input '" + xsdInput . getName ( ) + "' does not exist" ) ; } log . info ( "Reading legstar xsd files from " + xsdInput . getName ( ) ) ; if ( xsdInput . isDirectory ( ) ) { Collection < File > xsdFiles = FileUtils . listFiles ( xsdInput , new String [ ] { "xsd" } , true ) ; for ( File xsdFile : xsdFiles ) { translate ( xsdFile , mapSchemas , avroNamespacePrefix ) ; } } else { translate ( xsdInput , mapSchemas , avroNamespacePrefix ) ; } log . info ( "COBOL to Avro translator ended" ) ; return mapSchemas ; }
Translate a legstar generated xsd file (with COBOL annotations) to an
avro schema.
<p/>
If a folder is passed rather than a single file then all xsd files from
that folder are translated.

@param xsdInput a single xsd file or a folder containing xsd files
@param avroNamespacePrefix for avro schema (package name for generated
objects)
@return for each xsd file translated, the avro schema serialized as
string
@throws IOException if translation fails