Author: rob.stryker(a)jboss.com
Date: 2008-02-27 23:28:51 -0500 (Wed, 27 Feb 2008)
New Revision: 6616
Added:
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/lib/concurrent-1.3.4.jar
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/lib/jboss-common-core-2.2.1.GA.jar
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/lib/jboss-common-logging-log4j-2.0.4.GA.jar
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/lib/jboss-common-logging-spi-2.0.4.GA.jar
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/lib/jboss-xml-binding.jar
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/lib/xercesImpl-2.9.1.jar
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/ArchivesUnmarshallerImpl.java
Removed:
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/lib/concurrent.jar
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/lib/jboss-common-4.0.4.jar
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/lib/jbossxb-1.0.1.TEST.jar
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/lib/xercesImpl.jar
Modified:
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/.classpath
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/META-INF/MANIFEST.MF
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/build.properties
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/XMLBinding.java
Log:
Upgraded version of jboss xb to one i actually know the version of and can trace through
the source when an error arrives.
Modified: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/.classpath
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.core/.classpath 2008-02-28 02:08:03
UTC (rev 6615)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.core/.classpath 2008-02-28 04:28:51
UTC (rev 6616)
@@ -3,11 +3,13 @@
<classpathentry kind="src" path="src/main"/>
<classpathentry kind="src" path="src/xml"/>
<classpathentry kind="src" path="src/eclipse"/>
- <classpathentry exported="true" kind="lib"
path="lib/concurrent.jar"/>
- <classpathentry exported="true" kind="lib"
path="lib/truezip-6.jar" />
- <classpathentry exported="true" kind="lib"
path="lib/xercesImpl.jar"/>
- <classpathentry exported="true" kind="lib"
path="lib/jboss-common-4.0.4.jar" />
- <classpathentry exported="true" kind="lib"
path="lib/jbossxb-1.0.1.TEST.jar"/>
+ <classpathentry exported="true" kind="lib"
path="lib/jboss-common-core-2.2.1.GA.jar"/>
+ <classpathentry exported="true" kind="lib"
path="lib/jboss-common-logging-log4j-2.0.4.GA.jar"/>
+ <classpathentry exported="true" kind="lib"
path="lib/jboss-common-logging-spi-2.0.4.GA.jar"/>
+ <classpathentry exported="true" kind="lib"
path="lib/xercesImpl-2.9.1.jar"/>
+ <classpathentry exported="true" kind="lib"
path="lib/concurrent-1.3.4.jar"/>
+ <classpathentry exported="true" kind="lib"
path="lib/truezip-6.jar"/>
+ <classpathentry exported="true" kind="lib"
path="lib/jboss-xml-binding.jar"
sourcepath="/home/rob/code/xb/target/jboss-xml-binding-sources.jar"/>
<classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con"
path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="output" path="bin"/>
Modified: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/META-INF/MANIFEST.MF
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.core/META-INF/MANIFEST.MF 2008-02-28
02:08:03 UTC (rev 6615)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.core/META-INF/MANIFEST.MF 2008-02-28
04:28:51 UTC (rev 6616)
@@ -14,13 +14,15 @@
org.eclipse.jdt.core,
org.eclipse.core.variables
Eclipse-LazyStart: true
-Bundle-ClassPath: lib/concurrent.jar,
+Bundle-ClassPath: archivescore.jar,
+ archivescore-eclipse.jar,
lib/truezip-6.jar,
- lib/xercesImpl.jar,
- lib/jboss-common-4.0.4.jar,
- lib/jbossxb-1.0.1.TEST.jar,
- archivescore.jar,
- archivescore-eclipse.jar
+ lib/concurrent-1.3.4.jar,
+ lib/jboss-xml-binding.jar,
+ lib/xercesImpl-2.9.1.jar,
+ lib/jboss-common-logging-log4j-2.0.4.GA.jar,
+ lib/jboss-common-logging-spi-2.0.4.GA.jar,
+ lib/jboss-common-core-2.2.1.GA.jar
Export-Package:
de.schlichtherle.io;x-friends:="org.jboss.ide.eclipse.archives.test",
org.jboss.ide.eclipse.archives.core,
org.jboss.ide.eclipse.archives.core.ant,
Modified: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/build.properties
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.core/build.properties 2008-02-28
02:08:03 UTC (rev 6615)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.core/build.properties 2008-02-28
04:28:51 UTC (rev 6616)
@@ -2,13 +2,16 @@
bin.includes = META-INF/,\
plugin.xml,\
archivescore.jar,\
- lib/,\
LICENSE-truezip.txt,\
- lib/xercesImpl.jar,\
- lib/jboss-common-4.0.4.jar,\
- lib/jbossxb-1.0.1.TEST.jar,\
log4j.xml,\
- archivescore-eclipse.jar
+ archivescore-eclipse.jar,\
+ lib/jboss-xml-binding.jar,\
+ lib/truezip-6.jar,\
+ lib/concurrent-1.3.4.jar,\
+ lib/xercesImpl-2.9.1.jar,\
+ lib/jboss-common-logging-log4j-2.0.4.GA.jar,\
+ lib/jboss-common-logging-spi-2.0.4.GA.jar,\
+ lib/jboss-common-core-2.2.1.GA.jar
source.archivescore.jar = src/main/,\
src/xml/
src.includes = LICENSE-truezip.txt,\
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/lib/concurrent-1.3.4.jar
===================================================================
(Binary files differ)
Property changes on:
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/lib/concurrent-1.3.4.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Deleted: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/lib/concurrent.jar
===================================================================
(Binary files differ)
Deleted:
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/lib/jboss-common-4.0.4.jar
===================================================================
(Binary files differ)
Added:
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/lib/jboss-common-core-2.2.1.GA.jar
===================================================================
(Binary files differ)
Property changes on:
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/lib/jboss-common-core-2.2.1.GA.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added:
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/lib/jboss-common-logging-log4j-2.0.4.GA.jar
===================================================================
(Binary files differ)
Property changes on:
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/lib/jboss-common-logging-log4j-2.0.4.GA.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added:
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/lib/jboss-common-logging-spi-2.0.4.GA.jar
===================================================================
(Binary files differ)
Property changes on:
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/lib/jboss-common-logging-spi-2.0.4.GA.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/lib/jboss-xml-binding.jar
===================================================================
(Binary files differ)
Property changes on:
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/lib/jboss-xml-binding.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Deleted:
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/lib/jbossxb-1.0.1.TEST.jar
===================================================================
(Binary files differ)
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/lib/xercesImpl-2.9.1.jar
===================================================================
(Binary files differ)
Property changes on:
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/lib/xercesImpl-2.9.1.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Deleted: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/lib/xercesImpl.jar
===================================================================
(Binary files differ)
Added:
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/ArchivesUnmarshallerImpl.java
===================================================================
---
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/ArchivesUnmarshallerImpl.java
(rev 0)
+++
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/ArchivesUnmarshallerImpl.java 2008-02-28
04:28:51 UTC (rev 6616)
@@ -0,0 +1,213 @@
+/**
+ * JBoss, a Division of Red Hat
+ * Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ide.eclipse.archives.core.model.internal.xb;
+
+import java.io.InputStream;
+import java.io.Reader;
+
+import org.jboss.xb.binding.JBossXBException;
+import org.jboss.xb.binding.ObjectModelBuilder;
+import org.jboss.xb.binding.ObjectModelFactory;
+import org.jboss.xb.binding.Unmarshaller;
+import org.jboss.xb.binding.metadata.unmarshalling.DocumentBinding;
+import org.jboss.xb.binding.parser.JBossXBParser;
+import org.jboss.xb.binding.parser.sax.SaxJBossXBParser;
+import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding;
+import org.jboss.xb.binding.sunday.unmarshalling.SchemaBindingResolver;
+import org.jboss.xb.binding.sunday.unmarshalling.SundayContentHandler;
+import org.xml.sax.EntityResolver;
+import org.xml.sax.ErrorHandler;
+
+/**
+ * Unmarshaller implementation.
+ * WARNING: this implementation is not thread-safe.
+ *
+ * Taken from JBoss XB. Changed to let getParser() be public.
+ *
+ * @author <a href="mailto:alex@jboss.org">Alexey Loubyansky</a>
+ * @version <tt>$Revision: 2365 $</tt>
+ */
+public class ArchivesUnmarshallerImpl implements Unmarshaller {
+ private ObjectModelBuilder builder = new ObjectModelBuilder();
+ private final JBossXBParser parser;
+
+ // Constructor
+
+ /**
+ * The constructor for DTD and XSD client awareness.
+ */
+ public ArchivesUnmarshallerImpl() throws JBossXBException {
+ parser = new SaxJBossXBParser();
+ }
+
+ public void setValidation(boolean validation) throws JBossXBException {
+ parser.setFeature(VALIDATION, validation);
+ /*
+ * Only set DYNAMIC_VALIDATION to false. Setting this to true if its not
+ * already requires a document to have a DOCTYPE declaring the root
+ * element
+ */
+ if (validation == false)
+ parser.setFeature(DYNAMIC_VALIDATION, false);
+ }
+
+ public void setSchemaValidation(boolean validation) throws JBossXBException {
+ parser.setFeature(SCHEMA_VALIDATION, validation);
+ }
+
+ public void setFeature(String feature, boolean value)
+ throws JBossXBException {
+ parser.setFeature(feature, value);
+ }
+
+ public void setNamespaceAware(boolean namespaces) throws JBossXBException {
+ parser.setFeature(NAMESPACES, namespaces);
+ }
+
+ public void setEntityResolver(EntityResolver entityResolver)
+ throws JBossXBException {
+ parser.setEntityResolver(entityResolver);
+ }
+
+ public void setErrorHandler(ErrorHandler errorHandler) {
+ // todo reader.setErrorHandler(errorHandler);
+ }
+
+ public void mapFactoryToNamespace(ObjectModelFactory factory,
+ String namespaceUri) {
+ if (builder == null) {
+ builder = new ObjectModelBuilder();
+ }
+ builder.mapFactoryToNamespace(factory, namespaceUri);
+ }
+
+ public Object unmarshal(String xmlFile) throws JBossXBException {
+ // todo
+ throw new UnsupportedOperationException();
+ }
+
+ public Object unmarshal(String xmlFile, JBossXBParser.ContentHandler handler)
+ throws JBossXBException {
+ parser.parse(xmlFile, handler);
+ return handler.getRoot();
+ }
+
+ public Object unmarshal(String xml, SchemaBinding schemaBinding)
+ throws JBossXBException {
+ JBossXBParser.ContentHandler cHandler = new SundayContentHandler(
+ schemaBinding);
+ parser.parse(xml, cHandler);
+ return cHandler.getRoot();
+ }
+
+ public Object unmarshal(Reader xmlReader, SchemaBinding schemaBinding)
+ throws JBossXBException {
+ JBossXBParser.ContentHandler cHandler = new SundayContentHandler(
+ schemaBinding);
+ parser.parse(xmlReader, cHandler);
+ return cHandler.getRoot();
+ }
+
+ public Object unmarshal(InputStream xmlStream, SchemaBinding schemaBinding)
+ throws JBossXBException {
+ JBossXBParser.ContentHandler cHandler = new SundayContentHandler(
+ schemaBinding);
+ parser.parse(xmlStream, cHandler);
+ return cHandler.getRoot();
+ }
+
+ public Object unmarshal(String xml, SchemaBindingResolver schemaResolver)
+ throws JBossXBException {
+ JBossXBParser.ContentHandler cHandler = new SundayContentHandler(
+ schemaResolver);
+ parser.parse(xml, cHandler);
+ return cHandler.getRoot();
+ }
+
+ public Object unmarshal(Reader xmlReader,
+ SchemaBindingResolver schemaResolver) throws JBossXBException {
+ JBossXBParser.ContentHandler cHandler = new SundayContentHandler(
+ schemaResolver);
+ parser.parse(xmlReader, cHandler);
+ return cHandler.getRoot();
+ }
+
+ public Object unmarshal(InputStream xmlStream,
+ SchemaBindingResolver schemaResolver) throws JBossXBException {
+ JBossXBParser.ContentHandler cHandler = new SundayContentHandler(
+ schemaResolver);
+ parser.parse(xmlStream, cHandler);
+ return cHandler.getRoot();
+ }
+
+ public Object unmarshal(Reader reader, ObjectModelFactory factory,
+ Object root) throws JBossXBException {
+ if (builder == null) {
+ builder = new ObjectModelBuilder();
+ }
+ builder.init(factory, root);
+ parser.parse(reader, builder);
+ return builder.getRoot();
+ }
+
+ public Object unmarshal(InputStream is, ObjectModelFactory factory,
+ Object root) throws JBossXBException {
+ if (builder == null) {
+ builder = new ObjectModelBuilder();
+ }
+ builder.init(factory, root);
+ parser.parse(is, builder);
+ return builder.getRoot();
+ }
+
+ public Object unmarshal(String systemId, ObjectModelFactory factory,
+ Object root) throws JBossXBException {
+ if (builder == null) {
+ builder = new ObjectModelBuilder();
+ }
+ builder.init(factory, root);
+ parser.parse(systemId, builder);
+ return builder.getRoot();
+ }
+
+ public Object unmarshal(String systemId, ObjectModelFactory factory,
+ DocumentBinding binding) throws JBossXBException {
+ if (binding != null) {
+ throw new IllegalStateException(
+ "DocumentBinding API is not supported anymore!");
+ }
+ return unmarshal(systemId, factory, (Object) null);
+ }
+
+ public Object unmarshal(Reader reader, ObjectModelFactory factory,
+ DocumentBinding binding) throws JBossXBException {
+ if (binding != null) {
+ throw new IllegalStateException(
+ "DocumentBinding API is not supported anymore!");
+ }
+ return unmarshal(reader, factory, (Object) null);
+ }
+
+ public JBossXBParser getParser() {
+ return parser;
+ }
+}
Modified:
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/XMLBinding.java
===================================================================
---
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/XMLBinding.java 2008-02-28
02:08:03 UTC (rev 6615)
+++
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/XMLBinding.java 2008-02-28
04:28:51 UTC (rev 6616)
@@ -22,7 +22,7 @@
package org.jboss.ide.eclipse.archives.core.model.internal.xb;
import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
+import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
@@ -41,8 +41,6 @@
import org.jboss.ide.eclipse.archives.core.model.IArchivesLogger;
import org.jboss.ide.eclipse.archives.core.model.internal.ArchiveImpl;
import org.jboss.xb.binding.JBossXBException;
-import org.jboss.xb.binding.Unmarshaller;
-import org.jboss.xb.binding.UnmarshallerFactory;
import org.jboss.xb.binding.XercesXsMarshaller;
import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding;
import org.jboss.xb.binding.sunday.unmarshalling.XsdBinder;
@@ -73,7 +71,7 @@
{
try {
InputStream stream = schema.openStream();
- binding = XsdBinder.bind(stream, "UTF-8", null);
+ binding = XsdBinder.bind(stream, "UTF-8", (String)null);
stream.close();
initialized = true;
} catch (IOException e) {
@@ -108,9 +106,12 @@
XbRunnable runnable = new XbRunnable() {
public void run () throws XbException {
try {
- Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
+ ArchivesUnmarshallerImpl unmarshaller = new ArchivesUnmarshallerImpl();
monitor.worked(1);
binding.setStrictSchema(true);
+ unmarshaller.setValidation(true);
+
unmarshaller.getParser().setFeature("http://apache.org/xml/features/...;,
true);
+
unmarshaller.getParser().setProperty("http://apache.org/xml/properti...;,
schema.toExternalForm());
Object xmlObject = unmarshaller.unmarshal(in, binding);
monitor.worked(1);