Author: thomas.diesler(a)jboss.com
Date: 2007-06-26 17:03:20 -0400 (Tue, 26 Jun 2007)
New Revision: 3733
Added:
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/binding/
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/binding/AbstractDeserializerFactory.java
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/binding/AbstractSerializerFactory.java
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/binding/BindingException.java
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/binding/BufferedStreamResult.java
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/binding/ComplexTypeDeserializer.java
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/binding/ComplexTypeSerializer.java
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/binding/DeserializerSupport.java
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/binding/SerializationContext.java
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/binding/SerializerSupport.java
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/binding/TypeMappingImpl.java
Removed:
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/TypeMappingImpl.java
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/BindingException.java
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/BufferedStreamResult.java
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/ComplexTypeDeserializer.java
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/ComplexTypeSerializer.java
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/DeserializerFactoryBase.java
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/DeserializerSupport.java
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/SerializationContext.java
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/SerializerFactoryBase.java
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/SerializerSupport.java
Modified:
branches/jbossws-2.0/integration/native/src/main/java/org/jboss/wsf/stack/jbws/RequestHandlerImpl.java
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/CommonBinding.java
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/CommonMessageContext.java
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/CommonSOAPBinding.java
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/EncodedTypeMapping.java
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/LiteralTypeMapping.java
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/ParameterWrapping.java
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/SOAPFaultHelperJAXRPC.java
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/SerializationContextJAXRPC.java
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/TypeMappingRegistryImpl.java
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/Base64Deserializer.java
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/Base64DeserializerFactory.java
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/Base64Serializer.java
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/Base64SerializerFactory.java
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/CalendarDeserializer.java
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/CalendarDeserializerFactory.java
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/CalendarSerializer.java
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/CalendarSerializerFactory.java
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/DateDeserializer.java
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/DateDeserializerFactory.java
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/DateSerializer.java
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/DateSerializerFactory.java
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/ElementDeserializer.java
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/ElementDeserializerFactory.java
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/ElementSerializer.java
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/ElementSerializerFactory.java
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/HexDeserializer.java
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/HexDeserializerFactory.java
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/HexSerializer.java
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/HexSerializerFactory.java
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/JBossXBDeserializer.java
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/JBossXBDeserializerFactory.java
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/JBossXBSerializer.java
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/JBossXBSerializerFactory.java
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/NullValueSerializer.java
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/QNameDeserializer.java
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/QNameDeserializerFactory.java
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/QNameSerializer.java
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/QNameSerializerFactory.java
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/SOAPArrayDeserializer.java
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/SOAPArrayDeserializerFactory.java
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/SOAPArraySerializer.java
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/SOAPArraySerializerFactory.java
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/SOAPElementDeserializer.java
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/SOAPElementDeserializerFactory.java
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/SOAPElementSerializer.java
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/SOAPElementSerializerFactory.java
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/SimpleDeserializer.java
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/SimpleDeserializerFactory.java
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/SimpleSerializer.java
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/SimpleSerializerFactory.java
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/client/CallImpl.java
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/handler/MessageContextJAXRPC.java
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/JAXBDeserializer.java
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/JAXBDeserializerFactory.java
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/JAXBSerializer.java
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/JAXBSerializerFactory.java
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/SOAPFaultHelperJAXWS.java
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/SerializationContextJAXWS.java
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/binding/HTTPBindingJAXWS.java
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/binding/MessageBinding.java
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/binding/PayloadBinding.java
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/client/DispatchHTTPBinding.java
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/handler/MessageContextJAXWS.java
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/server/DelegatingInvocation.java
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/server/ServiceEndpointInvokerEJB21.java
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/soap/ObjectContent.java
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/soap/XMLContent.java
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/soap/XMLFragment.java
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCMetaDataBuilder.java
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/metadata/umdm/EndpointMetaData.java
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/metadata/umdm/ServiceMetaData.java
branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/common/jbossxb/SerializerDeserializerTestCase.java
Log:
Refactor stuff to ws.common.binding
Modified:
branches/jbossws-2.0/integration/native/src/main/java/org/jboss/wsf/stack/jbws/RequestHandlerImpl.java
===================================================================
---
branches/jbossws-2.0/integration/native/src/main/java/org/jboss/wsf/stack/jbws/RequestHandlerImpl.java 2007-06-26
19:46:25 UTC (rev 3732)
+++
branches/jbossws-2.0/integration/native/src/main/java/org/jboss/wsf/stack/jbws/RequestHandlerImpl.java 2007-06-26
21:03:20 UTC (rev 3733)
@@ -61,7 +61,7 @@
import org.jboss.ws.core.HTTPMessageImpl;
import org.jboss.ws.core.MessageAbstraction;
import org.jboss.ws.core.MessageTrace;
-import org.jboss.ws.core.jaxrpc.binding.BindingException;
+import org.jboss.ws.core.binding.BindingException;
import org.jboss.ws.core.jaxrpc.handler.MessageContextJAXRPC;
import org.jboss.ws.core.jaxrpc.handler.SOAPMessageContextJAXRPC;
import org.jboss.ws.core.jaxws.handler.MessageContextJAXWS;
Modified:
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/CommonBinding.java
===================================================================
---
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/CommonBinding.java 2007-06-26
19:46:25 UTC (rev 3732)
+++
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/CommonBinding.java 2007-06-26
21:03:20 UTC (rev 3733)
@@ -27,7 +27,7 @@
import javax.xml.namespace.QName;
-import org.jboss.ws.core.jaxrpc.binding.BindingException;
+import org.jboss.ws.core.binding.BindingException;
import org.jboss.ws.core.soap.UnboundHeader;
import org.jboss.ws.metadata.umdm.OperationMetaData;
Modified:
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/CommonMessageContext.java
===================================================================
---
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/CommonMessageContext.java 2007-06-26
19:46:25 UTC (rev 3732)
+++
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/CommonMessageContext.java 2007-06-26
21:03:20 UTC (rev 3733)
@@ -33,7 +33,7 @@
import javax.xml.ws.handler.MessageContext.Scope;
import org.jboss.logging.Logger;
-import org.jboss.ws.core.jaxrpc.binding.SerializationContext;
+import org.jboss.ws.core.binding.SerializationContext;
import org.jboss.ws.extensions.xop.XOPContext;
import org.jboss.ws.metadata.umdm.EndpointMetaData;
import org.jboss.ws.metadata.umdm.OperationMetaData;
Modified:
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/CommonSOAPBinding.java
===================================================================
---
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/CommonSOAPBinding.java 2007-06-26
19:46:25 UTC (rev 3732)
+++
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/CommonSOAPBinding.java 2007-06-26
21:03:20 UTC (rev 3733)
@@ -51,8 +51,8 @@
import org.jboss.logging.Logger;
import org.jboss.ws.Constants;
import org.jboss.ws.WSException;
+import org.jboss.ws.core.binding.BindingException;
import org.jboss.ws.core.jaxrpc.ParameterWrapping;
-import org.jboss.ws.core.jaxrpc.binding.BindingException;
import org.jboss.ws.core.jaxws.handler.MessageContextJAXWS;
import org.jboss.ws.core.soap.MessageContextAssociation;
import org.jboss.ws.core.soap.MessageFactoryImpl;
Added:
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/binding/AbstractDeserializerFactory.java
===================================================================
---
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/binding/AbstractDeserializerFactory.java
(rev 0)
+++
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/binding/AbstractDeserializerFactory.java 2007-06-26
21:03:20 UTC (rev 3733)
@@ -0,0 +1,50 @@
+/*
+* 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.core.binding;
+
+// $Id: DeserializerFactoryBase.java 2210 2007-01-31 09:51:54Z thomas.diesler(a)jboss.com
$
+
+import java.util.Iterator;
+
+import javax.xml.rpc.encoding.Deserializer;
+import javax.xml.rpc.encoding.DeserializerFactory;
+
+import org.jboss.util.NotImplementedException;
+
+/**
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 04-Dec-2004
+ */
+public abstract class AbstractDeserializerFactory implements DeserializerFactory
+{
+ public abstract DeserializerSupport getDeserializer() throws BindingException;
+
+ public Deserializer getDeserializerAs(String mechanismType)
+ {
+ throw new NotImplementedException();
+ }
+
+ public Iterator getSupportedMechanismTypes()
+ {
+ throw new NotImplementedException();
+ }
+}
Added:
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/binding/AbstractSerializerFactory.java
===================================================================
---
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/binding/AbstractSerializerFactory.java
(rev 0)
+++
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/binding/AbstractSerializerFactory.java 2007-06-26
21:03:20 UTC (rev 3733)
@@ -0,0 +1,50 @@
+/*
+* 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.core.binding;
+
+// $Id: SerializerFactoryBase.java 2210 2007-01-31 09:51:54Z thomas.diesler(a)jboss.com $
+
+import java.util.Iterator;
+
+import javax.xml.rpc.encoding.Serializer;
+import javax.xml.rpc.encoding.SerializerFactory;
+
+import org.jboss.util.NotImplementedException;
+
+/**
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 04-Dec-2004
+ */
+public abstract class AbstractSerializerFactory implements SerializerFactory
+{
+ public abstract SerializerSupport getSerializer() throws BindingException;
+
+ public Serializer getSerializerAs(String mechanismType)
+ {
+ throw new NotImplementedException();
+ }
+
+ public Iterator getSupportedMechanismTypes()
+ {
+ throw new NotImplementedException();
+ }
+}
Copied:
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/binding/BindingException.java
(from rev 3729,
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/BindingException.java)
===================================================================
---
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/binding/BindingException.java
(rev 0)
+++
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/binding/BindingException.java 2007-06-26
21:03:20 UTC (rev 3733)
@@ -0,0 +1,92 @@
+/*
+* 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.core.binding;
+
+// $Id$
+
+/** An exception that may occur during message binding
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 16-Oct-2004
+ */
+public class BindingException extends Exception
+{
+ /**
+ * Constructs a new exception with <code>null</code> as its detail
message.
+ * The cause is not initialized, and may subsequently be initialized by a
+ * call to {@link #initCause}.
+ */
+ public BindingException()
+ {
+ }
+
+ /**
+ * Constructs a new exception with the specified detail message. The
+ * cause is not initialized, and may subsequently be initialized by
+ * a call to {@link #initCause}.
+ *
+ * @param message the detail message. The detail message is saved for
+ * later retrieval by the {@link #getMessage()} method.
+ */
+ public BindingException(String message)
+ {
+ super(message);
+ }
+
+ /**
+ * Constructs a new exception with the specified cause and a detail
+ * message of <tt>(cause==null ? null : cause.toString())</tt> (which
+ * typically contains the class and detail message of <tt>cause</tt>).
+ * This constructor is useful for exceptions that are little more than
+ * wrappers for other throwables (for example, {@link
+ * java.security.PrivilegedActionException}).
+ *
+ * @param cause the cause (which is saved for later retrieval by the
+ * {@link #getCause()} method). (A <tt>null</tt> value is
+ * permitted, and indicates that the cause is nonexistent or
+ * unknown.)
+ * @since 1.4
+ */
+ public BindingException(Throwable cause)
+ {
+ super(cause);
+ }
+
+ /**
+ * Constructs a new exception with the specified detail message and
+ * cause. <p>Note that the detail message associated with
+ * <code>cause</code> is <i>not</i> automatically incorporated
in
+ * this exception's detail message.
+ *
+ * @param message the detail message (which is saved for later retrieval
+ * by the {@link #getMessage()} method).
+ * @param cause the cause (which is saved for later retrieval by the
+ * {@link #getCause()} method). (A <tt>null</tt> value is
+ * permitted, and indicates that the cause is nonexistent or
+ * unknown.)
+ * @since 1.4
+ */
+ public BindingException(String message, Throwable cause)
+ {
+ super(message, cause);
+ }
+}
Copied:
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/binding/BufferedStreamResult.java
(from rev 3729,
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/BufferedStreamResult.java)
===================================================================
---
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/binding/BufferedStreamResult.java
(rev 0)
+++
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/binding/BufferedStreamResult.java 2007-06-26
21:03:20 UTC (rev 3733)
@@ -0,0 +1,90 @@
+/*
+ * 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.core.binding;
+
+// $Id: $
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.Writer;
+
+import javax.xml.transform.stream.StreamResult;
+
+import org.jboss.ws.WSException;
+import org.jboss.wsf.spi.utils.IOUtils;
+
+/**
+ * @author Heiko.Braun(a)jboss.org
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 06.02.2007
+ */
+public class BufferedStreamResult extends StreamResult
+{
+ ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);
+
+ public BufferedStreamResult()
+ {
+ }
+
+ public BufferedStreamResult(String xmlFragment)
+ {
+ try
+ {
+ IOUtils.copyStream(getOutputStream(), new
ByteArrayInputStream(xmlFragment.getBytes()));
+ }
+ catch (IOException e)
+ {
+ WSException.rethrow(e);
+ }
+ }
+
+ @Override
+ public Writer getWriter()
+ {
+ return null;
+ }
+
+ @Override
+ public OutputStream getOutputStream()
+ {
+ return baos;
+ }
+
+ @Override
+ public void setWriter(Writer writer)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public void setOutputStream(OutputStream outputStream)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public String toString()
+ {
+ return baos.toString();
+ }
+}
Copied:
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/binding/ComplexTypeDeserializer.java
(from rev 3729,
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/ComplexTypeDeserializer.java)
===================================================================
---
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/binding/ComplexTypeDeserializer.java
(rev 0)
+++
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/binding/ComplexTypeDeserializer.java 2007-06-26
21:03:20 UTC (rev 3733)
@@ -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.core.binding;
+
+
+
+// $Id$
+
+/**
+ * A Deserializer that can handle complex types by delegating to JAXB.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 04-Dec-2004
+ */
+public abstract class ComplexTypeDeserializer extends DeserializerSupport
+{
+
+}
Added:
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/binding/ComplexTypeSerializer.java
===================================================================
---
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/binding/ComplexTypeSerializer.java
(rev 0)
+++
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/binding/ComplexTypeSerializer.java 2007-06-26
21:03:20 UTC (rev 3733)
@@ -0,0 +1,38 @@
+/*
+ * 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.core.binding;
+
+
+
+
+// $Id: ComplexTypeSerializer.java 1757 2006-12-22 15:40:24Z thomas.diesler(a)jboss.com $
+
+/**
+ * A Serializer that can handle complex types by delegating to JAXB.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 04-Dec-2004
+ */
+public abstract class ComplexTypeSerializer extends SerializerSupport
+{
+
+}
Copied:
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/binding/DeserializerSupport.java
(from rev 3729,
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/DeserializerSupport.java)
===================================================================
---
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/binding/DeserializerSupport.java
(rev 0)
+++
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/binding/DeserializerSupport.java 2007-06-26
21:03:20 UTC (rev 3733)
@@ -0,0 +1,160 @@
+/*
+ * 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.core.binding;
+
+// $Id$
+
+import java.io.ByteArrayOutputStream;
+
+import javax.xml.namespace.QName;
+import javax.xml.rpc.encoding.Deserializer;
+import javax.xml.transform.Source;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+
+import org.jboss.logging.Logger;
+import org.jboss.util.NotImplementedException;
+import org.jboss.ws.WSException;
+import org.jboss.ws.core.soap.SOAPContentElement;
+import org.jboss.ws.core.utils.XMLPredefinedEntityReferenceResolver;
+import org.jboss.wsf.spi.utils.DOMWriter;
+import org.w3c.dom.Node;
+
+/** The base class for all Deserializers.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 04-Dec-2004
+ */
+public abstract class DeserializerSupport implements Deserializer
+{
+ private static final Logger log = Logger.getLogger(DeserializerSupport.class);
+
+ public Object deserialize(SOAPContentElement soapElement, SerializationContext
serContext) throws BindingException
+ {
+ QName xmlName = soapElement.getElementQName();
+ QName xmlType = soapElement.getXmlType();
+
+ Source source = soapElement.getXMLFragment().getSource();
+ return deserialize(xmlName, xmlType, source, serContext);
+ }
+
+ /** Deserialize an XML fragment to an object value
+ *
+ * @param xmlName The root element name of the resulting fragment
+ * @param xmlType The associated schema type
+ * @param xmlFragment The XML fragment to deserialize
+ * @param serContext The serialization context
+ */
+ public abstract Object deserialize(QName xmlName, QName xmlType, Source xmlFragment,
SerializationContext serContext) throws BindingException;
+
+ // TODO: remove when JBossXB supports unmarshall(Source)
+ //
http://jira.jboss.org/jira/browse/JBXB-100
+ protected static String sourceToString(Source source)
+ {
+ String xmlFragment = null;
+ try
+ {
+ if (source instanceof DOMSource)
+ {
+ Node node = ((DOMSource)source).getNode();
+ xmlFragment = DOMWriter.printNode(node, false);
+ }
+ else
+ {
+ // Note, this code will not handler namespaces correctly that
+ // are defined on a parent of the DOMSource
+ //
+ // <env:Envelope
xmlns:xsd='http://www.w3.org/2001/XMLSchema'>
+ // <env:Body>
+ // <myMethod>
+ // <param xsi:type='xsd:string'>Hello
World!</param>
+ // </myMethod>
+ // </env:Body>
+ // </env:Envelope>
+ //
+ TransformerFactory tf = TransformerFactory.newInstance();
+ ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);
+ StreamResult streamResult = new StreamResult(baos);
+ tf.newTransformer().transform(source, streamResult);
+ xmlFragment = new String(baos.toByteArray());
+ if (xmlFragment.startsWith("<?xml"))
+ {
+ int index = xmlFragment.indexOf(">");
+ xmlFragment = xmlFragment.substring(index + 1);
+ }
+ }
+ }
+ catch (TransformerException e)
+ {
+ WSException.rethrow(e);
+ }
+
+ return xmlFragment;
+ }
+
+ /** Unwrap the value string from the XML fragment
+ *
+ * @return The value string or null if the startTag contains a xsi:nil='true'
attribute
+ */
+ protected String unwrapValueStr(String xmlFragment)
+ {
+ // We only scan for :nil if the xmlFragment is an empty element
+ if (isEmptyElement(xmlFragment))
+ {
+ return (isNil(xmlFragment) ? null : "");
+ }
+
+ int endOfStartTag = xmlFragment.indexOf(">");
+ int startOfEndTag = xmlFragment.lastIndexOf("</");
+ if (endOfStartTag < 0 || startOfEndTag < 0)
+ throw new IllegalArgumentException("Invalid XML fragment: " +
xmlFragment);
+
+ String valueStr = xmlFragment.substring(endOfStartTag + 1, startOfEndTag);
+
+ return XMLPredefinedEntityReferenceResolver.resolve(valueStr);
+ }
+
+ protected boolean isEmptyElement(String xmlFragment)
+ {
+ return xmlFragment.startsWith("<") &&
xmlFragment.endsWith("/>");
+ }
+
+ protected boolean isNil(String xmlFragment)
+ {
+ boolean isNil = false;
+ if (isEmptyElement(xmlFragment))
+ {
+ int endOfStartTag = xmlFragment.indexOf(">");
+ String startTag = xmlFragment.substring(0, endOfStartTag);
+ isNil = startTag.indexOf(":nil='1'") > 0 ||
startTag.indexOf(":nil=\"1\"") > 0;
+ isNil = isNil || startTag.indexOf(":nil='true'") > 0 ||
startTag.indexOf(":nil=\"true\"") > 0;
+ }
+ return isNil;
+ }
+
+ public String getMechanismType()
+ {
+ throw new NotImplementedException();
+ }
+}
Added:
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/binding/SerializationContext.java
===================================================================
---
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/binding/SerializationContext.java
(rev 0)
+++
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/binding/SerializationContext.java 2007-06-26
21:03:20 UTC (rev 3733)
@@ -0,0 +1,81 @@
+/*
+ * 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.core.binding;
+
+// $Id: SerializationContext.java 2634 2007-03-16 23:44:09Z jason.greene(a)jboss.com $
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.jboss.xb.binding.NamespaceRegistry;
+
+/**
+ * An abstract serialization context
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 04-Dec-2004
+ */
+public abstract class SerializationContext
+{
+ private Class javaType;
+
+ private TypeMappingImpl typeMapping;
+ // The namespace registry that is valid for this serialization context
+ private NamespaceRegistry namespaceRegistry = new NamespaceRegistry();
+ // An arbitrary property bag
+ private Map<Object, Object> properties = new HashMap<Object, Object>();
+
+ public Object getProperty(Object key)
+ {
+ return properties.get(key);
+ }
+
+ public void setProperty(Object key, Object value)
+ {
+ properties.put(key, value);
+ }
+
+ public TypeMappingImpl getTypeMapping()
+ {
+ return typeMapping;
+ }
+
+ public void setTypeMapping(TypeMappingImpl typeMapping)
+ {
+ this.typeMapping = typeMapping;
+ }
+
+ public NamespaceRegistry getNamespaceRegistry()
+ {
+ return namespaceRegistry;
+ }
+
+ public Class getJavaType()
+ {
+ return javaType;
+ }
+
+ public void setJavaType(Class javaType)
+ {
+ this.javaType = javaType;
+ }
+}
Added:
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/binding/SerializerSupport.java
===================================================================
---
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/binding/SerializerSupport.java
(rev 0)
+++
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/binding/SerializerSupport.java 2007-06-26
21:03:20 UTC (rev 3733)
@@ -0,0 +1,205 @@
+/*
+ * 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.core.binding;
+
+// $Id: SerializerSupport.java 3146 2007-05-18 22:55:26Z thomas.diesler(a)jboss.com $
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+import javax.xml.namespace.QName;
+import javax.xml.rpc.encoding.Serializer;
+import javax.xml.transform.Result;
+
+import org.jboss.util.NotImplementedException;
+import org.jboss.ws.Constants;
+import org.jboss.ws.core.soap.SOAPContentElement;
+import org.jboss.xb.binding.NamespaceRegistry;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+
+/**
+ * The base class for all Serializers.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @author <a href="mailto:jason.greene@jboss.com">Jason T.
Greene</a>
+ * @since 04-Dec-2004
+ */
+public abstract class SerializerSupport implements Serializer
+{
+
+ public Result serialize(SOAPContentElement soapElement, SerializationContext
serContext) throws BindingException
+ {
+ QName xmlName = soapElement.getElementQName();
+ QName xmlType = soapElement.getXmlType();
+ NamedNodeMap attributes = soapElement.getAttributes();
+ Object objectValue = soapElement.getObjectValue();
+ return serialize(xmlName, xmlType, objectValue, serContext, attributes);
+ }
+
+ /** Serialize an object value to an XML fragment
+ *
+ * @param xmlName The root element name of the resulting fragment
+ * @param xmlType The associated schema type
+ * @param value The value to serialize
+ * @param serContext The serialization context
+ * @param attributes The attributes on this element
+ */
+ public abstract Result serialize(QName xmlName, QName xmlType, Object value,
SerializationContext serContext, NamedNodeMap attributes) throws BindingException;
+
+ /** Wrap the value string in a XML fragment with the given name
+ */
+ protected String wrapValueStr(QName xmlName, String valueStr, NamespaceRegistry
nsRegistry, Set<String> nsExtras, NamedNodeMap attributes, boolean normalize)
+ {
+ String xmlNameURI = xmlName.getNamespaceURI();
+ String localPart = xmlName.getLocalPart();
+
+ Map<String, String> namespaces = new HashMap<String, String>();
+
+ StringBuilder nsAttr = new StringBuilder("");
+ if (attributes != null)
+ {
+ for (int i = 0; i < attributes.getLength(); i++)
+ {
+ Node attr = attributes.item(i);
+ String attrName = attr.getNodeName();
+ String attrValue = attr.getNodeValue();
+ nsAttr.append(" " + attrName + "='" + attrValue +
"'");
+
+ if (attrName.startsWith("xmlns:"))
+ {
+ String prefix = attrName.substring(6);
+ namespaces.put(attrValue, prefix);
+ }
+ }
+ }
+
+ String elName;
+ if (xmlNameURI.length() > 0)
+ {
+ xmlName = nsRegistry.registerQName(xmlName);
+ String prefix = xmlName.getPrefix();
+ elName = prefix + ":" + localPart;
+ if (namespaces.get(xmlNameURI) == null ||
!prefix.equals(namespaces.get(xmlNameURI)))
+ {
+ nsAttr.append(" xmlns:" + prefix + "='" + xmlNameURI
+ "'");
+ namespaces.put(xmlNameURI, prefix);
+ }
+ }
+ else
+ {
+ elName = localPart;
+ }
+
+ if (nsExtras != null)
+ {
+ for (String nsURI : nsExtras)
+ {
+ String prefix = nsRegistry.getPrefix(nsURI);
+ if (namespaces.get(nsURI) == null || !prefix.equals(namespaces.get(nsURI)))
+ {
+ nsAttr.append(" xmlns:" + prefix + "='" + nsURI +
"'");
+ namespaces.put(nsURI, prefix);
+ }
+ }
+ }
+
+ String xmlFragment;
+ if (valueStr == null)
+ {
+ String xsins = "";
+ if (namespaces.get(Constants.NS_SCHEMA_XSI) == null ||
!Constants.PREFIX_XSI.equals(namespaces.get(xmlNameURI)))
+ {
+ xsins = " xmlns:" + Constants.PREFIX_XSI + "='" +
Constants.NS_SCHEMA_XSI + "'";
+ namespaces.put(Constants.NS_SCHEMA_XSI, Constants.PREFIX_XSI);
+ }
+
+ xmlFragment = "<" + elName + nsAttr + " " +
Constants.PREFIX_XSI + ":nil='1'" + xsins + "/>";
+ }
+ else
+ {
+ if (normalize)
+ valueStr = normalize(valueStr);
+
+ xmlFragment = "<" + elName + nsAttr + ">" + valueStr +
"</" + elName + ">";
+ }
+
+ return xmlFragment;
+ }
+
+ public String getMechanismType()
+ {
+ throw new NotImplementedException();
+ }
+
+ private String normalize(String valueStr)
+ {
+ // We assume most strings will not contain characters that need
"escaping",
+ // and optimize for this case.
+ boolean found = false;
+ int i = 0;
+
+ outer: for (; i < valueStr.length(); i++)
+ {
+ switch (valueStr.charAt(i))
+ {
+ case '<':
+ case '>':
+ case '&':
+ case '"':
+ found = true;
+ break outer;
+ }
+ }
+
+ if (!found)
+ return valueStr;
+
+ // Resume where we left off
+ StringBuilder builder = new StringBuilder();
+ builder.append(valueStr.substring(0, i));
+ for (; i < valueStr.length(); i++)
+ {
+ char c = valueStr.charAt(i);
+ switch (c)
+ {
+ case '<':
+ builder.append("<");
+ break;
+ case '>':
+ builder.append(">");
+ break;
+ case '&':
+ builder.append("&");
+ break;
+ case '"':
+ builder.append(""");
+ break;
+ default:
+ builder.append(c);
+ }
+ }
+
+ return builder.toString();
+ }
+}
\ No newline at end of file
Copied:
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/binding/TypeMappingImpl.java
(from rev 3729,
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/TypeMappingImpl.java)
===================================================================
---
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/binding/TypeMappingImpl.java
(rev 0)
+++
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/binding/TypeMappingImpl.java 2007-06-26
21:03:20 UTC (rev 3733)
@@ -0,0 +1,744 @@
+/*
+* 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.core.binding;
+
+// $Id$
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import javax.xml.namespace.QName;
+import javax.xml.rpc.encoding.DeserializerFactory;
+import javax.xml.rpc.encoding.SerializerFactory;
+import javax.xml.rpc.encoding.TypeMapping;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.Constants;
+import org.jboss.ws.core.jaxrpc.binding.Base64DeserializerFactory;
+import org.jboss.ws.core.jaxrpc.binding.Base64SerializerFactory;
+import org.jboss.ws.core.jaxrpc.binding.CalendarDeserializerFactory;
+import org.jboss.ws.core.jaxrpc.binding.CalendarSerializerFactory;
+import org.jboss.ws.core.jaxrpc.binding.DateDeserializerFactory;
+import org.jboss.ws.core.jaxrpc.binding.DateSerializerFactory;
+import org.jboss.ws.core.jaxrpc.binding.HexDeserializerFactory;
+import org.jboss.ws.core.jaxrpc.binding.HexSerializerFactory;
+import org.jboss.ws.core.jaxrpc.binding.QNameDeserializerFactory;
+import org.jboss.ws.core.jaxrpc.binding.QNameSerializerFactory;
+import org.jboss.ws.core.jaxrpc.binding.SimpleDeserializerFactory;
+import org.jboss.ws.core.jaxrpc.binding.SimpleSerializerFactory;
+import org.jboss.ws.core.utils.HashCodeUtil;
+import org.jboss.wsf.spi.utils.JavaUtils;
+
+/**
+ * This is the representation of a type mapping.
+ * This TypeMapping implementation supports the literal encoding style.
+ *
+ * The TypeMapping instance maintains a tuple of the type
+ * {XML typeQName, Java Class, SerializerFactory, DeserializerFactory}.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 10-Oct-2004
+ */
+public abstract class TypeMappingImpl implements TypeMapping
+{
+ // provide logging
+ private static final Logger log = Logger.getLogger(TypeMappingImpl.class);
+
+ // Map<KeyPair,FactoryPair>
+ private Map<KeyPair, FactoryPair> tupleMap = new LinkedHashMap<KeyPair,
FactoryPair>();
+
+ private Map<Integer, List<KeyPair>> keyPairCache = new
ConcurrentHashMap<Integer, List<KeyPair>>();
+
+ /**
+ * Gets the DeserializerFactory registered for the specified pair of Java type and XML
data type.
+ * @param javaType Class of the Java type
+ * @param xmlType QName of the XML type
+ * @return Registered DeserializerFactory or null if there is no registered factory
+ */
+ public DeserializerFactory getDeserializer(Class javaType, QName xmlType)
+ {
+ FactoryPair fPair = getFactoryPair(new IQName(xmlType), javaType);
+ return (fPair != null ? fPair.getDeserializerFactory() : null);
+ }
+
+ /**
+ * Gets the SerializerFactory registered for the specified pair of Java type and XML
data type.
+ * @param javaType Class of the Java type
+ * @param xmlType QName of the XML type
+ * @return Registered SerializerFactory or null if there is no registered factory
+ */
+ public SerializerFactory getSerializer(Class javaType, QName xmlType)
+ {
+ FactoryPair fPair = getFactoryPair(new IQName(xmlType), javaType);
+ return (fPair != null ? fPair.getSerializerFactory() : null);
+ }
+
+ /**
+ * Returns the encodingStyle URIs (as String[]) supported by this TypeMapping
instance.
+ * A TypeMapping that contains only encoding style independent serializers and
deserializers
+ * returns null from this method.
+ *
+ * @return Array of encodingStyle URIs for the supported encoding styles
+ */
+ public abstract String[] getSupportedEncodings();
+
+ /**
+ * Sets the encodingStyle URIs supported by this TypeMapping instance. A TypeMapping
that contains only encoding
+ * independent serializers and deserializers requires null as the parameter for this
method.
+ *
+ * @param encodingStyleURIs Array of encodingStyle URIs for the supported encoding
styles
+ */
+ public abstract void setSupportedEncodings(String[] encodingStyleURIs);
+
+ /**
+ * Checks whether or not type mapping between specified XML type and Java type is
registered.
+ * @param javaType Class of the Java type
+ * @param xmlType QName of the XML type
+ * @return boolean; true if type mapping between the specified XML type and Java type
is registered; otherwise false
+ */
+ public boolean isRegistered(Class javaType, QName xmlType)
+ {
+ return getFactoryPair(new IQName(xmlType), javaType) != null;
+ }
+
+ /**
+ * Registers SerializerFactory and DeserializerFactory for a specific type mapping
between an XML type and Java type.
+ * This method replaces any existing registered SerializerFactory DeserializerFactory
instances.
+ * @param javaType Class of the Java type
+ * @param xmlType QName of the XML type
+ * @param sf SerializerFactory
+ * @param df DeserializerFactory
+ * @throws javax.xml.rpc.JAXRPCException If any error during the registration
+ */
+ public void register(Class javaType, QName xmlType, SerializerFactory sf,
DeserializerFactory df)
+ {
+ if (log.isTraceEnabled())
+ log.trace("register: TypeMappingImpl@" + hashCode() + "
[xmlType=" + xmlType + ",javaType=" + javaType.getName() + ",sf="
+ sf + ",df=" + df + "]");
+
+ registerInternal(javaType, new IQName(xmlType), sf, df);
+ keyPairCache.clear();
+ }
+
+ private void registerInternal(Class javaType, IQName xmlType, SerializerFactory sf,
DeserializerFactory df)
+ {
+ if (javaType == null)
+ throw new IllegalArgumentException("javaType cannot be null for: " +
xmlType);
+ if (xmlType == null)
+ throw new IllegalArgumentException("xmlType cannot be null for: " +
javaType);
+
+ KeyPair kPair = new KeyPair(xmlType, javaType);
+ FactoryPair fPair = new FactoryPair(sf, df);
+ tupleMap.put(kPair, fPair);
+ }
+
+ /**
+ * Removes the DeserializerFactory registered for the specified pair of Java type and
XML data type.
+ * @param javaType Class of the Java type
+ * @param xmlType QName of the XML type
+ * @throws javax.xml.rpc.JAXRPCException If there is error in removing the registered
DeserializerFactory
+ */
+ public void removeDeserializer(Class javaType, QName xmlType)
+ {
+ FactoryPair fPair = getFactoryPair(new IQName(xmlType), javaType);
+ if (fPair != null)
+ fPair.setDeserializerFactory(null);
+ }
+
+ /**
+ * Removes the SerializerFactory registered for the specified pair of Java type and
XML data type.
+ * @param javaType Class of the Java type
+ * @param xmlType QName of the XML type
+ * @throws javax.xml.rpc.JAXRPCException If there is error in removing the registered
SerializerFactory
+ */
+ public void removeSerializer(Class javaType, QName xmlType)
+ {
+ FactoryPair fPair = getFactoryPair(new IQName(xmlType), javaType);
+ if (fPair != null)
+ fPair.setSerializerFactory(null);
+ }
+
+ /** Get the list of registered XML types */
+ public List<QName> getRegisteredXmlTypes()
+ {
+ List<QName> types = new ArrayList<QName>();
+ for (KeyPair keyPair : getKeyPairs(null, null))
+ {
+ types.add(keyPair.getXmlType().toQName());
+ }
+ return types;
+ }
+
+ /** Get the list of registered Java types */
+ public List<Class> getRegisteredJavaTypes()
+ {
+ List<Class> types = new ArrayList<Class>();
+ for (KeyPair keyPair : getKeyPairs(null, null))
+ {
+ types.add(keyPair.getJavaType());
+ }
+ return types;
+ }
+
+ /** Get the Class that was registered last for this xmlType */
+ public Class getJavaType(QName xmlType)
+ {
+ Class javaType = null;
+
+ List keyPairList = getKeyPairs(new IQName(xmlType), null);
+ int size = keyPairList.size();
+ if (size > 0)
+ {
+ KeyPair kPair = (KeyPair)keyPairList.get(size - 1);
+ javaType = kPair.getJavaType();
+ }
+
+ return javaType;
+ }
+
+ /**
+ * Get all of the Classes registered for this xmlType.
+ */
+ public List<Class> getJavaTypes(QName xmlType)
+ {
+ List<KeyPair> keyPairList = getKeyPairs( new IQName(xmlType), null);
+ List<Class> classes = new ArrayList<Class>(keyPairList.size());
+
+ for (KeyPair current : keyPairList)
+ {
+ classes.add(current.getJavaType());
+ }
+
+ return classes;
+ }
+
+ /**
+ * Get the Class that was registered last for this xmlType
+ * If there are two Java Types registered for the xmlType
+ * return the primitive type rather than the wrapper,
+ * if available
+ */
+ public Class getJavaType(QName xmlType,boolean getPrimitive)
+ {
+ //Lets get the primitive type if available
+ Class javaType = null;
+
+ List keyPairList = getKeyPairs(new IQName(xmlType), null);
+ int size = keyPairList.size();
+ if (size == 2 && getPrimitive)
+ {
+ KeyPair kPair1 = (KeyPair)keyPairList.get(0);
+ Class javaType1 = kPair1.getJavaType();
+ KeyPair kPair2 = (KeyPair)keyPairList.get(1);
+ Class javaType2 = kPair2.getJavaType();
+ if(javaType2.isPrimitive() && !javaType1.isPrimitive())
+ javaType = javaType2;
+ else
+ if(javaType1.isPrimitive() && !javaType2.isPrimitive())
+ javaType = javaType1;
+ else
+ javaType = javaType2; //Fallback on the most latest
+ }
+ else
+ return getJavaType(xmlType);
+
+ return javaType;
+ }
+
+ /** Get the Class name that was registered last for this xmlType */
+ public String getJavaTypeName(QName xmlType)
+ {
+ Class javaType = getJavaType(xmlType);
+ return (javaType != null ? javaType.getName() : null);
+ }
+
+ /** Get the QName that was registered last for this javaType */
+ public QName getXMLType(Class javaType)
+ {
+ QName xmlType = null;
+
+ List keyPairList = getKeyPairs(null, javaType);
+ int size = keyPairList.size();
+ if (size > 0)
+ {
+ KeyPair kPair = (KeyPair)keyPairList.get(size - 1);
+ xmlType = kPair.getXmlType().toQName();
+ }
+
+ return xmlType;
+ }
+
+ /** Get the QNames that was registered last for this javaType */
+ public List<QName> getXMLTypes(Class javaType)
+ {
+ List<QName> xmlTypes = new ArrayList<QName>();
+
+ for (KeyPair kPair : getKeyPairs(null, javaType))
+ {
+ xmlTypes.add(kPair.getXmlType().toQName());
+ }
+ return xmlTypes;
+ }
+
+ /**
+ * Get the QName that was registered last for this javaType
+ * @param javaType class for which XML Type is needed
+ * @param tryAssignable If the xmlType is not registered for javaType
+ * should a base class type be checked?
+ *
+ */
+ public QName getXMLType(Class javaType, boolean tryAssignable)
+ {
+ if(tryAssignable) return getXMLType(javaType);
+
+ QName xmlType = null;
+
+ List keyPairList = getKeyPairs(null, javaType, tryAssignable);
+ int size = keyPairList.size();
+ if (size > 0)
+ {
+ KeyPair kPair = (KeyPair)keyPairList.get(size - 1);
+ xmlType = kPair.getXmlType().toQName();
+ }
+
+ return xmlType;
+ }
+
+ /**
+ * Get the serializer/deserializer factory pair for the given xmlType, javaType
+ * Both xmlType, javaType may be null. In that case, this implementation still
+ * returns a FactoryPair if there is only one possible match.
+ *
+ * @param xmlType can be null
+ * @param javaType can be null
+ */
+ private List<KeyPair> getKeyPairs(IQName xmlType, Class javaType)
+ {
+ Integer cacheId = cacheIdFor(javaType, xmlType);
+
+ List<KeyPair> keyPairList = keyPairCache.get(cacheId);
+ if(null == keyPairList)
+ {
+ keyPairList = getKeyPairsInternal(xmlType, javaType);
+ keyPairCache.put(cacheId, keyPairList);
+ }
+
+ return keyPairList;
+ }
+
+ private Integer cacheIdFor(Class javaType, IQName xmlType) {
+ int result = HashCodeUtil.SEED;
+ int nullHash = HashCodeUtil.hash(result, "null");
+ result = javaType!= null ? HashCodeUtil.hash(result, javaType.getName()) :
HashCodeUtil.hash(result, nullHash);
+ result = xmlType!= null ? HashCodeUtil.hash(result, xmlType.hashCode()):
HashCodeUtil.hash(result, nullHash);
+ return new Integer(result);
+ }
+
+ private List<KeyPair> getKeyPairsInternal(IQName xmlType, Class javaType)
+ {
+ List<KeyPair> keyPairList = new ArrayList<KeyPair>();
+
+ // Getting the exact matching pair
+ if (xmlType != null && javaType != null)
+ {
+ for (KeyPair entry : tupleMap.keySet())
+ {
+ if (xmlType.equals(entry.getXmlType()) && entry.getJavaType() ==
javaType)
+ {
+ keyPairList.add(entry);
+ }
+ }
+ // No exact match, try assignable
+ if (keyPairList.size() == 0)
+ {
+ for (KeyPair entry : tupleMap.keySet())
+ {
+ if (xmlType.equals(entry.getXmlType()) &&
JavaUtils.isAssignableFrom(entry.getJavaType(), javaType))
+ {
+ keyPairList.add(entry);
+ }
+ }
+ }
+ }
+
+ // Getting the pair for a given xmlType
+ else if (xmlType != null && javaType == null)
+ {
+ for (KeyPair entry : tupleMap.keySet())
+ {
+ if (xmlType.equals(entry.getXmlType()))
+ {
+ keyPairList.add(entry);
+ }
+ }
+ }
+
+ // Getting the pair for a given javaType
+ else if (xmlType == null && javaType != null)
+ {
+ for (KeyPair entry : tupleMap.keySet())
+ {
+ if (entry.getJavaType() == javaType)
+ {
+ keyPairList.add(entry);
+ }
+ }
+ // No exact match, try assignable
+ if (keyPairList.size() == 0)
+ {
+ for (KeyPair entry : tupleMap.keySet())
+ {
+ if (JavaUtils.isAssignableFrom(entry.getJavaType(), javaType))
+ {
+ keyPairList.add(entry);
+ }
+ }
+ }
+ }
+
+ // Getting the all pairs
+ else if (xmlType == null && javaType == null)
+ {
+ keyPairList.addAll(tupleMap.keySet());
+ }
+
+ return keyPairList;
+ }
+
+ private List<KeyPair> getKeyPairs(IQName xmlType, Class javaType, boolean
tryAssignable)
+ {
+ Integer cacheId = cacheIdFor(javaType, xmlType);
+
+ List<KeyPair> keyPairList = keyPairCache.get(cacheId);
+ if(null == keyPairList)
+ {
+ keyPairList = getKeyPairsInternal(xmlType, javaType, tryAssignable);
+ keyPairCache.put(cacheId, keyPairList);
+ }
+
+ return keyPairList;
+ }
+
+ /**
+ * Get the serializer/deserializer factory pair for the given xmlType, javaType
+ * Both xmlType, javaType may be null. In that case, this implementation still
+ * returns a FactoryPair if there is only one possible match.
+ * <br>Note: This method does not try for the base class, if no keypair exists
for the
+ * javaType in question.
+ */
+ private List<KeyPair> getKeyPairsInternal(IQName xmlType, Class javaType,
boolean tryAssignable)
+ {
+ if(tryAssignable) return getKeyPairs( xmlType, javaType );
+
+ List<KeyPair> keyPairList = new ArrayList<KeyPair>();
+
+ // Getting the exact matching pair
+ if (xmlType != null && javaType != null)
+ {
+ for (KeyPair entry : tupleMap.keySet())
+ {
+ if (xmlType.equals(entry.getXmlType()) && entry.getJavaType() ==
javaType)
+ {
+ keyPairList.add(entry);
+ }
+ }
+ }
+
+ // Getting the pair for a given xmlType
+ else if (xmlType != null && javaType == null)
+ {
+ for (KeyPair entry : tupleMap.keySet())
+ {
+ if (xmlType.equals(entry.getXmlType()))
+ {
+ keyPairList.add(entry);
+ }
+ }
+ }
+
+ // Getting the pair for a given javaType
+ else if (xmlType == null && javaType != null)
+ {
+ for (KeyPair entry : tupleMap.keySet())
+ {
+ if (entry.getJavaType() == javaType)
+ {
+ keyPairList.add(entry);
+ }
+ }
+ }
+
+ // Getting the all pairs
+ else if (xmlType == null && javaType == null)
+ {
+ keyPairList.addAll(tupleMap.keySet());
+ }
+
+ return keyPairList;
+ }
+
+ /**
+ * Get the serializer/deserializer factory pair for the given xmlType, javaType
+ * Both xmlType, javaType may be null. In that case, this implementation still
+ * returns a FactoryPair that was last registered
+ */
+ private FactoryPair getFactoryPair(IQName xmlType, Class javaType)
+ {
+ FactoryPair fPair = null;
+
+ List<KeyPair> keyPairList = getKeyPairs(xmlType, javaType);
+ int size = keyPairList.size();
+ if (size > 0)
+ {
+ KeyPair kPair = keyPairList.get(size - 1);
+ fPair = (FactoryPair)tupleMap.get(kPair);
+ }
+
+ return fPair;
+ }
+
+ protected void registerStandardLiteralTypes()
+ {
+ register(BigDecimal.class, Constants.TYPE_LITERAL_DECIMAL, new
SimpleSerializerFactory(), new SimpleDeserializerFactory());
+
+ register(BigInteger.class, Constants.TYPE_LITERAL_POSITIVEINTEGER, new
SimpleSerializerFactory(), new SimpleDeserializerFactory());
+ register(BigInteger.class, Constants.TYPE_LITERAL_NEGATIVEINTEGER, new
SimpleSerializerFactory(), new SimpleDeserializerFactory());
+ register(BigInteger.class, Constants.TYPE_LITERAL_NONPOSITIVEINTEGER, new
SimpleSerializerFactory(), new SimpleDeserializerFactory());
+ register(BigInteger.class, Constants.TYPE_LITERAL_NONNEGATIVEINTEGER, new
SimpleSerializerFactory(), new SimpleDeserializerFactory());
+ register(BigInteger.class, Constants.TYPE_LITERAL_UNSIGNEDLONG, new
SimpleSerializerFactory(), new SimpleDeserializerFactory());
+ register(BigInteger.class, Constants.TYPE_LITERAL_INTEGER, new
SimpleSerializerFactory(), new SimpleDeserializerFactory());
+
+ register(Date.class, Constants.TYPE_LITERAL_DATETIME, new DateSerializerFactory(),
new DateDeserializerFactory());
+
+ register(Calendar.class, Constants.TYPE_LITERAL_DATE, new
CalendarSerializerFactory(), new CalendarDeserializerFactory());
+ register(Calendar.class, Constants.TYPE_LITERAL_TIME, new
CalendarSerializerFactory(), new CalendarDeserializerFactory());
+ register(Calendar.class, Constants.TYPE_LITERAL_DATETIME, new
CalendarSerializerFactory(), new CalendarDeserializerFactory());
+
+ register(QName.class, Constants.TYPE_LITERAL_QNAME, new QNameSerializerFactory(),
new QNameDeserializerFactory());
+
+ register(String.class, Constants.TYPE_LITERAL_ANYSIMPLETYPE, new
SimpleSerializerFactory(), new SimpleDeserializerFactory());
+ register(String.class, Constants.TYPE_LITERAL_DURATION, new
SimpleSerializerFactory(), new SimpleDeserializerFactory());
+ register(String.class, Constants.TYPE_LITERAL_GDAY, new SimpleSerializerFactory(),
new SimpleDeserializerFactory());
+ register(String.class, Constants.TYPE_LITERAL_GMONTH, new
SimpleSerializerFactory(), new SimpleDeserializerFactory());
+ register(String.class, Constants.TYPE_LITERAL_GMONTHDAY, new
SimpleSerializerFactory(), new SimpleDeserializerFactory());
+ register(String.class, Constants.TYPE_LITERAL_GYEAR, new SimpleSerializerFactory(),
new SimpleDeserializerFactory());
+ register(String.class, Constants.TYPE_LITERAL_GYEARMONTH, new
SimpleSerializerFactory(), new SimpleDeserializerFactory());
+ register(String.class, Constants.TYPE_LITERAL_ID, new SimpleSerializerFactory(),
new SimpleDeserializerFactory());
+ register(String.class, Constants.TYPE_LITERAL_LANGUAGE, new
SimpleSerializerFactory(), new SimpleDeserializerFactory());
+ register(String.class, Constants.TYPE_LITERAL_NAME, new SimpleSerializerFactory(),
new SimpleDeserializerFactory());
+ register(String.class, Constants.TYPE_LITERAL_NCNAME, new
SimpleSerializerFactory(), new SimpleDeserializerFactory());
+ register(String.class, Constants.TYPE_LITERAL_NMTOKEN, new
SimpleSerializerFactory(), new SimpleDeserializerFactory());
+ register(String.class, Constants.TYPE_LITERAL_NORMALIZEDSTRING, new
SimpleSerializerFactory(), new SimpleDeserializerFactory());
+ register(String.class, Constants.TYPE_LITERAL_TOKEN, new SimpleSerializerFactory(),
new SimpleDeserializerFactory());
+ register(String.class, Constants.TYPE_LITERAL_STRING, new
SimpleSerializerFactory(), new SimpleDeserializerFactory());
+
+ register(String[].class, Constants.TYPE_LITERAL_NMTOKENS, new
SimpleSerializerFactory(), new SimpleDeserializerFactory());
+
+ register(URI.class, Constants.TYPE_LITERAL_ANYURI, new SimpleSerializerFactory(),
new SimpleDeserializerFactory());
+
+ register(boolean.class, Constants.TYPE_LITERAL_BOOLEAN, new
SimpleSerializerFactory(), new SimpleDeserializerFactory());
+ register(Boolean.class, Constants.TYPE_LITERAL_BOOLEAN, new
SimpleSerializerFactory(), new SimpleDeserializerFactory());
+
+ register(byte.class, Constants.TYPE_LITERAL_BYTE, new SimpleSerializerFactory(),
new SimpleDeserializerFactory());
+ register(Byte.class, Constants.TYPE_LITERAL_BYTE, new SimpleSerializerFactory(),
new SimpleDeserializerFactory());
+
+ register(Byte[].class, Constants.TYPE_LITERAL_HEXBINARY, new
HexSerializerFactory(), new HexDeserializerFactory());
+ register(byte[].class, Constants.TYPE_LITERAL_HEXBINARY, new
HexSerializerFactory(), new HexDeserializerFactory());
+
+ register(Byte[].class, Constants.TYPE_LITERAL_BASE64BINARY, new
Base64SerializerFactory(), new Base64DeserializerFactory());
+ register(byte[].class, Constants.TYPE_LITERAL_BASE64BINARY, new
Base64SerializerFactory(), new Base64DeserializerFactory());
+
+ register(double.class, Constants.TYPE_LITERAL_DOUBLE, new
SimpleSerializerFactory(), new SimpleDeserializerFactory());
+ register(Double.class, Constants.TYPE_LITERAL_DOUBLE, new
SimpleSerializerFactory(), new SimpleDeserializerFactory());
+
+ register(float.class, Constants.TYPE_LITERAL_FLOAT, new SimpleSerializerFactory(),
new SimpleDeserializerFactory());
+ register(Float.class, Constants.TYPE_LITERAL_FLOAT, new SimpleSerializerFactory(),
new SimpleDeserializerFactory());
+
+ register(int.class, Constants.TYPE_LITERAL_UNSIGNEDSHORT, new
SimpleSerializerFactory(), new SimpleDeserializerFactory());
+ register(Integer.class, Constants.TYPE_LITERAL_UNSIGNEDSHORT, new
SimpleSerializerFactory(), new SimpleDeserializerFactory());
+ register(int.class, Constants.TYPE_LITERAL_INT, new SimpleSerializerFactory(), new
SimpleDeserializerFactory());
+ register(Integer.class, Constants.TYPE_LITERAL_INT, new SimpleSerializerFactory(),
new SimpleDeserializerFactory());
+
+ register(long.class, Constants.TYPE_LITERAL_UNSIGNEDINT, new
SimpleSerializerFactory(), new SimpleDeserializerFactory());
+ register(Long.class, Constants.TYPE_LITERAL_UNSIGNEDINT, new
SimpleSerializerFactory(), new SimpleDeserializerFactory());
+ register(long.class, Constants.TYPE_LITERAL_LONG, new SimpleSerializerFactory(),
new SimpleDeserializerFactory());
+ register(Long.class, Constants.TYPE_LITERAL_LONG, new SimpleSerializerFactory(),
new SimpleDeserializerFactory());
+
+ register(short.class, Constants.TYPE_LITERAL_UNSIGNEDBYTE, new
SimpleSerializerFactory(), new SimpleDeserializerFactory());
+ register(Short.class, Constants.TYPE_LITERAL_UNSIGNEDBYTE, new
SimpleSerializerFactory(), new SimpleDeserializerFactory());
+ register(short.class, Constants.TYPE_LITERAL_SHORT, new SimpleSerializerFactory(),
new SimpleDeserializerFactory());
+ register(Short.class, Constants.TYPE_LITERAL_SHORT, new SimpleSerializerFactory(),
new SimpleDeserializerFactory());
+ }
+
+ /** A tuple of the type {XML typeQName, Java Class, SerializerFactory,
DeserializerFactory}.
+ */
+ private static class KeyPair
+ {
+ private IQName xmlType;
+ private Class javaType;
+
+ public KeyPair(IQName xmlType, Class javaType)
+ {
+ this.javaType = javaType;
+ this.xmlType = xmlType;
+ }
+
+ public Class getJavaType()
+ {
+ return javaType;
+ }
+
+ public IQName getXmlType()
+ {
+ return xmlType;
+ }
+
+ public boolean equals(Object o)
+ {
+ if (this == o) return true;
+ if (!(o instanceof KeyPair)) return false;
+
+ final KeyPair keyPair = (KeyPair)o;
+
+ if (!javaType.equals(keyPair.javaType)) return false;
+ if (!xmlType.equals(keyPair.xmlType)) return false;
+
+ return true;
+ }
+
+ public int hashCode()
+ {
+ int result;
+ result = xmlType.hashCode();
+ result = 29 * result + javaType.hashCode();
+ return result;
+ }
+
+ public String toString()
+ {
+ return "[xmlType=" + xmlType + ",javaType=" +
javaType.getName() + "]";
+ }
+ }
+
+ /** A tuple of the type {XML typeQName, Java Class, SerializerFactory,
DeserializerFactory}.
+ */
+ public static class FactoryPair
+ {
+ private SerializerFactory serializerFactory;
+ private DeserializerFactory deserializerFactory;
+
+ FactoryPair(SerializerFactory sf, DeserializerFactory df)
+ {
+ this.deserializerFactory = df;
+ this.serializerFactory = sf;
+ }
+
+ public DeserializerFactory getDeserializerFactory()
+ {
+ return deserializerFactory;
+ }
+
+ public SerializerFactory getSerializerFactory()
+ {
+ return serializerFactory;
+ }
+
+ public void setDeserializerFactory(DeserializerFactory df)
+ {
+ this.deserializerFactory = df;
+ }
+
+ public void setSerializerFactory(SerializerFactory sf)
+ {
+ this.serializerFactory = sf;
+ }
+ }
+
+ /**
+ * A duck typed QName that relies on internalized Strings.<p>
+ * Taken from the {@link javax.xml.namespace.QName} docs:<br>
+ * The value of a QName contains a Namespace URI, local part and prefix.
+ * The prefix is included in QName to retain lexical information when present in an
XML input source.
+ * The prefix is NOT used in QName.equals(Object) or to compute the QName.hashCode().
+ * Equality and the hash code are defined using only the Namespace URI and local
part.
+ * If not specified, the Namespace URI is set to "" (the empty string).
+ * If not specified, the prefix is set to "" (the empty string).
+ */
+ private final class IQName
+ {
+ public String namespace;
+ public String localPart;
+ public String prefix;
+ public int hash;
+
+ public IQName(QName name)
+ {
+ namespace = name.getNamespaceURI() != null ? name.getNamespaceURI().intern() :
"".intern();
+ localPart = name.getLocalPart() != null ? name.getLocalPart().intern() :
"".intern();
+ prefix = name.getPrefix() != null ? name.getPrefix().intern() :
"".intern();
+ hash = name.hashCode();
+ }
+
+ public boolean equals(Object object) {
+ if(!(object instanceof IQName))
+ throw new IllegalArgumentException("Cannot compare IQName to " +
object);
+
+ IQName iqn = (IQName)object;
+ return (iqn.namespace == this.namespace && iqn.localPart ==
this.localPart);
+ }
+
+ public QName toQName()
+ {
+ QName qname;
+
+ if(null == namespace)
+ qname = new QName(localPart);
+ else if(null == prefix)
+ qname = new QName(namespace, localPart);
+ else
+ qname = new QName(namespace, localPart, prefix);
+
+ return qname;
+ }
+
+ /**
+ * This implementation currently represents a QName as: "{" + Namespace
URI + "}" + local part.
+ * If the Namespace URI .equals(""), only the local part is returned.
+ */
+ public String toString() {
+ String ns = "".equals(namespace) ? namespace :
"{"+namespace+"}";
+ return ns+localPart;
+ }
+
+ public int hashCode()
+ {
+ return this.hash;
+ }
+ }
+}
Modified:
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/EncodedTypeMapping.java
===================================================================
---
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/EncodedTypeMapping.java 2007-06-26
19:46:25 UTC (rev 3732)
+++
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/EncodedTypeMapping.java 2007-06-26
21:03:20 UTC (rev 3733)
@@ -34,6 +34,7 @@
import org.jboss.util.NotImplementedException;
import org.jboss.ws.Constants;
+import org.jboss.ws.core.binding.TypeMappingImpl;
import org.jboss.ws.core.jaxrpc.binding.Base64DeserializerFactory;
import org.jboss.ws.core.jaxrpc.binding.Base64SerializerFactory;
import org.jboss.ws.core.jaxrpc.binding.CalendarDeserializerFactory;
Modified:
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/LiteralTypeMapping.java
===================================================================
---
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/LiteralTypeMapping.java 2007-06-26
19:46:25 UTC (rev 3732)
+++
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/LiteralTypeMapping.java 2007-06-26
21:03:20 UTC (rev 3733)
@@ -32,6 +32,7 @@
import org.jboss.util.NotImplementedException;
import org.jboss.ws.Constants;
+import org.jboss.ws.core.binding.TypeMappingImpl;
import org.jboss.ws.core.jaxrpc.binding.ElementDeserializerFactory;
import org.jboss.ws.core.jaxrpc.binding.ElementSerializerFactory;
import org.jboss.ws.core.jaxrpc.binding.JBossXBDeserializerFactory;
Modified:
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/ParameterWrapping.java
===================================================================
---
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/ParameterWrapping.java 2007-06-26
19:46:25 UTC (rev 3732)
+++
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/ParameterWrapping.java 2007-06-26
21:03:20 UTC (rev 3733)
@@ -41,6 +41,7 @@
import org.jboss.logging.Logger;
import org.jboss.ws.WSException;
+import org.jboss.ws.core.binding.TypeMappingImpl;
import org.jboss.ws.core.jaxrpc.binding.JBossXBDeserializerFactory;
import org.jboss.ws.core.jaxrpc.binding.JBossXBSerializerFactory;
import org.jboss.ws.core.soap.Style;
Modified:
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/SOAPFaultHelperJAXRPC.java
===================================================================
---
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/SOAPFaultHelperJAXRPC.java 2007-06-26
19:46:25 UTC (rev 3732)
+++
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/SOAPFaultHelperJAXRPC.java 2007-06-26
21:03:20 UTC (rev 3733)
@@ -48,12 +48,12 @@
import org.jboss.ws.WSException;
import org.jboss.ws.core.CommonMessageContext;
import org.jboss.ws.core.CommonSOAPFaultException;
-import org.jboss.ws.core.jaxrpc.binding.BindingException;
-import org.jboss.ws.core.jaxrpc.binding.DeserializerFactoryBase;
-import org.jboss.ws.core.jaxrpc.binding.DeserializerSupport;
-import org.jboss.ws.core.jaxrpc.binding.SerializationContext;
-import org.jboss.ws.core.jaxrpc.binding.SerializerFactoryBase;
-import org.jboss.ws.core.jaxrpc.binding.SerializerSupport;
+import org.jboss.ws.core.binding.BindingException;
+import org.jboss.ws.core.binding.AbstractDeserializerFactory;
+import org.jboss.ws.core.binding.DeserializerSupport;
+import org.jboss.ws.core.binding.SerializationContext;
+import org.jboss.ws.core.binding.AbstractSerializerFactory;
+import org.jboss.ws.core.binding.SerializerSupport;
import org.jboss.ws.core.soap.MessageContextAssociation;
import org.jboss.ws.core.soap.MessageFactoryImpl;
import org.jboss.ws.core.soap.NameImpl;
@@ -124,7 +124,7 @@
Class javaType = faultMetaData.getJavaType();
// Get the deserializer from the type mapping
- DeserializerFactoryBase desFactory =
(DeserializerFactoryBase)typeMapping.getDeserializer(javaType, xmlType);
+ AbstractDeserializerFactory desFactory =
(AbstractDeserializerFactory)typeMapping.getDeserializer(javaType, xmlType);
if (desFactory == null)
throw new JAXRPCException("Cannot obtain deserializer factory for:
" + xmlType);
@@ -266,7 +266,7 @@
xmlName = nsRegistry.registerQName(xmlName);
// Get the serializer from the type mapping
- SerializerFactoryBase serFactory =
(SerializerFactoryBase)typeMapping.getSerializer(javaType, xmlType);
+ AbstractSerializerFactory serFactory =
(AbstractSerializerFactory)typeMapping.getSerializer(javaType, xmlType);
if (serFactory == null)
throw new JAXRPCException("Cannot obtain serializer factory for:
" + xmlType);
Modified:
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/SerializationContextJAXRPC.java
===================================================================
---
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/SerializationContextJAXRPC.java 2007-06-26
19:46:25 UTC (rev 3732)
+++
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/SerializationContextJAXRPC.java 2007-06-26
21:03:20 UTC (rev 3733)
@@ -29,7 +29,7 @@
import org.jboss.logging.Logger;
import org.jboss.ws.Constants;
import org.jboss.ws.WSException;
-import org.jboss.ws.core.jaxrpc.binding.SerializationContext;
+import org.jboss.ws.core.binding.SerializationContext;
import org.jboss.ws.core.jaxrpc.handler.SOAPMessageContextJAXRPC;
import org.jboss.ws.core.soap.MessageContextAssociation;
import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping;
Deleted:
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/TypeMappingImpl.java
===================================================================
---
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/TypeMappingImpl.java 2007-06-26
19:46:25 UTC (rev 3732)
+++
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/TypeMappingImpl.java 2007-06-26
21:03:20 UTC (rev 3733)
@@ -1,744 +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.core.jaxrpc;
-
-// $Id$
-
-import java.math.BigDecimal;
-import java.math.BigInteger;
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-import javax.xml.namespace.QName;
-import javax.xml.rpc.encoding.DeserializerFactory;
-import javax.xml.rpc.encoding.SerializerFactory;
-import javax.xml.rpc.encoding.TypeMapping;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.Constants;
-import org.jboss.ws.core.jaxrpc.binding.Base64DeserializerFactory;
-import org.jboss.ws.core.jaxrpc.binding.Base64SerializerFactory;
-import org.jboss.ws.core.jaxrpc.binding.CalendarDeserializerFactory;
-import org.jboss.ws.core.jaxrpc.binding.CalendarSerializerFactory;
-import org.jboss.ws.core.jaxrpc.binding.DateDeserializerFactory;
-import org.jboss.ws.core.jaxrpc.binding.DateSerializerFactory;
-import org.jboss.ws.core.jaxrpc.binding.HexDeserializerFactory;
-import org.jboss.ws.core.jaxrpc.binding.HexSerializerFactory;
-import org.jboss.ws.core.jaxrpc.binding.QNameDeserializerFactory;
-import org.jboss.ws.core.jaxrpc.binding.QNameSerializerFactory;
-import org.jboss.ws.core.jaxrpc.binding.SimpleDeserializerFactory;
-import org.jboss.ws.core.jaxrpc.binding.SimpleSerializerFactory;
-import org.jboss.ws.core.utils.HashCodeUtil;
-import org.jboss.wsf.spi.utils.JavaUtils;
-
-/**
- * This is the representation of a type mapping.
- * This TypeMapping implementation supports the literal encoding style.
- *
- * The TypeMapping instance maintains a tuple of the type
- * {XML typeQName, Java Class, SerializerFactory, DeserializerFactory}.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 10-Oct-2004
- */
-public abstract class TypeMappingImpl implements TypeMapping
-{
- // provide logging
- private static final Logger log = Logger.getLogger(TypeMappingImpl.class);
-
- // Map<KeyPair,FactoryPair>
- private Map<KeyPair, FactoryPair> tupleMap = new LinkedHashMap<KeyPair,
FactoryPair>();
-
- private Map<Integer, List<KeyPair>> keyPairCache = new
ConcurrentHashMap<Integer, List<KeyPair>>();
-
- /**
- * Gets the DeserializerFactory registered for the specified pair of Java type and XML
data type.
- * @param javaType Class of the Java type
- * @param xmlType QName of the XML type
- * @return Registered DeserializerFactory or null if there is no registered factory
- */
- public DeserializerFactory getDeserializer(Class javaType, QName xmlType)
- {
- FactoryPair fPair = getFactoryPair(new IQName(xmlType), javaType);
- return (fPair != null ? fPair.getDeserializerFactory() : null);
- }
-
- /**
- * Gets the SerializerFactory registered for the specified pair of Java type and XML
data type.
- * @param javaType Class of the Java type
- * @param xmlType QName of the XML type
- * @return Registered SerializerFactory or null if there is no registered factory
- */
- public SerializerFactory getSerializer(Class javaType, QName xmlType)
- {
- FactoryPair fPair = getFactoryPair(new IQName(xmlType), javaType);
- return (fPair != null ? fPair.getSerializerFactory() : null);
- }
-
- /**
- * Returns the encodingStyle URIs (as String[]) supported by this TypeMapping
instance.
- * A TypeMapping that contains only encoding style independent serializers and
deserializers
- * returns null from this method.
- *
- * @return Array of encodingStyle URIs for the supported encoding styles
- */
- public abstract String[] getSupportedEncodings();
-
- /**
- * Sets the encodingStyle URIs supported by this TypeMapping instance. A TypeMapping
that contains only encoding
- * independent serializers and deserializers requires null as the parameter for this
method.
- *
- * @param encodingStyleURIs Array of encodingStyle URIs for the supported encoding
styles
- */
- public abstract void setSupportedEncodings(String[] encodingStyleURIs);
-
- /**
- * Checks whether or not type mapping between specified XML type and Java type is
registered.
- * @param javaType Class of the Java type
- * @param xmlType QName of the XML type
- * @return boolean; true if type mapping between the specified XML type and Java type
is registered; otherwise false
- */
- public boolean isRegistered(Class javaType, QName xmlType)
- {
- return getFactoryPair(new IQName(xmlType), javaType) != null;
- }
-
- /**
- * Registers SerializerFactory and DeserializerFactory for a specific type mapping
between an XML type and Java type.
- * This method replaces any existing registered SerializerFactory DeserializerFactory
instances.
- * @param javaType Class of the Java type
- * @param xmlType QName of the XML type
- * @param sf SerializerFactory
- * @param df DeserializerFactory
- * @throws javax.xml.rpc.JAXRPCException If any error during the registration
- */
- public void register(Class javaType, QName xmlType, SerializerFactory sf,
DeserializerFactory df)
- {
- if (log.isTraceEnabled())
- log.trace("register: TypeMappingImpl@" + hashCode() + "
[xmlType=" + xmlType + ",javaType=" + javaType.getName() + ",sf="
+ sf + ",df=" + df + "]");
-
- registerInternal(javaType, new IQName(xmlType), sf, df);
- keyPairCache.clear();
- }
-
- private void registerInternal(Class javaType, IQName xmlType, SerializerFactory sf,
DeserializerFactory df)
- {
- if (javaType == null)
- throw new IllegalArgumentException("javaType cannot be null for: " +
xmlType);
- if (xmlType == null)
- throw new IllegalArgumentException("xmlType cannot be null for: " +
javaType);
-
- KeyPair kPair = new KeyPair(xmlType, javaType);
- FactoryPair fPair = new FactoryPair(sf, df);
- tupleMap.put(kPair, fPair);
- }
-
- /**
- * Removes the DeserializerFactory registered for the specified pair of Java type and
XML data type.
- * @param javaType Class of the Java type
- * @param xmlType QName of the XML type
- * @throws javax.xml.rpc.JAXRPCException If there is error in removing the registered
DeserializerFactory
- */
- public void removeDeserializer(Class javaType, QName xmlType)
- {
- FactoryPair fPair = getFactoryPair(new IQName(xmlType), javaType);
- if (fPair != null)
- fPair.setDeserializerFactory(null);
- }
-
- /**
- * Removes the SerializerFactory registered for the specified pair of Java type and
XML data type.
- * @param javaType Class of the Java type
- * @param xmlType QName of the XML type
- * @throws javax.xml.rpc.JAXRPCException If there is error in removing the registered
SerializerFactory
- */
- public void removeSerializer(Class javaType, QName xmlType)
- {
- FactoryPair fPair = getFactoryPair(new IQName(xmlType), javaType);
- if (fPair != null)
- fPair.setSerializerFactory(null);
- }
-
- /** Get the list of registered XML types */
- public List<QName> getRegisteredXmlTypes()
- {
- List<QName> types = new ArrayList<QName>();
- for (KeyPair keyPair : getKeyPairs(null, null))
- {
- types.add(keyPair.getXmlType().toQName());
- }
- return types;
- }
-
- /** Get the list of registered Java types */
- public List<Class> getRegisteredJavaTypes()
- {
- List<Class> types = new ArrayList<Class>();
- for (KeyPair keyPair : getKeyPairs(null, null))
- {
- types.add(keyPair.getJavaType());
- }
- return types;
- }
-
- /** Get the Class that was registered last for this xmlType */
- public Class getJavaType(QName xmlType)
- {
- Class javaType = null;
-
- List keyPairList = getKeyPairs(new IQName(xmlType), null);
- int size = keyPairList.size();
- if (size > 0)
- {
- KeyPair kPair = (KeyPair)keyPairList.get(size - 1);
- javaType = kPair.getJavaType();
- }
-
- return javaType;
- }
-
- /**
- * Get all of the Classes registered for this xmlType.
- */
- public List<Class> getJavaTypes(QName xmlType)
- {
- List<KeyPair> keyPairList = getKeyPairs( new IQName(xmlType), null);
- List<Class> classes = new ArrayList<Class>(keyPairList.size());
-
- for (KeyPair current : keyPairList)
- {
- classes.add(current.getJavaType());
- }
-
- return classes;
- }
-
- /**
- * Get the Class that was registered last for this xmlType
- * If there are two Java Types registered for the xmlType
- * return the primitive type rather than the wrapper,
- * if available
- */
- public Class getJavaType(QName xmlType,boolean getPrimitive)
- {
- //Lets get the primitive type if available
- Class javaType = null;
-
- List keyPairList = getKeyPairs(new IQName(xmlType), null);
- int size = keyPairList.size();
- if (size == 2 && getPrimitive)
- {
- KeyPair kPair1 = (KeyPair)keyPairList.get(0);
- Class javaType1 = kPair1.getJavaType();
- KeyPair kPair2 = (KeyPair)keyPairList.get(1);
- Class javaType2 = kPair2.getJavaType();
- if(javaType2.isPrimitive() && !javaType1.isPrimitive())
- javaType = javaType2;
- else
- if(javaType1.isPrimitive() && !javaType2.isPrimitive())
- javaType = javaType1;
- else
- javaType = javaType2; //Fallback on the most latest
- }
- else
- return getJavaType(xmlType);
-
- return javaType;
- }
-
- /** Get the Class name that was registered last for this xmlType */
- public String getJavaTypeName(QName xmlType)
- {
- Class javaType = getJavaType(xmlType);
- return (javaType != null ? javaType.getName() : null);
- }
-
- /** Get the QName that was registered last for this javaType */
- public QName getXMLType(Class javaType)
- {
- QName xmlType = null;
-
- List keyPairList = getKeyPairs(null, javaType);
- int size = keyPairList.size();
- if (size > 0)
- {
- KeyPair kPair = (KeyPair)keyPairList.get(size - 1);
- xmlType = kPair.getXmlType().toQName();
- }
-
- return xmlType;
- }
-
- /** Get the QNames that was registered last for this javaType */
- public List<QName> getXMLTypes(Class javaType)
- {
- List<QName> xmlTypes = new ArrayList<QName>();
-
- for (KeyPair kPair : getKeyPairs(null, javaType))
- {
- xmlTypes.add(kPair.getXmlType().toQName());
- }
- return xmlTypes;
- }
-
- /**
- * Get the QName that was registered last for this javaType
- * @param javaType class for which XML Type is needed
- * @param tryAssignable If the xmlType is not registered for javaType
- * should a base class type be checked?
- *
- */
- public QName getXMLType(Class javaType, boolean tryAssignable)
- {
- if(tryAssignable) return getXMLType(javaType);
-
- QName xmlType = null;
-
- List keyPairList = getKeyPairs(null, javaType, tryAssignable);
- int size = keyPairList.size();
- if (size > 0)
- {
- KeyPair kPair = (KeyPair)keyPairList.get(size - 1);
- xmlType = kPair.getXmlType().toQName();
- }
-
- return xmlType;
- }
-
- /**
- * Get the serializer/deserializer factory pair for the given xmlType, javaType
- * Both xmlType, javaType may be null. In that case, this implementation still
- * returns a FactoryPair if there is only one possible match.
- *
- * @param xmlType can be null
- * @param javaType can be null
- */
- private List<KeyPair> getKeyPairs(IQName xmlType, Class javaType)
- {
- Integer cacheId = cacheIdFor(javaType, xmlType);
-
- List<KeyPair> keyPairList = keyPairCache.get(cacheId);
- if(null == keyPairList)
- {
- keyPairList = getKeyPairsInternal(xmlType, javaType);
- keyPairCache.put(cacheId, keyPairList);
- }
-
- return keyPairList;
- }
-
- private Integer cacheIdFor(Class javaType, IQName xmlType) {
- int result = HashCodeUtil.SEED;
- int nullHash = HashCodeUtil.hash(result, "null");
- result = javaType!= null ? HashCodeUtil.hash(result, javaType.getName()) :
HashCodeUtil.hash(result, nullHash);
- result = xmlType!= null ? HashCodeUtil.hash(result, xmlType.hashCode()):
HashCodeUtil.hash(result, nullHash);
- return new Integer(result);
- }
-
- private List<KeyPair> getKeyPairsInternal(IQName xmlType, Class javaType)
- {
- List<KeyPair> keyPairList = new ArrayList<KeyPair>();
-
- // Getting the exact matching pair
- if (xmlType != null && javaType != null)
- {
- for (KeyPair entry : tupleMap.keySet())
- {
- if (xmlType.equals(entry.getXmlType()) && entry.getJavaType() ==
javaType)
- {
- keyPairList.add(entry);
- }
- }
- // No exact match, try assignable
- if (keyPairList.size() == 0)
- {
- for (KeyPair entry : tupleMap.keySet())
- {
- if (xmlType.equals(entry.getXmlType()) &&
JavaUtils.isAssignableFrom(entry.getJavaType(), javaType))
- {
- keyPairList.add(entry);
- }
- }
- }
- }
-
- // Getting the pair for a given xmlType
- else if (xmlType != null && javaType == null)
- {
- for (KeyPair entry : tupleMap.keySet())
- {
- if (xmlType.equals(entry.getXmlType()))
- {
- keyPairList.add(entry);
- }
- }
- }
-
- // Getting the pair for a given javaType
- else if (xmlType == null && javaType != null)
- {
- for (KeyPair entry : tupleMap.keySet())
- {
- if (entry.getJavaType() == javaType)
- {
- keyPairList.add(entry);
- }
- }
- // No exact match, try assignable
- if (keyPairList.size() == 0)
- {
- for (KeyPair entry : tupleMap.keySet())
- {
- if (JavaUtils.isAssignableFrom(entry.getJavaType(), javaType))
- {
- keyPairList.add(entry);
- }
- }
- }
- }
-
- // Getting the all pairs
- else if (xmlType == null && javaType == null)
- {
- keyPairList.addAll(tupleMap.keySet());
- }
-
- return keyPairList;
- }
-
- private List<KeyPair> getKeyPairs(IQName xmlType, Class javaType, boolean
tryAssignable)
- {
- Integer cacheId = cacheIdFor(javaType, xmlType);
-
- List<KeyPair> keyPairList = keyPairCache.get(cacheId);
- if(null == keyPairList)
- {
- keyPairList = getKeyPairsInternal(xmlType, javaType, tryAssignable);
- keyPairCache.put(cacheId, keyPairList);
- }
-
- return keyPairList;
- }
-
- /**
- * Get the serializer/deserializer factory pair for the given xmlType, javaType
- * Both xmlType, javaType may be null. In that case, this implementation still
- * returns a FactoryPair if there is only one possible match.
- * <br>Note: This method does not try for the base class, if no keypair exists
for the
- * javaType in question.
- */
- private List<KeyPair> getKeyPairsInternal(IQName xmlType, Class javaType,
boolean tryAssignable)
- {
- if(tryAssignable) return getKeyPairs( xmlType, javaType );
-
- List<KeyPair> keyPairList = new ArrayList<KeyPair>();
-
- // Getting the exact matching pair
- if (xmlType != null && javaType != null)
- {
- for (KeyPair entry : tupleMap.keySet())
- {
- if (xmlType.equals(entry.getXmlType()) && entry.getJavaType() ==
javaType)
- {
- keyPairList.add(entry);
- }
- }
- }
-
- // Getting the pair for a given xmlType
- else if (xmlType != null && javaType == null)
- {
- for (KeyPair entry : tupleMap.keySet())
- {
- if (xmlType.equals(entry.getXmlType()))
- {
- keyPairList.add(entry);
- }
- }
- }
-
- // Getting the pair for a given javaType
- else if (xmlType == null && javaType != null)
- {
- for (KeyPair entry : tupleMap.keySet())
- {
- if (entry.getJavaType() == javaType)
- {
- keyPairList.add(entry);
- }
- }
- }
-
- // Getting the all pairs
- else if (xmlType == null && javaType == null)
- {
- keyPairList.addAll(tupleMap.keySet());
- }
-
- return keyPairList;
- }
-
- /**
- * Get the serializer/deserializer factory pair for the given xmlType, javaType
- * Both xmlType, javaType may be null. In that case, this implementation still
- * returns a FactoryPair that was last registered
- */
- private FactoryPair getFactoryPair(IQName xmlType, Class javaType)
- {
- FactoryPair fPair = null;
-
- List<KeyPair> keyPairList = getKeyPairs(xmlType, javaType);
- int size = keyPairList.size();
- if (size > 0)
- {
- KeyPair kPair = keyPairList.get(size - 1);
- fPair = (FactoryPair)tupleMap.get(kPair);
- }
-
- return fPair;
- }
-
- protected void registerStandardLiteralTypes()
- {
- register(BigDecimal.class, Constants.TYPE_LITERAL_DECIMAL, new
SimpleSerializerFactory(), new SimpleDeserializerFactory());
-
- register(BigInteger.class, Constants.TYPE_LITERAL_POSITIVEINTEGER, new
SimpleSerializerFactory(), new SimpleDeserializerFactory());
- register(BigInteger.class, Constants.TYPE_LITERAL_NEGATIVEINTEGER, new
SimpleSerializerFactory(), new SimpleDeserializerFactory());
- register(BigInteger.class, Constants.TYPE_LITERAL_NONPOSITIVEINTEGER, new
SimpleSerializerFactory(), new SimpleDeserializerFactory());
- register(BigInteger.class, Constants.TYPE_LITERAL_NONNEGATIVEINTEGER, new
SimpleSerializerFactory(), new SimpleDeserializerFactory());
- register(BigInteger.class, Constants.TYPE_LITERAL_UNSIGNEDLONG, new
SimpleSerializerFactory(), new SimpleDeserializerFactory());
- register(BigInteger.class, Constants.TYPE_LITERAL_INTEGER, new
SimpleSerializerFactory(), new SimpleDeserializerFactory());
-
- register(Date.class, Constants.TYPE_LITERAL_DATETIME, new DateSerializerFactory(),
new DateDeserializerFactory());
-
- register(Calendar.class, Constants.TYPE_LITERAL_DATE, new
CalendarSerializerFactory(), new CalendarDeserializerFactory());
- register(Calendar.class, Constants.TYPE_LITERAL_TIME, new
CalendarSerializerFactory(), new CalendarDeserializerFactory());
- register(Calendar.class, Constants.TYPE_LITERAL_DATETIME, new
CalendarSerializerFactory(), new CalendarDeserializerFactory());
-
- register(QName.class, Constants.TYPE_LITERAL_QNAME, new QNameSerializerFactory(),
new QNameDeserializerFactory());
-
- register(String.class, Constants.TYPE_LITERAL_ANYSIMPLETYPE, new
SimpleSerializerFactory(), new SimpleDeserializerFactory());
- register(String.class, Constants.TYPE_LITERAL_DURATION, new
SimpleSerializerFactory(), new SimpleDeserializerFactory());
- register(String.class, Constants.TYPE_LITERAL_GDAY, new SimpleSerializerFactory(),
new SimpleDeserializerFactory());
- register(String.class, Constants.TYPE_LITERAL_GMONTH, new
SimpleSerializerFactory(), new SimpleDeserializerFactory());
- register(String.class, Constants.TYPE_LITERAL_GMONTHDAY, new
SimpleSerializerFactory(), new SimpleDeserializerFactory());
- register(String.class, Constants.TYPE_LITERAL_GYEAR, new SimpleSerializerFactory(),
new SimpleDeserializerFactory());
- register(String.class, Constants.TYPE_LITERAL_GYEARMONTH, new
SimpleSerializerFactory(), new SimpleDeserializerFactory());
- register(String.class, Constants.TYPE_LITERAL_ID, new SimpleSerializerFactory(),
new SimpleDeserializerFactory());
- register(String.class, Constants.TYPE_LITERAL_LANGUAGE, new
SimpleSerializerFactory(), new SimpleDeserializerFactory());
- register(String.class, Constants.TYPE_LITERAL_NAME, new SimpleSerializerFactory(),
new SimpleDeserializerFactory());
- register(String.class, Constants.TYPE_LITERAL_NCNAME, new
SimpleSerializerFactory(), new SimpleDeserializerFactory());
- register(String.class, Constants.TYPE_LITERAL_NMTOKEN, new
SimpleSerializerFactory(), new SimpleDeserializerFactory());
- register(String.class, Constants.TYPE_LITERAL_NORMALIZEDSTRING, new
SimpleSerializerFactory(), new SimpleDeserializerFactory());
- register(String.class, Constants.TYPE_LITERAL_TOKEN, new SimpleSerializerFactory(),
new SimpleDeserializerFactory());
- register(String.class, Constants.TYPE_LITERAL_STRING, new
SimpleSerializerFactory(), new SimpleDeserializerFactory());
-
- register(String[].class, Constants.TYPE_LITERAL_NMTOKENS, new
SimpleSerializerFactory(), new SimpleDeserializerFactory());
-
- register(URI.class, Constants.TYPE_LITERAL_ANYURI, new SimpleSerializerFactory(),
new SimpleDeserializerFactory());
-
- register(boolean.class, Constants.TYPE_LITERAL_BOOLEAN, new
SimpleSerializerFactory(), new SimpleDeserializerFactory());
- register(Boolean.class, Constants.TYPE_LITERAL_BOOLEAN, new
SimpleSerializerFactory(), new SimpleDeserializerFactory());
-
- register(byte.class, Constants.TYPE_LITERAL_BYTE, new SimpleSerializerFactory(),
new SimpleDeserializerFactory());
- register(Byte.class, Constants.TYPE_LITERAL_BYTE, new SimpleSerializerFactory(),
new SimpleDeserializerFactory());
-
- register(Byte[].class, Constants.TYPE_LITERAL_HEXBINARY, new
HexSerializerFactory(), new HexDeserializerFactory());
- register(byte[].class, Constants.TYPE_LITERAL_HEXBINARY, new
HexSerializerFactory(), new HexDeserializerFactory());
-
- register(Byte[].class, Constants.TYPE_LITERAL_BASE64BINARY, new
Base64SerializerFactory(), new Base64DeserializerFactory());
- register(byte[].class, Constants.TYPE_LITERAL_BASE64BINARY, new
Base64SerializerFactory(), new Base64DeserializerFactory());
-
- register(double.class, Constants.TYPE_LITERAL_DOUBLE, new
SimpleSerializerFactory(), new SimpleDeserializerFactory());
- register(Double.class, Constants.TYPE_LITERAL_DOUBLE, new
SimpleSerializerFactory(), new SimpleDeserializerFactory());
-
- register(float.class, Constants.TYPE_LITERAL_FLOAT, new SimpleSerializerFactory(),
new SimpleDeserializerFactory());
- register(Float.class, Constants.TYPE_LITERAL_FLOAT, new SimpleSerializerFactory(),
new SimpleDeserializerFactory());
-
- register(int.class, Constants.TYPE_LITERAL_UNSIGNEDSHORT, new
SimpleSerializerFactory(), new SimpleDeserializerFactory());
- register(Integer.class, Constants.TYPE_LITERAL_UNSIGNEDSHORT, new
SimpleSerializerFactory(), new SimpleDeserializerFactory());
- register(int.class, Constants.TYPE_LITERAL_INT, new SimpleSerializerFactory(), new
SimpleDeserializerFactory());
- register(Integer.class, Constants.TYPE_LITERAL_INT, new SimpleSerializerFactory(),
new SimpleDeserializerFactory());
-
- register(long.class, Constants.TYPE_LITERAL_UNSIGNEDINT, new
SimpleSerializerFactory(), new SimpleDeserializerFactory());
- register(Long.class, Constants.TYPE_LITERAL_UNSIGNEDINT, new
SimpleSerializerFactory(), new SimpleDeserializerFactory());
- register(long.class, Constants.TYPE_LITERAL_LONG, new SimpleSerializerFactory(),
new SimpleDeserializerFactory());
- register(Long.class, Constants.TYPE_LITERAL_LONG, new SimpleSerializerFactory(),
new SimpleDeserializerFactory());
-
- register(short.class, Constants.TYPE_LITERAL_UNSIGNEDBYTE, new
SimpleSerializerFactory(), new SimpleDeserializerFactory());
- register(Short.class, Constants.TYPE_LITERAL_UNSIGNEDBYTE, new
SimpleSerializerFactory(), new SimpleDeserializerFactory());
- register(short.class, Constants.TYPE_LITERAL_SHORT, new SimpleSerializerFactory(),
new SimpleDeserializerFactory());
- register(Short.class, Constants.TYPE_LITERAL_SHORT, new SimpleSerializerFactory(),
new SimpleDeserializerFactory());
- }
-
- /** A tuple of the type {XML typeQName, Java Class, SerializerFactory,
DeserializerFactory}.
- */
- private static class KeyPair
- {
- private IQName xmlType;
- private Class javaType;
-
- public KeyPair(IQName xmlType, Class javaType)
- {
- this.javaType = javaType;
- this.xmlType = xmlType;
- }
-
- public Class getJavaType()
- {
- return javaType;
- }
-
- public IQName getXmlType()
- {
- return xmlType;
- }
-
- public boolean equals(Object o)
- {
- if (this == o) return true;
- if (!(o instanceof KeyPair)) return false;
-
- final KeyPair keyPair = (KeyPair)o;
-
- if (!javaType.equals(keyPair.javaType)) return false;
- if (!xmlType.equals(keyPair.xmlType)) return false;
-
- return true;
- }
-
- public int hashCode()
- {
- int result;
- result = xmlType.hashCode();
- result = 29 * result + javaType.hashCode();
- return result;
- }
-
- public String toString()
- {
- return "[xmlType=" + xmlType + ",javaType=" +
javaType.getName() + "]";
- }
- }
-
- /** A tuple of the type {XML typeQName, Java Class, SerializerFactory,
DeserializerFactory}.
- */
- public static class FactoryPair
- {
- private SerializerFactory serializerFactory;
- private DeserializerFactory deserializerFactory;
-
- FactoryPair(SerializerFactory sf, DeserializerFactory df)
- {
- this.deserializerFactory = df;
- this.serializerFactory = sf;
- }
-
- public DeserializerFactory getDeserializerFactory()
- {
- return deserializerFactory;
- }
-
- public SerializerFactory getSerializerFactory()
- {
- return serializerFactory;
- }
-
- public void setDeserializerFactory(DeserializerFactory df)
- {
- this.deserializerFactory = df;
- }
-
- public void setSerializerFactory(SerializerFactory sf)
- {
- this.serializerFactory = sf;
- }
- }
-
- /**
- * A duck typed QName that relies on internalized Strings.<p>
- * Taken from the {@link javax.xml.namespace.QName} docs:<br>
- * The value of a QName contains a Namespace URI, local part and prefix.
- * The prefix is included in QName to retain lexical information when present in an
XML input source.
- * The prefix is NOT used in QName.equals(Object) or to compute the QName.hashCode().
- * Equality and the hash code are defined using only the Namespace URI and local
part.
- * If not specified, the Namespace URI is set to "" (the empty string).
- * If not specified, the prefix is set to "" (the empty string).
- */
- private final class IQName
- {
- public String namespace;
- public String localPart;
- public String prefix;
- public int hash;
-
- public IQName(QName name)
- {
- namespace = name.getNamespaceURI() != null ? name.getNamespaceURI().intern() :
"".intern();
- localPart = name.getLocalPart() != null ? name.getLocalPart().intern() :
"".intern();
- prefix = name.getPrefix() != null ? name.getPrefix().intern() :
"".intern();
- hash = name.hashCode();
- }
-
- public boolean equals(Object object) {
- if(!(object instanceof IQName))
- throw new IllegalArgumentException("Cannot compare IQName to " +
object);
-
- IQName iqn = (IQName)object;
- return (iqn.namespace == this.namespace && iqn.localPart ==
this.localPart);
- }
-
- public QName toQName()
- {
- QName qname;
-
- if(null == namespace)
- qname = new QName(localPart);
- else if(null == prefix)
- qname = new QName(namespace, localPart);
- else
- qname = new QName(namespace, localPart, prefix);
-
- return qname;
- }
-
- /**
- * This implementation currently represents a QName as: "{" + Namespace
URI + "}" + local part.
- * If the Namespace URI .equals(""), only the local part is returned.
- */
- public String toString() {
- String ns = "".equals(namespace) ? namespace :
"{"+namespace+"}";
- return ns+localPart;
- }
-
- public int hashCode()
- {
- return this.hash;
- }
- }
-}
Modified:
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/TypeMappingRegistryImpl.java
===================================================================
---
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/TypeMappingRegistryImpl.java 2007-06-26
19:46:25 UTC (rev 3732)
+++
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/TypeMappingRegistryImpl.java 2007-06-26
21:03:20 UTC (rev 3733)
@@ -32,6 +32,7 @@
import org.jboss.util.NotImplementedException;
import org.jboss.ws.Constants;
+import org.jboss.ws.core.binding.TypeMappingImpl;
/**
* This defines a registry of TypeMapping instances for encoding styles.
Modified:
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/Base64Deserializer.java
===================================================================
---
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/Base64Deserializer.java 2007-06-26
19:46:25 UTC (rev 3732)
+++
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/Base64Deserializer.java 2007-06-26
21:03:20 UTC (rev 3733)
@@ -30,6 +30,9 @@
import org.jboss.logging.Logger;
import org.jboss.ws.WSException;
+import org.jboss.ws.core.binding.BindingException;
+import org.jboss.ws.core.binding.DeserializerSupport;
+import org.jboss.ws.core.binding.SerializationContext;
import org.jboss.ws.extensions.xop.XOPContext;
import org.jboss.ws.extensions.xop.jaxrpc.XOPUnmarshallerImpl;
import org.jboss.wsf.spi.utils.DOMUtils;
Modified:
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/Base64DeserializerFactory.java
===================================================================
---
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/Base64DeserializerFactory.java 2007-06-26
19:46:25 UTC (rev 3732)
+++
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/Base64DeserializerFactory.java 2007-06-26
21:03:20 UTC (rev 3733)
@@ -21,7 +21,10 @@
*/
package org.jboss.ws.core.jaxrpc.binding;
+import org.jboss.ws.core.binding.AbstractDeserializerFactory;
+import org.jboss.ws.core.binding.DeserializerSupport;
+
// $Id$
@@ -31,7 +34,7 @@
* @author Thomas.Diesler(a)jboss.org
* @since 04-Dec-2004
*/
-public class Base64DeserializerFactory extends DeserializerFactoryBase
+public class Base64DeserializerFactory extends AbstractDeserializerFactory
{
public DeserializerSupport getDeserializer()
{
Modified:
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/Base64Serializer.java
===================================================================
---
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/Base64Serializer.java 2007-06-26
19:46:25 UTC (rev 3732)
+++
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/Base64Serializer.java 2007-06-26
21:03:20 UTC (rev 3733)
@@ -27,6 +27,10 @@
import javax.xml.transform.Result;
import org.jboss.logging.Logger;
+import org.jboss.ws.core.binding.BindingException;
+import org.jboss.ws.core.binding.BufferedStreamResult;
+import org.jboss.ws.core.binding.SerializationContext;
+import org.jboss.ws.core.binding.SerializerSupport;
import org.jboss.ws.extensions.xop.XOPContext;
import org.jboss.ws.extensions.xop.jaxrpc.XOPMarshallerImpl;
import org.jboss.wsf.spi.utils.JavaUtils;
Modified:
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/Base64SerializerFactory.java
===================================================================
---
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/Base64SerializerFactory.java 2007-06-26
19:46:25 UTC (rev 3732)
+++
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/Base64SerializerFactory.java 2007-06-26
21:03:20 UTC (rev 3733)
@@ -21,7 +21,10 @@
*/
package org.jboss.ws.core.jaxrpc.binding;
+import org.jboss.ws.core.binding.AbstractSerializerFactory;
+import org.jboss.ws.core.binding.SerializerSupport;
+
// $Id$
@@ -31,7 +34,7 @@
* @author Thomas.Diesler(a)jboss.org
* @since 04-Dec-2004
*/
-public class Base64SerializerFactory extends SerializerFactoryBase
+public class Base64SerializerFactory extends AbstractSerializerFactory
{
public SerializerSupport getSerializer()
{
Deleted:
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/BindingException.java
===================================================================
---
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/BindingException.java 2007-06-26
19:46:25 UTC (rev 3732)
+++
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/BindingException.java 2007-06-26
21:03:20 UTC (rev 3733)
@@ -1,92 +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.core.jaxrpc.binding;
-
-// $Id$
-
-/** An exception that may occur during message binding
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 16-Oct-2004
- */
-public class BindingException extends Exception
-{
- /**
- * Constructs a new exception with <code>null</code> as its detail
message.
- * The cause is not initialized, and may subsequently be initialized by a
- * call to {@link #initCause}.
- */
- public BindingException()
- {
- }
-
- /**
- * Constructs a new exception with the specified detail message. The
- * cause is not initialized, and may subsequently be initialized by
- * a call to {@link #initCause}.
- *
- * @param message the detail message. The detail message is saved for
- * later retrieval by the {@link #getMessage()} method.
- */
- public BindingException(String message)
- {
- super(message);
- }
-
- /**
- * Constructs a new exception with the specified cause and a detail
- * message of <tt>(cause==null ? null : cause.toString())</tt> (which
- * typically contains the class and detail message of <tt>cause</tt>).
- * This constructor is useful for exceptions that are little more than
- * wrappers for other throwables (for example, {@link
- * java.security.PrivilegedActionException}).
- *
- * @param cause the cause (which is saved for later retrieval by the
- * {@link #getCause()} method). (A <tt>null</tt> value is
- * permitted, and indicates that the cause is nonexistent or
- * unknown.)
- * @since 1.4
- */
- public BindingException(Throwable cause)
- {
- super(cause);
- }
-
- /**
- * Constructs a new exception with the specified detail message and
- * cause. <p>Note that the detail message associated with
- * <code>cause</code> is <i>not</i> automatically incorporated
in
- * this exception's detail message.
- *
- * @param message the detail message (which is saved for later retrieval
- * by the {@link #getMessage()} method).
- * @param cause the cause (which is saved for later retrieval by the
- * {@link #getCause()} method). (A <tt>null</tt> value is
- * permitted, and indicates that the cause is nonexistent or
- * unknown.)
- * @since 1.4
- */
- public BindingException(String message, Throwable cause)
- {
- super(message, cause);
- }
-}
Deleted:
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/BufferedStreamResult.java
===================================================================
---
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/BufferedStreamResult.java 2007-06-26
19:46:25 UTC (rev 3732)
+++
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/BufferedStreamResult.java 2007-06-26
21:03:20 UTC (rev 3733)
@@ -1,90 +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.core.jaxrpc.binding;
-
-// $Id: $
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.Writer;
-
-import javax.xml.transform.stream.StreamResult;
-
-import org.jboss.ws.WSException;
-import org.jboss.wsf.spi.utils.IOUtils;
-
-/**
- * @author Heiko.Braun(a)jboss.org
- * @author Thomas.Diesler(a)jboss.org
- * @since 06.02.2007
- */
-public class BufferedStreamResult extends StreamResult
-{
- ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);
-
- public BufferedStreamResult()
- {
- }
-
- public BufferedStreamResult(String xmlFragment)
- {
- try
- {
- IOUtils.copyStream(getOutputStream(), new
ByteArrayInputStream(xmlFragment.getBytes()));
- }
- catch (IOException e)
- {
- WSException.rethrow(e);
- }
- }
-
- @Override
- public Writer getWriter()
- {
- return null;
- }
-
- @Override
- public OutputStream getOutputStream()
- {
- return baos;
- }
-
- @Override
- public void setWriter(Writer writer)
- {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public void setOutputStream(OutputStream outputStream)
- {
- throw new UnsupportedOperationException();
- }
-
- public String toString()
- {
- return baos.toString();
- }
-}
Modified:
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/CalendarDeserializer.java
===================================================================
---
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/CalendarDeserializer.java 2007-06-26
19:46:25 UTC (rev 3732)
+++
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/CalendarDeserializer.java 2007-06-26
21:03:20 UTC (rev 3733)
@@ -30,6 +30,9 @@
import org.jboss.logging.Logger;
import org.jboss.ws.Constants;
+import org.jboss.ws.core.binding.BindingException;
+import org.jboss.ws.core.binding.DeserializerSupport;
+import org.jboss.ws.core.binding.SerializationContext;
import org.jboss.xb.binding.SimpleTypeBindings;
/**
Modified:
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/CalendarDeserializerFactory.java
===================================================================
---
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/CalendarDeserializerFactory.java 2007-06-26
19:46:25 UTC (rev 3732)
+++
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/CalendarDeserializerFactory.java 2007-06-26
21:03:20 UTC (rev 3733)
@@ -21,7 +21,10 @@
*/
package org.jboss.ws.core.jaxrpc.binding;
+import org.jboss.ws.core.binding.AbstractDeserializerFactory;
+import org.jboss.ws.core.binding.DeserializerSupport;
+
// $Id$
@@ -31,7 +34,7 @@
* @author Thomas.Diesler(a)jboss.org
* @since 04-Dec-2004
*/
-public class CalendarDeserializerFactory extends DeserializerFactoryBase
+public class CalendarDeserializerFactory extends AbstractDeserializerFactory
{
public DeserializerSupport getDeserializer()
Modified:
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/CalendarSerializer.java
===================================================================
---
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/CalendarSerializer.java 2007-06-26
19:46:25 UTC (rev 3732)
+++
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/CalendarSerializer.java 2007-06-26
21:03:20 UTC (rev 3733)
@@ -30,6 +30,10 @@
import org.jboss.logging.Logger;
import org.jboss.ws.Constants;
+import org.jboss.ws.core.binding.BindingException;
+import org.jboss.ws.core.binding.BufferedStreamResult;
+import org.jboss.ws.core.binding.SerializationContext;
+import org.jboss.ws.core.binding.SerializerSupport;
import org.jboss.xb.binding.NamespaceRegistry;
import org.jboss.xb.binding.SimpleTypeBindings;
import org.w3c.dom.NamedNodeMap;
Modified:
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/CalendarSerializerFactory.java
===================================================================
---
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/CalendarSerializerFactory.java 2007-06-26
19:46:25 UTC (rev 3732)
+++
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/CalendarSerializerFactory.java 2007-06-26
21:03:20 UTC (rev 3733)
@@ -21,7 +21,10 @@
*/
package org.jboss.ws.core.jaxrpc.binding;
+import org.jboss.ws.core.binding.AbstractSerializerFactory;
+import org.jboss.ws.core.binding.SerializerSupport;
+
// $Id$
@@ -29,7 +32,7 @@
* @author Thomas.Diesler(a)jboss.org
* @since 04-Dec-2004
*/
-public class CalendarSerializerFactory extends SerializerFactoryBase
+public class CalendarSerializerFactory extends AbstractSerializerFactory
{
public SerializerSupport getSerializer()
{
Deleted:
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/ComplexTypeDeserializer.java
===================================================================
---
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/ComplexTypeDeserializer.java 2007-06-26
19:46:25 UTC (rev 3732)
+++
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/ComplexTypeDeserializer.java 2007-06-26
21:03:20 UTC (rev 3733)
@@ -1,36 +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.core.jaxrpc.binding;
-
-
-// $Id$
-
-/**
- * A Deserializer that can handle complex types by delegating to JAXB.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 04-Dec-2004
- */
-public abstract class ComplexTypeDeserializer extends DeserializerSupport
-{
-
-}
Deleted:
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/ComplexTypeSerializer.java
===================================================================
---
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/ComplexTypeSerializer.java 2007-06-26
19:46:25 UTC (rev 3732)
+++
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/ComplexTypeSerializer.java 2007-06-26
21:03:20 UTC (rev 3733)
@@ -1,36 +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.core.jaxrpc.binding;
-
-
-// $Id$
-
-/**
- * A Serializer that can handle complex types by delegating to JAXB.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 04-Dec-2004
- */
-public abstract class ComplexTypeSerializer extends SerializerSupport
-{
-
-}
Modified:
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/DateDeserializer.java
===================================================================
---
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/DateDeserializer.java 2007-06-26
19:46:25 UTC (rev 3732)
+++
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/DateDeserializer.java 2007-06-26
21:03:20 UTC (rev 3733)
@@ -30,6 +30,9 @@
import javax.xml.transform.Source;
import org.jboss.logging.Logger;
+import org.jboss.ws.core.binding.BindingException;
+import org.jboss.ws.core.binding.DeserializerSupport;
+import org.jboss.ws.core.binding.SerializationContext;
import org.jboss.xb.binding.SimpleTypeBindings;
/**
Modified:
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/DateDeserializerFactory.java
===================================================================
---
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/DateDeserializerFactory.java 2007-06-26
19:46:25 UTC (rev 3732)
+++
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/DateDeserializerFactory.java 2007-06-26
21:03:20 UTC (rev 3733)
@@ -21,7 +21,10 @@
*/
package org.jboss.ws.core.jaxrpc.binding;
+import org.jboss.ws.core.binding.AbstractDeserializerFactory;
+import org.jboss.ws.core.binding.DeserializerSupport;
+
// $Id$
@@ -31,7 +34,7 @@
* @author Thomas.Diesler(a)jboss.org
* @since 04-Dec-2004
*/
-public class DateDeserializerFactory extends DeserializerFactoryBase
+public class DateDeserializerFactory extends AbstractDeserializerFactory
{
public DeserializerSupport getDeserializer()
{
Modified:
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/DateSerializer.java
===================================================================
---
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/DateSerializer.java 2007-06-26
19:46:25 UTC (rev 3732)
+++
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/DateSerializer.java 2007-06-26
21:03:20 UTC (rev 3733)
@@ -31,6 +31,10 @@
import javax.xml.transform.Result;
import org.jboss.logging.Logger;
+import org.jboss.ws.core.binding.BindingException;
+import org.jboss.ws.core.binding.BufferedStreamResult;
+import org.jboss.ws.core.binding.SerializationContext;
+import org.jboss.ws.core.binding.SerializerSupport;
import org.jboss.xb.binding.NamespaceRegistry;
import org.jboss.xb.binding.SimpleTypeBindings;
import org.w3c.dom.NamedNodeMap;
Modified:
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/DateSerializerFactory.java
===================================================================
---
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/DateSerializerFactory.java 2007-06-26
19:46:25 UTC (rev 3732)
+++
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/DateSerializerFactory.java 2007-06-26
21:03:20 UTC (rev 3733)
@@ -21,7 +21,10 @@
*/
package org.jboss.ws.core.jaxrpc.binding;
+import org.jboss.ws.core.binding.AbstractSerializerFactory;
+import org.jboss.ws.core.binding.SerializerSupport;
+
// $Id$
@@ -31,7 +34,7 @@
* @author Thomas.Diesler(a)jboss.org
* @since 04-Dec-2004
*/
-public class DateSerializerFactory extends SerializerFactoryBase
+public class DateSerializerFactory extends AbstractSerializerFactory
{
public SerializerSupport getSerializer()
{
Deleted:
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/DeserializerFactoryBase.java
===================================================================
---
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/DeserializerFactoryBase.java 2007-06-26
19:46:25 UTC (rev 3732)
+++
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/DeserializerFactoryBase.java 2007-06-26
21:03:20 UTC (rev 3733)
@@ -1,50 +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.core.jaxrpc.binding;
-
-// $Id$
-
-import java.util.Iterator;
-
-import javax.xml.rpc.encoding.Deserializer;
-import javax.xml.rpc.encoding.DeserializerFactory;
-
-import org.jboss.util.NotImplementedException;
-
-/**
- * @author Thomas.Diesler(a)jboss.org
- * @since 04-Dec-2004
- */
-public abstract class DeserializerFactoryBase implements DeserializerFactory
-{
- public abstract DeserializerSupport getDeserializer() throws BindingException;
-
- public Deserializer getDeserializerAs(String mechanismType)
- {
- throw new NotImplementedException();
- }
-
- public Iterator getSupportedMechanismTypes()
- {
- throw new NotImplementedException();
- }
-}
Deleted:
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/DeserializerSupport.java
===================================================================
---
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/DeserializerSupport.java 2007-06-26
19:46:25 UTC (rev 3732)
+++
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/DeserializerSupport.java 2007-06-26
21:03:20 UTC (rev 3733)
@@ -1,160 +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.core.jaxrpc.binding;
-
-// $Id$
-
-import java.io.ByteArrayOutputStream;
-
-import javax.xml.namespace.QName;
-import javax.xml.rpc.encoding.Deserializer;
-import javax.xml.transform.Source;
-import javax.xml.transform.TransformerException;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.stream.StreamResult;
-
-import org.jboss.logging.Logger;
-import org.jboss.util.NotImplementedException;
-import org.jboss.ws.WSException;
-import org.jboss.ws.core.soap.SOAPContentElement;
-import org.jboss.ws.core.utils.XMLPredefinedEntityReferenceResolver;
-import org.jboss.wsf.spi.utils.DOMWriter;
-import org.w3c.dom.Node;
-
-/** The base class for all Deserializers.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 04-Dec-2004
- */
-public abstract class DeserializerSupport implements Deserializer
-{
- private static final Logger log = Logger.getLogger(DeserializerSupport.class);
-
- public Object deserialize(SOAPContentElement soapElement, SerializationContext
serContext) throws BindingException
- {
- QName xmlName = soapElement.getElementQName();
- QName xmlType = soapElement.getXmlType();
-
- Source source = soapElement.getXMLFragment().getSource();
- return deserialize(xmlName, xmlType, source, serContext);
- }
-
- /** Deserialize an XML fragment to an object value
- *
- * @param xmlName The root element name of the resulting fragment
- * @param xmlType The associated schema type
- * @param xmlFragment The XML fragment to deserialize
- * @param serContext The serialization context
- */
- public abstract Object deserialize(QName xmlName, QName xmlType, Source xmlFragment,
SerializationContext serContext) throws BindingException;
-
- // TODO: remove when JBossXB supports unmarshall(Source)
- //
http://jira.jboss.org/jira/browse/JBXB-100
- protected static String sourceToString(Source source)
- {
- String xmlFragment = null;
- try
- {
- if (source instanceof DOMSource)
- {
- Node node = ((DOMSource)source).getNode();
- xmlFragment = DOMWriter.printNode(node, false);
- }
- else
- {
- // Note, this code will not handler namespaces correctly that
- // are defined on a parent of the DOMSource
- //
- // <env:Envelope
xmlns:xsd='http://www.w3.org/2001/XMLSchema'>
- // <env:Body>
- // <myMethod>
- // <param xsi:type='xsd:string'>Hello
World!</param>
- // </myMethod>
- // </env:Body>
- // </env:Envelope>
- //
- TransformerFactory tf = TransformerFactory.newInstance();
- ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);
- StreamResult streamResult = new StreamResult(baos);
- tf.newTransformer().transform(source, streamResult);
- xmlFragment = new String(baos.toByteArray());
- if (xmlFragment.startsWith("<?xml"))
- {
- int index = xmlFragment.indexOf(">");
- xmlFragment = xmlFragment.substring(index + 1);
- }
- }
- }
- catch (TransformerException e)
- {
- WSException.rethrow(e);
- }
-
- return xmlFragment;
- }
-
- /** Unwrap the value string from the XML fragment
- *
- * @return The value string or null if the startTag contains a xsi:nil='true'
attribute
- */
- protected String unwrapValueStr(String xmlFragment)
- {
- // We only scan for :nil if the xmlFragment is an empty element
- if (isEmptyElement(xmlFragment))
- {
- return (isNil(xmlFragment) ? null : "");
- }
-
- int endOfStartTag = xmlFragment.indexOf(">");
- int startOfEndTag = xmlFragment.lastIndexOf("</");
- if (endOfStartTag < 0 || startOfEndTag < 0)
- throw new IllegalArgumentException("Invalid XML fragment: " +
xmlFragment);
-
- String valueStr = xmlFragment.substring(endOfStartTag + 1, startOfEndTag);
-
- return XMLPredefinedEntityReferenceResolver.resolve(valueStr);
- }
-
- protected boolean isEmptyElement(String xmlFragment)
- {
- return xmlFragment.startsWith("<") &&
xmlFragment.endsWith("/>");
- }
-
- protected boolean isNil(String xmlFragment)
- {
- boolean isNil = false;
- if (isEmptyElement(xmlFragment))
- {
- int endOfStartTag = xmlFragment.indexOf(">");
- String startTag = xmlFragment.substring(0, endOfStartTag);
- isNil = startTag.indexOf(":nil='1'") > 0 ||
startTag.indexOf(":nil=\"1\"") > 0;
- isNil = isNil || startTag.indexOf(":nil='true'") > 0 ||
startTag.indexOf(":nil=\"true\"") > 0;
- }
- return isNil;
- }
-
- public String getMechanismType()
- {
- throw new NotImplementedException();
- }
-}
Modified:
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/ElementDeserializer.java
===================================================================
---
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/ElementDeserializer.java 2007-06-26
19:46:25 UTC (rev 3732)
+++
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/ElementDeserializer.java 2007-06-26
21:03:20 UTC (rev 3733)
@@ -27,6 +27,9 @@
import javax.xml.transform.Source;
import org.jboss.logging.Logger;
+import org.jboss.ws.core.binding.BindingException;
+import org.jboss.ws.core.binding.DeserializerSupport;
+import org.jboss.ws.core.binding.SerializationContext;
import org.jboss.wsf.spi.utils.DOMUtils;
import org.w3c.dom.Element;
Modified:
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/ElementDeserializerFactory.java
===================================================================
---
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/ElementDeserializerFactory.java 2007-06-26
19:46:25 UTC (rev 3732)
+++
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/ElementDeserializerFactory.java 2007-06-26
21:03:20 UTC (rev 3733)
@@ -21,7 +21,10 @@
*/
package org.jboss.ws.core.jaxrpc.binding;
+import org.jboss.ws.core.binding.AbstractDeserializerFactory;
+import org.jboss.ws.core.binding.DeserializerSupport;
+
// $Id$
@@ -31,7 +34,7 @@
* @author Thomas.Diesler(a)jboss.org
* @since 18-Oct-2004
*/
-public class ElementDeserializerFactory extends DeserializerFactoryBase
+public class ElementDeserializerFactory extends AbstractDeserializerFactory
{
public DeserializerSupport getDeserializer()
{
Modified:
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/ElementSerializer.java
===================================================================
---
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/ElementSerializer.java 2007-06-26
19:46:25 UTC (rev 3732)
+++
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/ElementSerializer.java 2007-06-26
21:03:20 UTC (rev 3733)
@@ -27,6 +27,10 @@
import javax.xml.transform.Result;
import org.jboss.logging.Logger;
+import org.jboss.ws.core.binding.BindingException;
+import org.jboss.ws.core.binding.BufferedStreamResult;
+import org.jboss.ws.core.binding.SerializationContext;
+import org.jboss.ws.core.binding.SerializerSupport;
import org.jboss.wsf.spi.utils.DOMWriter;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
Modified:
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/ElementSerializerFactory.java
===================================================================
---
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/ElementSerializerFactory.java 2007-06-26
19:46:25 UTC (rev 3732)
+++
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/ElementSerializerFactory.java 2007-06-26
21:03:20 UTC (rev 3733)
@@ -21,7 +21,10 @@
*/
package org.jboss.ws.core.jaxrpc.binding;
+import org.jboss.ws.core.binding.AbstractSerializerFactory;
+import org.jboss.ws.core.binding.SerializerSupport;
+
// $Id$
/**
@@ -30,7 +33,7 @@
* @author Thomas.Diesler(a)jboss.org
* @since 23-Jun-2005
*/
-public class ElementSerializerFactory extends SerializerFactoryBase
+public class ElementSerializerFactory extends AbstractSerializerFactory
{
public SerializerSupport getSerializer()
{
Modified:
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/HexDeserializer.java
===================================================================
---
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/HexDeserializer.java 2007-06-26
19:46:25 UTC (rev 3732)
+++
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/HexDeserializer.java 2007-06-26
21:03:20 UTC (rev 3733)
@@ -27,6 +27,9 @@
import javax.xml.transform.Source;
import org.jboss.logging.Logger;
+import org.jboss.ws.core.binding.BindingException;
+import org.jboss.ws.core.binding.DeserializerSupport;
+import org.jboss.ws.core.binding.SerializationContext;
import org.jboss.xb.binding.SimpleTypeBindings;
/**
Modified:
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/HexDeserializerFactory.java
===================================================================
---
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/HexDeserializerFactory.java 2007-06-26
19:46:25 UTC (rev 3732)
+++
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/HexDeserializerFactory.java 2007-06-26
21:03:20 UTC (rev 3733)
@@ -21,7 +21,10 @@
*/
package org.jboss.ws.core.jaxrpc.binding;
+import org.jboss.ws.core.binding.AbstractDeserializerFactory;
+import org.jboss.ws.core.binding.DeserializerSupport;
+
// $Id$
@@ -31,7 +34,7 @@
* @author Thomas.Diesler(a)jboss.org
* @since 04-Dec-2004
*/
-public class HexDeserializerFactory extends DeserializerFactoryBase
+public class HexDeserializerFactory extends AbstractDeserializerFactory
{
public DeserializerSupport getDeserializer()
{
Modified:
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/HexSerializer.java
===================================================================
---
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/HexSerializer.java 2007-06-26
19:46:25 UTC (rev 3732)
+++
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/HexSerializer.java 2007-06-26
21:03:20 UTC (rev 3733)
@@ -27,6 +27,10 @@
import javax.xml.transform.Result;
import org.jboss.logging.Logger;
+import org.jboss.ws.core.binding.BindingException;
+import org.jboss.ws.core.binding.BufferedStreamResult;
+import org.jboss.ws.core.binding.SerializationContext;
+import org.jboss.ws.core.binding.SerializerSupport;
import org.jboss.wsf.spi.utils.JavaUtils;
import org.jboss.xb.binding.NamespaceRegistry;
import org.jboss.xb.binding.SimpleTypeBindings;
Modified:
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/HexSerializerFactory.java
===================================================================
---
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/HexSerializerFactory.java 2007-06-26
19:46:25 UTC (rev 3732)
+++
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/HexSerializerFactory.java 2007-06-26
21:03:20 UTC (rev 3733)
@@ -21,7 +21,10 @@
*/
package org.jboss.ws.core.jaxrpc.binding;
+import org.jboss.ws.core.binding.AbstractSerializerFactory;
+import org.jboss.ws.core.binding.SerializerSupport;
+
// $Id$
@@ -31,7 +34,7 @@
* @author Thomas.Diesler(a)jboss.org
* @since 04-Dec-2004
*/
-public class HexSerializerFactory extends SerializerFactoryBase
+public class HexSerializerFactory extends AbstractSerializerFactory
{
public SerializerSupport getSerializer()
{
Modified:
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/JBossXBDeserializer.java
===================================================================
---
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/JBossXBDeserializer.java 2007-06-26
19:46:25 UTC (rev 3732)
+++
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/JBossXBDeserializer.java 2007-06-26
21:03:20 UTC (rev 3733)
@@ -30,6 +30,9 @@
import org.apache.xerces.xs.XSModel;
import org.jboss.logging.Logger;
+import org.jboss.ws.core.binding.BindingException;
+import org.jboss.ws.core.binding.ComplexTypeDeserializer;
+import org.jboss.ws.core.binding.SerializationContext;
import org.jboss.ws.core.jaxrpc.SerializationContextJAXRPC;
import org.jboss.ws.core.jaxrpc.binding.jbossxb.JBossXBConstants;
import org.jboss.ws.core.jaxrpc.binding.jbossxb.JBossXBUnmarshaller;
Modified:
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/JBossXBDeserializerFactory.java
===================================================================
---
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/JBossXBDeserializerFactory.java 2007-06-26
19:46:25 UTC (rev 3732)
+++
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/JBossXBDeserializerFactory.java 2007-06-26
21:03:20 UTC (rev 3733)
@@ -21,7 +21,11 @@
*/
package org.jboss.ws.core.jaxrpc.binding;
+import org.jboss.ws.core.binding.BindingException;
+import org.jboss.ws.core.binding.AbstractDeserializerFactory;
+import org.jboss.ws.core.binding.DeserializerSupport;
+
// $Id$
/**
@@ -31,7 +35,7 @@
* @author Thomas.Diesler(a)jboss.org
* @since 04-Dec-2004
*/
-public class JBossXBDeserializerFactory extends DeserializerFactoryBase
+public class JBossXBDeserializerFactory extends AbstractDeserializerFactory
{
public DeserializerSupport getDeserializer() throws BindingException
{
Modified:
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/JBossXBSerializer.java
===================================================================
---
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/JBossXBSerializer.java 2007-06-26
19:46:25 UTC (rev 3732)
+++
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/JBossXBSerializer.java 2007-06-26
21:03:20 UTC (rev 3733)
@@ -31,6 +31,10 @@
import org.apache.xerces.xs.XSModel;
import org.jboss.logging.Logger;
+import org.jboss.ws.core.binding.BindingException;
+import org.jboss.ws.core.binding.BufferedStreamResult;
+import org.jboss.ws.core.binding.ComplexTypeSerializer;
+import org.jboss.ws.core.binding.SerializationContext;
import org.jboss.ws.core.jaxrpc.SerializationContextJAXRPC;
import org.jboss.ws.core.jaxrpc.binding.jbossxb.JBossXBConstants;
import org.jboss.ws.core.jaxrpc.binding.jbossxb.JBossXBMarshaller;
Modified:
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/JBossXBSerializerFactory.java
===================================================================
---
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/JBossXBSerializerFactory.java 2007-06-26
19:46:25 UTC (rev 3732)
+++
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/JBossXBSerializerFactory.java 2007-06-26
21:03:20 UTC (rev 3733)
@@ -21,7 +21,11 @@
*/
package org.jboss.ws.core.jaxrpc.binding;
+import org.jboss.ws.core.binding.BindingException;
+import org.jboss.ws.core.binding.AbstractSerializerFactory;
+import org.jboss.ws.core.binding.SerializerSupport;
+
// $Id$
@@ -32,7 +36,7 @@
* @author Thomas.Diesler(a)jboss.org
* @since 04-Dec-2004
*/
-public class JBossXBSerializerFactory extends SerializerFactoryBase
+public class JBossXBSerializerFactory extends AbstractSerializerFactory
{
public SerializerSupport getSerializer() throws BindingException
{
Modified:
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/NullValueSerializer.java
===================================================================
---
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/NullValueSerializer.java 2007-06-26
19:46:25 UTC (rev 3732)
+++
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/NullValueSerializer.java 2007-06-26
21:03:20 UTC (rev 3733)
@@ -28,6 +28,10 @@
import org.jboss.logging.Logger;
import org.jboss.ws.Constants;
+import org.jboss.ws.core.binding.BindingException;
+import org.jboss.ws.core.binding.BufferedStreamResult;
+import org.jboss.ws.core.binding.SerializationContext;
+import org.jboss.ws.core.binding.SerializerSupport;
import org.jboss.xb.binding.NamespaceRegistry;
import org.w3c.dom.NamedNodeMap;
Modified:
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/QNameDeserializer.java
===================================================================
---
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/QNameDeserializer.java 2007-06-26
19:46:25 UTC (rev 3732)
+++
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/QNameDeserializer.java 2007-06-26
21:03:20 UTC (rev 3733)
@@ -29,6 +29,9 @@
import javax.xml.transform.Source;
import org.jboss.logging.Logger;
+import org.jboss.ws.core.binding.BindingException;
+import org.jboss.ws.core.binding.DeserializerSupport;
+import org.jboss.ws.core.binding.SerializationContext;
import org.jboss.wsf.spi.utils.DOMUtils;
import org.jboss.xb.binding.NamespaceRegistry;
import org.jboss.xb.binding.SimpleTypeBindings;
Modified:
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/QNameDeserializerFactory.java
===================================================================
---
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/QNameDeserializerFactory.java 2007-06-26
19:46:25 UTC (rev 3732)
+++
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/QNameDeserializerFactory.java 2007-06-26
21:03:20 UTC (rev 3733)
@@ -21,7 +21,10 @@
*/
package org.jboss.ws.core.jaxrpc.binding;
+import org.jboss.ws.core.binding.AbstractDeserializerFactory;
+import org.jboss.ws.core.binding.DeserializerSupport;
+
// $Id$
@@ -29,7 +32,7 @@
* @author Thomas.Diesler(a)jboss.org
* @since 04-Dec-2004
*/
-public class QNameDeserializerFactory extends DeserializerFactoryBase
+public class QNameDeserializerFactory extends AbstractDeserializerFactory
{
public DeserializerSupport getDeserializer()
{
Modified:
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/QNameSerializer.java
===================================================================
---
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/QNameSerializer.java 2007-06-26
19:46:25 UTC (rev 3732)
+++
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/QNameSerializer.java 2007-06-26
21:03:20 UTC (rev 3733)
@@ -30,6 +30,10 @@
import javax.xml.transform.Result;
import org.jboss.logging.Logger;
+import org.jboss.ws.core.binding.BindingException;
+import org.jboss.ws.core.binding.BufferedStreamResult;
+import org.jboss.ws.core.binding.SerializationContext;
+import org.jboss.ws.core.binding.SerializerSupport;
import org.jboss.xb.binding.NamespaceRegistry;
import org.jboss.xb.binding.SimpleTypeBindings;
import org.w3c.dom.NamedNodeMap;
Modified:
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/QNameSerializerFactory.java
===================================================================
---
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/QNameSerializerFactory.java 2007-06-26
19:46:25 UTC (rev 3732)
+++
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/QNameSerializerFactory.java 2007-06-26
21:03:20 UTC (rev 3733)
@@ -21,7 +21,10 @@
*/
package org.jboss.ws.core.jaxrpc.binding;
+import org.jboss.ws.core.binding.AbstractSerializerFactory;
+import org.jboss.ws.core.binding.SerializerSupport;
+
// $Id$
@@ -31,7 +34,7 @@
* @author Thomas.Diesler(a)jboss.org
* @since 04-Dec-2004
*/
-public class QNameSerializerFactory extends SerializerFactoryBase
+public class QNameSerializerFactory extends AbstractSerializerFactory
{
public SerializerSupport getSerializer()
{
Modified:
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/SOAPArrayDeserializer.java
===================================================================
---
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/SOAPArrayDeserializer.java 2007-06-26
19:46:25 UTC (rev 3732)
+++
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/SOAPArrayDeserializer.java 2007-06-26
21:03:20 UTC (rev 3733)
@@ -35,7 +35,11 @@
import org.jboss.logging.Logger;
import org.jboss.ws.Constants;
import org.jboss.ws.WSException;
-import org.jboss.ws.core.jaxrpc.TypeMappingImpl;
+import org.jboss.ws.core.binding.BindingException;
+import org.jboss.ws.core.binding.AbstractDeserializerFactory;
+import org.jboss.ws.core.binding.DeserializerSupport;
+import org.jboss.ws.core.binding.SerializationContext;
+import org.jboss.ws.core.binding.TypeMappingImpl;
import org.jboss.ws.metadata.umdm.ParameterMetaData;
import org.jboss.wsf.spi.utils.DOMUtils;
import org.jboss.wsf.spi.utils.JavaUtils;
@@ -78,11 +82,11 @@
Object[] retArray = (Object[])Array.newInstance(compJavaType, arrDims);
TypeMappingImpl typeMapping = serContext.getTypeMapping();
- DeserializerFactoryBase compDeserializerFactory =
(DeserializerFactoryBase)typeMapping.getDeserializer(compJavaType, compXmlType);
+ AbstractDeserializerFactory compDeserializerFactory =
(AbstractDeserializerFactory)typeMapping.getDeserializer(compJavaType, compXmlType);
if (compDeserializerFactory == null)
{
log.warn("Cannot obtain component deserializer for: [javaType=" +
compJavaType.getName() + ",xmlType=" + compXmlType + "]");
- compDeserializerFactory =
(DeserializerFactoryBase)typeMapping.getDeserializer(null, compXmlType);
+ compDeserializerFactory =
(AbstractDeserializerFactory)typeMapping.getDeserializer(null, compXmlType);
}
if (compDeserializerFactory == null)
Modified:
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/SOAPArrayDeserializerFactory.java
===================================================================
---
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/SOAPArrayDeserializerFactory.java 2007-06-26
19:46:25 UTC (rev 3732)
+++
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/SOAPArrayDeserializerFactory.java 2007-06-26
21:03:20 UTC (rev 3733)
@@ -21,7 +21,11 @@
*/
package org.jboss.ws.core.jaxrpc.binding;
+import org.jboss.ws.core.binding.BindingException;
+import org.jboss.ws.core.binding.AbstractDeserializerFactory;
+import org.jboss.ws.core.binding.DeserializerSupport;
+
// $Id$
/**
@@ -30,7 +34,7 @@
* @author Thomas.Diesler(a)jboss.org
* @since 31-Oct-2005
*/
-public class SOAPArrayDeserializerFactory extends DeserializerFactoryBase
+public class SOAPArrayDeserializerFactory extends AbstractDeserializerFactory
{
public DeserializerSupport getDeserializer() throws BindingException
{
Modified:
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/SOAPArraySerializer.java
===================================================================
---
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/SOAPArraySerializer.java 2007-06-26
19:46:25 UTC (rev 3732)
+++
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/SOAPArraySerializer.java 2007-06-26
21:03:20 UTC (rev 3733)
@@ -29,7 +29,12 @@
import org.jboss.logging.Logger;
import org.jboss.ws.Constants;
import org.jboss.ws.WSException;
-import org.jboss.ws.core.jaxrpc.TypeMappingImpl;
+import org.jboss.ws.core.binding.BindingException;
+import org.jboss.ws.core.binding.BufferedStreamResult;
+import org.jboss.ws.core.binding.SerializationContext;
+import org.jboss.ws.core.binding.AbstractSerializerFactory;
+import org.jboss.ws.core.binding.SerializerSupport;
+import org.jboss.ws.core.binding.TypeMappingImpl;
import org.jboss.ws.core.soap.NameImpl;
import org.jboss.ws.core.soap.SOAPContentElement;
import org.jboss.ws.core.soap.XMLFragment;
@@ -101,11 +106,11 @@
// Get the component type serializer factory
log.debug("Get component serializer for: [javaType=" +
compJavaType.getName() + ",xmlType=" + compXmlType + "]");
- SerializerFactoryBase compSerializerFactory =
(SerializerFactoryBase)typeMapping.getSerializer(compJavaType, compXmlType);
+ AbstractSerializerFactory compSerializerFactory =
(AbstractSerializerFactory)typeMapping.getSerializer(compJavaType, compXmlType);
if (compSerializerFactory == null)
{
log.warn("Cannot obtain component serializer for: [javaType=" +
compJavaType.getName() + ",xmlType=" + compXmlType + "]");
- compSerializerFactory =
(SerializerFactoryBase)typeMapping.getSerializer(null, compXmlType);
+ compSerializerFactory =
(AbstractSerializerFactory)typeMapping.getSerializer(null, compXmlType);
}
if (compSerializerFactory == null)
throw new WSException("Cannot obtain component serializer for: " +
compXmlType);
Modified:
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/SOAPArraySerializerFactory.java
===================================================================
---
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/SOAPArraySerializerFactory.java 2007-06-26
19:46:25 UTC (rev 3732)
+++
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/SOAPArraySerializerFactory.java 2007-06-26
21:03:20 UTC (rev 3733)
@@ -21,7 +21,11 @@
*/
package org.jboss.ws.core.jaxrpc.binding;
+import org.jboss.ws.core.binding.BindingException;
+import org.jboss.ws.core.binding.AbstractSerializerFactory;
+import org.jboss.ws.core.binding.SerializerSupport;
+
// $Id$
@@ -31,7 +35,7 @@
* @author Thomas.Diesler(a)jboss.org
* @since 31-Oct-2005
*/
-public class SOAPArraySerializerFactory extends SerializerFactoryBase
+public class SOAPArraySerializerFactory extends AbstractSerializerFactory
{
public SerializerSupport getSerializer() throws BindingException
{
Modified:
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/SOAPElementDeserializer.java
===================================================================
---
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/SOAPElementDeserializer.java 2007-06-26
19:46:25 UTC (rev 3732)
+++
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/SOAPElementDeserializer.java 2007-06-26
21:03:20 UTC (rev 3733)
@@ -28,6 +28,9 @@
import javax.xml.transform.Source;
import org.jboss.logging.Logger;
+import org.jboss.ws.core.binding.BindingException;
+import org.jboss.ws.core.binding.DeserializerSupport;
+import org.jboss.ws.core.binding.SerializationContext;
import org.jboss.ws.core.soap.SOAPFactoryImpl;
import org.jboss.wsf.spi.utils.DOMUtils;
import org.w3c.dom.Element;
Modified:
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/SOAPElementDeserializerFactory.java
===================================================================
---
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/SOAPElementDeserializerFactory.java 2007-06-26
19:46:25 UTC (rev 3732)
+++
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/SOAPElementDeserializerFactory.java 2007-06-26
21:03:20 UTC (rev 3733)
@@ -21,7 +21,10 @@
*/
package org.jboss.ws.core.jaxrpc.binding;
+import org.jboss.ws.core.binding.AbstractDeserializerFactory;
+import org.jboss.ws.core.binding.DeserializerSupport;
+
// $Id$
@@ -31,7 +34,7 @@
* @author Thomas.Diesler(a)jboss.org
* @since 18-Oct-2004
*/
-public class SOAPElementDeserializerFactory extends DeserializerFactoryBase
+public class SOAPElementDeserializerFactory extends AbstractDeserializerFactory
{
public DeserializerSupport getDeserializer()
{
Modified:
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/SOAPElementSerializer.java
===================================================================
---
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/SOAPElementSerializer.java 2007-06-26
19:46:25 UTC (rev 3732)
+++
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/SOAPElementSerializer.java 2007-06-26
21:03:20 UTC (rev 3733)
@@ -28,6 +28,10 @@
import javax.xml.transform.Result;
import org.jboss.logging.Logger;
+import org.jboss.ws.core.binding.BindingException;
+import org.jboss.ws.core.binding.BufferedStreamResult;
+import org.jboss.ws.core.binding.SerializationContext;
+import org.jboss.ws.core.binding.SerializerSupport;
import org.jboss.wsf.spi.utils.DOMWriter;
import org.w3c.dom.NamedNodeMap;
Modified:
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/SOAPElementSerializerFactory.java
===================================================================
---
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/SOAPElementSerializerFactory.java 2007-06-26
19:46:25 UTC (rev 3732)
+++
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/SOAPElementSerializerFactory.java 2007-06-26
21:03:20 UTC (rev 3733)
@@ -21,7 +21,10 @@
*/
package org.jboss.ws.core.jaxrpc.binding;
+import org.jboss.ws.core.binding.AbstractSerializerFactory;
+import org.jboss.ws.core.binding.SerializerSupport;
+
// $Id$
/**
@@ -30,7 +33,7 @@
* @author Thomas.Diesler(a)jboss.org
* @since 23-Jun-2005
*/
-public class SOAPElementSerializerFactory extends SerializerFactoryBase
+public class SOAPElementSerializerFactory extends AbstractSerializerFactory
{
public SerializerSupport getSerializer()
{
Deleted:
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/SerializationContext.java
===================================================================
---
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/SerializationContext.java 2007-06-26
19:46:25 UTC (rev 3732)
+++
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/SerializationContext.java 2007-06-26
21:03:20 UTC (rev 3733)
@@ -1,84 +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.core.jaxrpc.binding;
-
-// $Id$
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.jboss.ws.core.jaxrpc.TypeMappingImpl;
-import org.jboss.xb.binding.NamespaceRegistry;
-
-/**
- * An abstract serialization context
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 04-Dec-2004
- */
-public abstract class SerializationContext
-{
- public static final String CONTEXT_TYPES =
"org.jboss.ws.jaxrpc.binding.contextTypes";
-
- private Class javaType;
-
- private TypeMappingImpl typeMapping;
- // The namespace registry that is valid for this serialization context
- private NamespaceRegistry namespaceRegistry = new NamespaceRegistry();
- // An arbitrary property bag
- private Map<Object, Object> properties = new HashMap<Object, Object>();
-
- public Object getProperty(Object key)
- {
- return properties.get(key);
- }
-
- public void setProperty(Object key, Object value)
- {
- properties.put(key, value);
- }
-
- public TypeMappingImpl getTypeMapping()
- {
- return typeMapping;
- }
-
- public void setTypeMapping(TypeMappingImpl typeMapping)
- {
- this.typeMapping = typeMapping;
- }
-
- public NamespaceRegistry getNamespaceRegistry()
- {
- return namespaceRegistry;
- }
-
- public Class getJavaType()
- {
- return javaType;
- }
-
- public void setJavaType(Class javaType)
- {
- this.javaType = javaType;
- }
-}
Deleted:
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/SerializerFactoryBase.java
===================================================================
---
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/SerializerFactoryBase.java 2007-06-26
19:46:25 UTC (rev 3732)
+++
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/SerializerFactoryBase.java 2007-06-26
21:03:20 UTC (rev 3733)
@@ -1,50 +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.core.jaxrpc.binding;
-
-// $Id$
-
-import java.util.Iterator;
-
-import javax.xml.rpc.encoding.Serializer;
-import javax.xml.rpc.encoding.SerializerFactory;
-
-import org.jboss.util.NotImplementedException;
-
-/**
- * @author Thomas.Diesler(a)jboss.org
- * @since 04-Dec-2004
- */
-public abstract class SerializerFactoryBase implements SerializerFactory
-{
- public abstract SerializerSupport getSerializer() throws BindingException;
-
- public Serializer getSerializerAs(String mechanismType)
- {
- throw new NotImplementedException();
- }
-
- public Iterator getSupportedMechanismTypes()
- {
- throw new NotImplementedException();
- }
-}
Deleted:
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/SerializerSupport.java
===================================================================
---
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/SerializerSupport.java 2007-06-26
19:46:25 UTC (rev 3732)
+++
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/SerializerSupport.java 2007-06-26
21:03:20 UTC (rev 3733)
@@ -1,209 +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.core.jaxrpc.binding;
-
-// $Id$
-
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-
-import javax.xml.namespace.QName;
-import javax.xml.rpc.encoding.Serializer;
-import javax.xml.transform.Result;
-
-import org.jboss.util.NotImplementedException;
-import org.jboss.ws.Constants;
-import org.jboss.ws.WSException;
-import org.jboss.ws.core.soap.SOAPContentElement;
-import org.jboss.wsf.spi.utils.IOUtils;
-import org.jboss.xb.binding.NamespaceRegistry;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-
-/**
- * The base class for all Serializers.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @author <a href="mailto:jason.greene@jboss.com">Jason T.
Greene</a>
- * @since 04-Dec-2004
- */
-public abstract class SerializerSupport implements Serializer
-{
-
- public Result serialize(SOAPContentElement soapElement, SerializationContext
serContext) throws BindingException
- {
- QName xmlName = soapElement.getElementQName();
- QName xmlType = soapElement.getXmlType();
- NamedNodeMap attributes = soapElement.getAttributes();
- Object objectValue = soapElement.getObjectValue();
- return serialize(xmlName, xmlType, objectValue, serContext, attributes);
- }
-
- /** Serialize an object value to an XML fragment
- *
- * @param xmlName The root element name of the resulting fragment
- * @param xmlType The associated schema type
- * @param value The value to serialize
- * @param serContext The serialization context
- * @param attributes The attributes on this element
- */
- public abstract Result serialize(QName xmlName, QName xmlType, Object value,
SerializationContext serContext, NamedNodeMap attributes) throws BindingException;
-
- /** Wrap the value string in a XML fragment with the given name
- */
- protected String wrapValueStr(QName xmlName, String valueStr, NamespaceRegistry
nsRegistry, Set<String> nsExtras, NamedNodeMap attributes, boolean normalize)
- {
- String xmlNameURI = xmlName.getNamespaceURI();
- String localPart = xmlName.getLocalPart();
-
- Map<String, String> namespaces = new HashMap<String, String>();
-
- StringBuilder nsAttr = new StringBuilder("");
- if (attributes != null)
- {
- for (int i = 0; i < attributes.getLength(); i++)
- {
- Node attr = attributes.item(i);
- String attrName = attr.getNodeName();
- String attrValue = attr.getNodeValue();
- nsAttr.append(" " + attrName + "='" + attrValue +
"'");
-
- if (attrName.startsWith("xmlns:"))
- {
- String prefix = attrName.substring(6);
- namespaces.put(attrValue, prefix);
- }
- }
- }
-
- String elName;
- if (xmlNameURI.length() > 0)
- {
- xmlName = nsRegistry.registerQName(xmlName);
- String prefix = xmlName.getPrefix();
- elName = prefix + ":" + localPart;
- if (namespaces.get(xmlNameURI) == null ||
!prefix.equals(namespaces.get(xmlNameURI)))
- {
- nsAttr.append(" xmlns:" + prefix + "='" + xmlNameURI
+ "'");
- namespaces.put(xmlNameURI, prefix);
- }
- }
- else
- {
- elName = localPart;
- }
-
- if (nsExtras != null)
- {
- for (String nsURI : nsExtras)
- {
- String prefix = nsRegistry.getPrefix(nsURI);
- if (namespaces.get(nsURI) == null || !prefix.equals(namespaces.get(nsURI)))
- {
- nsAttr.append(" xmlns:" + prefix + "='" + nsURI +
"'");
- namespaces.put(nsURI, prefix);
- }
- }
- }
-
- String xmlFragment;
- if (valueStr == null)
- {
- String xsins = "";
- if (namespaces.get(Constants.NS_SCHEMA_XSI) == null ||
!Constants.PREFIX_XSI.equals(namespaces.get(xmlNameURI)))
- {
- xsins = " xmlns:" + Constants.PREFIX_XSI + "='" +
Constants.NS_SCHEMA_XSI + "'";
- namespaces.put(Constants.NS_SCHEMA_XSI, Constants.PREFIX_XSI);
- }
-
- xmlFragment = "<" + elName + nsAttr + " " +
Constants.PREFIX_XSI + ":nil='1'" + xsins + "/>";
- }
- else
- {
- if (normalize)
- valueStr = normalize(valueStr);
-
- xmlFragment = "<" + elName + nsAttr + ">" + valueStr +
"</" + elName + ">";
- }
-
- return xmlFragment;
- }
-
- public String getMechanismType()
- {
- throw new NotImplementedException();
- }
-
- private String normalize(String valueStr)
- {
- // We assume most strings will not contain characters that need
"escaping",
- // and optimize for this case.
- boolean found = false;
- int i = 0;
-
- outer: for (; i < valueStr.length(); i++)
- {
- switch (valueStr.charAt(i))
- {
- case '<':
- case '>':
- case '&':
- case '"':
- found = true;
- break outer;
- }
- }
-
- if (!found)
- return valueStr;
-
- // Resume where we left off
- StringBuilder builder = new StringBuilder();
- builder.append(valueStr.substring(0, i));
- for (; i < valueStr.length(); i++)
- {
- char c = valueStr.charAt(i);
- switch (c)
- {
- case '<':
- builder.append("<");
- break;
- case '>':
- builder.append(">");
- break;
- case '&':
- builder.append("&");
- break;
- case '"':
- builder.append(""");
- break;
- default:
- builder.append(c);
- }
- }
-
- return builder.toString();
- }
-}
\ No newline at end of file
Modified:
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/SimpleDeserializer.java
===================================================================
---
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/SimpleDeserializer.java 2007-06-26
19:46:25 UTC (rev 3732)
+++
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/SimpleDeserializer.java 2007-06-26
21:03:20 UTC (rev 3733)
@@ -27,6 +27,9 @@
import javax.xml.transform.Source;
import org.jboss.logging.Logger;
+import org.jboss.ws.core.binding.BindingException;
+import org.jboss.ws.core.binding.DeserializerSupport;
+import org.jboss.ws.core.binding.SerializationContext;
import org.jboss.xb.binding.SimpleTypeBindings;
/**
Modified:
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/SimpleDeserializerFactory.java
===================================================================
---
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/SimpleDeserializerFactory.java 2007-06-26
19:46:25 UTC (rev 3732)
+++
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/SimpleDeserializerFactory.java 2007-06-26
21:03:20 UTC (rev 3733)
@@ -21,7 +21,10 @@
*/
package org.jboss.ws.core.jaxrpc.binding;
+import org.jboss.ws.core.binding.AbstractDeserializerFactory;
+import org.jboss.ws.core.binding.DeserializerSupport;
+
// $Id$
@@ -31,7 +34,7 @@
* @author Thomas.Diesler(a)jboss.org
* @since 18-Oct-2004
*/
-public class SimpleDeserializerFactory extends DeserializerFactoryBase
+public class SimpleDeserializerFactory extends AbstractDeserializerFactory
{
public DeserializerSupport getDeserializer()
{
Modified:
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/SimpleSerializer.java
===================================================================
---
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/SimpleSerializer.java 2007-06-26
19:46:25 UTC (rev 3732)
+++
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/SimpleSerializer.java 2007-06-26
21:03:20 UTC (rev 3733)
@@ -28,6 +28,10 @@
import org.jboss.logging.Logger;
import org.jboss.util.NotImplementedException;
+import org.jboss.ws.core.binding.BindingException;
+import org.jboss.ws.core.binding.BufferedStreamResult;
+import org.jboss.ws.core.binding.SerializationContext;
+import org.jboss.ws.core.binding.SerializerSupport;
import org.jboss.xb.binding.NamespaceRegistry;
import org.jboss.xb.binding.SimpleTypeBindings;
import org.w3c.dom.NamedNodeMap;
Modified:
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/SimpleSerializerFactory.java
===================================================================
---
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/SimpleSerializerFactory.java 2007-06-26
19:46:25 UTC (rev 3732)
+++
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/SimpleSerializerFactory.java 2007-06-26
21:03:20 UTC (rev 3733)
@@ -21,7 +21,10 @@
*/
package org.jboss.ws.core.jaxrpc.binding;
+import org.jboss.ws.core.binding.AbstractSerializerFactory;
+import org.jboss.ws.core.binding.SerializerSupport;
+
// $Id$
@@ -31,7 +34,7 @@
* @author Thomas.Diesler(a)jboss.org
* @since 18-Oct-2004
*/
-public class SimpleSerializerFactory extends SerializerFactoryBase
+public class SimpleSerializerFactory extends AbstractSerializerFactory
{
public SerializerSupport getSerializer()
{
Modified:
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/client/CallImpl.java
===================================================================
---
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/client/CallImpl.java 2007-06-26
19:46:25 UTC (rev 3732)
+++
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/client/CallImpl.java 2007-06-26
21:03:20 UTC (rev 3733)
@@ -52,8 +52,8 @@
import org.jboss.ws.core.CommonMessageContext;
import org.jboss.ws.core.RoleSource;
import org.jboss.ws.core.WSTimeoutException;
+import org.jboss.ws.core.binding.TypeMappingImpl;
import org.jboss.ws.core.jaxrpc.SchemaGenerator;
-import org.jboss.ws.core.jaxrpc.TypeMappingImpl;
import org.jboss.ws.core.jaxrpc.UnqualifiedCallParameter;
import org.jboss.ws.core.jaxrpc.binding.JBossXBDeserializerFactory;
import org.jboss.ws.core.jaxrpc.binding.JBossXBSerializerFactory;
Modified:
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/handler/MessageContextJAXRPC.java
===================================================================
---
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/handler/MessageContextJAXRPC.java 2007-06-26
19:46:25 UTC (rev 3732)
+++
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/handler/MessageContextJAXRPC.java 2007-06-26
21:03:20 UTC (rev 3733)
@@ -32,8 +32,8 @@
import org.jboss.logging.Logger;
import org.jboss.ws.core.CommonMessageContext;
+import org.jboss.ws.core.binding.SerializationContext;
import org.jboss.ws.core.jaxrpc.SerializationContextJAXRPC;
-import org.jboss.ws.core.jaxrpc.binding.SerializationContext;
import org.jboss.ws.metadata.umdm.EndpointMetaData;
import org.jboss.ws.metadata.umdm.ServiceMetaData;
import org.jboss.xb.binding.NamespaceRegistry;
Modified:
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/JAXBDeserializer.java
===================================================================
---
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/JAXBDeserializer.java 2007-06-26
19:46:25 UTC (rev 3732)
+++
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/JAXBDeserializer.java 2007-06-26
21:03:20 UTC (rev 3733)
@@ -32,10 +32,10 @@
import javax.xml.ws.WebServiceException;
import org.jboss.logging.Logger;
-import org.jboss.ws.core.jaxrpc.TypeMappingImpl;
-import org.jboss.ws.core.jaxrpc.binding.BindingException;
-import org.jboss.ws.core.jaxrpc.binding.ComplexTypeDeserializer;
-import org.jboss.ws.core.jaxrpc.binding.SerializationContext;
+import org.jboss.ws.core.binding.BindingException;
+import org.jboss.ws.core.binding.ComplexTypeDeserializer;
+import org.jboss.ws.core.binding.SerializationContext;
+import org.jboss.ws.core.binding.TypeMappingImpl;
import org.jboss.ws.extensions.xop.jaxws.AttachmentUnmarshallerImpl;
/**
@@ -60,7 +60,7 @@
Object value = null;
try
{
- Class[] javaTypes =
(Class[])serContext.getProperty(SerializationContext.CONTEXT_TYPES);
+ Class[] javaTypes =
(Class[])serContext.getProperty(SerializationContextJAXWS.JAXB_CONTEXT_TYPES);
TypeMappingImpl typeMapping = serContext.getTypeMapping();
Class javaType = typeMapping.getJavaType(xmlType);
Modified:
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/JAXBDeserializerFactory.java
===================================================================
---
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/JAXBDeserializerFactory.java 2007-06-26
19:46:25 UTC (rev 3732)
+++
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/JAXBDeserializerFactory.java 2007-06-26
21:03:20 UTC (rev 3733)
@@ -21,9 +21,9 @@
*/
package org.jboss.ws.core.jaxws;
-import org.jboss.ws.core.jaxrpc.binding.BindingException;
-import org.jboss.ws.core.jaxrpc.binding.DeserializerFactoryBase;
-import org.jboss.ws.core.jaxrpc.binding.DeserializerSupport;
+import org.jboss.ws.core.binding.BindingException;
+import org.jboss.ws.core.binding.AbstractDeserializerFactory;
+import org.jboss.ws.core.binding.DeserializerSupport;
// $Id$
@@ -34,7 +34,7 @@
* @author Thomas.Diesler(a)jboss.org
* @since 04-Dec-2004
*/
-public class JAXBDeserializerFactory extends DeserializerFactoryBase
+public class JAXBDeserializerFactory extends AbstractDeserializerFactory
{
public DeserializerSupport getDeserializer() throws BindingException
{
Modified:
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/JAXBSerializer.java
===================================================================
---
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/JAXBSerializer.java 2007-06-26
19:46:25 UTC (rev 3732)
+++
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/JAXBSerializer.java 2007-06-26
21:03:20 UTC (rev 3733)
@@ -32,10 +32,10 @@
import javax.xml.ws.WebServiceException;
import org.jboss.logging.Logger;
-import org.jboss.ws.core.jaxrpc.binding.BindingException;
-import org.jboss.ws.core.jaxrpc.binding.BufferedStreamResult;
-import org.jboss.ws.core.jaxrpc.binding.ComplexTypeSerializer;
-import org.jboss.ws.core.jaxrpc.binding.SerializationContext;
+import org.jboss.ws.core.binding.BindingException;
+import org.jboss.ws.core.binding.BufferedStreamResult;
+import org.jboss.ws.core.binding.ComplexTypeSerializer;
+import org.jboss.ws.core.binding.SerializationContext;
import org.jboss.ws.extensions.xop.jaxws.AttachmentMarshallerImpl;
import org.jboss.ws.metadata.umdm.ParameterMetaData;
import org.w3c.dom.NamedNodeMap;
Modified:
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/JAXBSerializerFactory.java
===================================================================
---
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/JAXBSerializerFactory.java 2007-06-26
19:46:25 UTC (rev 3732)
+++
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/JAXBSerializerFactory.java 2007-06-26
21:03:20 UTC (rev 3733)
@@ -21,9 +21,9 @@
*/
package org.jboss.ws.core.jaxws;
-import org.jboss.ws.core.jaxrpc.binding.BindingException;
-import org.jboss.ws.core.jaxrpc.binding.SerializerFactoryBase;
-import org.jboss.ws.core.jaxrpc.binding.SerializerSupport;
+import org.jboss.ws.core.binding.BindingException;
+import org.jboss.ws.core.binding.AbstractSerializerFactory;
+import org.jboss.ws.core.binding.SerializerSupport;
// $Id$
@@ -35,7 +35,7 @@
* @author Thomas.Diesler(a)jboss.org
* @since 04-Dec-2004
*/
-public class JAXBSerializerFactory extends SerializerFactoryBase
+public class JAXBSerializerFactory extends AbstractSerializerFactory
{
public SerializerSupport getSerializer() throws BindingException
{
Modified:
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/SOAPFaultHelperJAXWS.java
===================================================================
---
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/SOAPFaultHelperJAXWS.java 2007-06-26
19:46:25 UTC (rev 3732)
+++
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/SOAPFaultHelperJAXWS.java 2007-06-26
21:03:20 UTC (rev 3733)
@@ -36,13 +36,13 @@
import org.jboss.ws.Constants;
import org.jboss.ws.core.CommonMessageContext;
import org.jboss.ws.core.CommonSOAPFaultException;
+import org.jboss.ws.core.binding.BindingException;
+import org.jboss.ws.core.binding.AbstractDeserializerFactory;
+import org.jboss.ws.core.binding.DeserializerSupport;
+import org.jboss.ws.core.binding.SerializationContext;
+import org.jboss.ws.core.binding.AbstractSerializerFactory;
+import org.jboss.ws.core.binding.SerializerSupport;
import org.jboss.ws.core.jaxrpc.SOAPFaultHelperJAXRPC;
-import org.jboss.ws.core.jaxrpc.binding.BindingException;
-import org.jboss.ws.core.jaxrpc.binding.DeserializerFactoryBase;
-import org.jboss.ws.core.jaxrpc.binding.DeserializerSupport;
-import org.jboss.ws.core.jaxrpc.binding.SerializationContext;
-import org.jboss.ws.core.jaxrpc.binding.SerializerFactoryBase;
-import org.jboss.ws.core.jaxrpc.binding.SerializerSupport;
import org.jboss.ws.core.soap.MessageContextAssociation;
import org.jboss.ws.core.soap.NameImpl;
import org.jboss.ws.core.soap.SOAPFactoryImpl;
@@ -92,7 +92,7 @@
Class<?> faultBeanClass = faultMetaData.getFaultBean();
// Get the deserializer from the type mapping
- DeserializerFactoryBase desFactory =
(DeserializerFactoryBase)typeMapping.getDeserializer(faultBeanClass, xmlType);
+ AbstractDeserializerFactory desFactory =
(AbstractDeserializerFactory)typeMapping.getDeserializer(faultBeanClass, xmlType);
if (desFactory == null)
throw new WebServiceException("Cannot obtain deserializer factory:
xmlType=" + xmlType + ", javaType=" + faultBeanClass);
@@ -119,7 +119,7 @@
try
{
Class[] types =
opMetaData.getEndpointMetaData().getRegisteredTypes().toArray(new Class[0]);
- serContext.setProperty(SerializationContext.CONTEXT_TYPES, types);
+ serContext.setProperty(SerializationContextJAXWS.JAXB_CONTEXT_TYPES,
types);
Source source = new DOMSource(deElement);
DeserializerSupport des =
(DeserializerSupport)desFactory.getDeserializer();
@@ -304,7 +304,7 @@
QName xmlType = faultMetaData.getXmlType();
Class javaType = faultMetaData.getFaultBean();
serContext.setJavaType(javaType);
- SerializerFactoryBase serFactory =
(SerializerFactoryBase)serContext.getTypeMapping().getSerializer(javaType, xmlType);
+ AbstractSerializerFactory serFactory =
(AbstractSerializerFactory)serContext.getTypeMapping().getSerializer(javaType, xmlType);
if (serFactory == null)
throw new WebServiceException("Cannot obtain serializer factory:
xmlType=" + xmlType + ", javaType=" + javaType);
Modified:
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/SerializationContextJAXWS.java
===================================================================
---
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/SerializationContextJAXWS.java 2007-06-26
19:46:25 UTC (rev 3732)
+++
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/SerializationContextJAXWS.java 2007-06-26
21:03:20 UTC (rev 3733)
@@ -24,7 +24,7 @@
// $Id$
import org.jboss.logging.Logger;
-import org.jboss.ws.core.jaxrpc.binding.SerializationContext;
+import org.jboss.ws.core.binding.SerializationContext;
/**
* The serialization context for JAXWS endpoints/clients
@@ -36,5 +36,6 @@
{
// provide logging
private static final Logger log = Logger.getLogger(SerializationContextJAXWS.class);
-
+
+ public static final String JAXB_CONTEXT_TYPES =
"org.jboss.ws.jaxb.context.types";
}
Modified:
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/binding/HTTPBindingJAXWS.java
===================================================================
---
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/binding/HTTPBindingJAXWS.java 2007-06-26
19:46:25 UTC (rev 3732)
+++
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/binding/HTTPBindingJAXWS.java 2007-06-26
21:03:20 UTC (rev 3733)
@@ -40,7 +40,7 @@
import org.jboss.ws.core.HTTPMessageImpl;
import org.jboss.ws.core.HeaderSource;
import org.jboss.ws.core.MessageAbstraction;
-import org.jboss.ws.core.jaxrpc.binding.BindingException;
+import org.jboss.ws.core.binding.BindingException;
import org.jboss.ws.core.soap.MessageContextAssociation;
import org.jboss.ws.core.soap.UnboundHeader;
import org.jboss.ws.metadata.umdm.OperationMetaData;
Modified:
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/binding/MessageBinding.java
===================================================================
---
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/binding/MessageBinding.java 2007-06-26
19:46:25 UTC (rev 3732)
+++
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/binding/MessageBinding.java 2007-06-26
21:03:20 UTC (rev 3733)
@@ -37,7 +37,7 @@
import org.jboss.ws.core.EndpointInvocation;
import org.jboss.ws.core.HeaderSource;
import org.jboss.ws.core.MessageAbstraction;
-import org.jboss.ws.core.jaxrpc.binding.BindingException;
+import org.jboss.ws.core.binding.BindingException;
import org.jboss.ws.core.jaxws.SOAPFaultHelperJAXWS;
import org.jboss.ws.core.jaxws.handler.SOAPMessageContextJAXWS;
import org.jboss.ws.core.soap.MessageContextAssociation;
Modified:
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/binding/PayloadBinding.java
===================================================================
---
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/binding/PayloadBinding.java 2007-06-26
19:46:25 UTC (rev 3732)
+++
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/binding/PayloadBinding.java 2007-06-26
21:03:20 UTC (rev 3733)
@@ -42,7 +42,7 @@
import org.jboss.ws.core.EndpointInvocation;
import org.jboss.ws.core.HeaderSource;
import org.jboss.ws.core.MessageAbstraction;
-import org.jboss.ws.core.jaxrpc.binding.BindingException;
+import org.jboss.ws.core.binding.BindingException;
import org.jboss.ws.core.jaxws.SOAPFaultHelperJAXWS;
import org.jboss.ws.core.jaxws.handler.SOAPMessageContextJAXWS;
import org.jboss.ws.core.soap.MessageContextAssociation;
Modified:
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/client/DispatchHTTPBinding.java
===================================================================
---
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/client/DispatchHTTPBinding.java 2007-06-26
19:46:25 UTC (rev 3732)
+++
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/client/DispatchHTTPBinding.java 2007-06-26
21:03:20 UTC (rev 3733)
@@ -26,7 +26,7 @@
import org.jboss.logging.Logger;
import org.jboss.ws.core.HTTPMessageImpl;
import org.jboss.ws.core.MessageAbstraction;
-import org.jboss.ws.core.jaxrpc.binding.BufferedStreamResult;
+import org.jboss.ws.core.binding.BufferedStreamResult;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.Marshaller;
Modified:
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/handler/MessageContextJAXWS.java
===================================================================
---
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/handler/MessageContextJAXWS.java 2007-06-26
19:46:25 UTC (rev 3732)
+++
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/handler/MessageContextJAXWS.java 2007-06-26
21:03:20 UTC (rev 3733)
@@ -27,7 +27,7 @@
import org.jboss.logging.Logger;
import org.jboss.ws.core.CommonMessageContext;
-import org.jboss.ws.core.jaxrpc.binding.SerializationContext;
+import org.jboss.ws.core.binding.SerializationContext;
import org.jboss.ws.core.jaxws.SerializationContextJAXWS;
import org.jboss.ws.core.soap.MessageContextAssociation;
import org.jboss.ws.metadata.umdm.EndpointMetaData;
Modified:
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/server/DelegatingInvocation.java
===================================================================
---
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/server/DelegatingInvocation.java 2007-06-26
19:46:25 UTC (rev 3732)
+++
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/server/DelegatingInvocation.java 2007-06-26
21:03:20 UTC (rev 3733)
@@ -30,7 +30,7 @@
import org.jboss.ws.core.CommonBinding;
import org.jboss.ws.core.CommonBindingProvider;
import org.jboss.ws.core.EndpointInvocation;
-import org.jboss.ws.core.jaxrpc.binding.BindingException;
+import org.jboss.ws.core.binding.BindingException;
import org.jboss.ws.metadata.umdm.OperationMetaData;
import org.jboss.wsf.spi.invocation.BasicEndpointInvocation;
Modified:
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/server/ServiceEndpointInvokerEJB21.java
===================================================================
---
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/server/ServiceEndpointInvokerEJB21.java 2007-06-26
19:46:25 UTC (rev 3732)
+++
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/server/ServiceEndpointInvokerEJB21.java 2007-06-26
21:03:20 UTC (rev 3733)
@@ -29,7 +29,7 @@
import org.jboss.ws.core.CommonBindingProvider;
import org.jboss.ws.core.CommonMessageContext;
import org.jboss.ws.core.EndpointInvocation;
-import org.jboss.ws.core.jaxrpc.binding.BindingException;
+import org.jboss.ws.core.binding.BindingException;
import org.jboss.ws.core.soap.MessageContextAssociation;
import org.jboss.ws.metadata.umdm.OperationMetaData;
import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
Modified:
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/soap/ObjectContent.java
===================================================================
---
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/soap/ObjectContent.java 2007-06-26
19:46:25 UTC (rev 3732)
+++
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/soap/ObjectContent.java 2007-06-26
21:03:20 UTC (rev 3733)
@@ -30,12 +30,12 @@
import org.jboss.logging.Logger;
import org.jboss.ws.WSException;
import org.jboss.ws.core.CommonMessageContext;
-import org.jboss.ws.core.jaxrpc.TypeMappingImpl;
-import org.jboss.ws.core.jaxrpc.binding.BindingException;
+import org.jboss.ws.core.binding.BindingException;
+import org.jboss.ws.core.binding.SerializationContext;
+import org.jboss.ws.core.binding.AbstractSerializerFactory;
+import org.jboss.ws.core.binding.SerializerSupport;
+import org.jboss.ws.core.binding.TypeMappingImpl;
import org.jboss.ws.core.jaxrpc.binding.NullValueSerializer;
-import org.jboss.ws.core.jaxrpc.binding.SerializationContext;
-import org.jboss.ws.core.jaxrpc.binding.SerializerFactoryBase;
-import org.jboss.ws.core.jaxrpc.binding.SerializerSupport;
import org.jboss.wsf.spi.utils.JavaUtils;
/**
@@ -148,7 +148,7 @@
SerializerSupport ser;
if (objectValue != null)
{
- SerializerFactoryBase serializerFactory = getSerializerFactory(typeMapping,
javaType, xmlType);
+ AbstractSerializerFactory serializerFactory =
getSerializerFactory(typeMapping, javaType, xmlType);
ser = (SerializerSupport)serializerFactory.getSerializer();
}
else
@@ -172,9 +172,9 @@
/**
* Get the serializer factory for a given javaType and xmlType
*/
- private SerializerFactoryBase getSerializerFactory(TypeMappingImpl typeMapping, Class
javaType, QName xmlType)
+ private AbstractSerializerFactory getSerializerFactory(TypeMappingImpl typeMapping,
Class javaType, QName xmlType)
{
- SerializerFactoryBase serializerFactory =
(SerializerFactoryBase)typeMapping.getSerializer(javaType, xmlType);
+ AbstractSerializerFactory serializerFactory =
(AbstractSerializerFactory)typeMapping.getSerializer(javaType, xmlType);
// The type mapping might contain a mapping for the array wrapper bean
if (serializerFactory == null && javaType.isArray())
@@ -188,7 +188,7 @@
Class returnType = toArrayMethod.getReturnType();
if (JavaUtils.isAssignableFrom(javaType, returnType))
{
- serializerFactory =
(SerializerFactoryBase)typeMapping.getSerializer(arrayWrapperType, xmlType);
+ serializerFactory =
(AbstractSerializerFactory)typeMapping.getSerializer(arrayWrapperType, xmlType);
}
}
catch (NoSuchMethodException e)
Modified:
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/soap/XMLContent.java
===================================================================
---
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/soap/XMLContent.java 2007-06-26
19:46:25 UTC (rev 3732)
+++
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/soap/XMLContent.java 2007-06-26
21:03:20 UTC (rev 3733)
@@ -41,11 +41,12 @@
import org.jboss.ws.Constants;
import org.jboss.ws.WSException;
import org.jboss.ws.core.CommonMessageContext;
-import org.jboss.ws.core.jaxrpc.TypeMappingImpl;
-import org.jboss.ws.core.jaxrpc.binding.BindingException;
-import org.jboss.ws.core.jaxrpc.binding.DeserializerFactoryBase;
-import org.jboss.ws.core.jaxrpc.binding.DeserializerSupport;
-import org.jboss.ws.core.jaxrpc.binding.SerializationContext;
+import org.jboss.ws.core.binding.BindingException;
+import org.jboss.ws.core.binding.AbstractDeserializerFactory;
+import org.jboss.ws.core.binding.DeserializerSupport;
+import org.jboss.ws.core.binding.SerializationContext;
+import org.jboss.ws.core.binding.TypeMappingImpl;
+import org.jboss.ws.core.jaxws.SerializationContextJAXWS;
import org.jboss.ws.core.soap.attachment.SwapableMemoryDataSource;
import org.jboss.ws.core.utils.MimeUtils;
import org.jboss.ws.extensions.xop.XOPContext;
@@ -167,13 +168,13 @@
serContext.setProperty(ParameterMetaData.class.getName(), pmd);
serContext.setJavaType(javaType);
List<Class> registeredTypes =
opMetaData.getEndpointMetaData().getRegisteredTypes();
- serContext.setProperty(SerializationContext.CONTEXT_TYPES,
registeredTypes.toArray(new Class[0]));
+ serContext.setProperty(SerializationContextJAXWS.JAXB_CONTEXT_TYPES,
registeredTypes.toArray(new Class[0]));
try
{
// Get the deserializer from the type mapping
TypeMappingImpl typeMapping = serContext.getTypeMapping();
- DeserializerFactoryBase deserializerFactory =
getDeserializerFactory(typeMapping, javaType, xmlType);
+ AbstractDeserializerFactory deserializerFactory =
getDeserializerFactory(typeMapping, javaType, xmlType);
DeserializerSupport des =
(DeserializerSupport)deserializerFactory.getDeserializer();
obj = des.deserialize(container, serContext);
@@ -255,9 +256,9 @@
}
// Get the deserializer factory for a given javaType and xmlType
- private static DeserializerFactoryBase getDeserializerFactory(TypeMappingImpl
typeMapping, Class javaType, QName xmlType)
+ private static AbstractDeserializerFactory getDeserializerFactory(TypeMappingImpl
typeMapping, Class javaType, QName xmlType)
{
- DeserializerFactoryBase deserializerFactory =
(DeserializerFactoryBase)typeMapping.getDeserializer(javaType, xmlType);
+ AbstractDeserializerFactory deserializerFactory =
(AbstractDeserializerFactory)typeMapping.getDeserializer(javaType, xmlType);
// The type mapping might contain a mapping for the array wrapper bean
if (deserializerFactory == null && javaType.isArray())
@@ -271,7 +272,7 @@
Class returnType = toArrayMethod.getReturnType();
if (JavaUtils.isAssignableFrom(javaType, returnType))
{
- deserializerFactory =
(DeserializerFactoryBase)typeMapping.getDeserializer(arrayWrapperType, xmlType);
+ deserializerFactory =
(AbstractDeserializerFactory)typeMapping.getDeserializer(arrayWrapperType, xmlType);
}
}
catch (NoSuchMethodException e)
Modified:
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/soap/XMLFragment.java
===================================================================
---
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/soap/XMLFragment.java 2007-06-26
19:46:25 UTC (rev 3732)
+++
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/soap/XMLFragment.java 2007-06-26
21:03:20 UTC (rev 3733)
@@ -41,7 +41,7 @@
import org.jboss.logging.Logger;
import org.jboss.ws.WSException;
-import org.jboss.ws.core.jaxrpc.binding.BufferedStreamResult;
+import org.jboss.ws.core.binding.BufferedStreamResult;
import org.jboss.ws.core.jaxrpc.binding.BufferedStreamSource;
import org.jboss.wsf.spi.utils.DOMUtils;
import org.jboss.wsf.spi.utils.DOMWriter;
Modified:
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCMetaDataBuilder.java
===================================================================
---
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCMetaDataBuilder.java 2007-06-26
19:46:25 UTC (rev 3732)
+++
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCMetaDataBuilder.java 2007-06-26
21:03:20 UTC (rev 3733)
@@ -37,9 +37,9 @@
import org.jboss.logging.Logger;
import org.jboss.ws.Constants;
import org.jboss.ws.WSException;
+import org.jboss.ws.core.binding.TypeMappingImpl;
import org.jboss.ws.core.jaxrpc.EncodedTypeMapping;
import org.jboss.ws.core.jaxrpc.LiteralTypeMapping;
-import org.jboss.ws.core.jaxrpc.TypeMappingImpl;
import org.jboss.ws.core.jaxrpc.TypeMappingRegistryImpl;
import org.jboss.ws.core.jaxrpc.UnqualifiedFaultException;
import org.jboss.ws.core.soap.Style;
Modified:
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/metadata/umdm/EndpointMetaData.java
===================================================================
---
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/metadata/umdm/EndpointMetaData.java 2007-06-26
19:46:25 UTC (rev 3732)
+++
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/metadata/umdm/EndpointMetaData.java 2007-06-26
21:03:20 UTC (rev 3733)
@@ -45,7 +45,7 @@
import org.jboss.ws.WSException;
import org.jboss.ws.core.CommonBindingProvider;
import org.jboss.ws.core.CommonSOAPBinding;
-import org.jboss.ws.core.jaxrpc.TypeMappingImpl;
+import org.jboss.ws.core.binding.TypeMappingImpl;
import org.jboss.ws.core.jaxrpc.binding.JBossXBDeserializerFactory;
import org.jboss.ws.core.jaxrpc.binding.JBossXBSerializerFactory;
import org.jboss.ws.core.jaxrpc.binding.SOAPArrayDeserializerFactory;
Modified:
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/metadata/umdm/ServiceMetaData.java
===================================================================
---
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/metadata/umdm/ServiceMetaData.java 2007-06-26
19:46:25 UTC (rev 3732)
+++
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/metadata/umdm/ServiceMetaData.java 2007-06-26
21:03:20 UTC (rev 3733)
@@ -38,7 +38,7 @@
import org.jboss.logging.Logger;
import org.jboss.ws.WSException;
-import org.jboss.ws.core.jaxrpc.TypeMappingImpl;
+import org.jboss.ws.core.binding.TypeMappingImpl;
import org.jboss.ws.core.jaxrpc.TypeMappingRegistryImpl;
import org.jboss.ws.core.jaxrpc.binding.jbossxb.SchemaBindingBuilder;
import org.jboss.ws.core.soap.Use;
Modified:
branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/common/jbossxb/SerializerDeserializerTestCase.java
===================================================================
---
branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/common/jbossxb/SerializerDeserializerTestCase.java 2007-06-26
19:46:25 UTC (rev 3732)
+++
branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/common/jbossxb/SerializerDeserializerTestCase.java 2007-06-26
21:03:20 UTC (rev 3733)
@@ -35,14 +35,14 @@
import javax.xml.transform.stream.StreamSource;
import org.jboss.ws.Constants;
+import org.jboss.ws.core.binding.AbstractDeserializerFactory;
+import org.jboss.ws.core.binding.DeserializerSupport;
+import org.jboss.ws.core.binding.SerializationContext;
+import org.jboss.ws.core.binding.AbstractSerializerFactory;
+import org.jboss.ws.core.binding.SerializerSupport;
+import org.jboss.ws.core.binding.TypeMappingImpl;
import org.jboss.ws.core.jaxrpc.SerializationContextJAXRPC;
-import org.jboss.ws.core.jaxrpc.TypeMappingImpl;
import org.jboss.ws.core.jaxrpc.TypeMappingRegistryImpl;
-import org.jboss.ws.core.jaxrpc.binding.DeserializerFactoryBase;
-import org.jboss.ws.core.jaxrpc.binding.DeserializerSupport;
-import org.jboss.ws.core.jaxrpc.binding.SerializationContext;
-import org.jboss.ws.core.jaxrpc.binding.SerializerFactoryBase;
-import org.jboss.ws.core.jaxrpc.binding.SerializerSupport;
import org.jboss.ws.core.soap.XMLFragment;
import org.jboss.wsf.spi.test.JBossWSTest;
import org.jboss.xb.binding.NamespaceRegistry;
@@ -76,12 +76,12 @@
QName xmlType = Constants.TYPE_LITERAL_STRING;
String value = "Hello World!";
- SerializerFactoryBase serializerFactory =
(SerializerFactoryBase)typeMapping.getSerializer(String.class, xmlType);
+ AbstractSerializerFactory serializerFactory =
(AbstractSerializerFactory)typeMapping.getSerializer(String.class, xmlType);
SerializerSupport ser = (SerializerSupport)serializerFactory.getSerializer();
Result result = ser.serialize(xmlName, xmlType, value, serContext, null);
assertNotNull(result);
- DeserializerFactoryBase deserializerFactory =
(DeserializerFactoryBase)typeMapping.getDeserializer(String.class, xmlType);
+ AbstractDeserializerFactory deserializerFactory =
(AbstractDeserializerFactory)typeMapping.getDeserializer(String.class, xmlType);
DeserializerSupport des =
(DeserializerSupport)deserializerFactory.getDeserializer();
Source source = new StreamSource(new ByteArrayInputStream( new
XMLFragment(result).toXMLString().getBytes()));
String out = (String)des.deserialize(xmlName, xmlType, source, serContext);
@@ -94,12 +94,12 @@
QName xmlType = Constants.TYPE_LITERAL_DATETIME;
Calendar value = new GregorianCalendar(2004, 10, 20, 14, 53, 25);
- SerializerFactoryBase serializerFactory =
(SerializerFactoryBase)typeMapping.getSerializer(Calendar.class, xmlType);
+ AbstractSerializerFactory serializerFactory =
(AbstractSerializerFactory)typeMapping.getSerializer(Calendar.class, xmlType);
SerializerSupport ser = (SerializerSupport)serializerFactory.getSerializer();
Result result = ser.serialize(xmlName, xmlType, value, serContext, null);
assertNotNull(result);
- DeserializerFactoryBase deserializerFactory =
(DeserializerFactoryBase)typeMapping.getDeserializer(Calendar.class, xmlType);
+ AbstractDeserializerFactory deserializerFactory =
(AbstractDeserializerFactory)typeMapping.getDeserializer(Calendar.class, xmlType);
DeserializerSupport des =
(DeserializerSupport)deserializerFactory.getDeserializer();
Source source = new StreamSource(new ByteArrayInputStream( new
XMLFragment(result).toXMLString().getBytes()));
Calendar out = (Calendar)des.deserialize(xmlName, xmlType, source, serContext);
@@ -113,12 +113,12 @@
QName xmlType = Constants.TYPE_LITERAL_INTEGER;
BigInteger value = new BigInteger("12345678901234567890");
- SerializerFactoryBase serializerFactory =
(SerializerFactoryBase)typeMapping.getSerializer(BigInteger.class, xmlType);
+ AbstractSerializerFactory serializerFactory =
(AbstractSerializerFactory)typeMapping.getSerializer(BigInteger.class, xmlType);
SerializerSupport ser = (SerializerSupport)serializerFactory.getSerializer();
Result result = ser.serialize(xmlName, xmlType, value, serContext, null);
assertNotNull(result);
- DeserializerFactoryBase deserializerFactory =
(DeserializerFactoryBase)typeMapping.getDeserializer(BigInteger.class, xmlType);
+ AbstractDeserializerFactory deserializerFactory =
(AbstractDeserializerFactory)typeMapping.getDeserializer(BigInteger.class, xmlType);
DeserializerSupport des =
(DeserializerSupport)deserializerFactory.getDeserializer();
Source source = new StreamSource(new ByteArrayInputStream( new
XMLFragment(result).toXMLString().getBytes()));
BigInteger out = (BigInteger)des.deserialize(xmlName, xmlType, source,
serContext);
@@ -131,12 +131,12 @@
QName xmlType = Constants.TYPE_LITERAL_DECIMAL;
BigDecimal value = new BigDecimal("12345678901234567890");
- SerializerFactoryBase serializerFactory =
(SerializerFactoryBase)typeMapping.getSerializer(BigDecimal.class, xmlType);
+ AbstractSerializerFactory serializerFactory =
(AbstractSerializerFactory)typeMapping.getSerializer(BigDecimal.class, xmlType);
SerializerSupport ser = (SerializerSupport)serializerFactory.getSerializer();
Result result = ser.serialize(xmlName, xmlType, value, serContext, null);
assertNotNull(result);
- DeserializerFactoryBase deserializerFactory =
(DeserializerFactoryBase)typeMapping.getDeserializer(BigDecimal.class, xmlType);
+ AbstractDeserializerFactory deserializerFactory =
(AbstractDeserializerFactory)typeMapping.getDeserializer(BigDecimal.class, xmlType);
DeserializerSupport des =
(DeserializerSupport)deserializerFactory.getDeserializer();
Source source = new StreamSource(new ByteArrayInputStream( new
XMLFragment(result).toXMLString().getBytes()));
BigDecimal out = (BigDecimal)des.deserialize(xmlName, xmlType, source,
serContext);
@@ -149,7 +149,7 @@
QName xmlType = Constants.TYPE_LITERAL_QNAME;
QName value = new QName("http://some-ns", "localPart",
"ns1");
- SerializerFactoryBase serializerFactory =
(SerializerFactoryBase)typeMapping.getSerializer(QName.class, xmlType);
+ AbstractSerializerFactory serializerFactory =
(AbstractSerializerFactory)typeMapping.getSerializer(QName.class, xmlType);
SerializerSupport ser = (SerializerSupport)serializerFactory.getSerializer();
Result result = ser.serialize(xmlName, xmlType, value, serContext, null);
assertNotNull(result);
@@ -159,7 +159,7 @@
assertEquals("ns1", nsRegistry.getPrefix("http://some-ns"));
nsRegistry.unregisterURI("http://some-ns");
- DeserializerFactoryBase deserializerFactory =
(DeserializerFactoryBase)typeMapping.getDeserializer(QName.class, xmlType);
+ AbstractDeserializerFactory deserializerFactory =
(AbstractDeserializerFactory)typeMapping.getDeserializer(QName.class, xmlType);
DeserializerSupport des =
(DeserializerSupport)deserializerFactory.getDeserializer();
Source source = new StreamSource(new ByteArrayInputStream( new
XMLFragment(result).toXMLString().getBytes()));
QName out = (QName)des.deserialize(xmlName, xmlType, source, serContext);
@@ -172,12 +172,12 @@
QName xmlType = Constants.TYPE_LITERAL_ANYURI;
URI value = new URI("http://someURI:that:has:more:parts");
- SerializerFactoryBase serializerFactory =
(SerializerFactoryBase)typeMapping.getSerializer(URI.class, xmlType);
+ AbstractSerializerFactory serializerFactory =
(AbstractSerializerFactory)typeMapping.getSerializer(URI.class, xmlType);
SerializerSupport ser = (SerializerSupport)serializerFactory.getSerializer();
Result result = ser.serialize(xmlName, xmlType, value, serContext, null);
assertNotNull(result);
- DeserializerFactoryBase deserializerFactory =
(DeserializerFactoryBase)typeMapping.getDeserializer(URI.class, xmlType);
+ AbstractDeserializerFactory deserializerFactory =
(AbstractDeserializerFactory)typeMapping.getDeserializer(URI.class, xmlType);
DeserializerSupport des =
(DeserializerSupport)deserializerFactory.getDeserializer();
Source source = new StreamSource(new ByteArrayInputStream( new
XMLFragment(result).toXMLString().getBytes()));
URI out = (URI)des.deserialize(xmlName, xmlType, source, serContext);
@@ -190,12 +190,12 @@
QName xmlType = Constants.TYPE_LITERAL_BASE64BINARY;
byte[] value = new String("Some base64 binary string").getBytes();
- SerializerFactoryBase serializerFactory =
(SerializerFactoryBase)typeMapping.getSerializer(byte[].class, xmlType);
+ AbstractSerializerFactory serializerFactory =
(AbstractSerializerFactory)typeMapping.getSerializer(byte[].class, xmlType);
SerializerSupport ser = (SerializerSupport)serializerFactory.getSerializer();
Result result = ser.serialize(xmlName, xmlType, value, serContext, null);
assertNotNull(result);
- DeserializerFactoryBase deserializerFactory =
(DeserializerFactoryBase)typeMapping.getDeserializer(byte[].class, xmlType);
+ AbstractDeserializerFactory deserializerFactory =
(AbstractDeserializerFactory)typeMapping.getDeserializer(byte[].class, xmlType);
DeserializerSupport des =
(DeserializerSupport)deserializerFactory.getDeserializer();
Source source = new StreamSource(new ByteArrayInputStream( new
XMLFragment(result).toXMLString().getBytes()));
byte[] out = (byte[])des.deserialize(xmlName, xmlType, source, serContext);
@@ -208,12 +208,12 @@
QName xmlType = Constants.TYPE_LITERAL_HEXBINARY;
byte[] value = new String("Some hex binary string").getBytes();
- SerializerFactoryBase serializerFactory =
(SerializerFactoryBase)typeMapping.getSerializer(byte[].class, xmlType);
+ AbstractSerializerFactory serializerFactory =
(AbstractSerializerFactory)typeMapping.getSerializer(byte[].class, xmlType);
SerializerSupport ser = (SerializerSupport)serializerFactory.getSerializer();
Result result = ser.serialize(xmlName, xmlType, value, serContext, null);
assertNotNull(result);
- DeserializerFactoryBase deserializerFactory =
(DeserializerFactoryBase)typeMapping.getDeserializer(byte[].class, xmlType);
+ AbstractDeserializerFactory deserializerFactory =
(AbstractDeserializerFactory)typeMapping.getDeserializer(byte[].class, xmlType);
DeserializerSupport des =
(DeserializerSupport)deserializerFactory.getDeserializer();
Source source = new StreamSource(new ByteArrayInputStream( new
XMLFragment(result).toXMLString().getBytes()));
byte[] out = (byte[])des.deserialize(xmlName, xmlType, source, serContext);