You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ki...@apache.org on 2019/03/17 19:08:57 UTC
svn commit: r1855717 - in /xmlbeans/branches/xmlbeans-536: build.xml
src/typeholder/org/apache/xmlbeans/impl/schema/TypeSystemHolder.java
Author: kiwiwings
Date: Sun Mar 17 19:08:56 2019
New Revision: 1855717
URL: http://svn.apache.org/viewvc?rev=1855717&view=rev
Log:
(XMLBEANS-536) - clean up TypeSystemHolder
Modified:
xmlbeans/branches/xmlbeans-536/build.xml
xmlbeans/branches/xmlbeans-536/src/typeholder/org/apache/xmlbeans/impl/schema/TypeSystemHolder.java
Modified: xmlbeans/branches/xmlbeans-536/build.xml
URL: http://svn.apache.org/viewvc/xmlbeans/branches/xmlbeans-536/build.xml?rev=1855717&r1=1855716&r2=1855717&view=diff
==============================================================================
--- xmlbeans/branches/xmlbeans-536/build.xml (original)
+++ xmlbeans/branches/xmlbeans-536/build.xml Sun Mar 17 19:08:56 2019
@@ -13,7 +13,9 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-<project name="XMLBeans" default="process-resources" basedir="." xmlns:if="ant:if" xmlns:unless="ant:unless">
+<project name="XMLBeans" default="process-resources" basedir="."
+ xmlns:mvn="antlib:org.apache.maven.artifact.ant"
+ xmlns:if="ant:if" xmlns:unless="ant:unless">
<property name="build.compiler" value="javac1.6"/>
<property name="ant.build.javac.source" value="1.6"/>
@@ -73,7 +75,7 @@
<path id="xmlbeans-test">
<pathelement location="build/classes"/>
<pathelement location="build/generated-resources"/>
- <dirset dir="resources" includes="*"/>
+ <dirset dir="resources" includes="*" excludes="maven"/>
<path refid="saxon"/>
<pathelement location="${xcresolver.jar}"/>
<pathelement location="test/lib/w3c_domts.jar"/>
@@ -204,7 +206,7 @@
<mkdir dir="${srcDir}"/>
<mkdir dir="${rscDir}"/>
- <uptodate property="up2date" targetfile="${rscDir}/schemaorg_apache_xmlbeans/system/@{schemaName}/TypeSystemHolder.class">
+ <uptodate property="up2date" targetfile="${rscDir}/org/apache/xmlbeans/system/@{schemaName}/TypeSystemHolder.class">
<srcresources>
<filelist dir="${basedir}" files="@{src}"/>
</srcresources>
@@ -252,17 +254,27 @@
<javac destdir="build/classes" debug="true" debuglevel="lines,vars,source" includeantruntime="true">
<src refid="sources"/>
<src path="build/bootstrap/generated-sources"/>
+ <src path="src/typeholder"/>
<classpath>
<path refid="oldxbean"/>
<path refid="saxon"/>
</classpath>
</javac>
+ <mkdir dir="build/generated-resources/org/apache/xmlbeans/impl/schema"/>
+
+ <!-- need to provide the template also in classes - generated-resources will be ignored on bootstrapping -->
+ <copy file="build/classes/org/apache/xmlbeans/impl/schema/TypeSystemHolder.class"
+ tofile="build/classes/org/apache/xmlbeans/impl/schema/TypeSystemHolder.template"/>
+
+ <move file="build/classes/org/apache/xmlbeans/impl/schema/TypeSystemHolder.class"
+ tofile="build/generated-resources/org/apache/xmlbeans/impl/schema/TypeSystemHolder.template"/>
+
<!-- now generate new xmlbeans re-/sources and remove the traces of the oldxbean generated re-/sources -->
<path id="oldschemas">
<pathelement location="build/classes"/>
<pathelement location="build/bootstrap/generated-resources"/>
- <dirset dir="resources" includes="*"/>
+ <dirset dir="resources" includes="*" excludes="maven"/>
</path>
<schemaCompProd classpathref="oldschemas" dest="build"/>
@@ -453,7 +465,7 @@
<fileset dir="." includes="LICENSE.txt,NOTICE.txt"/>
<fileset dir="build/generated-resources"/>
<mappedresources>
- <fileset dir="resources"/>
+ <fileset dir="resources" excludes="maven"/>
<cutdirsmapper dirs="1"/>
</mappedresources>
<manifest>
@@ -481,16 +493,24 @@
</manifest>
</jar>
- <jar jarfile="build/xmlbeans-${version.base}-sources.jar" update="false" index="false">
+ <chainedmapper id="src-mapper">
+ <cutdirsmapper dirs="1"/>
+ <firstmatchmapper>
+ <globmapper from="schema/*" to="org/apache/xmlbeans/src/*"/>
+ <identitymapper />
+ </firstmatchmapper>
+ </chainedmapper>
+
+ <jar jarfile="build/xmlbeans-${version.base}-sources.jar" update="false" index="false" duplicate="preserve">
<fileset dir="." includes="LICENSE.txt,NOTICE.txt"/>
<mappedresources>
<fileset dir="src" excludes="toolschema/**,shell/**"/>
- <cutdirsmapper dirs="1"/>
+ <mapper refid="src-mapper"/>
</mappedresources>
- <zipfileset dir="src/toolschema" prefix="schema"/>
+ <zipfileset dir="src/toolschema" prefix="org/apache/xmlbeans/src" excludes="**/*.xsd"/>
<mappedresources>
- <fileset dir="build" includes="generated-sources/**,generated-resources/**"/>
- <cutdirsmapper dirs="1"/>
+ <fileset dir="build" includes="generated-sources/**,generated-resources/**" excludes="**/*.xsb,**/*.class"/>
+ <mapper refid="src-mapper"/>
</mappedresources>
<manifest>
Modified: xmlbeans/branches/xmlbeans-536/src/typeholder/org/apache/xmlbeans/impl/schema/TypeSystemHolder.java
URL: http://svn.apache.org/viewvc/xmlbeans/branches/xmlbeans-536/src/typeholder/org/apache/xmlbeans/impl/schema/TypeSystemHolder.java?rev=1855717&r1=1855716&r2=1855717&view=diff
==============================================================================
--- xmlbeans/branches/xmlbeans-536/src/typeholder/org/apache/xmlbeans/impl/schema/TypeSystemHolder.java (original)
+++ xmlbeans/branches/xmlbeans-536/src/typeholder/org/apache/xmlbeans/impl/schema/TypeSystemHolder.java Sun Mar 17 19:08:56 2019
@@ -35,45 +35,15 @@ import org.apache.xmlbeans.SchemaTypeSys
// !!! If you modify this class, you will have to run bootstrap.
// !!! If this scares you, turn back now !!!
//
-public class TypeSystemHolder
-{
- private TypeSystemHolder() { }
+public final class TypeSystemHolder extends SchemaTypeSystemImpl {
+ // TODO: provide parameter-less parent constructor
+ private TypeSystemHolder() { super(TypeSystemHolder.class); }
- public static final SchemaTypeSystem typeSystem = loadTypeSystem();
+ // the type system
+ public static final SchemaTypeSystem typeSystem = new TypeSystemHolder();
// Commenting out this line has the effect of not loading all components in a
// typesystem upfront, but just as they are needed, which may improve
// performance significantly
//static { typeSystem.resolve(); }
-
- private static final SchemaTypeSystem loadTypeSystem()
- {
- try
- {
- // The fact that we are using TypeSystemHolder.class.getClassLoader()
- // to load the SchemaTypeSystem class means that the TypeSystemHolder's
- // classloader MUST be a descendant of the XmlBeans classloader, even
- // though it can be different.
- // In other words, each Schema type has only one copy per VM, not one
- // copy per copy of XmlBeans in use, therefore this implies that
- // there either must be one copy of XmlBeans in the VM or copies in
- // different classloaders will each need a different copy of one
- // Schema type, which seems a reasonable restriction, but needs to be
- // understood nevertheless
- return (SchemaTypeSystem)
- Class.forName(
- "org.apache.xmlbeans.impl.schema.SchemaTypeSystemImpl",
- true, TypeSystemHolder.class.getClassLoader())
- .getConstructor(new Class[] { Class.class })
- .newInstance(new java.lang.Object[] { TypeSystemHolder.class });
- }
- catch (ClassNotFoundException e)
- {
- throw new RuntimeException("Cannot load org.apache.xmlbeans.impl.SchemaTypeSystemImpl: make sure xbean.jar is on the classpath.", e);
- }
- catch (Exception e)
- {
- throw new RuntimeException("Could not instantiate SchemaTypeSystemImpl (" + e.toString() + "): is the version of xbean.jar correct?", e);
- }
- }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org