Main { public static void main(String args[]) {{ // ********************************************************************* // Check the input arguments // ********************************************************************* String usage = "Usage: java Main XSD-filename Output-directory" + " [Output-code-type(DJ/DemeterJ)]"; if ((args.length < 2) || (args.length > 3)) { System.out.println(usage); System.exit(1); } String xsdFileName = args[0]; String outputDirectory = args[1]; String behCodeType = "DemeterJ"; if (args.length > 2) { if (args[2].equalsIgnoreCase("DJ")) behCodeType = "DJ"; else if (args[2].equalsIgnoreCase("DemeterJ")) behCodeType = "DEMETERJ"; else { System.out.println("Invalid output-code-type: expected DJ or DemeterJ"); System.out.println(usage); System.exit(1); } } try { // ***************************************************************** // Parse the schema-definition file(s) to extract the definitions // ***************************************************************** CDDef def = Schema.readDefinition(xsdFileName); // ***************************************************************** // Traverse the definition to create the equivalent cd file (to // represent the object structure) and beh files (to implement the // constraints) // ***************************************************************** def.generateOutputFiles(outputDirectory, behCodeType); // All done. System.exit(0); } catch (Exception e) { System.err.println("The conversion resulted in the following errors:"); System.err.println(e.getMessage()); String contentFileName = Preprocessor.saveSchemaInFile(); if (! contentFileName.equals("")) System.err.println("\nThe preprocessed schema-definition has been saved in the file: '" + contentFileName + "'."); System.exit(1); } }} }