Commit e01d8c58 authored by Claus Nagel's avatar Claus Nagel
Browse files

0.3.0pre: intermediate commit to make changes persistent

do not update to this revision.
parent 59a65873
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<property name="app.name" value="ade-xjc"/> <property name="app.name" value="ade-xjc"/>
<property name="app.version" value="1.0ea"/> <property name="app.version" value="1.0ea"/>
<property name="app.jar" value="${app.name}-${app.version}.jar"/> <property name="app.jar" value="${app.name}-${app.version}.jar"/>
<property name="app.title" value="JAXB xjc wrapper for citygml4j ${app.version}"/> <property name="app.title" value="JAXB xjc wrapper for citygml4j version ${app.version}"/>
<property name="app.vendor" value="IGG, Technical University Berlin, Germany, http://www.igg.tu-berlin.de"/> <property name="app.vendor" value="IGG, Technical University Berlin, Germany, http://www.igg.tu-berlin.de"/>
<property name="app.class" value="org.citygml4j.ade_xjc.ADE_XJC"/> <property name="app.class" value="org.citygml4j.ade_xjc.ADE_XJC"/>
...@@ -17,16 +17,16 @@ ...@@ -17,16 +17,16 @@
<property name="resources" location="resources"/> <property name="resources" location="resources"/>
<property name="resources.doc" location="${resources}/doc"/> <property name="resources.doc" location="${resources}/doc"/>
<property name="resources.license" location="${resources}/license"/> <property name="resources.license" location="${resources}/license"/>
<property name="resources.schemas" location="${resources}/xml/schemas"/> <property name="resources.schemas" location="${resources}/schemas"/>
<property name="build" location="build"/> <property name="build" location="build"/>
<property name="build.classes" location="${build}/classes"/> <property name="build.classes" location="${build}/classes"/>
<property name="build.lib" location="${build}/lib"/> <property name="build.lib" location="${build}/lib"/>
<property name="build.schemas" location="${build.classes}/schemas"/>
<property name="dist" location="${app.name}-${app.version}"/> <property name="dist" location="${app.name}-${app.version}"/>
<property name="dist.lib" location="${dist}/lib"/> <property name="dist.lib" location="${dist}/lib"/>
<property name="dist.license" location="${dist}/license"/> <property name="dist.license" location="${dist}/license"/>
<property name="dist.schemas" location="${dist}/schemas"/>
<!-- classpath --> <!-- classpath -->
<path id="classpath"> <path id="classpath">
...@@ -82,7 +82,7 @@ ...@@ -82,7 +82,7 @@
<replace file="${dist}/README" token="!app.version!" value="${app.version}"/> <replace file="${dist}/README" token="!app.version!" value="${app.version}"/>
<!-- copy schema files --> <!-- copy schema files -->
<copy todir="${build.schemas}"> <copy todir="${dist.schemas}">
<fileset dir="${resources.schemas}" includes="**/*"/> <fileset dir="${resources.schemas}" includes="**/*"/>
</copy> </copy>
......
...@@ -3,7 +3,7 @@ package org.citygml4j.ade_xjc; ...@@ -3,7 +3,7 @@ package org.citygml4j.ade_xjc;
import java.io.File; import java.io.File;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
import java.io.PrintStream; import java.io.PrintStream;
import java.net.URL; import java.math.BigInteger;
import java.security.NoSuchAlgorithmException; import java.security.NoSuchAlgorithmException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
...@@ -22,9 +22,12 @@ import com.sun.tools.xjc.api.XJC; ...@@ -22,9 +22,12 @@ import com.sun.tools.xjc.api.XJC;
public class ADE_XJC { public class ADE_XJC {
private static final Logger LOG = Logger.getInstance(); private static final Logger LOG = Logger.getInstance();
// some dirs we will need
private File schema_dir = new File("schemas");
// some files we will need // some files we will need
private URL baseProfileFile = ADE_XJC.class.getResource("/schemas/CityGML/citygml4j_profile.xsd"); private File baseProfileFile = new File(schema_dir.getAbsoluteFile() + "/CityGML/citygml4j_profile.xsd");
private URL bindingFile = ADE_XJC.class.getResource("/schemas/CityGML/binding.xjb"); private File bindingFile = new File(schema_dir.getAbsoluteFile() + "/CityGML/binding.xjb");
private File adeSchemaFile = null; private File adeSchemaFile = null;
// args // args
...@@ -74,8 +77,8 @@ public class ADE_XJC { ...@@ -74,8 +77,8 @@ public class ADE_XJC {
} }
if (version) { if (version) {
System.out.println("ade-xjc version \"0.2.1\""); System.out.println("ade-xjc version " + this.getClass().getPackage().getImplementationVersion());
System.out.println("ade-xjc is a JAXB xjc wrapper built for citygml4j version \"0.2.1\""); System.out.println(this.getClass().getPackage().getImplementationTitle());
System.exit(0); System.exit(0);
} }
...@@ -97,7 +100,7 @@ public class ADE_XJC { ...@@ -97,7 +100,7 @@ public class ADE_XJC {
try { try {
LOG.info("Setting up build environment"); LOG.info("Setting up build environment");
//checkBuildEnvironment(); checkBuildEnvironment();
if (clean) { if (clean) {
LOG.info("Cleaning output folder"); LOG.info("Cleaning output folder");
...@@ -121,17 +124,16 @@ public class ADE_XJC { ...@@ -121,17 +124,16 @@ public class ADE_XJC {
SchemaCompiler sc = XJC.createSchemaCompiler(); SchemaCompiler sc = XJC.createSchemaCompiler();
sc.setDefaultPackageName(packageName); sc.setDefaultPackageName(packageName);
sc.setEntityResolver(new XJCEntityResolver());
XJCErrorListener listener = new XJCErrorListener(); XJCErrorListener listener = new XJCErrorListener();
sc.setErrorListener(listener); sc.setErrorListener(listener);
sc.parseSchema(new InputSource(baseProfileFile.toString())); sc.parseSchema(new InputSource(baseProfileFile.toURI().toString()));
sc.parseSchema(new InputSource(bindingFile.toString())); sc.parseSchema(new InputSource(bindingFile.toURI().toString()));
sc.parseSchema(new InputSource(adeSchemaFile.getAbsolutePath())); sc.parseSchema(new InputSource(adeSchemaFile.toURI().toString()));
if (adeBindingFile != null) if (adeBindingFile != null)
sc.parseSchema(new InputSource(adeBindingFile.getAbsolutePath())); sc.parseSchema(new InputSource(adeBindingFile.toURI().toString()));
S2JJAXBModel model = sc.bind(); S2JJAXBModel model = sc.bind();
JCodeModel code = model.generateCode(null, listener); JCodeModel code = model.generateCode(null, listener);
...@@ -172,7 +174,7 @@ public class ADE_XJC { ...@@ -172,7 +174,7 @@ public class ADE_XJC {
} }
private void checkBuildEnvironment() throws Exception, FileNotFoundException, NoSuchAlgorithmException { private void checkBuildEnvironment() throws Exception, FileNotFoundException, NoSuchAlgorithmException {
/*if (!schema_dir.exists()) if (!schema_dir.exists())
throw new FileNotFoundException("Could not open folder " + schema_dir.getAbsolutePath()); throw new FileNotFoundException("Could not open folder " + schema_dir.getAbsolutePath());
if (!nonStrict) { if (!nonStrict) {
...@@ -186,7 +188,7 @@ public class ADE_XJC { ...@@ -186,7 +188,7 @@ public class ADE_XJC {
else else
md5 = Util.file2md5(file.getAbsolutePath(), md5); md5 = Util.file2md5(file.getAbsolutePath(), md5);
if (!md5.toString(16).equals("b51bc6a36f36e2bac8c8674f1cb69042")) if (!md5.toString(16).equals("38f087a5dcf0ea2fbbe2a2769abbbc3b"))
throw new Exception("Contents of subfolder 'schemas' have been altered. Please restore its original state."); throw new Exception("Contents of subfolder 'schemas' have been altered. Please restore its original state.");
} }
...@@ -195,7 +197,6 @@ public class ADE_XJC { ...@@ -195,7 +197,6 @@ public class ADE_XJC {
if (adeBindingFile != null && (!adeBindingFile.exists() || !adeBindingFile.isFile() || !adeBindingFile.canRead())) if (adeBindingFile != null && (!adeBindingFile.exists() || !adeBindingFile.isFile() || !adeBindingFile.canRead()))
throw new Exception("Could not open ADE binding file " + adeBindingFile.getAbsolutePath()); throw new Exception("Could not open ADE binding file " + adeBindingFile.getAbsolutePath());
*/
} }
private void cleanBuildEnvironment() { private void cleanBuildEnvironment() {
......
package org.citygml4j.ade_xjc;
import java.io.IOException;
import java.net.URL;
import org.xml.sax.EntityResolver;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
public class XJCEntityResolver implements EntityResolver {
@Override
public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException {
URL url = null;
//if (systemId.endsWith("CityGML.xsd"))
//url = XJCEntityResolver.class.getResource("/schemas/CityGML/0.4.0/CityGML.xsd");
/*
FAILED: null file:/C:/java/ade-xjc/resources/xml/schemas/GML/3.1.1/base/gml.xsd
FAILED: null file:/C:/java/ade-xjc/resources/xml/schemas/GML/3.1.1/base/dynamicFeature.xsd
FAILED: null file:/C:/java/ade-xjc/resources/xml/schemas/GML/3.1.1/base/feature.xsd
FAILED: null file:/C:/java/ade-xjc/resources/xml/schemas/GML/3.1.1/base/geometryBasic2d.xsd
FAILED: null file:/C:/java/ade-xjc/resources/xml/schemas/GML/3.1.1/base/geometryBasic0d1d.xsd
FAILED: null file:/C:/java/ade-xjc/resources/xml/schemas/GML/3.1.1/base/measures.xsd
FAILED: null file:/C:/java/ade-xjc/resources/xml/schemas/GML/3.1.1/base/units.xsd
FAILED: null file:/C:/java/ade-xjc/resources/xml/schemas/GML/3.1.1/base/dictionary.xsd
FAILED: null file:/C:/java/ade-xjc/resources/xml/schemas/GML/3.1.1/base/gmlBase.xsd
FAILED: null file:/C:/java/ade-xjc/resources/xml/schemas/GML/3.1.1/base/basicTypes.xsd
FAILED: null file:/C:/java/ade-xjc/resources/xml/schemas/GML/3.1.1/xlink/xlinks.xsd
FAILED: null file:/C:/java/ade-xjc/resources/xml/schemas/GML/3.1.1/base/temporal.xsd
FAILED: null file:/C:/java/ade-xjc/resources/xml/schemas/GML/3.1.1/base/direction.xsd
FAILED: null file:/C:/java/ade-xjc/resources/xml/schemas/GML/3.1.1/base/topology.xsd
FAILED: null file:/C:/java/ade-xjc/resources/xml/schemas/GML/3.1.1/base/geometryComplexes.xsd
FAILED: null file:/C:/java/ade-xjc/resources/xml/schemas/GML/3.1.1/base/geometryAggregates.xsd
FAILED: null file:/C:/java/ade-xjc/resources/xml/schemas/GML/3.1.1/base/geometryPrimitives.xsd
FAILED: null file:/C:/java/ade-xjc/resources/xml/schemas/GML/3.1.1/base/coverage.xsd
FAILED: null file:/C:/java/ade-xjc/resources/xml/schemas/GML/3.1.1/base/valueObjects.xsd
FAILED: null file:/C:/java/ade-xjc/resources/xml/schemas/GML/3.1.1/base/grids.xsd
FAILED: null file:/C:/java/ade-xjc/resources/xml/schemas/GML/3.1.1/base/coordinateReferenceSystems.xsd
FAILED: null file:/C:/java/ade-xjc/resources/xml/schemas/GML/3.1.1/base/coordinateSystems.xsd
FAILED: null file:/C:/java/ade-xjc/resources/xml/schemas/GML/3.1.1/base/referenceSystems.xsd
FAILED: null file:/C:/java/ade-xjc/resources/xml/schemas/GML/3.1.1/base/datums.xsd
FAILED: null file:/C:/java/ade-xjc/resources/xml/schemas/GML/3.1.1/base/coordinateOperations.xsd
FAILED: null file:/C:/java/ade-xjc/resources/xml/schemas/GML/3.1.1/base/dataQuality.xsd
FAILED: null file:/C:/java/ade-xjc/resources/xml/schemas/GML/3.1.1/base/observation.xsd
FAILED: null file:/C:/java/ade-xjc/resources/xml/schemas/GML/3.1.1/base/defaultStyle.xsd
FAILED: null file:/C:/java/ade-xjc/resources/xml/schemas/GML/3.1.1/smil/smil20.xsd
FAILED: null file:/C:/java/ade-xjc/resources/xml/schemas/GML/3.1.1/smil/smil20-language.xsd
FAILED: null file:/C:/java/ade-xjc/resources/xml/schemas/GML/3.1.1/smil/xml-mod.xsd
FAILED: null file:/C:/java/ade-xjc/resources/xml/schemas/GML/3.1.1/base/temporalReferenceSystems.xsd
FAILED: null file:/C:/java/ade-xjc/resources/xml/schemas/GML/3.1.1/base/temporalTopology.xsd
FAILED: null file:/C:/java/ade-xjc/resources/xml/schemas/xAL/2.0/xAL.xsd
FAILED: null file:/C:/java/ade-xjc/resources/xml/schemas/CityGML/1.0.0/appearance.xsd
FAILED: null file:/C:/java/ade-xjc/resources/xml/schemas/CityGML/1.0.0/cityGMLBase.xsd
FAILED: null file:/C:/java/ade-xjc/resources/xml/schemas/CityGML/1.0.0/generics.xsd
FAILED: null file:/C:/java/ade-xjc/resources/xml/schemas/CityGML/1.0.0/building.xsd
FAILED: null file:/C:/java/ade-xjc/resources/xml/schemas/CityGML/1.0.0/cityFurniture.xsd
FAILED: null file:/C:/java/ade-xjc/resources/xml/schemas/CityGML/1.0.0/cityObjectGroup.xsd
FAILED: null file:/C:/java/ade-xjc/resources/xml/schemas/CityGML/1.0.0/landUse.xsd
FAILED: null file:/C:/java/ade-xjc/resources/xml/schemas/CityGML/1.0.0/relief.xsd
FAILED: null file:/C:/java/ade-xjc/resources/xml/schemas/CityGML/1.0.0/transportation.xsd
FAILED: null file:/C:/java/ade-xjc/resources/xml/schemas/CityGML/1.0.0/vegetation.xsd
FAILED: null file:/C:/java/ade-xjc/resources/xml/schemas/CityGML/1.0.0/waterBody.xsd
FAILED: null file:/C:/java/ade-xjc/resources/xml/schemas/CityGML/1.0.0/texturedSurface.xsd
return null;*/
return (url != null) ? new InputSource(url.toString()) : null;
}
}
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