Commit 0a80e5eb authored by Claus Nagel's avatar Claus Nagel
Browse files

No commit message

No commit message
parent a0c934a5
......@@ -5,7 +5,10 @@ import java.io.FileNotFoundException;
import java.io.PrintStream;
import java.math.BigInteger;
import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
import java.util.List;
import org.kohsuke.args4j.Argument;
import org.kohsuke.args4j.CmdLineException;
import org.kohsuke.args4j.CmdLineParser;
import org.kohsuke.args4j.Option;
......@@ -25,21 +28,22 @@ public class ADE_XJC {
// some files we will need
private File baseProfileFile = new File(schema_dir.getAbsoluteFile() + "/CityGML/citygml4j_profile.xsd");
private File bindingFile = new File(schema_dir.getAbsoluteFile() + "/CityGML/binding.xjb");
private File adeSchemaFile = null;
// args
@Option(name="-schema", usage="XML schema file of the ADE (required)", metaVar="<fileName>")
private File adeSchemaFile = null;
@Argument
private List<String> adeSchemaFileList = new ArrayList<String>();
@Option(name="-package", usage="package for the ADE classes (optional, default='ade')", metaVar="<packageName>")
@Option(name="-package", usage="package for the ADE JAXB classes (default: 'ade')", metaVar="<packageName>")
private String packageName = "ade";
@Option(name="-binding", usage="JAXB binding file for ADE schema (optional)", metaVar="<fileName>")
@Option(name="-binding", usage="optional JAXB binding file for ADE XML Schema", metaVar="<fileName>")
private File adeBindingFile = null;
@Option(name="-output", usage="output folder (optional, default='src-gen')", metaVar="<folderName>")
@Option(name="-output", usage="output folder (default: 'src-gen')", metaVar="<folderName>")
private File outputFolder = new File("src-gen");
@Option(name="-non-strict", usage="allow changes to contents of subfolder 'schema'\n(optional)")
@Option(name="-non-strict", usage="allow changes to contents of subfolder 'schema'")
private boolean nonStrict = false;
@Option(name="-clean", usage="clean output folder")
......@@ -74,23 +78,24 @@ public class ADE_XJC {
if (version) {
System.out.println("ade-xjc version \"0.1.0\"");
System.out.println("JAXB xjc wrapper built for citygml4j version \"0.1.0\"");
System.out.println("ade-xjc is a JAXB xjc wrapper built for citygml4j version \"0.1.0\"");
System.exit(0);
}
if (adeSchemaFile == null) {
System.out.println("Option \"-schema\" is required");
if (adeSchemaFileList.isEmpty()) {
System.out.println("Provide the ADE XML Schema definition file to be compiled as argument");
printUsage(parser, System.out);
System.exit(1);
}
if (packageName.startsWith("org.citygml4j")) {
LOG.error("The package " + packageName + " is not allowed for the ADE classes");
LOG.error("Choose a package which is not a subpackage of org.citygml4j. Exiting.");
if (adeSchemaFileList.size() > 1) {
System.out.println("Only provide one ADE XML Schema definition file at a time");
printUsage(parser, System.out);
System.exit(1);
}
LOG.info("Starting ade-xjc compiler");
adeSchemaFile = new File(adeSchemaFileList.get(0));
int status = 0;
try {
......@@ -103,6 +108,12 @@ public class ADE_XJC {
LOG.info("Checking build environment");
checkBuildEnvironment();
if (packageName.startsWith("org.citygml4j")) {
LOG.error("The package " + packageName + " is not allowed for the ADE classes");
LOG.error("Choose a package which is not a subpackage of org.citygml4j. Aborting.");
System.exit(1);
}
LOG.info("Using ADE schema " + adeSchemaFile.getAbsolutePath());
if (adeBindingFile != null)
LOG.info("Using JAXB binding " + adeBindingFile.getAbsolutePath());
......@@ -204,7 +215,7 @@ public class ADE_XJC {
}
private void printUsage(CmdLineParser parser, PrintStream out) {
out.println("Usage: java -jar ade-xjc.jar [-options]");
out.println("Usage: java -jar ade-xjc.jar [-options] ade.xsd");
out.println();
out.println("where options include:");
parser.printUsage(System.out);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment