From: <jbo...@li...> - 2006-07-05 08:15:46
|
Author: hei...@jb... Date: 2006-07-05 04:15:21 -0400 (Wed, 05 Jul 2006) New Revision: 559 Added: branches/jbossws-1.0/src/main/java/org/jboss/ws/jaxb/JAXBMarshaller.java branches/jbossws-1.0/src/main/java/org/jboss/ws/jaxb/JAXBUnmarshaller.java branches/jbossws-1.0/src/main/java/org/jboss/ws/jaxb/JBossXBMarshallerImpl.java branches/jbossws-1.0/src/main/java/org/jboss/ws/jaxb/JBossXBUnmarshallerImpl.java Removed: branches/jbossws-1.0/src/main/java/org/jboss/ws/jaxb/JAXBMarshallerImpl.java branches/jbossws-1.0/src/main/java/org/jboss/ws/jaxb/JAXBUnmarshallerImpl.java Modified: branches/jbossws-1.0/src/main/java/org/jboss/ws/jaxrpc/encoding/JAXBDeserializer.java branches/jbossws-1.0/src/main/java/org/jboss/ws/jaxrpc/encoding/JAXBSerializer.java branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/array/BigDecimalArrayMarshallerTestCase.java branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/array/BigDecimalArrayUnmarshallerTestCase.java branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/array/CalendarArrayMarshallerTestCase.java branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/array/CalendarArrayUnmarshallerTestCase.java branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/array/QNameArrayMarshallerTestCase.java branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/array/QNameArrayUnmarshallerTestCase.java branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/complex/ComplexTypeMarshallerTestCase.java branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/complex/ComplexTypeUnmarshallerTestCase.java branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/docstyle/DocumentStyleMarshallerTestCase.java branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/docstyle/DocumentStyleUnmarshallerTestCase.java branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/simple/SimpleUserTypeMarshallerTestCase.java branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/simple/SimpleUserTypeUnmarshallerTestCase.java Log: separate implementation and interface Added: branches/jbossws-1.0/src/main/java/org/jboss/ws/jaxb/JAXBMarshaller.java =================================================================== --- branches/jbossws-1.0/src/main/java/org/jboss/ws/jaxb/JAXBMarshaller.java 2006-07-05 07:08:13 UTC (rev 558) +++ branches/jbossws-1.0/src/main/java/org/jboss/ws/jaxb/JAXBMarshaller.java 2006-07-05 08:15:21 UTC (rev 559) @@ -0,0 +1,47 @@ +/* +* JBoss, Home of Professional Open Source +* Copyright 2005, JBoss Inc., 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.ws.jaxb; + +import org.xml.sax.ContentHandler; +import org.w3c.dom.Node; + +import java.io.Writer; +import java.io.OutputStream; + +/** + * @author Heiko Braun <hei...@jb...> + * @version $Id$ + * @since Jul 5, 2006 + */ +public interface JAXBMarshaller { + void marshal(Object obj, Writer writer) throws MarshalException; + + void marshal(Object obj, ContentHandler handler); + + void marshal(Object obj, Node node); + + void marshal(Object obj, OutputStream os) throws MarshalException; + + Object getProperty(String name); + + void setProperty(String name, Object value); +} Property changes on: branches/jbossws-1.0/src/main/java/org/jboss/ws/jaxb/JAXBMarshaller.java ___________________________________________________________________ Name: svn:keywords + Id Revision Name: svn:eol-style + LF Deleted: branches/jbossws-1.0/src/main/java/org/jboss/ws/jaxb/JAXBMarshallerImpl.java =================================================================== --- branches/jbossws-1.0/src/main/java/org/jboss/ws/jaxb/JAXBMarshallerImpl.java 2006-07-05 07:08:13 UTC (rev 558) +++ branches/jbossws-1.0/src/main/java/org/jboss/ws/jaxb/JAXBMarshallerImpl.java 2006-07-05 08:15:21 UTC (rev 559) @@ -1,305 +0,0 @@ -/* - * JBoss, Home of Professional Open Source - * Copyright 2005, JBoss Inc., 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.ws.jaxb; - -// $Id$ - -import org.jboss.logging.Logger; -import org.jboss.util.NotImplementedException; -import org.jboss.ws.WSException; -import org.jboss.ws.xop.XOPMarshallerImpl; -import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping; -import org.jboss.ws.metadata.jaxrpcmapping.JavaXmlTypeMapping; -import org.jboss.ws.metadata.jaxrpcmapping.VariableMapping; -import org.jboss.ws.utils.JavaUtils; -import org.jboss.xb.binding.Constants; -import org.jboss.xb.binding.MappingObjectModelProvider; -import org.jboss.xb.binding.MarshallingContext; -import org.jboss.xb.binding.ObjectLocalMarshaller; -import org.jboss.xb.binding.introspection.ClassInfos; -import org.jboss.xb.binding.sunday.marshalling.MarshallerImpl; -import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; -import org.jboss.xb.util.Dom2Sax; -import org.w3c.dom.Element; -import org.w3c.dom.Node; -import org.xml.sax.ContentHandler; -import org.xml.sax.SAXException; -import javax.xml.namespace.QName; -import java.io.OutputStream; -import java.io.OutputStreamWriter; -import java.io.Writer; -import java.util.HashMap; - -/** - * An implementation of a JAXB Marshaller. - * - * @author Tho...@jb... - * @since 18-Oct-2004 - */ -public class JAXBMarshallerImpl -{ - - // provide logging - private static final Logger log = Logger.getLogger(JAXBMarshallerImpl.class); - - // The marshaller properties - private HashMap properties = new HashMap(); - - private MarshallerImpl delegate; - - public JAXBMarshallerImpl() - { - - ClassInfos.disableCache(); - - delegate = new MarshallerImpl(); - delegate.setProperty(org.jboss.xb.binding.Marshaller.PROP_OUTPUT_XML_VERSION, "false"); - delegate.setProperty(org.jboss.xb.binding.Marshaller.PROP_OUTPUT_INDENTATION, "false"); - delegate.declareNamespace("xsi", Constants.NS_XML_SCHEMA_INSTANCE); - delegate.setSupportNil(true); - //delegate.setSimpleContentProperty("_value"); - } - - /** - * Marshal the content tree rooted at obj into a Writer. - */ - public void marshal(Object obj, Writer writer) throws MarshalException - { - assertRequiredProperties(); - - try - { - QName xmlName = (QName)getProperty(JAXBConstants.JAXB_ROOT_QNAME); - delegate.addRootElement(xmlName); - - QName xmlType = (QName)getProperty(JAXBConstants.JAXB_TYPE_QNAME); - if (xmlType != null) - { - delegate.setRootTypeQName(xmlType); - } - - if (xmlName.getNamespaceURI().length() > 0) - { - String prefix = xmlName.getPrefix(); - String nsURI = xmlName.getNamespaceURI(); - delegate.declareNamespace(prefix, nsURI); - } - - MappingObjectModelProvider provider = new MappingObjectModelProvider(); - provider.setIgnoreLowLine(false); - provider.setIgnoreNotFoundField(false); - - // todo complete wsdl mapping merge - JavaWsdlMapping wsdlMapping = (JavaWsdlMapping)getProperty(JAXBConstants.JAXB_JAVA_MAPPING); - if (wsdlMapping != null) - { - JavaXmlTypeMapping[] javaXmlMappings = wsdlMapping.getJavaXmlTypeMappings(); - if (javaXmlMappings != null) - { - for (int i = 0; i < javaXmlMappings.length; ++i) - { - JavaXmlTypeMapping javaXmlMapping = javaXmlMappings[i]; - VariableMapping[] variableMappings = javaXmlMapping.getVariableMappings(); - if (variableMappings != null) - { - String clsName = javaXmlMapping.getJavaType(); - Class cls = JavaUtils.loadJavaType(clsName, Thread.currentThread().getContextClassLoader()); - QName clsQName = javaXmlMapping.getRootTypeQName() != null ? javaXmlMapping.getRootTypeQName() : javaXmlMapping.getAnonymousTypeQName(); - - if (clsQName != null) - { - if ("element".equals(javaXmlMapping.getQnameScope())) - { - delegate.mapClassToGlobalElement(cls, clsQName.getLocalPart(), clsQName.getNamespaceURI(), null, provider); - } - else - { - delegate.mapClassToGlobalType(cls, clsQName.getLocalPart(), clsQName.getNamespaceURI(), null, provider); - delegate.mapClassToXsiType(cls, clsQName.getNamespaceURI(), clsQName.getLocalPart()); - } - } - - for (int j = 0; j < variableMappings.length; ++j) - { - VariableMapping variableMapping = variableMappings[j]; - String javaName = variableMapping.getJavaVariableName(); - if (variableMapping.getXmlElementName() != null) - { - String xmlElementName = variableMapping.getXmlElementName(); - provider.mapFieldToElement(cls, javaName, "", xmlElementName, null); - } - else if (variableMapping.getXmlAttributeName() != null) - { - log.trace("Unmapped attribute: " + javaName); - } - else if (variableMapping.getXmlWildcard()) - { - delegate.mapFieldToWildcard(cls, "_any", getWildcardMarshaller()); - } - else - { - log.warn("Unmapped variable: " + javaName); - } - } - } - } - } - } - - // the actual marshalling - SchemaBinding schemaBinding = JBossXBSupport.getOrCreateSchemaBinding(properties); - schemaBinding.setXopMarshaller(new XOPMarshallerImpl()); - delegate.marshal(schemaBinding, provider, obj, writer); - } - catch (RuntimeException e) - { - throw e; - } - catch (Exception e) - { - throw new MarshalException(e); - } - } - - private ObjectLocalMarshaller getWildcardMarshaller() - { - ObjectLocalMarshaller wildcardMarshaller = new ObjectLocalMarshaller() { - public void marshal(MarshallingContext ctx, Object o) - { - if (o == null) - { - return; - } - - Element e = (Element)o; - ContentHandler ch = ctx.getContentHandler(); - try - { - Dom2Sax.dom2sax(e, ch); - } - catch (SAXException e1) - { - throw new IllegalStateException("Failed to marshal DOM element " + new QName(e.getNamespaceURI(), e.getLocalName()) + ": " + e1.getMessage()); - } - /* - DOMSource domSource = new DOMSource(e); - SAXResult streamResult = new SAXResult(ch); - // if i use the system default transformer then it works - // the one that is actually used does not declare namespaces - //System.setProperty("javax.xml.transform.TransformerFactory", "com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl"); - TransformerFactory tf = TransformerFactory.newInstance(); - Transformer serializer = null; - try - { - serializer = tf.newTransformer(); - serializer.transform(domSource, streamResult); - } - catch(TransformerConfigurationException e1) - { - throw new JBossXBRuntimeException("Failed to create transformer", e1); - } - catch(TransformerException e1) - { - throw new JBossXBRuntimeException("Failed to marshal with transform", e1); - } - */ - } - }; - return wildcardMarshaller; - } - - /** - * Marshal the content tree rooted at obj into SAX2 events. - */ - public void marshal(Object obj, ContentHandler handler) - { - throw new NotImplementedException(); - } - - /** - * Marshal the content tree rooted at obj into a DOM tree. - */ - public void marshal(Object obj, Node node) - { - throw new NotImplementedException(); - } - - /** - * Marshal the content tree rooted at obj into an output stream. - */ - public void marshal(Object obj, OutputStream os) throws MarshalException - { - marshal(obj, new OutputStreamWriter(os)); - } - - /** - * Get the particular property in the underlying implementation of - * Marshaller. - */ - public Object getProperty(String name) - { - if (name == null) - throw new IllegalArgumentException("name parameter is null"); - - return properties.get(name); - } - - /** - * Set the particular property in the underlying implementation of - * Marshaller. - * - */ - public void setProperty(String name, Object value) - { - if (name == null) - throw new IllegalArgumentException("name parameter is null"); - - properties.put(name, value); - } - - /** - * Get a DOM tree view of the content tree(Optional). - */ - public Node getNode(Object contentTree) - { - throw new NotImplementedException(); - } - - /** - * Assert the required properties - */ - private void assertRequiredProperties() - { - if (getProperty(JAXBConstants.JAXB_SCHEMA_READER) == null && getProperty(JAXBConstants.JAXB_XS_MODEL) == null) - throw new WSException("Cannot find required property: " + JAXBConstants.JAXB_XS_MODEL); - - if (getProperty(JAXBConstants.JAXB_JAVA_MAPPING) == null) - throw new WSException("Cannot find required property: " + JAXBConstants.JAXB_JAVA_MAPPING); - - QName xmlName = (QName)getProperty(JAXBConstants.JAXB_ROOT_QNAME); - if (xmlName == null) - throw new WSException("Cannot find required property: " + JAXBConstants.JAXB_ROOT_QNAME); - - if (xmlName.getNamespaceURI().length() > 0 && xmlName.getPrefix().length() == 0) - throw new IllegalArgumentException("The given root element name must be prefix qualified: " + xmlName); - } -} Added: branches/jbossws-1.0/src/main/java/org/jboss/ws/jaxb/JAXBUnmarshaller.java =================================================================== --- branches/jbossws-1.0/src/main/java/org/jboss/ws/jaxb/JAXBUnmarshaller.java 2006-07-05 07:08:13 UTC (rev 558) +++ branches/jbossws-1.0/src/main/java/org/jboss/ws/jaxb/JAXBUnmarshaller.java 2006-07-05 08:15:21 UTC (rev 559) @@ -0,0 +1,37 @@ +/* +* JBoss, Home of Professional Open Source +* Copyright 2005, JBoss Inc., 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.ws.jaxb; + +import java.io.InputStream; + +/** + * @author Heiko Braun <hei...@jb...> + * @version $Id$ + * @since Jul 5, 2006 + */ +public interface JAXBUnmarshaller { + Object unmarshal(InputStream is) throws UnmarshalException; + + Object getProperty(String name); + + void setProperty(String name, Object value); +} Property changes on: branches/jbossws-1.0/src/main/java/org/jboss/ws/jaxb/JAXBUnmarshaller.java ___________________________________________________________________ Name: svn:keywords + Id Revision Name: svn:eol-style + LF Deleted: branches/jbossws-1.0/src/main/java/org/jboss/ws/jaxb/JAXBUnmarshallerImpl.java =================================================================== --- branches/jbossws-1.0/src/main/java/org/jboss/ws/jaxb/JAXBUnmarshallerImpl.java 2006-07-05 07:08:13 UTC (rev 558) +++ branches/jbossws-1.0/src/main/java/org/jboss/ws/jaxb/JAXBUnmarshallerImpl.java 2006-07-05 08:15:21 UTC (rev 559) @@ -1,108 +0,0 @@ -/* - * JBoss, Home of Professional Open Source - * Copyright 2005, JBoss Inc., 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.ws.jaxb; - -// $Id$ - -import java.io.InputStream; -import java.util.HashMap; - -import org.jboss.ws.WSException; -import org.jboss.ws.xop.XOPUnmarshallerImpl; -import org.jboss.xb.binding.JBossXBException; -import org.jboss.xb.binding.UnmarshallerFactory; -import org.jboss.xb.binding.introspection.ClassInfos; -import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; - -/** - * An implementation of a JAXB Unmarshaller. - * - * @author Tho...@jb... - * @author Ale...@jb... - * @since 18-Oct-2004 - */ -public class JAXBUnmarshallerImpl -{ - // The marshaller properties - private HashMap<String, Object> properties = new HashMap<String, Object>(); - - /** - * Unmarshal XML data from the specified InputStream and return the resulting content tree. - */ - public Object unmarshal(InputStream is) throws UnmarshalException - { - - ClassInfos.disableCache(); - - assertRequiredProperties(); - - org.jboss.xb.binding.Unmarshaller unm = UnmarshallerFactory.newInstance().newUnmarshaller(); - SchemaBinding schemaBinding = JBossXBSupport.getOrCreateSchemaBinding(properties); - schemaBinding.setXopUnmarshaller(new XOPUnmarshallerImpl()); - try - { - return unm.unmarshal(is, schemaBinding); - } - catch (JBossXBException e) - { - throw new UnmarshalException(e.getMessage(), e); - } - } - - /** - * Get the particular property in the underlying implementation of Unmarshaller. - */ - public Object getProperty(String name) - { - if (name == null) - throw new IllegalArgumentException("name parameter is null"); - - return properties.get(name); - } - - /** - * Set the particular property in the underlying implementation of Unmarshaller. - */ - public void setProperty(String name, Object value) - { - if (name == null) - throw new IllegalArgumentException("name parameter is null"); - - properties.put(name, value); - } - - - /** Assert the required properties - */ - private void assertRequiredProperties() - { - if (getProperty(JAXBConstants.JAXB_XS_MODEL) == null) - { - throw new WSException("Cannot find required property: " + JAXBConstants.JAXB_XS_MODEL); - } - - if (getProperty(JAXBConstants.JAXB_JAVA_MAPPING) == null) - { - throw new WSException("Cannot find required property: " + JAXBConstants.JAXB_JAVA_MAPPING); - } - } -} Copied: branches/jbossws-1.0/src/main/java/org/jboss/ws/jaxb/JBossXBMarshallerImpl.java (from rev 558, branches/jbossws-1.0/src/main/java/org/jboss/ws/jaxb/JAXBMarshallerImpl.java) =================================================================== --- branches/jbossws-1.0/src/main/java/org/jboss/ws/jaxb/JAXBMarshallerImpl.java 2006-07-05 07:08:13 UTC (rev 558) +++ branches/jbossws-1.0/src/main/java/org/jboss/ws/jaxb/JBossXBMarshallerImpl.java 2006-07-05 08:15:21 UTC (rev 559) @@ -0,0 +1,304 @@ +/* + * JBoss, Home of Professional Open Source + * Copyright 2005, JBoss Inc., 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.ws.jaxb; + +// $Id$ + +import org.jboss.logging.Logger; +import org.jboss.util.NotImplementedException; +import org.jboss.ws.WSException; +import org.jboss.ws.xop.XOPMarshallerImpl; +import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping; +import org.jboss.ws.metadata.jaxrpcmapping.JavaXmlTypeMapping; +import org.jboss.ws.metadata.jaxrpcmapping.VariableMapping; +import org.jboss.ws.utils.JavaUtils; +import org.jboss.xb.binding.Constants; +import org.jboss.xb.binding.MappingObjectModelProvider; +import org.jboss.xb.binding.MarshallingContext; +import org.jboss.xb.binding.ObjectLocalMarshaller; +import org.jboss.xb.binding.introspection.ClassInfos; +import org.jboss.xb.binding.sunday.marshalling.MarshallerImpl; +import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; +import org.jboss.xb.util.Dom2Sax; +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.xml.sax.ContentHandler; +import org.xml.sax.SAXException; +import javax.xml.namespace.QName; +import java.io.OutputStream; +import java.io.OutputStreamWriter; +import java.io.Writer; +import java.util.HashMap; + +/** + * An implementation of a JAXB Marshaller. + * + * @author Tho...@jb... + * @since 18-Oct-2004 + */ +public class JBossXBMarshallerImpl implements JAXBMarshaller { + + // provide logging + private static final Logger log = Logger.getLogger(JBossXBMarshallerImpl.class); + + // The marshaller properties + private HashMap properties = new HashMap(); + + private MarshallerImpl delegate; + + public JBossXBMarshallerImpl() + { + + ClassInfos.disableCache(); + + delegate = new MarshallerImpl(); + delegate.setProperty(org.jboss.xb.binding.Marshaller.PROP_OUTPUT_XML_VERSION, "false"); + delegate.setProperty(org.jboss.xb.binding.Marshaller.PROP_OUTPUT_INDENTATION, "false"); + delegate.declareNamespace("xsi", Constants.NS_XML_SCHEMA_INSTANCE); + delegate.setSupportNil(true); + //delegate.setSimpleContentProperty("_value"); + } + + /** + * Marshal the content tree rooted at obj into a Writer. + */ + public void marshal(Object obj, Writer writer) throws MarshalException + { + assertRequiredProperties(); + + try + { + QName xmlName = (QName)getProperty(JAXBConstants.JAXB_ROOT_QNAME); + delegate.addRootElement(xmlName); + + QName xmlType = (QName)getProperty(JAXBConstants.JAXB_TYPE_QNAME); + if (xmlType != null) + { + delegate.setRootTypeQName(xmlType); + } + + if (xmlName.getNamespaceURI().length() > 0) + { + String prefix = xmlName.getPrefix(); + String nsURI = xmlName.getNamespaceURI(); + delegate.declareNamespace(prefix, nsURI); + } + + MappingObjectModelProvider provider = new MappingObjectModelProvider(); + provider.setIgnoreLowLine(false); + provider.setIgnoreNotFoundField(false); + + // todo complete wsdl mapping merge + JavaWsdlMapping wsdlMapping = (JavaWsdlMapping)getProperty(JAXBConstants.JAXB_JAVA_MAPPING); + if (wsdlMapping != null) + { + JavaXmlTypeMapping[] javaXmlMappings = wsdlMapping.getJavaXmlTypeMappings(); + if (javaXmlMappings != null) + { + for (int i = 0; i < javaXmlMappings.length; ++i) + { + JavaXmlTypeMapping javaXmlMapping = javaXmlMappings[i]; + VariableMapping[] variableMappings = javaXmlMapping.getVariableMappings(); + if (variableMappings != null) + { + String clsName = javaXmlMapping.getJavaType(); + Class cls = JavaUtils.loadJavaType(clsName, Thread.currentThread().getContextClassLoader()); + QName clsQName = javaXmlMapping.getRootTypeQName() != null ? javaXmlMapping.getRootTypeQName() : javaXmlMapping.getAnonymousTypeQName(); + + if (clsQName != null) + { + if ("element".equals(javaXmlMapping.getQnameScope())) + { + delegate.mapClassToGlobalElement(cls, clsQName.getLocalPart(), clsQName.getNamespaceURI(), null, provider); + } + else + { + delegate.mapClassToGlobalType(cls, clsQName.getLocalPart(), clsQName.getNamespaceURI(), null, provider); + delegate.mapClassToXsiType(cls, clsQName.getNamespaceURI(), clsQName.getLocalPart()); + } + } + + for (int j = 0; j < variableMappings.length; ++j) + { + VariableMapping variableMapping = variableMappings[j]; + String javaName = variableMapping.getJavaVariableName(); + if (variableMapping.getXmlElementName() != null) + { + String xmlElementName = variableMapping.getXmlElementName(); + provider.mapFieldToElement(cls, javaName, "", xmlElementName, null); + } + else if (variableMapping.getXmlAttributeName() != null) + { + log.trace("Unmapped attribute: " + javaName); + } + else if (variableMapping.getXmlWildcard()) + { + delegate.mapFieldToWildcard(cls, "_any", getWildcardMarshaller()); + } + else + { + log.warn("Unmapped variable: " + javaName); + } + } + } + } + } + } + + // the actual marshalling + SchemaBinding schemaBinding = JBossXBSupport.getOrCreateSchemaBinding(properties); + schemaBinding.setXopMarshaller(new XOPMarshallerImpl()); + delegate.marshal(schemaBinding, provider, obj, writer); + } + catch (RuntimeException e) + { + throw e; + } + catch (Exception e) + { + throw new MarshalException(e); + } + } + + private ObjectLocalMarshaller getWildcardMarshaller() + { + ObjectLocalMarshaller wildcardMarshaller = new ObjectLocalMarshaller() { + public void marshal(MarshallingContext ctx, Object o) + { + if (o == null) + { + return; + } + + Element e = (Element)o; + ContentHandler ch = ctx.getContentHandler(); + try + { + Dom2Sax.dom2sax(e, ch); + } + catch (SAXException e1) + { + throw new IllegalStateException("Failed to marshal DOM element " + new QName(e.getNamespaceURI(), e.getLocalName()) + ": " + e1.getMessage()); + } + /* + DOMSource domSource = new DOMSource(e); + SAXResult streamResult = new SAXResult(ch); + // if i use the system default transformer then it works + // the one that is actually used does not declare namespaces + //System.setProperty("javax.xml.transform.TransformerFactory", "com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl"); + TransformerFactory tf = TransformerFactory.newInstance(); + Transformer serializer = null; + try + { + serializer = tf.newTransformer(); + serializer.transform(domSource, streamResult); + } + catch(TransformerConfigurationException e1) + { + throw new JBossXBRuntimeException("Failed to create transformer", e1); + } + catch(TransformerException e1) + { + throw new JBossXBRuntimeException("Failed to marshal with transform", e1); + } + */ + } + }; + return wildcardMarshaller; + } + + /** + * Marshal the content tree rooted at obj into SAX2 events. + */ + public void marshal(Object obj, ContentHandler handler) + { + throw new NotImplementedException(); + } + + /** + * Marshal the content tree rooted at obj into a DOM tree. + */ + public void marshal(Object obj, Node node) + { + throw new NotImplementedException(); + } + + /** + * Marshal the content tree rooted at obj into an output stream. + */ + public void marshal(Object obj, OutputStream os) throws MarshalException + { + marshal(obj, new OutputStreamWriter(os)); + } + + /** + * Get the particular property in the underlying implementation of + * Marshaller. + */ + public Object getProperty(String name) + { + if (name == null) + throw new IllegalArgumentException("name parameter is null"); + + return properties.get(name); + } + + /** + * Set the particular property in the underlying implementation of + * Marshaller. + * + */ + public void setProperty(String name, Object value) + { + if (name == null) + throw new IllegalArgumentException("name parameter is null"); + + properties.put(name, value); + } + + /** + * Get a DOM tree view of the content tree(Optional). + */ + public Node getNode(Object contentTree) + { + throw new NotImplementedException(); + } + + /** + * Assert the required properties + */ + private void assertRequiredProperties() + { + if (getProperty(JAXBConstants.JAXB_SCHEMA_READER) == null && getProperty(JAXBConstants.JAXB_XS_MODEL) == null) + throw new WSException("Cannot find required property: " + JAXBConstants.JAXB_XS_MODEL); + + if (getProperty(JAXBConstants.JAXB_JAVA_MAPPING) == null) + throw new WSException("Cannot find required property: " + JAXBConstants.JAXB_JAVA_MAPPING); + + QName xmlName = (QName)getProperty(JAXBConstants.JAXB_ROOT_QNAME); + if (xmlName == null) + throw new WSException("Cannot find required property: " + JAXBConstants.JAXB_ROOT_QNAME); + + if (xmlName.getNamespaceURI().length() > 0 && xmlName.getPrefix().length() == 0) + throw new IllegalArgumentException("The given root element name must be prefix qualified: " + xmlName); + } +} Property changes on: branches/jbossws-1.0/src/main/java/org/jboss/ws/jaxb/JBossXBMarshallerImpl.java ___________________________________________________________________ Name: svn:keywords + Id Revision Name: svn:eol-style + LF Copied: branches/jbossws-1.0/src/main/java/org/jboss/ws/jaxb/JBossXBUnmarshallerImpl.java (from rev 558, branches/jbossws-1.0/src/main/java/org/jboss/ws/jaxb/JAXBUnmarshallerImpl.java) =================================================================== --- branches/jbossws-1.0/src/main/java/org/jboss/ws/jaxb/JAXBUnmarshallerImpl.java 2006-07-05 07:08:13 UTC (rev 558) +++ branches/jbossws-1.0/src/main/java/org/jboss/ws/jaxb/JBossXBUnmarshallerImpl.java 2006-07-05 08:15:21 UTC (rev 559) @@ -0,0 +1,108 @@ +/* + * JBoss, Home of Professional Open Source + * Copyright 2005, JBoss Inc., 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.ws.jaxb; + +// $Id$ + +import java.io.InputStream; +import java.util.HashMap; + +import org.jboss.ws.WSException; +import org.jboss.ws.xop.XOPUnmarshallerImpl; +import org.jboss.xb.binding.JBossXBException; +import org.jboss.xb.binding.UnmarshallerFactory; +import org.jboss.xb.binding.introspection.ClassInfos; +import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; + +/** + * An implementation of a JAXB Unmarshaller. + * + * @author Tho...@jb... + * @author Ale...@jb... + * @since 18-Oct-2004 + */ +public class JBossXBUnmarshallerImpl implements JAXBUnmarshaller { + + // The marshaller properties + private HashMap<String, Object> properties = new HashMap<String, Object>(); + + /** + * Unmarshal XML data from the specified InputStream and return the resulting content tree. + */ + public Object unmarshal(InputStream is) throws UnmarshalException + { + + ClassInfos.disableCache(); + + assertRequiredProperties(); + + org.jboss.xb.binding.Unmarshaller unm = UnmarshallerFactory.newInstance().newUnmarshaller(); + SchemaBinding schemaBinding = JBossXBSupport.getOrCreateSchemaBinding(properties); + schemaBinding.setXopUnmarshaller(new XOPUnmarshallerImpl()); + try + { + return unm.unmarshal(is, schemaBinding); + } + catch (JBossXBException e) + { + throw new UnmarshalException(e.getMessage(), e); + } + } + + /** + * Get the particular property in the underlying implementation of Unmarshaller. + */ + public Object getProperty(String name) + { + if (name == null) + throw new IllegalArgumentException("name parameter is null"); + + return properties.get(name); + } + + /** + * Set the particular property in the underlying implementation of Unmarshaller. + */ + public void setProperty(String name, Object value) + { + if (name == null) + throw new IllegalArgumentException("name parameter is null"); + + properties.put(name, value); + } + + + /** Assert the required properties + */ + private void assertRequiredProperties() + { + if (getProperty(JAXBConstants.JAXB_XS_MODEL) == null) + { + throw new WSException("Cannot find required property: " + JAXBConstants.JAXB_XS_MODEL); + } + + if (getProperty(JAXBConstants.JAXB_JAVA_MAPPING) == null) + { + throw new WSException("Cannot find required property: " + JAXBConstants.JAXB_JAVA_MAPPING); + } + } +} Property changes on: branches/jbossws-1.0/src/main/java/org/jboss/ws/jaxb/JBossXBUnmarshallerImpl.java ___________________________________________________________________ Name: svn:keywords + Id Revision Name: svn:eol-style + LF Modified: branches/jbossws-1.0/src/main/java/org/jboss/ws/jaxrpc/encoding/JAXBDeserializer.java =================================================================== --- branches/jbossws-1.0/src/main/java/org/jboss/ws/jaxrpc/encoding/JAXBDeserializer.java 2006-07-05 07:08:13 UTC (rev 558) +++ branches/jbossws-1.0/src/main/java/org/jboss/ws/jaxrpc/encoding/JAXBDeserializer.java 2006-07-05 08:15:21 UTC (rev 559) @@ -31,7 +31,8 @@ import org.jboss.logging.Logger; import org.jboss.ws.binding.BindingException; import org.jboss.ws.jaxb.JAXBConstants; -import org.jboss.ws.jaxb.JAXBUnmarshallerImpl; +import org.jboss.ws.jaxb.JBossXBUnmarshallerImpl; +import org.jboss.ws.jaxb.JAXBUnmarshaller; import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping; /** @@ -45,12 +46,12 @@ // provide logging private static final Logger log = Logger.getLogger(JAXBDeserializer.class); - private JAXBUnmarshallerImpl jaxbUnmarshaller; + private JAXBUnmarshaller jaxbUnmarshaller; public JAXBDeserializer() throws BindingException { // Get the JAXB marshaller for complex objects - jaxbUnmarshaller = new JAXBUnmarshallerImpl(); + jaxbUnmarshaller = new JBossXBUnmarshallerImpl(); } /** Modified: branches/jbossws-1.0/src/main/java/org/jboss/ws/jaxrpc/encoding/JAXBSerializer.java =================================================================== --- branches/jbossws-1.0/src/main/java/org/jboss/ws/jaxrpc/encoding/JAXBSerializer.java 2006-07-05 07:08:13 UTC (rev 558) +++ branches/jbossws-1.0/src/main/java/org/jboss/ws/jaxrpc/encoding/JAXBSerializer.java 2006-07-05 08:15:21 UTC (rev 559) @@ -31,7 +31,8 @@ import org.jboss.logging.Logger; import org.jboss.ws.binding.BindingException; import org.jboss.ws.jaxb.JAXBConstants; -import org.jboss.ws.jaxb.JAXBMarshallerImpl; +import org.jboss.ws.jaxb.JBossXBMarshallerImpl; +import org.jboss.ws.jaxb.JAXBMarshaller; import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping; import org.w3c.dom.NamedNodeMap; @@ -46,12 +47,12 @@ // provide logging private static final Logger log = Logger.getLogger(JAXBSerializer.class); - private JAXBMarshallerImpl jaxbMarshaller; + private JAXBMarshaller JAXBMarshaller; public JAXBSerializer() throws BindingException { // Get the JAXB marshaller for complex objects - jaxbMarshaller = new JAXBMarshallerImpl(); + JAXBMarshaller = new JBossXBMarshallerImpl(); } /** @@ -84,13 +85,13 @@ // Get the jaxrpc-mapping.xml object graph JavaWsdlMapping jaxrpcMapping = serContext.getJavaWsdlMapping(); - jaxbMarshaller.setProperty(JAXBConstants.JAXB_XS_MODEL, model); - jaxbMarshaller.setProperty(JAXBConstants.JAXB_TYPE_QNAME, xmlType); - jaxbMarshaller.setProperty(JAXBConstants.JAXB_ROOT_QNAME, xmlName); - jaxbMarshaller.setProperty(JAXBConstants.JAXB_JAVA_MAPPING, jaxrpcMapping); + JAXBMarshaller.setProperty(JAXBConstants.JAXB_XS_MODEL, model); + JAXBMarshaller.setProperty(JAXBConstants.JAXB_TYPE_QNAME, xmlType); + JAXBMarshaller.setProperty(JAXBConstants.JAXB_ROOT_QNAME, xmlName); + JAXBMarshaller.setProperty(JAXBConstants.JAXB_JAVA_MAPPING, jaxrpcMapping); StringWriter strwr = new StringWriter(); - jaxbMarshaller.marshal(value, strwr); + JAXBMarshaller.marshal(value, strwr); xmlFragment = strwr.toString(); log.debug("serialized: " + xmlFragment); Modified: branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/array/BigDecimalArrayMarshallerTestCase.java =================================================================== --- branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/array/BigDecimalArrayMarshallerTestCase.java 2006-07-05 07:08:13 UTC (rev 558) +++ branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/array/BigDecimalArrayMarshallerTestCase.java 2006-07-05 08:15:21 UTC (rev 559) @@ -30,7 +30,8 @@ import org.jboss.test.ws.tools.WSToolsTest; import org.jboss.util.xml.DOMUtils; import org.jboss.ws.jaxb.JAXBConstants; -import org.jboss.ws.jaxb.JAXBMarshallerImpl; +import org.jboss.ws.jaxb.JBossXBMarshallerImpl; +import org.jboss.ws.jaxb.JAXBMarshaller; import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping; /** @@ -71,7 +72,7 @@ // + " <element name='value' type='decimal' nillable='true' minOccurs='0' maxOccurs='unbounded'/>" + " </sequence>" // + " </complexType>" + "</schema>", "UTF-8"); StringWriter strwr; - JAXBMarshallerImpl marshaller = new JAXBMarshallerImpl(); + JAXBMarshaller marshaller = new JBossXBMarshallerImpl(); marshaller.setProperty(JAXBConstants.JAXB_XS_MODEL, model); marshaller.setProperty(JAXBConstants.JAXB_TYPE_QNAME, xmlType); marshaller.setProperty(JAXBConstants.JAXB_ROOT_QNAME, xmlName); Modified: branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/array/BigDecimalArrayUnmarshallerTestCase.java =================================================================== --- branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/array/BigDecimalArrayUnmarshallerTestCase.java 2006-07-05 07:08:13 UTC (rev 558) +++ branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/array/BigDecimalArrayUnmarshallerTestCase.java 2006-07-05 08:15:21 UTC (rev 559) @@ -30,7 +30,8 @@ import org.jboss.test.ws.tools.WSToolsTest; import org.jboss.util.xml.DOMUtils; import org.jboss.ws.jaxb.JAXBConstants; -import org.jboss.ws.jaxb.JAXBUnmarshallerImpl; +import org.jboss.ws.jaxb.JBossXBUnmarshallerImpl; +import org.jboss.ws.jaxb.JAXBUnmarshaller; import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping; /** @@ -70,7 +71,7 @@ BigDecimal[] objArr = null; // Get the JAXB marshaller - JAXBUnmarshallerImpl unmarshaller = new JAXBUnmarshallerImpl(); + JAXBUnmarshaller unmarshaller = new JBossXBUnmarshallerImpl(); unmarshaller.setProperty(JAXBConstants.JAXB_XS_MODEL, model); unmarshaller.setProperty(JAXBConstants.JAXB_ROOT_QNAME, xmlName); unmarshaller.setProperty(JAXBConstants.JAXB_TYPE_QNAME, xmlType); Modified: branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/array/CalendarArrayMarshallerTestCase.java =================================================================== --- branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/array/CalendarArrayMarshallerTestCase.java 2006-07-05 07:08:13 UTC (rev 558) +++ branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/array/CalendarArrayMarshallerTestCase.java 2006-07-05 08:15:21 UTC (rev 559) @@ -32,7 +32,8 @@ import org.jboss.test.ws.tools.WSToolsTest; import org.jboss.util.xml.DOMUtils; import org.jboss.ws.jaxb.JAXBConstants; -import org.jboss.ws.jaxb.JAXBMarshallerImpl; +import org.jboss.ws.jaxb.JBossXBMarshallerImpl; +import org.jboss.ws.jaxb.JAXBMarshaller; import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping; /** @@ -75,7 +76,7 @@ XSModel model = generateSchemaXSModel(xmlType, Calendar[].class); StringWriter strwr; - JAXBMarshallerImpl marshaller = new JAXBMarshallerImpl(); + JAXBMarshaller marshaller = new JBossXBMarshallerImpl(); marshaller.setProperty(JAXBConstants.JAXB_XS_MODEL, model); marshaller.setProperty(JAXBConstants.JAXB_TYPE_QNAME, xmlType); marshaller.setProperty(JAXBConstants.JAXB_ROOT_QNAME, xmlName); Modified: branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/array/CalendarArrayUnmarshallerTestCase.java =================================================================== --- branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/array/CalendarArrayUnmarshallerTestCase.java 2006-07-05 07:08:13 UTC (rev 558) +++ branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/array/CalendarArrayUnmarshallerTestCase.java 2006-07-05 08:15:21 UTC (rev 559) @@ -32,7 +32,8 @@ import org.jboss.test.ws.tools.WSToolsTest; import org.jboss.util.xml.DOMUtils; import org.jboss.ws.jaxb.JAXBConstants; -import org.jboss.ws.jaxb.JAXBUnmarshallerImpl; +import org.jboss.ws.jaxb.JBossXBUnmarshallerImpl; +import org.jboss.ws.jaxb.JAXBUnmarshaller; import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping; /** @@ -67,7 +68,7 @@ XSModel model = generateSchemaXSModel(xmlType, Calendar[].class); Calendar[] objArr = null; - JAXBUnmarshallerImpl unmarshaller = new JAXBUnmarshallerImpl(); + JAXBUnmarshaller unmarshaller = new JBossXBUnmarshallerImpl(); unmarshaller.setProperty(JAXBConstants.JAXB_XS_MODEL, model); unmarshaller.setProperty(JAXBConstants.JAXB_ROOT_QNAME, xmlName); unmarshaller.setProperty(JAXBConstants.JAXB_TYPE_QNAME, xmlType); Modified: branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/array/QNameArrayMarshallerTestCase.java =================================================================== --- branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/array/QNameArrayMarshallerTestCase.java 2006-07-05 07:08:13 UTC (rev 558) +++ branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/array/QNameArrayMarshallerTestCase.java 2006-07-05 08:15:21 UTC (rev 559) @@ -29,7 +29,8 @@ import org.jboss.test.ws.tools.WSToolsTest; import org.jboss.util.xml.DOMUtils; import org.jboss.ws.jaxb.JAXBConstants; -import org.jboss.ws.jaxb.JAXBMarshallerImpl; +import org.jboss.ws.jaxb.JBossXBMarshallerImpl; +import org.jboss.ws.jaxb.JAXBMarshaller; import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping; /** @@ -67,7 +68,7 @@ XSModel model = generateSchemaXSModel(xmlType, QName[].class); StringWriter strwr; - JAXBMarshallerImpl marshaller = new JAXBMarshallerImpl(); + JAXBMarshaller marshaller = new JBossXBMarshallerImpl(); marshaller.setProperty(JAXBConstants.JAXB_XS_MODEL, model); marshaller.setProperty(JAXBConstants.JAXB_TYPE_QNAME, xmlType); marshaller.setProperty(JAXBConstants.JAXB_ROOT_QNAME, xmlName); Modified: branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/array/QNameArrayUnmarshallerTestCase.java =================================================================== --- branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/array/QNameArrayUnmarshallerTestCase.java 2006-07-05 07:08:13 UTC (rev 558) +++ branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/array/QNameArrayUnmarshallerTestCase.java 2006-07-05 08:15:21 UTC (rev 559) @@ -29,7 +29,8 @@ import org.jboss.test.ws.tools.WSToolsTest; import org.jboss.util.xml.DOMUtils; import org.jboss.ws.jaxb.JAXBConstants; -import org.jboss.ws.jaxb.JAXBUnmarshallerImpl; +import org.jboss.ws.jaxb.JBossXBUnmarshallerImpl; +import org.jboss.ws.jaxb.JAXBUnmarshaller; import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping; /** @@ -64,7 +65,7 @@ XSModel model = generateSchemaXSModel(xmlType, QName[].class); QName[] objArr = null; - JAXBUnmarshallerImpl unmarshaller = new JAXBUnmarshallerImpl(); + JAXBUnmarshaller unmarshaller = new JBossXBUnmarshallerImpl(); unmarshaller.setProperty(JAXBConstants.JAXB_XS_MODEL, model); unmarshaller.setProperty(JAXBConstants.JAXB_ROOT_QNAME, xmlName); unmarshaller.setProperty(JAXBConstants.JAXB_TYPE_QNAME, xmlType); Modified: branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/complex/ComplexTypeMarshallerTestCase.java =================================================================== --- branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/complex/ComplexTypeMarshallerTestCase.java 2006-07-05 07:08:13 UTC (rev 558) +++ branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/complex/ComplexTypeMarshallerTestCase.java 2006-07-05 08:15:21 UTC (rev 559) @@ -32,7 +32,8 @@ import org.jboss.test.ws.tools.WSToolsTest; import org.jboss.util.xml.DOMUtils; import org.jboss.ws.jaxb.JAXBConstants; -import org.jboss.ws.jaxb.JAXBMarshallerImpl; +import org.jboss.ws.jaxb.JBossXBMarshallerImpl; +import org.jboss.ws.jaxb.JAXBMarshaller; import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping; import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMappingFactory; @@ -68,7 +69,7 @@ XSModel model = getSchemaModel(xmlType, Base.class); StringWriter strwr; - JAXBMarshallerImpl marshaller = new JAXBMarshallerImpl(); + JAXBMarshaller marshaller = new JBossXBMarshallerImpl(); marshaller.setProperty(JAXBConstants.JAXB_XS_MODEL, model); marshaller.setProperty(JAXBConstants.JAXB_ROOT_QNAME, xmlName); marshaller.setProperty(JAXBConstants.JAXB_TYPE_QNAME, xmlType); @@ -96,7 +97,7 @@ XSModel model = getSchemaModel(xmlType, Derived.class); StringWriter strwr; - JAXBMarshallerImpl marshaller = new JAXBMarshallerImpl(); + JAXBMarshaller marshaller = new JBossXBMarshallerImpl(); marshaller.setProperty(JAXBConstants.JAXB_XS_MODEL, model); marshaller.setProperty(JAXBConstants.JAXB_ROOT_QNAME, xmlName); marshaller.setProperty(JAXBConstants.JAXB_TYPE_QNAME, xmlType); @@ -136,7 +137,7 @@ XSModel model = getSchemaModel(xmlType, Composite.class); StringWriter strwr; - JAXBMarshallerImpl marshaller = new JAXBMarshallerImpl(); + JAXBMarshaller marshaller = new JBossXBMarshallerImpl(); marshaller.setProperty(JAXBConstants.JAXB_XS_MODEL, model); marshaller.setProperty(JAXBConstants.JAXB_ROOT_QNAME, xmlName); marshaller.setProperty(JAXBConstants.JAXB_TYPE_QNAME, xmlType); Modified: branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/complex/ComplexTypeUnmarshallerTestCase.java =================================================================== --- branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/complex/ComplexTypeUnmarshallerTestCase.java 2006-07-05 07:08:13 UTC (rev 558) +++ branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/complex/ComplexTypeUnmarshallerTestCase.java 2006-07-05 08:15:21 UTC (rev 559) @@ -31,7 +31,8 @@ import org.apache.xerces.xs.XSModel; import org.jboss.test.ws.tools.WSToolsTest; import org.jboss.ws.jaxb.JAXBConstants; -import org.jboss.ws.jaxb.JAXBUnmarshallerImpl; +import org.jboss.ws.jaxb.JBossXBUnmarshallerImpl; +import org.jboss.ws.jaxb.JAXBUnmarshaller; import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping; import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMappingFactory; import org.jboss.ws.tools.JavaToXSD; @@ -70,7 +71,7 @@ exp.a = 100; exp.setB(200); - JAXBUnmarshallerImpl unmarshaller = new JAXBUnmarshallerImpl(); + JAXBUnmarshaller unmarshaller = new JBossXBUnmarshallerImpl(); unmarshaller.setProperty(JAXBConstants.JAXB_XS_MODEL, model); unmarshaller.setProperty(JAXBConstants.JAXB_JAVA_MAPPING, getJavaWSDLMapping()); unmarshaller.setProperty(JAXBConstants.JAXB_TYPE_QNAME, xmlType); @@ -96,7 +97,7 @@ XSModel model = getSchemaModel(xmlType, Derived.class); - JAXBUnmarshallerImpl unmarshaller = new JAXBUnmarshallerImpl(); + JAXBUnmarshaller unmarshaller = new JBossXBUnmarshallerImpl(); unmarshaller.setProperty(JAXBConstants.JAXB_XS_MODEL, model); unmarshaller.setProperty(JAXBConstants.JAXB_JAVA_MAPPING, getJavaWSDLMapping()); unmarshaller.setProperty(JAXBConstants.JAXB_TYPE_QNAME, xmlType); @@ -145,7 +146,7 @@ exp.composite = sub; - JAXBUnmarshallerImpl unmarshaller = new JAXBUnmarshallerImpl(); + JAXBUnmarshaller unmarshaller = new JBossXBUnmarshallerImpl(); unmarshaller.setProperty(JAXBConstants.JAXB_XS_MODEL, model); unmarshaller.setProperty(JAXBConstants.JAXB_JAVA_MAPPING, getJavaWSDLMapping()); unmarshaller.setProperty(JAXBConstants.JAXB_TYPE_QNAME, xmlType); Modified: branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/docstyle/DocumentStyleMarshallerTestCase.java =================================================================== --- branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/docstyle/DocumentStyleMarshallerTestCase.java 2006-07-05 07:08:13 UTC (rev 558) +++ branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/docstyle/DocumentStyleMarshallerTestCase.java 2006-07-05 08:15:21 UTC (rev 559) @@ -32,7 +32,8 @@ import org.jboss.test.ws.tools.WSToolsTest; import org.jboss.util.xml.DOMUtils; import org.jboss.ws.jaxb.JAXBConstants; -import org.jboss.ws.jaxb.JAXBMarshallerImpl; +import org.jboss.ws.jaxb.JBossXBMarshallerImpl; +import org.jboss.ws.jaxb.JAXBMarshaller; import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping; import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMappingFactory; @@ -70,7 +71,7 @@ XSModel model = getSchemaModel(); StringWriter strwr; - JAXBMarshallerImpl marshaller = new JAXBMarshallerImpl(); + JAXBMarshaller marshaller = new JBossXBMarshallerImpl(); marshaller.setProperty(JAXBConstants.JAXB_XS_MODEL, model); marshaller.setProperty(JAXBConstants.JAXB_ROOT_QNAME, xmlName); marshaller.setProperty(JAXBConstants.JAXB_TYPE_QNAME, xmlType); Modified: branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/docstyle/DocumentStyleUnmarshallerTestCase.java =================================================================== --- branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/docstyle/DocumentStyleUnmarshallerTestCase.java 2006-07-05 07:08:13 UTC (rev 558) +++ branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/docstyle/DocumentStyleUnmarshallerTestCase.java 2006-07-05 08:15:21 UTC (rev 559) @@ -30,7 +30,8 @@ import org.apache.xerces.xs.XSModel; import org.jboss.test.ws.tools.WSToolsTest; import org.jboss.ws.jaxb.JAXBConstants; -import org.jboss.ws.jaxb.JAXBUnmarshallerImpl; +import org.jboss.ws.jaxb.JBossXBUnmarshallerImpl; +import org.jboss.ws.jaxb.JAXBUnmarshaller; import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping; import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMappingFactory; @@ -66,7 +67,7 @@ EchoString_RequestStruct exp = new EchoString_RequestStruct("Hello", "world!"); - JAXBUnmarshallerImpl unmarshaller = new JAXBUnmarshallerImpl(); + JAXBUnmarshaller unmarshaller = new JBossXBUnmarshallerImpl(); unmarshaller.setProperty(JAXBConstants.JAXB_XS_MODEL, model); unmarshaller.setProperty(JAXBConstants.JAXB_JAVA_MAPPING, getJavaWSDLMapping()); unmarshaller.setProperty(JAXBConstants.JAXB_TYPE_QNAME, xmlType); Modified: branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/simple/SimpleUserTypeMarshallerTestCase.java =================================================================== --- branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/simple/SimpleUserTypeMarshallerTestCase.java 2006-07-05 07:08:13 UTC (rev 558) +++ branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/simple/SimpleUserTypeMarshallerTestCase.java 2006-07-05 08:15:21 UTC (rev 559) @@ -29,7 +29,8 @@ import org.jboss.test.ws.tools.WSToolsTest; import org.jboss.util.xml.DOMUtils; import org.jboss.ws.jaxb.JAXBConstants; -import org.jboss.ws.jaxb.JAXBMarshallerImpl; +import org.jboss.ws.jaxb.JBossXBMarshallerImpl; +import org.jboss.ws.jaxb.JAXBMarshaller; import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping; import org.jboss.ws.metadata.jaxrpcmapping.PackageMapping; @@ -72,7 +73,7 @@ XSModel model = generateSchemaXSModel(xmlType, SimpleUserType.class); StringWriter strwr; - JAXBMarshallerImpl marshaller = new JAXBMarshallerImpl(); + JAXBMarshaller marshaller = new JBossXBMarshallerImpl(); marshaller.setProperty(JAXBConstants.JAXB_XS_MODEL, model); marshaller.setProperty(JAXBConstants.JAXB_ROOT_QNAME, xmlName); marshaller.setProperty(JAXBConstants.JAXB_TYPE_QNAME, xmlType); @@ -103,7 +104,7 @@ StringWriter strwr; try { - JAXBMarshallerImpl marshaller = new JAXBMarshallerImpl(); + JAXBMarshaller marshaller = new JBossXBMarshallerImpl(); marshaller.setProperty(JAXBConstants.JAXB_XS_MODEL, model); marshaller.setProperty(JAXBConstants.JAXB_ROOT_QNAME, xmlName); marshaller.setProperty(JAXBConstants.JAXB_TYPE_QNAME, xmlType); Modified: branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/simple/SimpleUserTypeUnmarshallerTestCase.java =================================================================== --- branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/simple/SimpleUserTypeUnmarshallerTestCase.java 2006-07-05 07:08:13 UTC (rev 558) +++ branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/simple/SimpleUserTypeUnmarshallerTestCase.java 2006-07-05 08:15:21 UTC (rev 559) @@ -29,7 +29,8 @@ import org.jboss.test.ws.tools.WSToolsTest; import org.jboss.util.xml.DOMUtils; import org.jboss.ws.jaxb.JAXBConstants; -import org.jboss.ws.jaxb.JAXBUnmarshallerImpl; +import org.jboss.ws.jaxb.JBossXBUnmarshallerImpl; +import org.jboss.ws.jaxb.JAXBUnmarshaller; import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping; import org.jboss.ws.metadata.jaxrpcmapping.PackageMapping; @@ -64,7 +65,7 @@ XSModel model = generateSchemaXSModel(xmlType, SimpleUserType.class); SimpleUserType obj = null; - JAXBUnmarshallerImpl unmarshaller = new JAXBUnmarshallerImpl(); + JAXBUnmarshaller unmarshaller = new JBossXBUnmarshallerImpl(); unmarshaller.setProperty(JAXBConstants.JAXB_XS_MODEL, model); unmarshaller.setProperty(JAXBConstants.JAXB_ROOT_QNAME, xmlName); unmarshaller.setProperty(JAXBConstants.JAXB_TYPE_QNAME, xmlType); @@ -87,7 +88,7 @@ XSModel model = generateSchemaXSModel(xmlType, SimpleUserType.class); SimpleUserType obj = null; - JAXBUnmarshallerImpl unmarshaller = new JAXBUnmarshallerImpl(); + JAXBUnmarshaller unmarshaller = new JBossXBUnmarshallerImpl(); unmarshaller.setProperty(JAXBConstants.JAXB_XS_MODEL, model); unmarshaller.setProperty(JAXBConstants.JAXB_ROOT_QNAME, xmlName); unmarshaller.setProperty(JAXBConstants.JAXB_TYPE_QNAME, xmlType); |