Author: thomas.diesler(a)jboss.com
Date: 2006-12-06 20:09:03 -0500 (Wed, 06 Dec 2006)
New Revision: 1592
Added:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/Base64Deserializer.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/Base64DeserializerFactory.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/Base64Serializer.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/Base64SerializerFactory.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/BindingException.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/CalendarDeserializer.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/CalendarDeserializerFactory.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/CalendarSerializer.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/CalendarSerializerFactory.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/CommonBinding.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/CommonBindingProvider.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/CommonSOAP11Binding.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/CommonSOAP12Binding.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/CommonSOAPBinding.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/ComplexTypeDeserializer.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/ComplexTypeSerializer.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/DateDeserializer.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/DateDeserializerFactory.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/DateSerializer.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/DateSerializerFactory.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/DeserializerFactoryBase.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/DeserializerSupport.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/ElementDeserializer.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/ElementDeserializerFactory.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/ElementSerializer.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/ElementSerializerFactory.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/HexDeserializer.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/HexDeserializerFactory.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/HexSerializer.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/HexSerializerFactory.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/JBossXBDeserializer.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/JBossXBDeserializerFactory.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/JBossXBSerializer.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/JBossXBSerializerFactory.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/NullValueSerializer.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/QNameDeserializer.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/QNameDeserializerFactory.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/QNameSerializer.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/QNameSerializerFactory.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/SOAPArrayDeserializer.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/SOAPArrayDeserializerFactory.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/SOAPArraySerializer.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/SOAPArraySerializerFactory.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/SOAPElementDeserializer.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/SOAPElementDeserializerFactory.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/SOAPElementSerializer.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/SOAPElementSerializerFactory.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/SerializationContext.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/SerializerFactoryBase.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/SerializerSupport.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/SimpleDeserializer.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/SimpleDeserializerFactory.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/SimpleSerializer.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/SimpleSerializerFactory.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/jbossxb/
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/jbossxb/JBossXBConstants.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/jbossxb/JBossXBMarshaller.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/jbossxb/JBossXBMarshallerImpl.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/jbossxb/JBossXBSupport.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/jbossxb/JBossXBUnmarshaller.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/jbossxb/JBossXBUnmarshallerImpl.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/jbossxb/MarshalException.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/jbossxb/SchemaBindingBuilder.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/jbossxb/UnmarshalException.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/jbossxb/XercesXSMarshallerImpl.java
Removed:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/jbossxb/JBossXBConstants.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/jbossxb/JBossXBMarshaller.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/jbossxb/JBossXBMarshallerImpl.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/jbossxb/JBossXBSupport.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/jbossxb/JBossXBUnmarshaller.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/jbossxb/JBossXBUnmarshallerImpl.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/jbossxb/MarshalException.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/jbossxb/SchemaBindingBuilder.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/jbossxb/UnmarshalException.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/jbossxb/XercesXSMarshallerImpl.java
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/CommonClient.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/CommonMessageContext.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/CallImpl.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/EncodedTypeMapping.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/LiteralTypeMapping.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/ParameterWrapping.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/SOAP11BindingJAXRPC.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/SOAP12BindingJAXRPC.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/SOAPFaultHelperJAXRPC.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/SerializationContextJAXRPC.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/TypeMappingImpl.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/handler/MessageContextJAXRPC.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/JAXBDeserializer.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/JAXBDeserializerFactory.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/JAXBSerializer.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/JAXBSerializerFactory.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/SOAPFaultHelperJAXWS.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/SerializationContextJAXWS.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/binding/BindingProviderImpl.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/binding/HTTPBindingJAXWS.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/binding/MessageBinding.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/binding/PayloadBinding.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/binding/SOAP11BindingJAXWS.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/binding/SOAP12BindingJAXWS.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/client/ClientImpl.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/handler/MessageContextJAXWS.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/metadata/builder/MetaDataBuilder.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/metadata/umdm/EndpointMetaData.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/metadata/umdm/ServiceMetaData.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/AbstractServiceEndpointInvoker.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/ServiceEndpoint.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/SOAPContentElement.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/SOAPFactoryImpl.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/tools/ToolsUtils.java
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/binding/SOAPBindingTestCase.java
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/jbossxb/SerializerDeserializerTestCase.java
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/jbossxb/array/BigDecimalArrayMarshallerTestCase.java
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/jbossxb/array/BigDecimalArrayUnmarshallerTestCase.java
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/jbossxb/array/CalendarArrayMarshallerTestCase.java
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/jbossxb/array/CalendarArrayUnmarshallerTestCase.java
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/jbossxb/array/QNameArrayMarshallerTestCase.java
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/jbossxb/array/QNameArrayUnmarshallerTestCase.java
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/jbossxb/complex/ComplexTypeMarshallerTestCase.java
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/jbossxb/complex/ComplexTypeUnmarshallerTestCase.java
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/jbossxb/docstyle/DocumentStyleMarshallerTestCase.java
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/jbossxb/docstyle/DocumentStyleUnmarshallerTestCase.java
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/jbossxb/simple/SimpleUserTypeMarshallerTestCase.java
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/jbossxb/simple/SimpleUserTypeUnmarshallerTestCase.java
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/soap/attachment/GenericAttachmentTestCase.java
Log:
Modified: branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/CommonClient.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/CommonClient.java 2006-12-07
01:03:49 UTC (rev 1591)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/CommonClient.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -37,10 +37,10 @@
import org.jboss.logging.Logger;
import org.jboss.ws.Constants;
import org.jboss.ws.WSException;
-import org.jboss.ws.core.binding.CommonBinding;
-import org.jboss.ws.core.binding.CommonBindingProvider;
import org.jboss.ws.core.jaxrpc.ParameterWrapping;
import org.jboss.ws.core.jaxrpc.Style;
+import org.jboss.ws.core.jaxrpc.binding.CommonBinding;
+import org.jboss.ws.core.jaxrpc.binding.CommonBindingProvider;
import org.jboss.ws.core.jaxrpc.handler.HandlerChainBaseImpl;
import org.jboss.ws.core.metadata.umdm.ClientEndpointMetaData;
import org.jboss.ws.core.metadata.umdm.EndpointMetaData;
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/CommonMessageContext.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/CommonMessageContext.java 2006-12-07
01:03:49 UTC (rev 1591)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/CommonMessageContext.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -29,7 +29,7 @@
import javax.xml.soap.SOAPMessage;
-import org.jboss.ws.core.binding.SerializationContext;
+import org.jboss.ws.core.jaxrpc.binding.SerializationContext;
import org.jboss.ws.core.metadata.umdm.EndpointMetaData;
import org.jboss.ws.core.metadata.umdm.OperationMetaData;
import org.jboss.ws.core.server.MessageContextPropertyHelper;
Modified: branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/CallImpl.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/CallImpl.java 2006-12-07
01:03:49 UTC (rev 1591)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/CallImpl.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -47,8 +47,8 @@
import org.jboss.logging.Logger;
import org.jboss.ws.Constants;
import org.jboss.ws.core.CommonClient;
-import org.jboss.ws.core.binding.JBossXBDeserializerFactory;
-import org.jboss.ws.core.binding.JBossXBSerializerFactory;
+import org.jboss.ws.core.jaxrpc.binding.JBossXBDeserializerFactory;
+import org.jboss.ws.core.jaxrpc.binding.JBossXBSerializerFactory;
import org.jboss.ws.core.jaxrpc.handler.HandlerChainBaseImpl;
import org.jboss.ws.core.jaxrpc.handler.SOAPMessageContextJAXRPC;
import org.jboss.ws.core.metadata.umdm.EndpointMetaData;
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/EncodedTypeMapping.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/EncodedTypeMapping.java 2006-12-07
01:03:49 UTC (rev 1591)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/EncodedTypeMapping.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -34,22 +34,22 @@
import org.jboss.util.NotImplementedException;
import org.jboss.ws.Constants;
-import org.jboss.ws.core.binding.Base64DeserializerFactory;
-import org.jboss.ws.core.binding.Base64SerializerFactory;
-import org.jboss.ws.core.binding.CalendarDeserializerFactory;
-import org.jboss.ws.core.binding.CalendarSerializerFactory;
-import org.jboss.ws.core.binding.DateDeserializerFactory;
-import org.jboss.ws.core.binding.DateSerializerFactory;
-import org.jboss.ws.core.binding.ElementDeserializerFactory;
-import org.jboss.ws.core.binding.ElementSerializerFactory;
-import org.jboss.ws.core.binding.HexDeserializerFactory;
-import org.jboss.ws.core.binding.HexSerializerFactory;
-import org.jboss.ws.core.binding.QNameDeserializerFactory;
-import org.jboss.ws.core.binding.QNameSerializerFactory;
-import org.jboss.ws.core.binding.SOAPElementDeserializerFactory;
-import org.jboss.ws.core.binding.SOAPElementSerializerFactory;
-import org.jboss.ws.core.binding.SimpleDeserializerFactory;
-import org.jboss.ws.core.binding.SimpleSerializerFactory;
+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.ElementDeserializerFactory;
+import org.jboss.ws.core.jaxrpc.binding.ElementSerializerFactory;
+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.SOAPElementDeserializerFactory;
+import org.jboss.ws.core.jaxrpc.binding.SOAPElementSerializerFactory;
+import org.jboss.ws.core.jaxrpc.binding.SimpleDeserializerFactory;
+import org.jboss.ws.core.jaxrpc.binding.SimpleSerializerFactory;
import org.w3c.dom.Element;
/**
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/LiteralTypeMapping.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/LiteralTypeMapping.java 2006-12-07
01:03:49 UTC (rev 1591)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/LiteralTypeMapping.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -32,12 +32,12 @@
import org.jboss.util.NotImplementedException;
import org.jboss.ws.Constants;
-import org.jboss.ws.core.binding.ElementDeserializerFactory;
-import org.jboss.ws.core.binding.ElementSerializerFactory;
-import org.jboss.ws.core.binding.JBossXBDeserializerFactory;
-import org.jboss.ws.core.binding.JBossXBSerializerFactory;
-import org.jboss.ws.core.binding.SOAPElementDeserializerFactory;
-import org.jboss.ws.core.binding.SOAPElementSerializerFactory;
+import org.jboss.ws.core.jaxrpc.binding.ElementDeserializerFactory;
+import org.jboss.ws.core.jaxrpc.binding.ElementSerializerFactory;
+import org.jboss.ws.core.jaxrpc.binding.JBossXBDeserializerFactory;
+import org.jboss.ws.core.jaxrpc.binding.JBossXBSerializerFactory;
+import org.jboss.ws.core.jaxrpc.binding.SOAPElementDeserializerFactory;
+import org.jboss.ws.core.jaxrpc.binding.SOAPElementSerializerFactory;
import org.w3c.dom.Element;
/**
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/ParameterWrapping.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/ParameterWrapping.java 2006-12-07
01:03:49 UTC (rev 1591)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/ParameterWrapping.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -41,8 +41,8 @@
import org.jboss.logging.Logger;
import org.jboss.ws.WSException;
-import org.jboss.ws.core.binding.JBossXBDeserializerFactory;
-import org.jboss.ws.core.binding.JBossXBSerializerFactory;
+import org.jboss.ws.core.jaxrpc.binding.JBossXBDeserializerFactory;
+import org.jboss.ws.core.jaxrpc.binding.JBossXBSerializerFactory;
import org.jboss.ws.core.metadata.umdm.EndpointMetaData;
import org.jboss.ws.core.metadata.umdm.OperationMetaData;
import org.jboss.ws.core.metadata.umdm.ParameterMetaData;
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/SOAP11BindingJAXRPC.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/SOAP11BindingJAXRPC.java 2006-12-07
01:03:49 UTC (rev 1591)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/SOAP11BindingJAXRPC.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -25,7 +25,7 @@
import javax.xml.soap.SOAPMessage;
-import org.jboss.ws.core.binding.CommonSOAP11Binding;
+import org.jboss.ws.core.jaxrpc.binding.CommonSOAP11Binding;
import org.jboss.ws.core.metadata.umdm.OperationMetaData;
import org.jboss.ws.core.soap.SOAPFaultImpl;
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/SOAP12BindingJAXRPC.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/SOAP12BindingJAXRPC.java 2006-12-07
01:03:49 UTC (rev 1591)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/SOAP12BindingJAXRPC.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -25,7 +25,7 @@
import javax.xml.soap.SOAPMessage;
-import org.jboss.ws.core.binding.CommonSOAP12Binding;
+import org.jboss.ws.core.jaxrpc.binding.CommonSOAP12Binding;
import org.jboss.ws.core.metadata.umdm.OperationMetaData;
import org.jboss.ws.core.soap.SOAPFaultImpl;
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/SOAPFaultHelperJAXRPC.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/SOAPFaultHelperJAXRPC.java 2006-12-07
01:03:49 UTC (rev 1591)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/SOAPFaultHelperJAXRPC.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -46,12 +46,12 @@
import org.jboss.ws.Constants;
import org.jboss.ws.WSException;
import org.jboss.ws.core.CommonMessageContext;
-import org.jboss.ws.core.binding.BindingException;
-import org.jboss.ws.core.binding.DeserializerFactoryBase;
-import org.jboss.ws.core.binding.DeserializerSupport;
-import org.jboss.ws.core.binding.SerializationContext;
-import org.jboss.ws.core.binding.SerializerFactoryBase;
-import org.jboss.ws.core.binding.SerializerSupport;
+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.metadata.umdm.FaultMetaData;
import org.jboss.ws.core.metadata.umdm.OperationMetaData;
import org.jboss.ws.core.soap.MessageContextAssociation;
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/SerializationContextJAXRPC.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/SerializationContextJAXRPC.java 2006-12-07
01:03:49 UTC (rev 1591)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/SerializationContextJAXRPC.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -29,7 +29,7 @@
import org.jboss.logging.Logger;
import org.jboss.ws.Constants;
import org.jboss.ws.WSException;
-import org.jboss.ws.core.binding.SerializationContext;
+import org.jboss.ws.core.jaxrpc.binding.SerializationContext;
import org.jboss.ws.core.jaxrpc.handler.SOAPMessageContextJAXRPC;
import org.jboss.ws.core.metadata.jaxrpcmapping.JavaWsdlMapping;
import org.jboss.ws.core.metadata.jaxrpcmapping.JavaXmlTypeMapping;
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/TypeMappingImpl.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/TypeMappingImpl.java 2006-12-07
01:03:49 UTC (rev 1591)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/TypeMappingImpl.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -40,18 +40,18 @@
import org.jboss.logging.Logger;
import org.jboss.ws.Constants;
-import org.jboss.ws.core.binding.Base64DeserializerFactory;
-import org.jboss.ws.core.binding.Base64SerializerFactory;
-import org.jboss.ws.core.binding.CalendarDeserializerFactory;
-import org.jboss.ws.core.binding.CalendarSerializerFactory;
-import org.jboss.ws.core.binding.DateDeserializerFactory;
-import org.jboss.ws.core.binding.DateSerializerFactory;
-import org.jboss.ws.core.binding.HexDeserializerFactory;
-import org.jboss.ws.core.binding.HexSerializerFactory;
-import org.jboss.ws.core.binding.QNameDeserializerFactory;
-import org.jboss.ws.core.binding.QNameSerializerFactory;
-import org.jboss.ws.core.binding.SimpleDeserializerFactory;
-import org.jboss.ws.core.binding.SimpleSerializerFactory;
+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.JavaUtils;
/**
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/Base64Deserializer.java
(from rev 1590,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/Base64Deserializer.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/Base64Deserializer.java 2006-12-07
00:59:53 UTC (rev 1590)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/Base64Deserializer.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -0,0 +1,79 @@
+/*
+* 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.IOException;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.WSException;
+import org.jboss.ws.core.jaxrpc.binding.BindingException;
+import org.jboss.ws.core.jaxrpc.binding.DeserializerSupport;
+import org.jboss.ws.core.jaxrpc.binding.SerializationContext;
+import org.jboss.ws.core.utils.DOMUtils;
+import org.jboss.ws.extentions.xop.XOPContext;
+import org.jboss.ws.extentions.xop.jaxrpc.XOPUnmarshallerImpl;
+import org.jboss.xb.binding.SimpleTypeBindings;
+import org.jboss.xb.binding.sunday.xop.XOPUnmarshaller;
+import org.w3c.dom.Element;
+/**
+ * Deserializer for Base64
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 04-Dec-2004
+ */
+public class Base64Deserializer extends DeserializerSupport
+{
+ // provide logging
+ private static final Logger log = Logger.getLogger(Base64Deserializer.class);
+
+ public Object deserialize(QName xmlName, QName xmlType, String xmlFragment,
SerializationContext serContext) throws BindingException
+ {
+ log.debug("deserialize: [xmlName=" + xmlName + ",xmlType=" +
xmlType + "]");
+
+ byte[] value = null;
+
+ String valueStr = unwrapValueStr(xmlFragment);
+ if(XOPContext.isXOPMessage())
+ {
+ try
+ {
+ Element xopInclude = DOMUtils.parse(valueStr);
+ String cid = xopInclude.getAttribute("href");
+ XOPUnmarshaller xopUnmarshaller = new XOPUnmarshallerImpl();
+ value = xopUnmarshaller.getAttachmentAsByteArray(cid);
+ }
+ catch (IOException e)
+ {
+ throw new WSException("Failed to parse xopInclude element");
+ }
+ }
+ else if (valueStr != null)
+ {
+ value = SimpleTypeBindings.unmarshalBase64(valueStr);
+ }
+ return value;
+ }
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/Base64DeserializerFactory.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/Base64DeserializerFactory.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/Base64DeserializerFactory.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/Base64DeserializerFactory.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -0,0 +1,41 @@
+/*
+* 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;
+
+import org.jboss.ws.core.jaxrpc.binding.DeserializerSupport;
+
+// $Id$
+
+
+/**
+ * DeserializerFactory for base64.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 04-Dec-2004
+ */
+public class Base64DeserializerFactory extends DeserializerFactoryBase
+{
+ public DeserializerSupport getDeserializer()
+ {
+ return new Base64Deserializer();
+ }
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/Base64Serializer.java
(from rev 1590,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/Base64Serializer.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/Base64Serializer.java 2006-12-07
00:59:53 UTC (rev 1590)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/Base64Serializer.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -0,0 +1,76 @@
+/*
+* 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 javax.xml.namespace.QName;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.core.jaxrpc.binding.BindingException;
+import org.jboss.ws.core.jaxrpc.binding.SerializationContext;
+import org.jboss.ws.core.jaxrpc.binding.SerializerSupport;
+import org.jboss.ws.core.utils.JavaUtils;
+import org.jboss.ws.extentions.xop.XOPContext;
+import org.jboss.ws.extentions.xop.jaxrpc.XOPMarshallerImpl;
+import org.jboss.xb.binding.NamespaceRegistry;
+import org.jboss.xb.binding.SimpleTypeBindings;
+import org.jboss.xb.binding.sunday.xop.XOPMarshaller;
+import org.jboss.xb.binding.sunday.xop.XOPObject;
+import org.w3c.dom.NamedNodeMap;
+
+/**
+ * Serializer for base64
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 04-Dec-2004
+ */
+public class Base64Serializer extends SerializerSupport
+{
+ // provide logging
+ private static final Logger log = Logger.getLogger(Base64Serializer.class);
+
+ public String serialize(QName xmlName, QName xmlType, Object value,
SerializationContext serContext, NamedNodeMap attributes) throws BindingException
+ {
+ log.debug("serialize: [xmlName=" + xmlName + ",xmlType=" +
xmlType + "]");
+
+ String xmlFragment = null;
+ NamespaceRegistry nsRegistry = serContext.getNamespaceRegistry();
+
+ if(XOPContext.isXOPMessage())
+ {
+ XOPMarshaller xopMarshaller = new XOPMarshallerImpl();
+ XOPObject xopObject = new XOPObject(value);
+ xopObject.setContentType("application/octet-stream");
+ String cid = xopMarshaller.addMtomAttachment(xopObject,
xmlName.getNamespaceURI(), xmlType.getLocalPart() );
+ String xopInclude = "<xop:Include
xmlns:xop='http://www.w3.org/2004/08/xop/include'
href='"+cid+"'/>";
+ xmlFragment = wrapValueStr(xmlName, xopInclude, nsRegistry, attributes, false);
+ }
+ else
+ {
+ value = JavaUtils.getPrimitiveValueArray(value);
+ String valueStr = SimpleTypeBindings.marshalBase64((byte[])value);
+ xmlFragment = wrapValueStr(xmlName, valueStr, nsRegistry, attributes, true);
+ }
+ return xmlFragment;
+ }
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/Base64SerializerFactory.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/Base64SerializerFactory.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/Base64SerializerFactory.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/Base64SerializerFactory.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -0,0 +1,41 @@
+/*
+* 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;
+
+import org.jboss.ws.core.jaxrpc.binding.SerializerSupport;
+
+// $Id$
+
+
+/**
+ * SerializerFactory for base64Binary.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 04-Dec-2004
+ */
+public class Base64SerializerFactory extends SerializerFactoryBase
+{
+ public SerializerSupport getSerializer()
+ {
+ return new Base64Serializer();
+ }
+}
\ No newline at end of file
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/BindingException.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/BindingException.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/BindingException.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/BindingException.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -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.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);
+ }
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/CalendarDeserializer.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/CalendarDeserializer.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/CalendarDeserializer.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/CalendarDeserializer.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -0,0 +1,60 @@
+/*
+* 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.Calendar;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.core.jaxrpc.binding.BindingException;
+import org.jboss.ws.core.jaxrpc.binding.DeserializerSupport;
+import org.jboss.ws.core.jaxrpc.binding.SerializationContext;
+import org.jboss.xb.binding.SimpleTypeBindings;
+
+/**
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 04-Dec-2004
+ * @see <a
href="http://www.w3.org/TR/xmlschema-2/#dateTime">XML Schema
3.2.16</a>
+ */
+public class CalendarDeserializer extends DeserializerSupport
+{
+ // provide logging
+ private static final Logger log = Logger.getLogger(CalendarDeserializer.class);
+
+ public Object deserialize(QName xmlName, QName xmlType, String xmlFragment,
SerializationContext serContext) throws BindingException
+ {
+ log.debug("deserialize: [xmlName=" + xmlName + ",xmlType=" +
xmlType + "]");
+
+ Calendar value = null;
+
+ String valueStr = unwrapValueStr(xmlFragment);
+ if (valueStr != null)
+ {
+ value = SimpleTypeBindings.unmarshalDateTime(valueStr);
+ }
+
+ return value;
+ }
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/CalendarDeserializerFactory.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/CalendarDeserializerFactory.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/CalendarDeserializerFactory.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/CalendarDeserializerFactory.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -0,0 +1,42 @@
+/*
+* 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;
+
+import org.jboss.ws.core.jaxrpc.binding.DeserializerSupport;
+
+// $Id$
+
+
+/**
+ * A CalendarDeserializer Factory
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 04-Dec-2004
+ */
+public class CalendarDeserializerFactory extends DeserializerFactoryBase
+{
+
+ public DeserializerSupport getDeserializer()
+ {
+ return new CalendarDeserializer();
+ }
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/CalendarSerializer.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/CalendarSerializer.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/CalendarSerializer.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/CalendarSerializer.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -0,0 +1,58 @@
+/*
+* 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.Calendar;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.core.jaxrpc.binding.BindingException;
+import org.jboss.ws.core.jaxrpc.binding.SerializationContext;
+import org.jboss.ws.core.jaxrpc.binding.SerializerSupport;
+import org.jboss.xb.binding.NamespaceRegistry;
+import org.jboss.xb.binding.SimpleTypeBindings;
+import org.w3c.dom.NamedNodeMap;
+
+/**
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 04-Dec-2004
+ * @see <a
href="http://www.w3.org/TR/xmlschema-2/#dateTime">XML Schema
3.2.16</a>
+ */
+public class CalendarSerializer extends SerializerSupport
+{
+ // provide logging
+ private static final Logger log = Logger.getLogger(CalendarSerializer.class);
+
+ public String serialize(QName xmlName, QName xmlType, Object value,
SerializationContext serContext, NamedNodeMap attributes) throws BindingException
+ {
+ log.debug("serialize: [xmlName=" + xmlName + ",xmlType=" +
xmlType + "]");
+
+ String valueStr = SimpleTypeBindings.marshalDateTime((Calendar)value);
+
+ NamespaceRegistry nsRegistry = serContext.getNamespaceRegistry();
+ String xmlFragment = wrapValueStr(xmlName, valueStr, nsRegistry, attributes,
true);
+ return xmlFragment;
+ }
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/CalendarSerializerFactory.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/CalendarSerializerFactory.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/CalendarSerializerFactory.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/CalendarSerializerFactory.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -0,0 +1,39 @@
+/*
+* 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;
+
+import org.jboss.ws.core.jaxrpc.binding.SerializerSupport;
+
+// $Id$
+
+
+/**
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 04-Dec-2004
+ */
+public class CalendarSerializerFactory extends SerializerFactoryBase
+{
+ public SerializerSupport getSerializer()
+ {
+ return new CalendarSerializer();
+ }
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/CommonBinding.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/CommonBinding.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/CommonBinding.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/CommonBinding.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -0,0 +1,53 @@
+/*
+ * 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.Map;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.ws.core.EndpointInvocation;
+import org.jboss.ws.core.metadata.umdm.OperationMetaData;
+import org.jboss.ws.core.soap.UnboundHeader;
+
+/**
+ * The base interface for protocol bindings.
+ *
+ * @author Thomas.Diesler(a)jboss.com
+ * @since 04-Jul-2006
+ */
+public interface CommonBinding
+{
+ /** On the client side, generate the Object from IN parameters. */
+ Object bindRequestMessage(OperationMetaData opMetaData, EndpointInvocation epInv,
Map<QName, UnboundHeader> unboundHeaders) throws BindingException;
+
+ /** On the server side, extract the IN parameters from the Object and populate an
Invocation object */
+ EndpointInvocation unbindRequestMessage(OperationMetaData opMetaData, Object
reqMessage) throws BindingException;
+
+ /** On the server side, generate the Object from OUT parameters in the Invocation
object. */
+ Object bindResponseMessage(OperationMetaData opMetaData, EndpointInvocation epInv)
throws BindingException;
+
+ /** On the client side, extract the OUT parameters from the Object and return them to
the client. */
+ void unbindResponseMessage(OperationMetaData opMetaData, Object resMessage,
EndpointInvocation epInv, Map<QName, UnboundHeader> unboundHeaders) throws
BindingException;
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/CommonBindingProvider.java
(from rev 1590,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/CommonBindingProvider.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/CommonBindingProvider.java 2006-12-07
00:59:53 UTC (rev 1590)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/CommonBindingProvider.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -0,0 +1,76 @@
+/*
+ * 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 org.jboss.ws.WSException;
+import org.jboss.ws.core.jaxrpc.SOAP11BindingJAXRPC;
+import org.jboss.ws.core.jaxrpc.SOAP12BindingJAXRPC;
+import org.jboss.ws.core.jaxws.binding.SOAP11BindingJAXWS;
+import org.jboss.ws.core.jaxws.binding.SOAP12BindingJAXWS;
+import org.jboss.ws.core.metadata.umdm.EndpointMetaData;
+import org.jboss.ws.core.metadata.umdm.EndpointMetaData.Type;
+
+/**
+ * Provides access to the protocol binding.
+ *
+ * @author Thomas.Diesler(a)jboss.com
+ * @since 04-Jul-2006
+ */
+public class CommonBindingProvider
+{
+ protected EndpointMetaData epMetaData;
+ protected CommonBinding binding;
+
+ public CommonBindingProvider(EndpointMetaData epMetaData)
+ {
+ this.epMetaData = epMetaData;
+ initBinding(epMetaData.getBindingId(), epMetaData.getType());
+ }
+
+ public CommonBindingProvider(String bindingId, Type type)
+ {
+ initBinding(bindingId, type);
+ }
+
+ protected void initBinding(String bindingId, Type type)
+ {
+ if (CommonSOAPBinding.SOAP11HTTP_BINDING.equals(bindingId))
+ {
+ binding = (type == Type.JAXWS ? new SOAP11BindingJAXWS() : new
SOAP11BindingJAXRPC());
+ }
+ else if (CommonSOAPBinding.SOAP12HTTP_BINDING.equals(bindingId))
+ {
+ binding = (type == Type.JAXWS ? new SOAP12BindingJAXWS() : new
SOAP12BindingJAXRPC());
+ }
+ else
+ {
+ throw new WSException("Unsupported binding: " + bindingId);
+ }
+ }
+
+ public CommonBinding getCommonBinding()
+ {
+ return binding;
+ }
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/CommonSOAP11Binding.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/CommonSOAP11Binding.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/CommonSOAP11Binding.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/CommonSOAP11Binding.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -0,0 +1,63 @@
+/*
+ * 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 javax.xml.soap.SOAPEnvelope;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPMessage;
+
+import org.jboss.ws.Constants;
+import org.jboss.ws.core.jaxrpc.Use;
+import org.jboss.ws.core.metadata.umdm.OperationMetaData;
+import org.jboss.ws.core.soap.MessageFactoryImpl;
+
+/**
+ * The SOAP11Binding
+ *
+ * @author Thomas.Diesler(a)jboss.com
+ * @since 04-Jul-2006
+ */
+public abstract class CommonSOAP11Binding extends CommonSOAPBinding
+{
+ public CommonSOAP11Binding()
+ {
+ }
+
+ /** Create the SOAP-1.1 message */
+ protected SOAPMessage createMessage(OperationMetaData opMetaData) throws
SOAPException
+ {
+ MessageFactoryImpl factory = new MessageFactoryImpl();
+ factory.setEnvelopeURI(Constants.NS_SOAP11_ENV);
+ SOAPMessage soapMessage = factory.createMessage();
+
+ Use encStyle = opMetaData.getEndpointMetaData().getEncodingStyle();
+ if (Use.ENCODED.equals(encStyle))
+ {
+ SOAPEnvelope soapEnvelope = soapMessage.getSOAPPart().getEnvelope();
+ soapEnvelope.addNamespaceDeclaration(Constants.PREFIX_SOAP11_ENC,
Constants.URI_SOAP11_ENC);
+ }
+
+ return soapMessage;
+ }
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/CommonSOAP12Binding.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/CommonSOAP12Binding.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/CommonSOAP12Binding.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/CommonSOAP12Binding.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -0,0 +1,53 @@
+/*
+ * 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 javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPMessage;
+
+import org.jboss.ws.Constants;
+import org.jboss.ws.core.metadata.umdm.OperationMetaData;
+import org.jboss.ws.core.soap.MessageFactoryImpl;
+
+/**
+ * The SOAP11Binding
+ *
+ * @author Thomas.Diesler(a)jboss.com
+ * @since 04-Jul-2006
+ */
+public abstract class CommonSOAP12Binding extends CommonSOAPBinding
+{
+
+ public CommonSOAP12Binding()
+ {
+ }
+
+ /** Create the SOAP-1.1 message */
+ protected SOAPMessage createMessage(OperationMetaData opMetaData) throws
SOAPException
+ {
+ MessageFactoryImpl factory = new MessageFactoryImpl();
+ factory.setEnvelopeURI(Constants.NS_SOAP12_ENV);
+ return factory.createMessage();
+ }
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/CommonSOAPBinding.java
(from rev 1590,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/CommonSOAPBinding.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/CommonSOAPBinding.java 2006-12-07
00:59:53 UTC (rev 1590)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/CommonSOAPBinding.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -0,0 +1,907 @@
+/*
+ * 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.Iterator;
+import java.util.Map;
+import java.util.Set;
+
+import javax.activation.DataHandler;
+import javax.xml.namespace.QName;
+import javax.xml.rpc.ParameterMode;
+import javax.xml.soap.AttachmentPart;
+import javax.xml.soap.MessageFactory;
+import javax.xml.soap.Name;
+import javax.xml.soap.SOAPBody;
+import javax.xml.soap.SOAPBodyElement;
+import javax.xml.soap.SOAPElement;
+import javax.xml.soap.SOAPEnvelope;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPFactory;
+import javax.xml.soap.SOAPHeader;
+import javax.xml.soap.SOAPMessage;
+
+import org.apache.xerces.xs.XSElementDeclaration;
+import org.apache.xerces.xs.XSTypeDefinition;
+import org.jboss.logging.Logger;
+import org.jboss.ws.Constants;
+import org.jboss.ws.WSException;
+import org.jboss.ws.core.CommonMessageContext;
+import org.jboss.ws.core.EndpointInvocation;
+import org.jboss.ws.core.jaxrpc.ParameterWrapping;
+import org.jboss.ws.core.jaxrpc.StubExt;
+import org.jboss.ws.core.jaxrpc.Style;
+import org.jboss.ws.core.metadata.umdm.OperationMetaData;
+import org.jboss.ws.core.metadata.umdm.ParameterMetaData;
+import org.jboss.ws.core.metadata.umdm.TypesMetaData;
+import org.jboss.ws.core.soap.MessageContextAssociation;
+import org.jboss.ws.core.soap.MessageFactoryImpl;
+import org.jboss.ws.core.soap.NameImpl;
+import org.jboss.ws.core.soap.SOAPBodyElementDoc;
+import org.jboss.ws.core.soap.SOAPBodyElementRpc;
+import org.jboss.ws.core.soap.SOAPContentElement;
+import org.jboss.ws.core.soap.SOAPElementImpl;
+import org.jboss.ws.core.soap.SOAPFactoryImpl;
+import org.jboss.ws.core.soap.SOAPFaultImpl;
+import org.jboss.ws.core.soap.SOAPHeaderElementImpl;
+import org.jboss.ws.core.soap.SOAPMessageImpl;
+import org.jboss.ws.core.soap.UnboundHeader;
+import org.jboss.ws.core.soap.attachment.AttachmentPartImpl;
+import org.jboss.ws.core.soap.attachment.CIDGenerator;
+import org.jboss.ws.core.utils.DOMUtils;
+import org.jboss.ws.core.utils.JavaUtils;
+import org.jboss.ws.core.utils.MimeUtils;
+import org.jboss.ws.extentions.xop.XOPContext;
+import org.jboss.xb.binding.NamespaceRegistry;
+import org.w3c.dom.Element;
+
+/**
+ * The SOAPBinding interface is an abstraction for the SOAP binding.
+ *
+ * @author Thomas.Diesler(a)jboss.com
+ * @since 04-Jul-2006
+ */
+public abstract class CommonSOAPBinding implements CommonBinding
+{
+ // provide logging
+ private static Logger log = Logger.getLogger(CommonSOAPBinding.class);
+
+ private boolean mtomEnabled;
+
+ /** A constant representing the identity of the SOAP 1.2 over HTTP binding. */
+ public static final String SOAP12HTTP_BINDING =
"http://www.w3.org/2003/05/soap/bindings/HTTP/";
+
+ /** A constant representing the identity of the SOAP 1.1 over HTTP binding. */
+ public static final String SOAP11HTTP_BINDING =
"http://schemas.xmlsoap.org/wsdl/soap/http";
+ private static final Name SOAP_ARRAY_NAME = new NameImpl("Array",
Constants.PREFIX_SOAP11_ENC, Constants.URI_SOAP11_ENC);
+
+ public CommonSOAPBinding()
+ {
+ }
+
+ public MessageFactory getMessageFactory()
+ {
+ return new MessageFactoryImpl();
+ }
+
+ public SOAPFactory getSOAPFactory()
+ {
+ return new SOAPFactoryImpl();
+ }
+
+ public boolean isMTOMEnabled()
+ {
+ return mtomEnabled;
+ }
+
+ public void setMTOMEnabled(boolean flag)
+ {
+ this.mtomEnabled = flag;
+ }
+
+ /** Create the SOAP-1.1 message */
+ protected abstract SOAPMessage createMessage(OperationMetaData opMetaData) throws
SOAPException;
+
+ /** On the client side, generate the payload from IN parameters. */
+ public Object bindRequestMessage(OperationMetaData opMetaData, EndpointInvocation
epInv, Map<QName, UnboundHeader> unboundHeaders) throws BindingException
+ {
+ log.debug("bindRequestMessage: " + opMetaData.getQName());
+
+ try
+ {
+ CommonMessageContext msgContext =
MessageContextAssociation.peekMessageContext();
+ if (msgContext == null)
+ throw new WSException("MessageContext not available");
+
+ // Disable MTOM for rpc/encoded
+ if (opMetaData.isRPCEncoded())
+ msgContext.setProperty(StubExt.PROPERTY_MTOM_ENABLED, Boolean.FALSE);
+
+ // Associate current message with message context
+ SOAPMessageImpl reqMessage = (SOAPMessageImpl)createMessage(opMetaData);
+ msgContext.setSOAPMessage(reqMessage);
+
+ SOAPEnvelope soapEnvelope = reqMessage.getSOAPPart().getEnvelope();
+ SOAPBody soapBody = soapEnvelope.getBody();
+ SOAPHeader soapHeader = soapEnvelope.getHeader();
+
+ // Get the namespace registry
+ NamespaceRegistry namespaceRegistry = msgContext.getNamespaceRegistry();
+
+ Style style = opMetaData.getStyle();
+ if (style == Style.RPC)
+ {
+ QName opQName = opMetaData.getQName();
+ Name opName = new NameImpl(namespaceRegistry.registerQName(opQName));
+
+ log.debug("Create RPC body element: " + opName);
+ SOAPBodyElement soapBodyElement = new SOAPBodyElementRpc(opName);
+
+
+ soapBodyElement =
(SOAPBodyElement)soapBody.addChildElement(soapBodyElement);
+
+ for (ParameterMetaData paramMetaData : opMetaData.getInputParameters())
+ {
+ QName xmlName = paramMetaData.getXmlName();
+ Object value = epInv.getRequestParamValue(xmlName);
+
+ if (paramMetaData.isSwA())
+ {
+ CIDGenerator cidGenerator = reqMessage.getCidGenerator();
+ AttachmentPart part = createAttachmentPart(paramMetaData, value,
cidGenerator);
+ reqMessage.addAttachmentPart(part);
+ }
+ else
+ {
+ SOAPElement soapElement = paramMetaData.isInHeader() ?
(SOAPElement)soapHeader : soapBodyElement;
+ addParameterToMessage(paramMetaData, value, soapElement);
+ }
+ }
+ }
+ else if (style == Style.DOCUMENT)
+ {
+ for (ParameterMetaData paramMetaData : opMetaData.getInputParameters())
+ {
+ QName xmlName = paramMetaData.getXmlName();
+ Object value = epInv.getRequestParamValue(xmlName);
+
+ if (paramMetaData.isSwA())
+ {
+ CIDGenerator cidGenerator = reqMessage.getCidGenerator();
+ AttachmentPart part = createAttachmentPart(paramMetaData, value,
cidGenerator);
+ reqMessage.addAttachmentPart(part);
+ }
+ else
+ {
+ SOAPElement soapElement = paramMetaData.isInHeader() ?
(SOAPElement)soapHeader : soapBody;
+ addParameterToMessage(paramMetaData, value, soapElement);
+ }
+ }
+ }
+ else
+ {
+ throw new WSException("Unsupported message style: " + style);
+ }
+
+ // Add unbound headers
+ if (unboundHeaders != null)
+ {
+ Iterator it = unboundHeaders.values().iterator();
+ while (it.hasNext())
+ {
+ UnboundHeader unboundHeader = (UnboundHeader)it.next();
+ if (unboundHeader.getMode() != ParameterMode.OUT)
+ {
+ QName xmlName = unboundHeader.getXmlName();
+ Object value = unboundHeader.getHeaderValue();
+
+ xmlName = namespaceRegistry.registerQName(xmlName);
+ Name soapName = new NameImpl(xmlName.getLocalPart(),
xmlName.getPrefix(), xmlName.getNamespaceURI());
+
+ log.debug("Add unboundHeader element: " + soapName);
+ SOAPContentElement contentElement = new
SOAPHeaderElementImpl(soapName);
+
contentElement.setParamMetaData(unboundHeader.toParameterMetaData(opMetaData));
+ soapHeader.addChildElement(contentElement);
+ contentElement.setObjectValue(value);
+ }
+ }
+ }
+
+ // Set the SOAPAction
+ setSOAPActionHeader(opMetaData, reqMessage);
+
+ return reqMessage;
+ }
+ catch (Exception e)
+ {
+ handleException(e);
+ return null;
+ }
+ }
+
+ /** Override to set the SOAPAction header */
+ public abstract void setSOAPActionHeader(OperationMetaData opMetaData, SOAPMessage
reqMessage);
+
+ /** On the server side, extract the IN parameters from the payload and populate an
Invocation object */
+ public EndpointInvocation unbindRequestMessage(OperationMetaData opMetaData, Object
payload) throws BindingException
+ {
+ log.debug("unbindRequestMessage: " + opMetaData.getQName());
+
+ try
+ {
+ // Read the SOAPEnvelope from the reqMessage
+ SOAPMessage reqMessage = (SOAPMessage)payload;
+ SOAPEnvelope soapEnvelope = reqMessage.getSOAPPart().getEnvelope();
+ SOAPHeader soapHeader = soapEnvelope.getHeader();
+ SOAPBody soapBody = soapEnvelope.getBody();
+
+ // Verify the SOAP version
+ verifySOAPVersion(opMetaData, soapEnvelope);
+
+ // Construct the endpoint invocation object
+ EndpointInvocation epInv = new EndpointInvocation(opMetaData);
+
+ CommonMessageContext msgContext =
MessageContextAssociation.peekMessageContext();
+ if (msgContext == null)
+ throw new WSException("MessageContext not available");
+
+ // Disable MTOM for rpc/encoded
+ if (opMetaData.isRPCEncoded())
+ msgContext.setProperty(StubExt.PROPERTY_MTOM_ENABLED, Boolean.FALSE);
+
+ // Get the namespace registry
+ NamespaceRegistry namespaceRegistry = msgContext.getNamespaceRegistry();
+
+ if (opMetaData.isMessageEndpoint() == false)
+ {
+ Style style = opMetaData.getStyle();
+ if (style == Style.RPC)
+ {
+ SOAPBodyElement soapBodyElement =
(SOAPBodyElement)soapBody.getChildElements().next();
+ Name elName = soapBodyElement.getElementName();
+
+ QName elQName = new QName(elName.getURI(), elName.getLocalName(),
elName.getPrefix());
+ elQName = namespaceRegistry.registerQName(elQName);
+
+ for (ParameterMetaData paramMetaData : opMetaData.getParameters())
+ {
+ QName xmlName = paramMetaData.getXmlName();
+ if (paramMetaData.getMode() == ParameterMode.OUT)
+ {
+ epInv.setRequestParamValue(xmlName, null);
+ }
+ else
+ {
+ if (paramMetaData.isSwA())
+ {
+ Object value = getAttachmentFromMessage(paramMetaData,
reqMessage);
+ epInv.setRequestParamValue(xmlName, value);
+ }
+ else
+ {
+ if (paramMetaData.isInHeader() == false)
+ {
+ Object value = getParameterFromMessage(paramMetaData,
soapBodyElement, false);
+ epInv.setRequestParamValue(xmlName, value);
+ }
+ else
+ {
+ Object value = getParameterFromMessage(paramMetaData,
soapHeader, false);
+ epInv.setRequestParamValue(xmlName, value);
+ }
+ }
+ }
+ }
+ }
+
+ // Document style
+ else
+ {
+ for (ParameterMetaData paramMetaData : opMetaData.getParameters())
+ {
+ QName xmlName = paramMetaData.getXmlName();
+ if (paramMetaData.isSwA())
+ {
+ Object value = getAttachmentFromMessage(paramMetaData, reqMessage);
+ epInv.setRequestParamValue(xmlName, value);
+ }
+ else
+ {
+ if (paramMetaData.isInHeader())
+ {
+ if (paramMetaData.getMode() == ParameterMode.IN)
+ {
+ Object value = getParameterFromMessage(paramMetaData,
soapHeader, false);
+ epInv.setRequestParamValue(xmlName, value);
+ }
+ else
+ {
+ Object value = getParameterFromMessage(paramMetaData,
soapHeader, true);
+ epInv.setRequestParamValue(xmlName, value);
+ }
+ }
+ else
+ {
+ Object value = getParameterFromMessage(paramMetaData, soapBody,
false);
+ epInv.setRequestParamValue(xmlName, value);
+ }
+ }
+ }
+ }
+ }
+
+ // Generic message endpoint
+ else
+ {
+ for (ParameterMetaData paramMetaData : opMetaData.getParameters())
+ {
+ QName xmlName = paramMetaData.getXmlName();
+ Object value = soapBody.getChildElements().next();
+ epInv.setRequestParamValue(xmlName, value);
+ }
+ }
+
+ return epInv;
+ }
+ catch (Exception e)
+ {
+ handleException(e);
+ return null;
+ }
+ }
+
+ /** On the server side, generate the payload from OUT parameters. */
+ public Object bindResponseMessage(OperationMetaData opMetaData, EndpointInvocation
epInv) throws BindingException
+ {
+ log.debug("bindResponseMessage: " + opMetaData.getQName());
+
+ try
+ {
+ CommonMessageContext msgContext =
MessageContextAssociation.peekMessageContext();
+ if (msgContext == null)
+ throw new WSException("MessageContext not available");
+
+ // Disable MTOM for rpc/encoded
+ if (opMetaData.isRPCEncoded())
+ msgContext.setProperty(StubExt.PROPERTY_MTOM_ENABLED, Boolean.FALSE);
+
+ // Associate current message with message context
+ SOAPMessageImpl resMessage = (SOAPMessageImpl)createMessage(opMetaData);
+ msgContext.setSOAPMessage(resMessage);
+
+ // R2714 For one-way operations, an INSTANCE MUST NOT return a HTTP response
that contains a SOAP envelope.
+ // Specifically, the HTTP response entity-body must be empty.
+ if (opMetaData.isOneWay())
+ {
+ resMessage.getSOAPPart().setContent(null);
+ return resMessage;
+ }
+
+ SOAPEnvelope soapEnvelope = resMessage.getSOAPPart().getEnvelope();
+ SOAPHeader soapHeader = soapEnvelope.getHeader();
+ SOAPBody soapBody = soapEnvelope.getBody();
+
+ // Get the namespace registry
+ NamespaceRegistry namespaceRegistry = msgContext.getNamespaceRegistry();
+
+ Style style = opMetaData.getStyle();
+ if (style == Style.RPC)
+ {
+ QName opQName = opMetaData.getResponseName();
+
+ Name opName = new NameImpl(namespaceRegistry.registerQName(opQName));
+ SOAPBodyElement soapBodyElement = new SOAPBodyElementRpc(opName);
+
+ soapBodyElement =
(SOAPBodyElement)soapBody.addChildElement(soapBodyElement);
+
+ // Add the return to the message
+ ParameterMetaData retMetaData = opMetaData.getReturnParameter();
+ if (retMetaData != null)
+ {
+ Object value = epInv.getReturnValue();
+ if (retMetaData.isSwA())
+ {
+ CIDGenerator cidGenerator = resMessage.getCidGenerator();
+ AttachmentPart part = createAttachmentPart(retMetaData, value,
cidGenerator);
+ resMessage.addAttachmentPart(part);
+ epInv.setReturnValue(part);
+ }
+ else
+ {
+ SOAPContentElement soapElement = addParameterToMessage(retMetaData,
value, soapBodyElement);
+ epInv.setReturnValue(soapElement);
+ soapElement.setObjectValue(value);
+ }
+ }
+
+ // Add the out parameters to the message
+ for (ParameterMetaData paramMetaData : opMetaData.getOutputParameters())
+ {
+ QName xmlName = paramMetaData.getXmlName();
+ Object value = epInv.getResponseParamValue(xmlName);
+ if (paramMetaData.isSwA())
+ {
+ CIDGenerator cidGenerator = resMessage.getCidGenerator();
+ AttachmentPart part = createAttachmentPart(retMetaData, value,
cidGenerator);
+ resMessage.addAttachmentPart(part);
+ }
+ else
+ {
+ if (paramMetaData.isInHeader())
+ {
+ addParameterToMessage(paramMetaData, value, soapHeader);
+ }
+ else
+ {
+ addParameterToMessage(paramMetaData, value, soapBodyElement);
+ }
+ }
+ }
+ }
+ else if (style == Style.DOCUMENT)
+ {
+ ParameterMetaData retMetaData = opMetaData.getReturnParameter();
+ if (retMetaData != null)
+ {
+ Object value = epInv.getReturnValue();
+ if (opMetaData.isDocumentWrapped())
+ value = ParameterWrapping.wrapResponseParameters(retMetaData, value,
epInv.getOutParameters());
+
+ if (retMetaData.isSwA())
+ {
+ CIDGenerator cidGenerator = resMessage.getCidGenerator();
+ AttachmentPart part = createAttachmentPart(retMetaData, value,
cidGenerator);
+ resMessage.addAttachmentPart(part);
+ epInv.setReturnValue(part);
+ }
+ else
+ {
+ SOAPContentElement soapElement = addParameterToMessage(retMetaData,
value, soapBody);
+ epInv.setReturnValue(soapElement);
+ }
+ }
+
+ // Add the out header parameters to the message
+ for (ParameterMetaData paramMetaData : opMetaData.getOutputParameters())
+ {
+ QName xmlName = paramMetaData.getXmlName();
+ if (paramMetaData.isInHeader())
+ {
+ Object value = epInv.getResponseParamValue(xmlName);
+ addParameterToMessage(paramMetaData, value, soapHeader);
+ }
+ }
+ }
+ else
+ {
+ throw new WSException("Unsupported message style: " + style);
+ }
+
+ return resMessage;
+ }
+ catch (Exception e)
+ {
+ handleException(e);
+ return null;
+ }
+ }
+
+ /** On the client side, extract the OUT parameters from the payload and return them to
the client. */
+ public void unbindResponseMessage(OperationMetaData opMetaData, Object payload,
EndpointInvocation epInv, Map<QName, UnboundHeader> unboundHeaders)
+ throws BindingException
+ {
+ log.debug("unbindResponseMessage: " + opMetaData.getQName());
+
+ try
+ {
+ // R2714 For one-way operations, an INSTANCE MUST NOT return a HTTP response
that contains a SOAP envelope.
+ // Specifically, the HTTP response entity-body must be empty.
+ if (opMetaData.isOneWay() == true)
+ {
+ return;
+ }
+
+ // WS-Addressing might redirect the response, which results in an empty
envelope
+ SOAPMessage resMessage = (SOAPMessage)payload;
+ SOAPEnvelope soapEnvelope = resMessage.getSOAPPart().getEnvelope();
+ if (soapEnvelope == null)
+ {
+ return;
+ }
+
+ // Verify the SOAP version
+ verifySOAPVersion(opMetaData, soapEnvelope);
+
+ // Get the SOAP message context that is associated with the current thread
+ CommonMessageContext msgContext =
MessageContextAssociation.peekMessageContext();
+ if (msgContext == null)
+ throw new WSException("MessageContext not available");
+
+ // Disable MTOM for rpc/encoded
+ if (opMetaData.isRPCEncoded())
+ msgContext.setProperty(StubExt.PROPERTY_MTOM_ENABLED, Boolean.FALSE);
+
+ SOAPHeader soapHeader = soapEnvelope.getHeader();
+ SOAPBody soapBody = soapEnvelope.getBody();
+ Iterator bodyChildren = soapBody.getChildElements();
+
+ SOAPBodyElement soapBodyElement = null;
+ if (bodyChildren.hasNext() != false)
+ soapBodyElement = (SOAPBodyElement)bodyChildren.next();
+
+ // Translate the SOAPFault to an exception and throw it
+ if (soapBodyElement instanceof SOAPFaultImpl)
+ throwFaultException((SOAPFaultImpl)soapBodyElement);
+
+ // Extract unbound OUT headers
+ if (unboundHeaders != null)
+ {
+ Map<QName, UnboundHeader> outHeaders = new HashMap<QName,
UnboundHeader>();
+ Iterator itHeaderElements = soapHeader.getChildElements();
+ while (itHeaderElements.hasNext())
+ {
+ SOAPContentElement soapHeaderElement =
(SOAPHeaderElementImpl)itHeaderElements.next();
+ Name elName = soapHeaderElement.getElementName();
+ QName xmlName = new QName(elName.getURI(), elName.getLocalName());
+
+ UnboundHeader unboundHeader = (UnboundHeader)unboundHeaders.get(xmlName);
+ if (unboundHeader != null)
+ {
+
soapHeaderElement.setParamMetaData(unboundHeader.toParameterMetaData(opMetaData));
+
+ // Do the unmarshalling
+ Object value = soapHeaderElement.getObjectValue();
+ unboundHeader.setHeaderValue(value);
+ outHeaders.put(xmlName, unboundHeader);
+ }
+ }
+ unboundHeaders.clear();
+ unboundHeaders.putAll(outHeaders);
+ }
+
+ Style style = opMetaData.getStyle();
+ if (style == Style.RPC)
+ {
+ if (soapBodyElement == null)
+ throw new WSException("Cannot unbind response message with empty soap
body");
+
+ ParameterMetaData retMetaData = opMetaData.getReturnParameter();
+ if (retMetaData != null)
+ {
+ if (retMetaData.isSwA())
+ {
+ Object value = getAttachmentFromMessage(retMetaData, resMessage);
+ epInv.setReturnValue(value);
+ }
+ else
+ {
+ Object value = getParameterFromMessage(retMetaData, soapBodyElement,
false);
+ epInv.setReturnValue(value);
+ }
+ }
+
+ for (ParameterMetaData paramMetaData : opMetaData.getOutputParameters())
+ {
+ QName xmlName = paramMetaData.getXmlName();
+ if (paramMetaData.isSwA())
+ {
+ Object value = getAttachmentFromMessage(paramMetaData, resMessage);
+ epInv.setResponseParamValue(xmlName, value);
+ }
+ else
+ {
+ SOAPElement soapElement = paramMetaData.isInHeader() ? soapHeader :
(SOAPElement)soapBodyElement;
+ Object value = getParameterFromMessage(paramMetaData, soapElement,
false);
+ epInv.setResponseParamValue(xmlName, value);
+ }
+ }
+ }
+ else if (style == Style.DOCUMENT)
+ {
+ ParameterMetaData retMetaData = opMetaData.getReturnParameter();
+
+ // WS-Eventing has no message part for UnsubscribeResponseMsg
+ if (retMetaData != null)
+ {
+ if (retMetaData.isSwA())
+ {
+ Object value = getAttachmentFromMessage(retMetaData, resMessage);
+ epInv.setReturnValue(value);
+ }
+ else
+ {
+ Object value = getParameterFromMessage(retMetaData, soapBody, false);
+ epInv.setReturnValue(value);
+ }
+
+ for (ParameterMetaData paramMetaData : opMetaData.getOutputParameters())
+ {
+ QName xmlName = paramMetaData.getXmlName();
+ if (paramMetaData.isInHeader())
+ {
+ Object value = getParameterFromMessage(paramMetaData, soapHeader,
false);
+ epInv.setResponseParamValue(xmlName, value);
+ }
+ }
+ }
+ }
+ else
+ {
+ throw new WSException("Unsupported message style: " + style);
+ }
+ }
+ catch (Exception e)
+ {
+ handleException(e);
+ }
+ }
+
+ public abstract SOAPMessage exceptionToFaultMessage(Exception ex);
+
+ private void verifySOAPVersion(OperationMetaData opMetaData, SOAPEnvelope
soapEnvelope)
+ {
+ String envNS = soapEnvelope.getNamespaceURI();
+ String bindingId = opMetaData.getEndpointMetaData().getBindingId();
+ if (CommonSOAPBinding.SOAP11HTTP_BINDING.equals(bindingId) &&
Constants.NS_SOAP11_ENV.equals(envNS) == false)
+ log.warn("Expected SOAP-1.1 envelope, but got: " + envNS);
+
+ if (CommonSOAPBinding.SOAP12HTTP_BINDING.equals(bindingId) &&
Constants.NS_SOAP12_ENV.equals(envNS) == false)
+ log.warn("Expected SOAP-1.2 envelope, but got: " + envNS);
+ }
+
+ private AttachmentPart createAttachmentPart(ParameterMetaData paramMetaData, Object
value, CIDGenerator cidGenerator) throws SOAPException, BindingException
+ {
+ String partName = paramMetaData.getXmlName().getLocalPart();
+ Set mimeTypes = paramMetaData.getMimeTypes();
+
+ AttachmentPart part = new AttachmentPartImpl();
+ if (value instanceof DataHandler)
+ {
+ DataHandler handler = (DataHandler)value;
+ String mimeType = MimeUtils.getBaseMimeType(handler.getContentType());
+
+ if (mimeTypes != null && !MimeUtils.isMemberOf(mimeType, mimeTypes))
+ throw new BindingException("Mime type " + mimeType + " not
allowed for parameter " + partName + " allowed types are " + mimeTypes);
+
+ part.setDataHandler((DataHandler)value);
+ }
+ else
+ {
+ String mimeType = null;
+ if (mimeTypes != null && mimeTypes.size() > 0)
+ {
+ mimeType = (String)mimeTypes.iterator().next();
+ }
+ else
+ {
+ mimeType = MimeUtils.resolveMimeType(value);
+ }
+
+ if (mimeType == null)
+ throw new BindingException("Could not determine mime type for attachment
parameter: " + partName);
+
+ part.setContent(value, mimeType);
+ }
+
+ if (paramMetaData.isSwA())
+ {
+ String swaCID = '<' + partName + "=" +
cidGenerator.generateFromCount() + '>';
+ part.setContentId(swaCID);
+ }
+ if (paramMetaData.isXOP())
+ {
+ String xopCID = '<' + cidGenerator.generateFromName(partName) +
'>';
+ part.setContentId(xopCID);
+ }
+
+ return part;
+ }
+
+ private Object getAttachmentFromMessage(ParameterMetaData paramMetaData, SOAPMessage
message) throws SOAPException, BindingException
+ {
+ QName xmlName = paramMetaData.getXmlName();
+
+ AttachmentPart part =
((SOAPMessageImpl)message).getAttachmentByPartName(xmlName.getLocalPart());
+ if (part == null)
+ throw new BindingException("Could not locate attachment for parameter:
" + paramMetaData.getXmlName());
+
+ return part;
+ }
+
+ /** Marshall the given parameter and add it to the SOAPMessage */
+ private SOAPContentElement addParameterToMessage(ParameterMetaData paramMetaData,
Object value, SOAPElement soapElement) throws SOAPException, BindingException
+ {
+ QName xmlName = paramMetaData.getXmlName();
+ Class javaType = paramMetaData.getJavaType();
+
+ if (value != null && paramMetaData.isXOP() == false)
+ {
+ Class valueType = value.getClass();
+ if (JavaUtils.isAssignableFrom(javaType, valueType) == false)
+ throw new BindingException("javaType " + javaType.getName() +
" is not assignable from: " + valueType.getName());
+ }
+
+ // Make sure we have a prefix on qualified names
+ if (xmlName.getNamespaceURI().length() > 0)
+ {
+ CommonMessageContext msgContext =
MessageContextAssociation.peekMessageContext();
+ NamespaceRegistry namespaceRegistry = msgContext.getNamespaceRegistry();
+ xmlName = namespaceRegistry.registerQName(xmlName);
+ }
+
+ Name soapName = new NameImpl(xmlName.getLocalPart(), xmlName.getPrefix(),
xmlName.getNamespaceURI());
+ if (paramMetaData.isSOAPArrayParam())
+ soapName = new NameImpl("Array", Constants.PREFIX_SOAP11_ENC,
Constants.URI_SOAP11_ENC);
+
+ SOAPContentElement contentElement;
+ if (soapElement instanceof SOAPHeader)
+ {
+ contentElement = new SOAPHeaderElementImpl(soapName);
+ soapElement.addChildElement(contentElement);
+ }
+ else
+ {
+ Style style = paramMetaData.getOperationMetaData().getStyle();
+ if (style == Style.DOCUMENT)
+ {
+ contentElement = new SOAPBodyElementDoc(soapName);
+ soapElement.addChildElement(contentElement);
+ }
+ else
+ {
+ contentElement = new SOAPContentElement(soapName);
+ soapElement.addChildElement(contentElement);
+ }
+ }
+
+ contentElement.setParamMetaData(paramMetaData);
+
+ if (paramMetaData.isSOAPArrayParam())
+ {
+ log.trace("Add parameter as SOAP encoded Array");
+ contentElement.addNamespaceDeclaration(Constants.PREFIX_SOAP11_ENC,
Constants.URI_SOAP11_ENC);
+ }
+
+ // When a potential xop parameter is detected and MTOM is enabled
+ // we flag the SOAP message as a XOP package
+ if (paramMetaData.isXOP() && XOPContext.isMTOMEnabled())
+ {
+ log.trace("Add parameter as XOP");
+ CommonMessageContext msgContext =
MessageContextAssociation.peekMessageContext();
+ SOAPMessageImpl soapMessage = (SOAPMessageImpl)msgContext.getSOAPMessage();
+ soapMessage.setXOPMessage(true);
+ }
+
+ contentElement.setObjectValue(value);
+
+ return contentElement;
+ }
+
+ /** Unmarshall a message element and add it to the parameter list */
+ private Object getParameterFromMessage(ParameterMetaData paramMetaData, SOAPElement
soapElement, boolean optional) throws BindingException
+ {
+ Name xmlName = new NameImpl(paramMetaData.getXmlName());
+
+ SOAPContentElement soapContentElement = null;
+ Iterator childElements = soapElement.getChildElements();
+ while (childElements.hasNext())
+ {
+ SOAPElementImpl childElement = (SOAPElementImpl)childElements.next();
+
+ // If this message was manipulated by a handler the child may not be a content
element
+ if (!(childElement instanceof SOAPContentElement))
+ childElement = (SOAPContentElement)soapElement.replaceChild(new
SOAPContentElement(childElement), childElement);
+
+ // The parameters are expected to be lazy
+ SOAPContentElement aux = (SOAPContentElement)childElement;
+ Name elName = aux.getElementName();
+
+ if (xmlName.equals(elName))
+ {
+ soapContentElement = aux;
+ soapContentElement.setParamMetaData(paramMetaData);
+ break;
+ }
+
+ if (SOAP_ARRAY_NAME.equals(elName))
+ {
+ CommonMessageContext msgContext =
MessageContextAssociation.peekMessageContext();
+ msgContext.setProperty(CommonMessageContext.ALLOW_EXPAND_TO_DOM,
Boolean.TRUE);
+ try
+ {
+ QName compXMLName = paramMetaData.getXmlName();
+ Element compElement = DOMUtils.getFirstChildElement(aux);
+ if (compElement.getNodeName().equals(compXMLName.getLocalPart()))
+ {
+ soapContentElement = aux;
+ soapContentElement.setParamMetaData(paramMetaData);
+ break;
+ }
+ }
+ finally
+ {
+ msgContext.removeProperty(CommonMessageContext.ALLOW_EXPAND_TO_DOM);
+ }
+ }
+ }
+
+ // If matching by name fails, try to match by xmlType
+ // This maybe necessary when wsa:Action dispatches to the operation
+ if (soapContentElement == null)
+ {
+ childElements = soapElement.getChildElements();
+ OperationMetaData opMetaData = paramMetaData.getOperationMetaData();
+ TypesMetaData typesMetaData =
opMetaData.getEndpointMetaData().getServiceMetaData().getTypesMetaData();
+ if (childElements.hasNext() && opMetaData.getStyle() == Style.DOCUMENT)
+ {
+ SOAPElementImpl childElement = (SOAPElementImpl)childElements.next();
+
+ // The parameters are expected to be lazy
+ SOAPContentElement aux = (SOAPContentElement)childElement;
+ Name elName = aux.getElementName();
+ QName elType = null;
+
+ XSElementDeclaration xsdElement =
typesMetaData.getSchemaModel().getElementDeclaration(elName.getLocalName(),
elName.getURI());
+ if (xsdElement != null && xsdElement.getTypeDefinition() != null)
+ {
+ XSTypeDefinition xsdType = xsdElement.getTypeDefinition();
+ elType = new QName(xsdType.getNamespace(), xsdType.getName());
+ }
+
+ if (paramMetaData.getXmlType().equals(elType))
+ {
+ soapContentElement = aux;
+ soapContentElement.setParamMetaData(paramMetaData);
+ }
+ }
+ }
+
+ if (soapContentElement == null && optional == false)
+ throw new WSException("Cannot find child element: " + xmlName);
+
+ // When a potential XOP parameter is detected and
+ // the incomming request is actuall XOP encoded we flag
+ // the SOAP message a XOP packaged.
+ if (paramMetaData.isXOP() && XOPContext.isXOPEncodedRequest())
+ {
+ SOAPMessageImpl soapMessage =
(SOAPMessageImpl)MessageContextAssociation.peekMessageContext().getSOAPMessage();
+ soapMessage.setXOPMessage(true);
+ }
+ return soapContentElement;
+ }
+
+ abstract protected void throwFaultException(SOAPFaultImpl fault) throws Exception;
+
+ private void handleException(Exception ex) throws BindingException
+ {
+ if (ex instanceof RuntimeException)
+ throw (RuntimeException)ex;
+
+ if (ex instanceof BindingException)
+ throw (BindingException)ex;
+
+ throw new BindingException(ex);
+ }
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/ComplexTypeDeserializer.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/ComplexTypeDeserializer.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/ComplexTypeDeserializer.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/ComplexTypeDeserializer.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -0,0 +1,36 @@
+/*
+ * 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
+{
+
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/ComplexTypeSerializer.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/ComplexTypeSerializer.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/ComplexTypeSerializer.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/ComplexTypeSerializer.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -0,0 +1,36 @@
+/*
+ * 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
+{
+
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/DateDeserializer.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/DateDeserializer.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/DateDeserializer.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/DateDeserializer.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -0,0 +1,61 @@
+/*
+* 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.Calendar;
+import java.util.Date;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.core.jaxrpc.binding.BindingException;
+import org.jboss.ws.core.jaxrpc.binding.DeserializerSupport;
+import org.jboss.ws.core.jaxrpc.binding.SerializationContext;
+import org.jboss.xb.binding.SimpleTypeBindings;
+
+/**
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 04-Dec-2004
+ */
+public class DateDeserializer extends DeserializerSupport
+{
+ // provide logging
+ private static final Logger log = Logger.getLogger(DateDeserializer.class);
+
+ public Object deserialize(QName xmlName, QName xmlType, String xmlFragment,
SerializationContext serContext) throws BindingException
+ {
+ log.debug("deserialize: [xmlName=" + xmlName + ",xmlType=" +
xmlType + "]");
+
+ Date value = null;
+
+ String valueStr = unwrapValueStr(xmlFragment);
+ if (valueStr != null)
+ {
+ Calendar cal = SimpleTypeBindings.unmarshalDateTime(valueStr);
+ value = cal.getTime();
+ }
+
+ return value;
+ }
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/DateDeserializerFactory.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/DateDeserializerFactory.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/DateDeserializerFactory.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/DateDeserializerFactory.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -0,0 +1,41 @@
+/*
+* 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;
+
+import org.jboss.ws.core.jaxrpc.binding.DeserializerSupport;
+
+// $Id$
+
+
+/**
+ * A DateDeserializer Factory
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 04-Dec-2004
+ */
+public class DateDeserializerFactory extends DeserializerFactoryBase
+{
+ public DeserializerSupport getDeserializer()
+ {
+ return new DateDeserializer();
+ }
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/DateSerializer.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/DateSerializer.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/DateSerializer.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/DateSerializer.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -0,0 +1,68 @@
+/*
+* 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.Calendar;
+import java.util.Date;
+import java.util.GregorianCalendar;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.core.jaxrpc.binding.BindingException;
+import org.jboss.ws.core.jaxrpc.binding.SerializationContext;
+import org.jboss.ws.core.jaxrpc.binding.SerializerSupport;
+import org.jboss.xb.binding.NamespaceRegistry;
+import org.jboss.xb.binding.SimpleTypeBindings;
+import org.w3c.dom.NamedNodeMap;
+
+/**
+ * Serializer for Dates.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 04-Dec-2004
+ * @see <a
href="http://www.w3.org/TR/xmlschema-2/#dateTime">XML Schema
3.2.16</a>
+ */
+public class DateSerializer extends SerializerSupport
+{
+ // provide logging
+ private static final Logger log = Logger.getLogger(DateSerializer.class);
+
+ public String serialize(QName xmlName, QName xmlType, Object value,
SerializationContext serContext, NamedNodeMap attributes) throws BindingException
+ {
+ log.debug("serialize: [xmlName=" + xmlName + ",xmlType=" +
xmlType + "]");
+ if (value != null)
+ {
+ Calendar cal = new GregorianCalendar();
+ cal.setTime((Date)value);
+ value = cal;
+ }
+
+ String valueStr = SimpleTypeBindings.marshalDateTime((Calendar)value);
+
+ NamespaceRegistry nsRegistry = serContext.getNamespaceRegistry();
+ String xmlFragment = wrapValueStr(xmlName, valueStr, nsRegistry, attributes,
true);
+ return xmlFragment;
+ }
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/DateSerializerFactory.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/DateSerializerFactory.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/DateSerializerFactory.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/DateSerializerFactory.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -0,0 +1,41 @@
+/*
+* 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;
+
+import org.jboss.ws.core.jaxrpc.binding.SerializerSupport;
+
+// $Id$
+
+
+/**
+ * SerializerFactory for Date primitives
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 04-Dec-2004
+ */
+public class DateSerializerFactory extends SerializerFactoryBase
+{
+ public SerializerSupport getSerializer()
+ {
+ return new DateSerializer();
+ }
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/DeserializerFactoryBase.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/DeserializerFactoryBase.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/DeserializerFactoryBase.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/DeserializerFactoryBase.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -0,0 +1,52 @@
+/*
+* 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;
+import org.jboss.ws.core.jaxrpc.binding.BindingException;
+import org.jboss.ws.core.jaxrpc.binding.DeserializerSupport;
+
+/**
+ * @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();
+ }
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/DeserializerSupport.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/DeserializerSupport.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/DeserializerSupport.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/DeserializerSupport.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -0,0 +1,93 @@
+/*
+ * 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 javax.xml.namespace.QName;
+import javax.xml.rpc.encoding.Deserializer;
+
+import org.jboss.util.NotImplementedException;
+import org.jboss.ws.core.utils.XMLPredefinedEntityReferenceResolver;
+
+/** The base class for all Deserializers.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 04-Dec-2004
+ */
+public abstract class DeserializerSupport implements Deserializer
+{
+
+ /** 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, String xmlFragment,
SerializationContext serContext) throws BindingException;
+
+ /** 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();
+ }
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/ElementDeserializer.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/ElementDeserializer.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/ElementDeserializer.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/ElementDeserializer.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -0,0 +1,65 @@
+/*
+* 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 javax.xml.namespace.QName;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.core.jaxrpc.binding.BindingException;
+import org.jboss.ws.core.jaxrpc.binding.DeserializerSupport;
+import org.jboss.ws.core.jaxrpc.binding.SerializationContext;
+import org.jboss.ws.core.utils.DOMUtils;
+import org.w3c.dom.Element;
+
+/**
+ * A deserializer that can handle xsd:anyType
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 23-Jun-2005
+ */
+public class ElementDeserializer extends DeserializerSupport
+{
+ // provide logging
+ private static final Logger log = Logger.getLogger(ElementDeserializer.class);
+
+ /** Deserialize the given simple xmlString
+ */
+ public Object deserialize(QName xmlName, QName xmlType, String xmlFragment,
SerializationContext serContext) throws BindingException
+ {
+ log.debug("deserialize: [xmlName=" + xmlName + ",xmlType=" +
xmlType + "]");
+ try
+ {
+ Element domElement = DOMUtils.parse(xmlFragment);
+ return domElement;
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (Exception ex)
+ {
+ throw new BindingException();
+ }
+ }
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/ElementDeserializerFactory.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/ElementDeserializerFactory.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/ElementDeserializerFactory.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/ElementDeserializerFactory.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -0,0 +1,41 @@
+/*
+* 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;
+
+import org.jboss.ws.core.jaxrpc.binding.DeserializerSupport;
+
+// $Id$
+
+
+/**
+ * A factory for a Deserializer that can handle XMLSchema simple types.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 18-Oct-2004
+ */
+public class ElementDeserializerFactory extends DeserializerFactoryBase
+{
+ public DeserializerSupport getDeserializer()
+ {
+ return new ElementDeserializer();
+ }
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/ElementSerializer.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/ElementSerializer.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/ElementSerializer.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/ElementSerializer.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -0,0 +1,65 @@
+/*
+* 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 javax.xml.namespace.QName;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.core.jaxrpc.binding.BindingException;
+import org.jboss.ws.core.jaxrpc.binding.SerializationContext;
+import org.jboss.ws.core.jaxrpc.binding.SerializerSupport;
+import org.jboss.ws.core.utils.DOMWriter;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+
+/**
+ * A serializer that can handle xsd:anyType
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 18-Oct-2004
+ */
+public class ElementSerializer extends SerializerSupport
+{
+ // provide logging
+ private static final Logger log = Logger.getLogger(ElementSerializer.class);
+
+ /** Marshal the value for a given XMLSchema type
+ * @param xmlType local part of the schema type
+ * @param value the value to marshal
+ * @param serContext
+ * @return the string representation od the value
+ */
+ public String serialize(QName xmlName, QName xmlType, Object value,
SerializationContext serContext, NamedNodeMap attributes)
+ throws BindingException
+ {
+ log.debug("serialize: [xmlName=" + xmlName + ",xmlType=" +
xmlType + "]");
+ if (value == null)
+ throw new IllegalArgumentException("Element value cannot be null");
+ if ((value instanceof Element) == false)
+ throw new IllegalArgumentException("Value is not a Element: " +
value.getClass().getName());
+
+ String xmlFragment = DOMWriter.printNode((Element)value, false);
+ return xmlFragment;
+ }
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/ElementSerializerFactory.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/ElementSerializerFactory.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/ElementSerializerFactory.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/ElementSerializerFactory.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -0,0 +1,40 @@
+/*
+* 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;
+
+import org.jboss.ws.core.jaxrpc.binding.SerializerSupport;
+
+// $Id$
+
+/**
+ * A factory for a Serializer that can handle xsd:anyType
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 23-Jun-2005
+ */
+public class ElementSerializerFactory extends SerializerFactoryBase
+{
+ public SerializerSupport getSerializer()
+ {
+ return new ElementSerializer();
+ }
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/HexDeserializer.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/HexDeserializer.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/HexDeserializer.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/HexDeserializer.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -0,0 +1,60 @@
+/*
+* 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 javax.xml.namespace.QName;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.core.jaxrpc.binding.BindingException;
+import org.jboss.ws.core.jaxrpc.binding.DeserializerSupport;
+import org.jboss.ws.core.jaxrpc.binding.SerializationContext;
+import org.jboss.xb.binding.SimpleTypeBindings;
+
+/**
+ * Deserializer for hexBinary.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 04-Dec-2004
+ * @see <a
href="http://www.w3.org/TR/xmlschema-2/#hexBinary">XML Schema
3.2.16</a>
+ */
+public class HexDeserializer extends DeserializerSupport
+{
+ // provide logging
+ private static final Logger log = Logger.getLogger(HexDeserializer.class);
+
+ public Object deserialize(QName xmlName, QName xmlType, String xmlFragment,
SerializationContext serContext) throws BindingException
+ {
+ log.debug("deserialize: [xmlName=" + xmlName + ",xmlType=" +
xmlType + "]");
+
+ byte[] value = null;
+
+ String valueStr = unwrapValueStr(xmlFragment);
+ if (valueStr != null)
+ {
+ value = SimpleTypeBindings.unmarshalHexBinary(valueStr);
+ }
+
+ return value;
+ }
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/HexDeserializerFactory.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/HexDeserializerFactory.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/HexDeserializerFactory.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/HexDeserializerFactory.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -0,0 +1,41 @@
+/*
+* 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;
+
+import org.jboss.ws.core.jaxrpc.binding.DeserializerSupport;
+
+// $Id$
+
+
+/**
+ * DeserializerFactory for hexBinary.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 04-Dec-2004
+ */
+public class HexDeserializerFactory extends DeserializerFactoryBase
+{
+ public DeserializerSupport getDeserializer()
+ {
+ return new HexDeserializer();
+ }
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/HexSerializer.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/HexSerializer.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/HexSerializer.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/HexSerializer.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -0,0 +1,60 @@
+/*
+* 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 javax.xml.namespace.QName;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.core.jaxrpc.binding.BindingException;
+import org.jboss.ws.core.jaxrpc.binding.SerializationContext;
+import org.jboss.ws.core.jaxrpc.binding.SerializerSupport;
+import org.jboss.ws.core.utils.JavaUtils;
+import org.jboss.xb.binding.NamespaceRegistry;
+import org.jboss.xb.binding.SimpleTypeBindings;
+import org.w3c.dom.NamedNodeMap;
+
+/**
+ * Serializer for hexBinary.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 04-Dec-2004
+ * @see <a
href="http://www.w3.org/TR/xmlschema-2/#hexBinary">XML Schema
3.2.16</a>
+ */
+public class HexSerializer extends SerializerSupport
+{
+ // provide logging
+ private static final Logger log = Logger.getLogger(HexSerializer.class);
+
+ public String serialize(QName xmlName, QName xmlType, Object value,
SerializationContext serContext, NamedNodeMap attributes) throws BindingException
+ {
+ log.debug("serialize: [xmlName=" + xmlName + ",xmlType=" +
xmlType + "]");
+
+ value = JavaUtils.getPrimitiveValueArray(value);
+ String valueStr = SimpleTypeBindings.marshalHexBinary((byte[])value);
+
+ NamespaceRegistry nsRegistry = serContext.getNamespaceRegistry();
+ String xmlFragment = wrapValueStr(xmlName, valueStr, nsRegistry, attributes,
true);
+ return xmlFragment;
+ }
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/HexSerializerFactory.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/HexSerializerFactory.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/HexSerializerFactory.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/HexSerializerFactory.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -0,0 +1,41 @@
+/*
+* 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;
+
+import org.jboss.ws.core.jaxrpc.binding.SerializerSupport;
+
+// $Id$
+
+
+/**
+ * SerializerFactory for hexBinary.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 04-Dec-2004
+ */
+public class HexSerializerFactory extends SerializerFactoryBase
+{
+ public SerializerSupport getSerializer()
+ {
+ return new HexSerializer();
+ }
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/JBossXBDeserializer.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/JBossXBDeserializer.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/JBossXBDeserializer.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/JBossXBDeserializer.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -0,0 +1,113 @@
+/*
+ * 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 javax.xml.namespace.QName;
+
+import org.apache.xerces.xs.XSModel;
+import org.jboss.logging.Logger;
+import org.jboss.ws.core.jaxrpc.SerializationContextJAXRPC;
+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.jaxrpc.binding.jbossxb.JBossXBConstants;
+import org.jboss.ws.core.jaxrpc.binding.jbossxb.JBossXBUnmarshaller;
+import org.jboss.ws.core.jaxrpc.binding.jbossxb.JBossXBUnmarshallerImpl;
+import org.jboss.ws.core.metadata.jaxrpcmapping.JavaWsdlMapping;
+
+/**
+ * A Deserializer that can handle complex types by delegating to JAXB.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 04-Dec-2004
+ */
+public class JBossXBDeserializer extends ComplexTypeDeserializer
+{
+ // provide logging
+ private static final Logger log = Logger.getLogger(JBossXBDeserializer.class);
+
+ private JBossXBUnmarshaller unmarshaller;
+
+ public JBossXBDeserializer() throws BindingException
+ {
+ // Get the JAXB marshaller for complex objects
+ unmarshaller = new JBossXBUnmarshallerImpl();
+ }
+
+ /**
+ * For unmarshalling the WS layer passes to the JAXB layer
+ *
+ * - required self contained xml content
+ * - required map of packaged or generated XSDSchema
+ * - optional QName of the root complex type
+ * - optional instance of JavaWsdlMapping
+ *
+ * The xmlType is redundant if the root element name corresponds to a global element
definition in schema.
+ * If the java mapping is null, default mapping rules apply.
+ *
+ * The result is an object instance or null.
+ * In case of an unmarshalling problem a descriptive exception is thrown.
+ */
+ public Object deserialize(QName xmlName, QName xmlType, String val,
SerializationContext serContext) throws BindingException
+ {
+ log.debug("deserialize: [xmlName=" + xmlName + ",xmlType=" +
xmlType + "]");
+
+ // Expect the specific JAXRPC serialization context
+ SerializationContextJAXRPC jaxrpcContext = (SerializationContextJAXRPC)serContext;
+
+ Object value = null;
+ String typeName = xmlType.getLocalPart();
+
+ try
+ {
+ // Get the parsed model
+ XSModel model = jaxrpcContext.getXsModel();
+
+ // Get the jaxrpc-mapping.xml meta data
+ JavaWsdlMapping jaxrpcMapping = jaxrpcContext.getJavaWsdlMapping();
+
+ unmarshaller.setProperty(JBossXBConstants.JBXB_XS_MODEL, model);
+ unmarshaller.setProperty(JBossXBConstants.JBXB_ROOT_QNAME, xmlName);
+ unmarshaller.setProperty(JBossXBConstants.JBXB_TYPE_QNAME, xmlType);
+ unmarshaller.setProperty(JBossXBConstants.JBXB_JAVA_MAPPING, jaxrpcMapping);
+
+ ByteArrayInputStream ins = new
ByteArrayInputStream(val.getBytes("UTF-8"));
+ value = unmarshaller.unmarshal(ins);
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (Exception ex)
+ {
+ throw new BindingException(ex);
+ }
+
+ log.debug("deserialized: " + (value != null ? value.getClass().getName()
: null));
+ return value;
+
+ }
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/JBossXBDeserializerFactory.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/JBossXBDeserializerFactory.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/JBossXBDeserializerFactory.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/JBossXBDeserializerFactory.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -0,0 +1,42 @@
+/*
+* 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;
+
+import org.jboss.ws.core.jaxrpc.binding.BindingException;
+import org.jboss.ws.core.jaxrpc.binding.DeserializerSupport;
+
+// $Id$
+
+/**
+ * A factory for a Deserializer that can handle complex types
+ * by delegating to JAXB.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 04-Dec-2004
+ */
+public class JBossXBDeserializerFactory extends DeserializerFactoryBase
+{
+ public DeserializerSupport getDeserializer() throws BindingException
+ {
+ return new JBossXBDeserializer();
+ }
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/JBossXBSerializer.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/JBossXBSerializer.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/JBossXBSerializer.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/JBossXBSerializer.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -0,0 +1,126 @@
+/*
+ * 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.StringWriter;
+
+import javax.xml.namespace.QName;
+
+import org.apache.xerces.xs.XSModel;
+import org.jboss.logging.Logger;
+import org.jboss.ws.core.jaxrpc.SerializationContextJAXRPC;
+import org.jboss.ws.core.jaxrpc.binding.BindingException;
+import org.jboss.ws.core.jaxrpc.binding.ComplexTypeSerializer;
+import org.jboss.ws.core.jaxrpc.binding.SerializationContext;
+import org.jboss.ws.core.jaxrpc.binding.jbossxb.JBossXBConstants;
+import org.jboss.ws.core.jaxrpc.binding.jbossxb.JBossXBMarshaller;
+import org.jboss.ws.core.jaxrpc.binding.jbossxb.JBossXBMarshallerImpl;
+import org.jboss.ws.core.jaxrpc.binding.jbossxb.XercesXSMarshallerImpl;
+import org.jboss.ws.core.metadata.jaxrpcmapping.JavaWsdlMapping;
+import org.w3c.dom.NamedNodeMap;
+
+/**
+ * A Serializer that can handle complex types by delegating to JAXB.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 04-Dec-2004
+ */
+public class JBossXBSerializer extends ComplexTypeSerializer
+{
+ // provide logging
+ private static final Logger log = Logger.getLogger(JBossXBSerializer.class);
+
+ private JBossXBMarshaller marshaller;
+
+ public JBossXBSerializer() throws BindingException
+ {
+ // Get the JAXB marshaller for complex objects
+ marshaller = new JBossXBMarshallerImpl();
+ }
+
+ /**
+ * For marshalling the WS layer passes to the JAXB layer
+ *
+ * - optional java object instance
+ * - required map of packaged or generated XSDSchema
+ * - required QName of the root element
+ * - optional QName of the root complex type
+ * - optional instance of JavaWsdlMapping
+ *
+ * If the object value is null, the corresponding XML representation of the nillable
element should be marshalled.
+ * The xmlType is redundant if the xmlName corresponds to a global element definition
in schema.
+ * If the java mapping is null, default mapping rules apply.
+ *
+ * The result is a self contained (i.e. contains all namespace definitions) XML
document without the XML declaration.
+ * In case of an marshalling problem a descriptive exception is thrown.
+ */
+ public String serialize(QName xmlName, QName xmlType, Object value,
SerializationContext serContext, NamedNodeMap attributes) throws BindingException
+ {
+ log.debug("serialize: [xmlName=" + xmlName + ",xmlType=" +
xmlType + "]");
+
+ // Expect the specific JAXRPC serialization context
+ SerializationContextJAXRPC jaxrpcContext = (SerializationContextJAXRPC)serContext;
+
+ try
+ {
+ // Get the parsed model
+ XSModel model = jaxrpcContext.getXsModel();
+
+ // Get the jaxrpc-mapping.xml object graph
+ JavaWsdlMapping jaxrpcMapping = jaxrpcContext.getJavaWsdlMapping();
+
+ // schemabinding marshaller is the default delegate
+ JBossXBMarshaller delegate = marshaller;
+
+ if(value instanceof Exception)
+ {
+ // todo: CTS workaround for custom exceptions, clarify when Alexey is back
+ // causes NPE in MarshallerImpl:458
+ delegate = new XercesXSMarshallerImpl();
+ }
+
+ // marshalling context
+ delegate.setProperty(JBossXBConstants.JBXB_XS_MODEL, model);
+ delegate.setProperty(JBossXBConstants.JBXB_TYPE_QNAME, xmlType);
+ delegate.setProperty(JBossXBConstants.JBXB_ROOT_QNAME, xmlName);
+ delegate.setProperty(JBossXBConstants.JBXB_JAVA_MAPPING, jaxrpcMapping);
+
+ // marshall
+ StringWriter strwr = new StringWriter();
+ delegate.marshal(value, strwr);
+ String xmlFragment = strwr.toString();
+
+ log.debug("serialized: " + xmlFragment);
+ return xmlFragment;
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (Exception ex)
+ {
+ throw new BindingException(ex);
+ }
+ }
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/JBossXBSerializerFactory.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/JBossXBSerializerFactory.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/JBossXBSerializerFactory.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/JBossXBSerializerFactory.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -0,0 +1,43 @@
+/*
+* 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;
+
+import org.jboss.ws.core.jaxrpc.binding.BindingException;
+import org.jboss.ws.core.jaxrpc.binding.SerializerSupport;
+
+// $Id$
+
+
+/**
+ * A factory for a Serializer that can handle complex types
+ * by delegating to JAXB.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 04-Dec-2004
+ */
+public class JBossXBSerializerFactory extends SerializerFactoryBase
+{
+ public SerializerSupport getSerializer() throws BindingException
+ {
+ return new JBossXBSerializer();
+ }
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/NullValueSerializer.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/NullValueSerializer.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/NullValueSerializer.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/NullValueSerializer.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -0,0 +1,68 @@
+/*
+ * 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 javax.xml.namespace.QName;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.Constants;
+import org.jboss.ws.core.jaxrpc.binding.BindingException;
+import org.jboss.ws.core.jaxrpc.binding.SerializationContext;
+import org.jboss.ws.core.jaxrpc.binding.SerializerSupport;
+import org.jboss.xb.binding.NamespaceRegistry;
+import org.w3c.dom.NamedNodeMap;
+
+/**
+ * Serializer for null values.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 24-Jun-2005
+ */
+public class NullValueSerializer extends SerializerSupport
+{
+ // provide logging
+ private static final Logger log = Logger.getLogger(NullValueSerializer.class);
+
+ /**
+ * Serializes an object null value.
+ *
+ * If a message part of an RPC parameter is defined like this
+ *
+ * <message name='SomeMessage'>
+ * <part name='partName' element='someElement'/>
+ * </message>
+ *
+ * it is possible that the element definition does not allow
+ * null values. In that case an error should be generated.
+ */
+ public String serialize(QName xmlName, QName xmlType, Object value,
SerializationContext serContext, NamedNodeMap attributes) throws BindingException
+ {
+ log.debug("serialize: [xmlName=" + xmlName + ",xmlType=" +
xmlType + "]");
+
+ NamespaceRegistry nsRegistry = serContext.getNamespaceRegistry();
+ nsRegistry.registerURI(Constants.NS_SCHEMA_XSI, Constants.PREFIX_XSI);
+ String xmlFragment = wrapValueStr(xmlName, null, nsRegistry, attributes, true);
+ return xmlFragment;
+ }
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/QNameDeserializer.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/QNameDeserializer.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/QNameDeserializer.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/QNameDeserializer.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -0,0 +1,98 @@
+/*
+ * 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.IOException;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.core.jaxrpc.binding.BindingException;
+import org.jboss.ws.core.jaxrpc.binding.DeserializerSupport;
+import org.jboss.ws.core.jaxrpc.binding.SerializationContext;
+import org.jboss.ws.core.utils.DOMUtils;
+import org.jboss.xb.binding.NamespaceRegistry;
+import org.jboss.xb.binding.SimpleTypeBindings;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+
+/**
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 04-Dec-2004
+ */
+public class QNameDeserializer extends DeserializerSupport
+{
+ // provide logging
+ private static final Logger log = Logger.getLogger(QNameDeserializer.class);
+
+ public Object deserialize(QName xmlName, QName xmlType, String xmlFragment,
SerializationContext serContext) throws BindingException
+ {
+ log.debug("deserialize: [xmlName=" + xmlName + ",xmlType=" +
xmlType + "]");
+
+ QName value = null;
+
+ NamespaceRegistry nsRegistry = serContext.getNamespaceRegistry();
+ String valueStr = unwrapValueStr(xmlFragment, nsRegistry);
+ if (valueStr != null)
+ {
+ value = SimpleTypeBindings.unmarshalQName(valueStr, nsRegistry);
+ }
+
+ return value;
+ }
+
+ /** 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, NamespaceRegistry nsRegistry)
+ {
+ if (isEmptyElement(xmlFragment) == false)
+ {
+ // Register namespace declarations
+ try
+ {
+ Element el = DOMUtils.parse(xmlFragment);
+ NamedNodeMap attribs = el.getAttributes();
+ for (int i = 0; i < attribs.getLength(); i++)
+ {
+ Node attr = attribs.item(i);
+ String nodeName = attr.getNodeName();
+ if (nodeName.startsWith("xmlns:"))
+ {
+ String prefix = nodeName.substring(6);
+ String nsURI = attr.getNodeValue();
+ nsRegistry.registerURI(nsURI, prefix);
+ }
+ }
+ }
+ catch (IOException e)
+ {
+ throw new IllegalArgumentException("Cannot parse xmlFragment: " +
xmlFragment);
+ }
+ }
+
+ return super.unwrapValueStr(xmlFragment);
+ }
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/QNameDeserializerFactory.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/QNameDeserializerFactory.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/QNameDeserializerFactory.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/QNameDeserializerFactory.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -0,0 +1,39 @@
+/*
+* 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;
+
+import org.jboss.ws.core.jaxrpc.binding.DeserializerSupport;
+
+// $Id$
+
+
+/**
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 04-Dec-2004
+ */
+public class QNameDeserializerFactory extends DeserializerFactoryBase
+{
+ public DeserializerSupport getDeserializer()
+ {
+ return new QNameDeserializer();
+ }
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/QNameSerializer.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/QNameSerializer.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/QNameSerializer.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/QNameSerializer.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -0,0 +1,78 @@
+/*
+* 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 javax.xml.namespace.QName;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.core.jaxrpc.binding.BindingException;
+import org.jboss.ws.core.jaxrpc.binding.SerializationContext;
+import org.jboss.ws.core.jaxrpc.binding.SerializerSupport;
+import org.jboss.xb.binding.NamespaceRegistry;
+import org.jboss.xb.binding.SimpleTypeBindings;
+import org.w3c.dom.NamedNodeMap;
+
+/**
+ * Serializer for QNames.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 04-Dec-2004
+ */
+public class QNameSerializer extends SerializerSupport
+{
+ // provide logging
+ private static final Logger log = Logger.getLogger(QNameSerializer.class);
+
+ public String serialize(QName xmlName, QName xmlType, Object value,
SerializationContext serContext, NamedNodeMap attributes) throws BindingException
+ {
+ log.debug("serialize: [xmlName=" + xmlName + ",xmlType=" +
xmlType + "]");
+
+ QName qnameValue = (QName)value;
+ String nsURI = qnameValue.getNamespaceURI();
+
+ NamespaceRegistry nsRegistry = serContext.getNamespaceRegistry();
+
+ // Remove prefix and register again
+ if (nsURI.length() > 0)
+ {
+ qnameValue = new QName(qnameValue.getNamespaceURI(),
qnameValue.getLocalPart());
+ qnameValue = nsRegistry.registerQName(qnameValue);
+ }
+
+ String valueStr = SimpleTypeBindings.marshalQName(qnameValue, nsRegistry);
+ String xmlFragment = wrapValueStr(xmlName, valueStr, nsRegistry, attributes,
true);
+
+ // Insert the NS declaration for the qnameValue
+ if (nsURI.length() > 0)
+ {
+ StringBuilder buffer = new StringBuilder(xmlFragment);
+ int indexGT = xmlFragment.indexOf(">");
+ String prefix = qnameValue.getPrefix();
+ buffer.insert(indexGT, " xmlns:" + prefix + "='" + nsURI
+ "'");
+ xmlFragment = buffer.toString();
+ }
+
+ return xmlFragment;
+ }
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/QNameSerializerFactory.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/QNameSerializerFactory.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/QNameSerializerFactory.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/QNameSerializerFactory.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -0,0 +1,41 @@
+/*
+* 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;
+
+import org.jboss.ws.core.jaxrpc.binding.SerializerSupport;
+
+// $Id$
+
+
+/**
+ * SerializerFactory for QName primitive
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 04-Dec-2004
+ */
+public class QNameSerializerFactory extends SerializerFactoryBase
+{
+ public SerializerSupport getSerializer()
+ {
+ return new QNameSerializer();
+ }
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/SOAPArrayDeserializer.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/SOAPArrayDeserializer.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/SOAPArrayDeserializer.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/SOAPArrayDeserializer.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -0,0 +1,189 @@
+/*
+ * 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.lang.reflect.Array;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.StringTokenizer;
+
+import javax.xml.namespace.QName;
+
+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.jaxrpc.binding.BindingException;
+import org.jboss.ws.core.jaxrpc.binding.DeserializerSupport;
+import org.jboss.ws.core.jaxrpc.binding.SerializationContext;
+import org.jboss.ws.core.metadata.umdm.ParameterMetaData;
+import org.jboss.ws.core.utils.DOMUtils;
+import org.jboss.ws.core.utils.DOMWriter;
+import org.jboss.ws.core.utils.JavaUtils;
+import org.w3c.dom.Element;
+
+/**
+ * A Deserializer that can handle SOAP encoded arrays.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 31-Oct-2005
+ */
+public class SOAPArrayDeserializer extends DeserializerSupport
+{
+ // provide logging
+ private static final Logger log = Logger.getLogger(SOAPArrayDeserializer.class);
+
+ private DeserializerSupport compDeserializer;
+
+ public SOAPArrayDeserializer() throws BindingException
+ {
+ }
+
+ /**
+ */
+ public Object deserialize(QName xmlName, QName xmlType, String xmlFragment,
SerializationContext serContext) throws BindingException
+ {
+ log.debug("deserialize: [xmlName=" + xmlName + ",xmlType=" +
xmlType + "]");
+ try
+ {
+ ParameterMetaData paramMetaData =
(ParameterMetaData)serContext.getProperty(ParameterMetaData.class.getName());
+ QName compXmlType = paramMetaData.getSOAPArrayCompType();
+ QName compXmlName = paramMetaData.getXmlName();
+
+ Element arrayElement = DOMUtils.parse(xmlFragment);
+ int[] arrDims = getDimensionsFromAttribute(arrayElement);
+ Class compJavaType = getComponentTypeFromAttribute(arrayElement, serContext);
+ Object[] retArray = (Object[])Array.newInstance(compJavaType, arrDims);
+
+ TypeMappingImpl typeMapping = serContext.getTypeMapping();
+ if (compXmlType == null)
+ {
+ compXmlType = typeMapping.getXMLType(compJavaType);
+ paramMetaData.setSOAPArrayCompType(compXmlType);
+ }
+
+ if (compXmlType == null)
+ throw new WSException("Cannot obtain component xmlType for: " +
compJavaType);
+
+ // Get the component type deserializer factory
+ log.debug("Get component deserializer for: [javaType=" +
compJavaType.getName() + ",xmlType=" + compXmlType + "]");
+ DeserializerFactoryBase compDeserializerFactory =
(DeserializerFactoryBase)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);
+ }
+ if (compDeserializerFactory == null)
+ throw new WSException("Cannot obtain component deserializer for: "
+ compXmlType);
+
+ // Get the component type deserializer
+ compDeserializer =
(DeserializerSupport)compDeserializerFactory.getDeserializer();
+
+ if (arrDims.length < 1 || 2 < arrDims.length)
+ throw new WSException("Unsupported array dimensions: " +
Arrays.asList(arrDims));
+
+ Iterator it = DOMUtils.getChildElements(arrayElement);
+ if (arrDims.length == 1)
+ {
+ Object[] subArr = retArray;
+ deserializeMemberValues(compXmlName, compXmlType, serContext, it, subArr);
+ }
+ if (arrDims.length == 2)
+ {
+ for (int i = 0; i < arrDims[0]; i++)
+ {
+ Object[] subArr = (Object[])retArray[i];
+ deserializeMemberValues(compXmlName, compXmlType, serContext, it,
subArr);
+ }
+ }
+
+ log.debug("deserialized: " + retArray.getClass().getName());
+ return retArray;
+ }
+ catch (RuntimeException e)
+ {
+ throw e;
+ }
+ catch (Exception e)
+ {
+ throw new BindingException(e);
+ }
+ }
+
+ private void deserializeMemberValues(QName compXmlName, QName compXmlType,
SerializationContext serContext, Iterator it, Object[] subArr) throws BindingException
+ {
+ int dim = subArr.length;
+ for (int i = 0; i < dim; i++)
+ {
+ Object compValue = null;
+ if (it.hasNext())
+ {
+ Element childElement = (Element)it.next();
+ String compXMLFragment = DOMWriter.printNode(childElement, false);
+ compValue = compDeserializer.deserialize(compXmlName, compXmlType,
compXMLFragment, serContext);
+ compValue = JavaUtils.getWrapperValueArray(compValue);
+ }
+ subArr[i] = compValue;
+ }
+ }
+
+ private int[] getDimensionsFromAttribute(Element arrayElement)
+ {
+ QName attrQName = new QName(Constants.URI_SOAP11_ENC, "arrayType");
+ QName arrayType = DOMUtils.getAttributeValueAsQName(arrayElement, attrQName);
+ if (arrayType == null)
+ throw new WSException("Cannot obtain attribute: " + attrQName);
+
+ String localPart = arrayType.getLocalPart();
+ int dimIndex = localPart.indexOf("[");
+
+ String dimStr = localPart.substring(dimIndex);
+ StringTokenizer st = new StringTokenizer(dimStr, "[,]");
+ int[] arrDims = new int[st.countTokens()];
+ for (int i = 0; st.hasMoreTokens(); i++)
+ arrDims[i] = new Integer(st.nextToken()).intValue();
+
+ return arrDims;
+ }
+
+ private Class getComponentTypeFromAttribute(Element arrayElement, SerializationContext
serContext)
+ {
+ QName attrQName = new QName(Constants.URI_SOAP11_ENC, "arrayType");
+ QName arrayType = DOMUtils.getAttributeValueAsQName(arrayElement, attrQName);
+ if (arrayType == null)
+ throw new WSException("Cannot obtain attribute: " + attrQName);
+
+ String nsURI = arrayType.getNamespaceURI();
+ String localPart = arrayType.getLocalPart();
+ int dimIndex = localPart.indexOf("[");
+ QName compXmlType = new QName(nsURI, localPart.substring(0, dimIndex));
+
+ TypeMappingImpl typeMapping = serContext.getTypeMapping();
+ Class javaType = typeMapping.getJavaType(compXmlType);
+ if (javaType == null)
+ throw new WSException("Cannot obtain javaType for: " + compXmlType);
+
+ return JavaUtils.getWrapperType(javaType);
+ }
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/SOAPArrayDeserializerFactory.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/SOAPArrayDeserializerFactory.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/SOAPArrayDeserializerFactory.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/SOAPArrayDeserializerFactory.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -0,0 +1,41 @@
+/*
+* 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;
+
+import org.jboss.ws.core.jaxrpc.binding.BindingException;
+import org.jboss.ws.core.jaxrpc.binding.DeserializerSupport;
+
+// $Id$
+
+/**
+ * A factory for a Deserializer that can handle SOAP encoded arrays.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 31-Oct-2005
+ */
+public class SOAPArrayDeserializerFactory extends DeserializerFactoryBase
+{
+ public DeserializerSupport getDeserializer() throws BindingException
+ {
+ return new SOAPArrayDeserializer();
+ }
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/SOAPArraySerializer.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/SOAPArraySerializer.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/SOAPArraySerializer.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/SOAPArraySerializer.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -0,0 +1,208 @@
+/*
+ * 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 javax.xml.namespace.QName;
+
+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.jaxrpc.binding.BindingException;
+import org.jboss.ws.core.jaxrpc.binding.SerializationContext;
+import org.jboss.ws.core.jaxrpc.binding.SerializerSupport;
+import org.jboss.ws.core.metadata.umdm.ParameterMetaData;
+import org.jboss.ws.core.utils.JavaUtils;
+import org.w3c.dom.NamedNodeMap;
+
+/**
+ * A Serializer that can handle SOAP encoded arrays.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 31-Oct-2005
+ */
+public class SOAPArraySerializer extends SerializerSupport
+{
+ // provide logging
+ private static final Logger log = Logger.getLogger(SOAPArraySerializer.class);
+
+ private SerializerSupport compSerializer;
+ private NullValueSerializer nullSerializer;
+ private boolean isArrayComponentType;
+ private boolean xsiNamespaceInserted;
+ private StringBuilder xmlFragment;
+
+ public SOAPArraySerializer() throws BindingException
+ {
+ nullSerializer = new NullValueSerializer();
+ }
+
+ /**
+ */
+ public String serialize(QName xmlName, QName xmlType, Object value,
SerializationContext serContext, NamedNodeMap attributes) throws BindingException
+ {
+ log.debug("serialize: [xmlName=" + xmlName + ",xmlType=" +
xmlType + ",valueType=" + value.getClass().getName() + "]");
+ try
+ {
+ ParameterMetaData paramMetaData =
(ParameterMetaData)serContext.getProperty(ParameterMetaData.class.getName());
+ QName compXmlType = paramMetaData.getSOAPArrayCompType();
+ QName compXmlName = paramMetaData.getXmlName();
+ Class javaType = paramMetaData.getJavaType();
+
+ Class compJavaType = javaType.getComponentType();
+ isArrayComponentType = isArrayJavaType(compJavaType) &&
isArrayXmlType(compXmlType);
+ while (compJavaType.getComponentType() != null && isArrayComponentType
== false)
+ {
+ compJavaType = compJavaType.getComponentType();
+ isArrayComponentType = isArrayJavaType(compJavaType) &&
isArrayXmlType(compXmlType);
+ }
+
+ TypeMappingImpl typeMapping = serContext.getTypeMapping();
+ if (compXmlType == null)
+ {
+ compXmlType = typeMapping.getXMLType(compJavaType);
+ paramMetaData.setSOAPArrayCompType(compXmlType);
+ }
+
+ if (compXmlType == null)
+ throw new WSException("Cannot obtain component xmlType for: " +
compJavaType);
+
+ // Get the component type serializer factory
+ log.debug("Get component serializer for: [javaType=" +
compJavaType.getName() + ",xmlType=" + compXmlType + "]");
+ SerializerFactoryBase compSerializerFactory =
(SerializerFactoryBase)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);
+ }
+ if (compSerializerFactory == null)
+ throw new WSException("Cannot obtain component serializer for: " +
compXmlType);
+
+ // Get the component type serializer
+ compSerializer = (SerializerSupport)compSerializerFactory.getSerializer();
+
+ // Get the corresponding wrapper type
+ if (JavaUtils.isPrimitive(value.getClass()))
+ value = JavaUtils.getWrapperValueArray(value);
+
+ xmlFragment = new StringBuilder("<" + Constants.PREFIX_SOAP11_ENC +
":Array ");
+ if (value instanceof Object[])
+ {
+ Object[] objArr = (Object[])value;
+ String arrayDim = "" + objArr.length;
+
+ // Get multiple array dimension
+ Object[] subArr = (Object[])value;
+ while (isArrayComponentType == false && subArr.length > 0
&& subArr[0] instanceof Object[])
+ {
+ subArr = (Object[])subArr[0];
+ arrayDim += "," + subArr.length;
+ }
+
+ compXmlType = serContext.getNamespaceRegistry().registerQName(compXmlType);
+ String arrayType = Constants.PREFIX_SOAP11_ENC + ":arrayType='"
+ compXmlType.getPrefix() + ":" + compXmlType.getLocalPart() + "[" +
arrayDim + "]'";
+ String compns = " xmlns:" + compXmlType.getPrefix() +
"='" + compXmlType.getNamespaceURI() + "'";
+ xmlFragment.append(arrayType + compns + ">");
+
+ serializeArrayComponents(compXmlName, compXmlType, serContext, objArr);
+ }
+ else
+ {
+ throw new WSException("Unsupported array type: " + javaType);
+ }
+ xmlFragment.append("</" + Constants.PREFIX_SOAP11_ENC +
":Array>");
+
+ log.debug("serialized: " + xmlFragment);
+ return xmlFragment.toString();
+ }
+ catch (RuntimeException e)
+ {
+ throw e;
+ }
+ catch (Exception e)
+ {
+ throw new BindingException(e);
+ }
+ }
+
+ private void serializeArrayComponents(QName compXmlName, QName compXmlType,
SerializationContext serContext, Object[] objArr) throws BindingException
+ {
+ for (Object compValue : objArr)
+ {
+ if (isArrayComponentType == false && compValue instanceof Object[])
+ {
+ serializeArrayComponents(compXmlName, compXmlType, serContext,
(Object[])compValue);
+ }
+ else
+ {
+ SerializerSupport ser = compSerializer;
+
+ // Null component value
+ if (compValue == null)
+ {
+ ser = nullSerializer;
+ if (xsiNamespaceInserted == false)
+ {
+ xsiNamespaceInserted = true;
+ int insIndex = ("<" + Constants.PREFIX_SOAP11_ENC +
":Array ").length();
+ xmlFragment.insert(insIndex, "xmlns:" + Constants.PREFIX_XSI
+ "='" + Constants.NS_SCHEMA_XSI + "' ");
+ }
+ }
+
+ String compFragment = ser.serialize(compXmlName, compXmlType, compValue,
serContext, null);
+ xmlFragment.append(compFragment);
+ }
+ }
+ }
+
+ /** True for all array xmlTypes, i.e. nmtokens, base64Binary, hexBinary
+ *
+ * FIXME: This method should be removed as soon as we can reliably get the SOAP
+ * arrayType from wsdl + schema.
+ */
+ private boolean isArrayXmlType(QName xmlType)
+ {
+ boolean isArrayType = Constants.TYPE_SOAP11_BASE64.equals(xmlType);
+ isArrayType = isArrayType || Constants.TYPE_SOAP11_BASE64.equals(xmlType);
+ isArrayType = isArrayType || Constants.TYPE_SOAP11_BASE64BINARY.equals(xmlType);
+ isArrayType = isArrayType || Constants.TYPE_SOAP11_HEXBINARY.equals(xmlType);
+ isArrayType = isArrayType || Constants.TYPE_SOAP11_NMTOKENS.equals(xmlType);
+ isArrayType = isArrayType || Constants.TYPE_LITERAL_BASE64BINARY.equals(xmlType);
+ isArrayType = isArrayType || Constants.TYPE_LITERAL_HEXBINARY.equals(xmlType);
+ isArrayType = isArrayType || Constants.TYPE_LITERAL_NMTOKENS.equals(xmlType);
+ return isArrayType;
+ }
+
+ /** True for all array javaTypes, i.e. String[], Byte[], byte[]
+ *
+ * FIXME: This method should be removed as soon as we can reliably get the SOAP
+ * arrayType from wsdl + schema.
+ */
+ private boolean isArrayJavaType(Class javaType)
+ {
+ boolean isBinaryType = String[].class.equals(javaType) ||
Byte[].class.equals(javaType) || byte[].class.equals(javaType);
+ return isBinaryType;
+ }
+
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/SOAPArraySerializerFactory.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/SOAPArraySerializerFactory.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/SOAPArraySerializerFactory.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/SOAPArraySerializerFactory.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -0,0 +1,42 @@
+/*
+* 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;
+
+import org.jboss.ws.core.jaxrpc.binding.BindingException;
+import org.jboss.ws.core.jaxrpc.binding.SerializerSupport;
+
+// $Id$
+
+
+/**
+ * A factory for a Serializer that can handle SOAP encoded arrays.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 31-Oct-2005
+ */
+public class SOAPArraySerializerFactory extends SerializerFactoryBase
+{
+ public SerializerSupport getSerializer() throws BindingException
+ {
+ return new SOAPArraySerializer();
+ }
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/SOAPElementDeserializer.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/SOAPElementDeserializer.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/SOAPElementDeserializer.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/SOAPElementDeserializer.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -0,0 +1,121 @@
+/*
+* 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 javax.xml.namespace.QName;
+import javax.xml.soap.SOAPElement;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPFactory;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.core.jaxrpc.binding.BindingException;
+import org.jboss.ws.core.jaxrpc.binding.DeserializerSupport;
+import org.jboss.ws.core.jaxrpc.binding.SerializationContext;
+import org.jboss.ws.core.utils.DOMUtils;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+/**
+ * A deserializer that can handle xsd:anyType
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 23-Jun-2005
+ */
+public class SOAPElementDeserializer extends DeserializerSupport
+{
+ // provide logging
+ private static final Logger log = Logger.getLogger(SOAPElementDeserializer.class);
+
+ public Object deserialize(QName xmlName, QName xmlType, String xmlFragment,
SerializationContext serContext) throws BindingException
+ {
+ log.debug("deserialize: [xmlName=" + xmlName + ",xmlType=" +
xmlType + "]");
+ try
+ {
+ Element domElement = DOMUtils.parse(xmlFragment);
+ SOAPElement soapElement = createElement(domElement, true);
+ return soapElement;
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (Exception ex)
+ {
+ throw new BindingException();
+ }
+ }
+
+ /**
+ * Create a SOAPElement from a DOM Element.
+ * This method is not part of the javax.xml.soap.SOAPFactory interface.
+ */
+ public SOAPElement createElement(Element domNode, boolean deep) throws SOAPException
+ {
+ if (domNode == null)
+ throw new IllegalArgumentException("Source node cannot be null");
+
+ String localName = domNode.getLocalName();
+ String prefix = domNode.getPrefix() != null ? domNode.getPrefix() : "";
+ String nsURI = domNode.getNamespaceURI() != null ? domNode.getNamespaceURI() :
"";
+
+ SOAPFactory factory = SOAPFactory.newInstance();
+ SOAPElement soapElement = factory.createElement(localName, prefix, nsURI);
+
+ // Add the child elements as well
+ if (deep)
+ {
+ if (domNode instanceof Element)
+ DOMUtils.copyAttributes(soapElement, (Element)domNode);
+
+ NodeList nlist = domNode.getChildNodes();
+ for (int i = 0; i < nlist.getLength(); i++)
+ {
+ Node child = nlist.item(i);
+ short nodeType = child.getNodeType();
+ if (nodeType == Node.ELEMENT_NODE)
+ {
+ SOAPElement soapChild = createElement((Element)child, true);
+ soapElement.addChildElement(soapChild);
+ }
+ else if (nodeType == Node.TEXT_NODE)
+ {
+ String nodeValue = child.getNodeValue();
+ soapElement.addTextNode(nodeValue);
+ }
+ else if (nodeType == Node.CDATA_SECTION_NODE)
+ {
+ String nodeValue = child.getNodeValue();
+ soapElement.addTextNode(nodeValue);
+ }
+ else
+ {
+ log.trace("Ignore child type: " + nodeType);
+ }
+ }
+ }
+
+ return soapElement;
+ }
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/SOAPElementDeserializerFactory.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/SOAPElementDeserializerFactory.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/SOAPElementDeserializerFactory.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/SOAPElementDeserializerFactory.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -0,0 +1,41 @@
+/*
+* 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;
+
+import org.jboss.ws.core.jaxrpc.binding.DeserializerSupport;
+
+// $Id$
+
+
+/**
+ * A factory for a Deserializer that can handle XMLSchema simple types.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 18-Oct-2004
+ */
+public class SOAPElementDeserializerFactory extends DeserializerFactoryBase
+{
+ public DeserializerSupport getDeserializer()
+ {
+ return new SOAPElementDeserializer();
+ }
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/SOAPElementSerializer.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/SOAPElementSerializer.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/SOAPElementSerializer.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/SOAPElementSerializer.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -0,0 +1,64 @@
+/*
+* 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 javax.xml.namespace.QName;
+import javax.xml.soap.SOAPElement;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.core.jaxrpc.binding.BindingException;
+import org.jboss.ws.core.jaxrpc.binding.SerializationContext;
+import org.jboss.ws.core.jaxrpc.binding.SerializerSupport;
+import org.jboss.ws.core.utils.DOMWriter;
+import org.w3c.dom.NamedNodeMap;
+
+/**
+ * A serializer that can handle xsd:anyType
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 18-Oct-2004
+ */
+public class SOAPElementSerializer extends SerializerSupport
+{
+ // provide logging
+ private static final Logger log = Logger.getLogger(SOAPElementSerializer.class);
+
+ /** Marshal the value for a given XMLSchema type
+ * @param xmlType local part of the schema type
+ * @param value the value to marshal
+ * @param serContext
+ * @return the string representation od the value
+ */
+ public String serialize(QName xmlName, QName xmlType, Object value,
SerializationContext serContext, NamedNodeMap attributes) throws BindingException
+ {
+ log.debug("serialize: [xmlName=" + xmlName + ",xmlType=" +
xmlType + "]");
+ if (value == null)
+ throw new IllegalArgumentException("SOAPElement value cannot be
null");
+ if ((value instanceof SOAPElement) == false)
+ throw new IllegalArgumentException("Value is not a SOAPElement: " +
value.getClass().getName());
+
+ String xmlFragment = DOMWriter.printNode((SOAPElement)value, false);
+ return xmlFragment;
+ }
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/SOAPElementSerializerFactory.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/SOAPElementSerializerFactory.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/SOAPElementSerializerFactory.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/SOAPElementSerializerFactory.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -0,0 +1,40 @@
+/*
+* 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;
+
+import org.jboss.ws.core.jaxrpc.binding.SerializerSupport;
+
+// $Id$
+
+/**
+ * A factory for a Serializer that can handle xsd:anyType
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 23-Jun-2005
+ */
+public class SOAPElementSerializerFactory extends SerializerFactoryBase
+{
+ public SerializerSupport getSerializer()
+ {
+ return new SOAPElementSerializer();
+ }
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/SerializationContext.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/SerializationContext.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/SerializationContext.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/SerializationContext.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -0,0 +1,71 @@
+/*
+ * 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
+{
+ // The type mapping that is valid for this serialization context
+ 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;
+ }
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/SerializerFactoryBase.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/SerializerFactoryBase.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/SerializerFactoryBase.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/SerializerFactoryBase.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -0,0 +1,52 @@
+/*
+* 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;
+import org.jboss.ws.core.jaxrpc.binding.BindingException;
+import org.jboss.ws.core.jaxrpc.binding.SerializerSupport;
+
+/**
+ * @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();
+ }
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/SerializerSupport.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/SerializerSupport.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/SerializerSupport.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/SerializerSupport.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -0,0 +1,164 @@
+/*
+ * 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 javax.xml.namespace.QName;
+import javax.xml.rpc.encoding.Serializer;
+
+import org.jboss.util.NotImplementedException;
+import org.jboss.ws.Constants;
+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
+{
+ /** 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 TODO
+ * @param attributes The attributes on this element
+ */
+ public abstract String 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, NamedNodeMap attributes, boolean normalize)
+ {
+ String nsURI = xmlName.getNamespaceURI();
+ String localPart = xmlName.getLocalPart();
+ String prefix = xmlName.getPrefix();
+
+ 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 +
"'");
+ }
+ }
+
+ String elName;
+ if (nsURI.length() > 0)
+ {
+ xmlName = nsRegistry.registerQName(xmlName);
+ prefix = xmlName.getPrefix();
+ elName = prefix + ":" + localPart;
+
+ String xmlns = " xmlns:" + prefix + "='" + nsURI +
"'";
+ if (nsAttr.indexOf(xmlns) < 0)
+ {
+ nsAttr.append(xmlns);
+ }
+ }
+ else
+ {
+ elName = localPart;
+ }
+
+ String xmlFragment;
+ if (valueStr == null)
+ {
+ String xmlns = " xmlns:" + Constants.PREFIX_XSI + "='" +
Constants.NS_SCHEMA_XSI + "'";
+ xmlFragment = "<" + elName + nsAttr + " " +
Constants.PREFIX_XSI + ":nil='1'" + xmlns + "/>";
+ }
+ 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/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/SimpleDeserializer.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/SimpleDeserializer.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/SimpleDeserializer.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/SimpleDeserializer.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -0,0 +1,59 @@
+/*
+ * 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 javax.xml.namespace.QName;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.core.jaxrpc.binding.BindingException;
+import org.jboss.ws.core.jaxrpc.binding.DeserializerSupport;
+import org.jboss.ws.core.jaxrpc.binding.SerializationContext;
+import org.jboss.xb.binding.SimpleTypeBindings;
+
+/**
+ * A deserializer that can handle XMLSchema simple types.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 22-Oct-2004
+ */
+public class SimpleDeserializer extends DeserializerSupport
+{
+ // provide logging
+ private static final Logger log = Logger.getLogger(SimpleDeserializer.class);
+
+ public Object deserialize(QName xmlName, QName xmlType, String xmlFragment,
SerializationContext serContext) throws BindingException
+ {
+ log.debug("deserialize: [xmlName=" + xmlName + ",xmlType=" +
xmlType + "]");
+
+ Object value = null;
+ String valueStr = unwrapValueStr(xmlFragment);
+
+ if (valueStr != null)
+ {
+ value = SimpleTypeBindings.unmarshal(xmlType.getLocalPart(), valueStr,
serContext.getNamespaceRegistry());
+ }
+
+ return value;
+ }
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/SimpleDeserializerFactory.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/SimpleDeserializerFactory.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/SimpleDeserializerFactory.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/SimpleDeserializerFactory.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -0,0 +1,41 @@
+/*
+* 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;
+
+import org.jboss.ws.core.jaxrpc.binding.DeserializerSupport;
+
+// $Id$
+
+
+/**
+ * A factory for a Deserializer that can handle XMLSchema simple types.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 18-Oct-2004
+ */
+public class SimpleDeserializerFactory extends DeserializerFactoryBase
+{
+ public DeserializerSupport getDeserializer()
+ {
+ return new SimpleDeserializer();
+ }
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/SimpleSerializer.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/SimpleSerializer.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/SimpleSerializer.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/SimpleSerializer.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -0,0 +1,74 @@
+/*
+ * 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 javax.xml.namespace.QName;
+
+import org.jboss.logging.Logger;
+import org.jboss.util.NotImplementedException;
+import org.jboss.ws.core.jaxrpc.binding.BindingException;
+import org.jboss.ws.core.jaxrpc.binding.SerializationContext;
+import org.jboss.ws.core.jaxrpc.binding.SerializerSupport;
+import org.jboss.xb.binding.NamespaceRegistry;
+import org.jboss.xb.binding.SimpleTypeBindings;
+import org.w3c.dom.NamedNodeMap;
+
+/**
+ * A serializer that can handle XMLSchema simple types.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 18-Oct-2004
+ */
+public class SimpleSerializer extends SerializerSupport
+{
+ // provide logging
+ private static final Logger log = Logger.getLogger(SimpleSerializer.class);
+
+ /** Marshal the value for a given XMLSchema type
+ * @param xmlType local part of the schema type
+ * @param value the value to marshal
+ * @param serContext
+ * @return the string representation od the value
+ */
+ public String serialize(QName xmlName, QName xmlType, Object value,
SerializationContext serContext, NamedNodeMap attributes) throws BindingException
+ {
+ log.debug("serialize: [xmlName=" + xmlName + ",xmlType=" +
xmlType + "]");
+
+ String valueStr;
+ String typeName = xmlType.getLocalPart();
+ NamespaceRegistry nsRegistry = serContext.getNamespaceRegistry();
+
+ if ("base64Binary".equals(typeName))
+ {
+ throw new NotImplementedException();
+ }
+ else
+ {
+ valueStr = SimpleTypeBindings.marshal(xmlType.getLocalPart(), value,
nsRegistry);
+ }
+
+ String xmlFragment = wrapValueStr(xmlName, valueStr, nsRegistry, attributes,
true);
+ return xmlFragment;
+ }
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/SimpleSerializerFactory.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/SimpleSerializerFactory.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/SimpleSerializerFactory.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/SimpleSerializerFactory.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -0,0 +1,41 @@
+/*
+* 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;
+
+import org.jboss.ws.core.jaxrpc.binding.SerializerSupport;
+
+// $Id$
+
+
+/**
+ * A factory for a Serializer that can handle XMLSchema simple types.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 18-Oct-2004
+ */
+public class SimpleSerializerFactory extends SerializerFactoryBase
+{
+ public SerializerSupport getSerializer()
+ {
+ return new SimpleSerializer();
+ }
+}
Copied: branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/jbossxb
(from rev 1589, branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/jbossxb)
Deleted:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/jbossxb/JBossXBConstants.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/jbossxb/JBossXBConstants.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/jbossxb/JBossXBConstants.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -1,43 +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.binding.jbossxb;
-
-// $Id$
-
-/** JBossXB Constants
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 18-Oct-2004
- */
-public interface JBossXBConstants
-{
- /** Set this property with a Reader to the xsdSchema */
- String JBXB_SCHEMA_READER = "org.jboss.xb.xsd.reader";
- /** Set this property with a the QName of the root element */
- String JBXB_ROOT_QNAME = "org.jboss.xb.root.qname";
- /** Set this property with a the QName of the root type */
- String JBXB_TYPE_QNAME = "org.jboss.xb.type.qname";
- /** Set this property with an instance of JavaWsdlMapping */
- String JBXB_JAVA_MAPPING = "org.jboss.xb.java.mapping";
- /** Set this property to the XSModel to pull schema info from */
- String JBXB_XS_MODEL = "org.jboss.xb.xsd.xsmodel";
-}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/jbossxb/JBossXBConstants.java
(from rev 1591,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/jbossxb/JBossXBConstants.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/jbossxb/JBossXBConstants.java 2006-12-07
01:03:49 UTC (rev 1591)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/jbossxb/JBossXBConstants.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -0,0 +1,43 @@
+/*
+* 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.jbossxb;
+
+// $Id$
+
+/** JBossXB Constants
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 18-Oct-2004
+ */
+public interface JBossXBConstants
+{
+ /** Set this property with a Reader to the xsdSchema */
+ String JBXB_SCHEMA_READER = "org.jboss.xb.xsd.reader";
+ /** Set this property with a the QName of the root element */
+ String JBXB_ROOT_QNAME = "org.jboss.xb.root.qname";
+ /** Set this property with a the QName of the root type */
+ String JBXB_TYPE_QNAME = "org.jboss.xb.type.qname";
+ /** Set this property with an instance of JavaWsdlMapping */
+ String JBXB_JAVA_MAPPING = "org.jboss.xb.java.mapping";
+ /** Set this property to the XSModel to pull schema info from */
+ String JBXB_XS_MODEL = "org.jboss.xb.xsd.xsmodel";
+}
Deleted:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/jbossxb/JBossXBMarshaller.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/jbossxb/JBossXBMarshaller.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/jbossxb/JBossXBMarshaller.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -1,48 +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.binding.jbossxb;
-
-import java.io.OutputStream;
-import java.io.Writer;
-
-import org.w3c.dom.Node;
-import org.xml.sax.ContentHandler;
-
-/**
- * @author Heiko Braun <heiko.braun(a)jboss.com>
- * @version $Id$
- * @since Jul 5, 2006
- */
-public interface JBossXBMarshaller {
-
- void marshal(Object obj, Writer writer) throws MarshalException;
-
- void marshal(Object obj, ContentHandler handler);
-
- void marshal(Object obj, Node node);
-
- void marshal(Object obj, OutputStream os) throws MarshalException;
-
- Object getProperty(String name);
-
- void setProperty(String name, Object value);
-}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/jbossxb/JBossXBMarshaller.java
(from rev 1591,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/jbossxb/JBossXBMarshaller.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/jbossxb/JBossXBMarshaller.java 2006-12-07
01:03:49 UTC (rev 1591)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/jbossxb/JBossXBMarshaller.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -0,0 +1,48 @@
+/*
+* 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.jbossxb;
+
+import java.io.OutputStream;
+import java.io.Writer;
+
+import org.w3c.dom.Node;
+import org.xml.sax.ContentHandler;
+
+/**
+ * @author Heiko Braun <heiko.braun(a)jboss.com>
+ * @version $Id$
+ * @since Jul 5, 2006
+ */
+public interface JBossXBMarshaller {
+
+ void marshal(Object obj, Writer writer) throws MarshalException;
+
+ void marshal(Object obj, ContentHandler handler);
+
+ void marshal(Object obj, Node node);
+
+ void marshal(Object obj, OutputStream os) throws MarshalException;
+
+ Object getProperty(String name);
+
+ void setProperty(String name, Object value);
+}
Deleted:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/jbossxb/JBossXBMarshallerImpl.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/jbossxb/JBossXBMarshallerImpl.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/jbossxb/JBossXBMarshallerImpl.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -1,233 +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.binding.jbossxb;
-
-// $Id$
-
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-import java.io.Writer;
-import java.util.HashMap;
-
-import javax.xml.namespace.QName;
-
-import org.jboss.logging.Logger;
-import org.jboss.util.NotImplementedException;
-import org.jboss.ws.WSException;
-import org.jboss.ws.core.metadata.jaxrpcmapping.JavaWsdlMapping;
-import org.jboss.ws.core.metadata.jaxrpcmapping.JavaXmlTypeMapping;
-import org.jboss.ws.core.metadata.jaxrpcmapping.VariableMapping;
-import org.jboss.ws.core.utils.JavaUtils;
-import org.jboss.ws.extras.xop.jaxrpc.XOPMarshallerImpl;
-import org.jboss.xb.binding.Constants;
-import org.jboss.xb.binding.sunday.marshalling.MarshallerImpl;
-import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding;
-import org.w3c.dom.Node;
-import org.xml.sax.ContentHandler;
-
-/**
- * An implementation of a JAXB Marshaller that uses the JBossXB schema binding
marshaller.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @author Heiko.Braun(a)jboss.org
- * @since 05-Jul-2006
- */
-public class JBossXBMarshallerImpl implements JBossXBMarshaller {
-
- // provide logging
- private static final Logger log = Logger.getLogger(JBossXBMarshallerImpl.class);
-
- // The marshaller properties
- private HashMap properties = new HashMap();
-
- private MarshallerImpl delegate;
-
- public JBossXBMarshallerImpl()
- {
-
- //ClassInfos.disableCache();
-
- delegate = new MarshallerImpl();
- delegate.setProperty(org.jboss.xb.binding.Marshaller.PROP_OUTPUT_XML_VERSION,
"false");
- delegate.setProperty(org.jboss.xb.binding.Marshaller.PROP_OUTPUT_INDENTATION,
"false");
- delegate.declareNamespace("xsi", Constants.NS_XML_SCHEMA_INSTANCE);
- delegate.setSupportNil(true);
- }
-
- /**
- * Marshal the content tree rooted at obj into a Writer.
- */
- public void marshal(Object obj, Writer writer) throws MarshalException
- {
- assertRequiredProperties();
-
- try
- {
- QName xmlName = (QName)getProperty(JBossXBConstants.JBXB_ROOT_QNAME);
- delegate.addRootElement(xmlName);
-
- QName xmlType = (QName)getProperty(JBossXBConstants.JBXB_TYPE_QNAME);
- boolean isAnonymousType = (xmlType != null &&
xmlType.getLocalPart().startsWith(">"));
- if (xmlType != null && !isAnonymousType)
- {
- delegate.setRootTypeQName(xmlType);
- }
-
- if (xmlName.getNamespaceURI().length() > 0)
- {
- String prefix = xmlName.getPrefix();
- String nsURI = xmlName.getNamespaceURI();
- delegate.declareNamespace(prefix, nsURI);
- }
-
- // wildcards still need to be mapped
- // todo: cleanup XB API
- JavaWsdlMapping wsdlMapping =
(JavaWsdlMapping)getProperty(JBossXBConstants.JBXB_JAVA_MAPPING);
- if (wsdlMapping != null)
- {
- JavaXmlTypeMapping[] javaXmlMappings = wsdlMapping.getJavaXmlTypeMappings();
- if (javaXmlMappings != null)
- {
- for (int i = 0; i < javaXmlMappings.length; ++i)
- {
- JavaXmlTypeMapping javaXmlMapping = javaXmlMappings[i];
- VariableMapping[] variableMappings =
javaXmlMapping.getVariableMappings();
-
- if (variableMappings != null)
- {
- String clsName = javaXmlMapping.getJavaType();
- Class cls = JavaUtils.loadJavaType(clsName,
Thread.currentThread().getContextClassLoader());
- QName clsQName = javaXmlMapping.getRootTypeQName();
-
- if (clsQName != null)
- {
- // TODO: legacy API usage, see JBWS-1091
- if
("complexType".equalsIgnoreCase(javaXmlMapping.getQnameScope()))
- {
- delegate.mapClassToXsiType(cls, clsQName.getNamespaceURI(),
clsQName.getLocalPart());
- }
- }
-
- for (int j = 0; j < variableMappings.length; ++j)
- {
- VariableMapping variableMapping = variableMappings[j];
- if (variableMapping.getXmlWildcard())
- {
- delegate.mapFieldToWildcard(cls, "_any",
JBossXBSupport.getWildcardMarshaller());
- }
- }
- }
- }
- }
- }
-
- // the actual marshalling
- SchemaBinding schemaBinding =
JBossXBSupport.getOrCreateSchemaBinding(properties);
- schemaBinding.setXopMarshaller(new XOPMarshallerImpl());
- delegate.marshal(schemaBinding, null, obj, writer);
- }
- catch (RuntimeException e)
- {
- throw e;
- }
- catch (Exception e)
- {
- throw new MarshalException(e);
- }
- }
-
- /**
- * Marshal the content tree rooted at obj into SAX2 events.
- */
- public void marshal(Object obj, ContentHandler handler)
- {
- throw new NotImplementedException();
- }
-
- /**
- * Marshal the content tree rooted at obj into a DOM tree.
- */
- public void marshal(Object obj, Node node)
- {
- throw new NotImplementedException();
- }
-
- /**
- * Marshal the content tree rooted at obj into an output stream.
- */
- public void marshal(Object obj, OutputStream os) throws MarshalException
- {
- marshal(obj, new OutputStreamWriter(os));
- }
-
- /**
- * Get the particular property in the underlying implementation of
- * Marshaller.
- */
- public Object getProperty(String name)
- {
- if (name == null)
- throw new IllegalArgumentException("name parameter is null");
-
- return properties.get(name);
- }
-
- /**
- * Set the particular property in the underlying implementation of
- * Marshaller.
- *
- */
- public void setProperty(String name, Object value)
- {
- if (name == null)
- throw new IllegalArgumentException("name parameter is null");
-
- properties.put(name, value);
- }
-
- /**
- * Get a DOM tree view of the content tree(Optional).
- */
- public Node getNode(Object contentTree)
- {
- throw new NotImplementedException();
- }
-
- /**
- * Assert the required properties
- */
- private void assertRequiredProperties()
- {
- if (getProperty(JBossXBConstants.JBXB_SCHEMA_READER) == null &&
getProperty(JBossXBConstants.JBXB_XS_MODEL) == null)
- throw new WSException("Cannot find required property: " +
JBossXBConstants.JBXB_XS_MODEL);
-
- if (getProperty(JBossXBConstants.JBXB_JAVA_MAPPING) == null)
- throw new WSException("Cannot find required property: " +
JBossXBConstants.JBXB_JAVA_MAPPING);
-
- QName xmlName = (QName)getProperty(JBossXBConstants.JBXB_ROOT_QNAME);
- if (xmlName == null)
- throw new WSException("Cannot find required property: " +
JBossXBConstants.JBXB_ROOT_QNAME);
-
- if (xmlName.getNamespaceURI().length() > 0 &&
xmlName.getPrefix().length() == 0)
- throw new IllegalArgumentException("The given root element name must be
prefix qualified: " + xmlName);
- }
-}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/jbossxb/JBossXBMarshallerImpl.java
(from rev 1591,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/jbossxb/JBossXBMarshallerImpl.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/jbossxb/JBossXBMarshallerImpl.java 2006-12-07
01:03:49 UTC (rev 1591)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/jbossxb/JBossXBMarshallerImpl.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -0,0 +1,233 @@
+/*
+ * 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.jbossxb;
+
+// $Id$
+
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.Writer;
+import java.util.HashMap;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.logging.Logger;
+import org.jboss.util.NotImplementedException;
+import org.jboss.ws.WSException;
+import org.jboss.ws.core.metadata.jaxrpcmapping.JavaWsdlMapping;
+import org.jboss.ws.core.metadata.jaxrpcmapping.JavaXmlTypeMapping;
+import org.jboss.ws.core.metadata.jaxrpcmapping.VariableMapping;
+import org.jboss.ws.core.utils.JavaUtils;
+import org.jboss.ws.extentions.xop.jaxrpc.XOPMarshallerImpl;
+import org.jboss.xb.binding.Constants;
+import org.jboss.xb.binding.sunday.marshalling.MarshallerImpl;
+import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding;
+import org.w3c.dom.Node;
+import org.xml.sax.ContentHandler;
+
+/**
+ * An implementation of a JAXB Marshaller that uses the JBossXB schema binding
marshaller.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @author Heiko.Braun(a)jboss.org
+ * @since 05-Jul-2006
+ */
+public class JBossXBMarshallerImpl implements JBossXBMarshaller {
+
+ // provide logging
+ private static final Logger log = Logger.getLogger(JBossXBMarshallerImpl.class);
+
+ // The marshaller properties
+ private HashMap properties = new HashMap();
+
+ private MarshallerImpl delegate;
+
+ public JBossXBMarshallerImpl()
+ {
+
+ //ClassInfos.disableCache();
+
+ delegate = new MarshallerImpl();
+ delegate.setProperty(org.jboss.xb.binding.Marshaller.PROP_OUTPUT_XML_VERSION,
"false");
+ delegate.setProperty(org.jboss.xb.binding.Marshaller.PROP_OUTPUT_INDENTATION,
"false");
+ delegate.declareNamespace("xsi", Constants.NS_XML_SCHEMA_INSTANCE);
+ delegate.setSupportNil(true);
+ }
+
+ /**
+ * Marshal the content tree rooted at obj into a Writer.
+ */
+ public void marshal(Object obj, Writer writer) throws MarshalException
+ {
+ assertRequiredProperties();
+
+ try
+ {
+ QName xmlName = (QName)getProperty(JBossXBConstants.JBXB_ROOT_QNAME);
+ delegate.addRootElement(xmlName);
+
+ QName xmlType = (QName)getProperty(JBossXBConstants.JBXB_TYPE_QNAME);
+ boolean isAnonymousType = (xmlType != null &&
xmlType.getLocalPart().startsWith(">"));
+ if (xmlType != null && !isAnonymousType)
+ {
+ delegate.setRootTypeQName(xmlType);
+ }
+
+ if (xmlName.getNamespaceURI().length() > 0)
+ {
+ String prefix = xmlName.getPrefix();
+ String nsURI = xmlName.getNamespaceURI();
+ delegate.declareNamespace(prefix, nsURI);
+ }
+
+ // wildcards still need to be mapped
+ // todo: cleanup XB API
+ JavaWsdlMapping wsdlMapping =
(JavaWsdlMapping)getProperty(JBossXBConstants.JBXB_JAVA_MAPPING);
+ if (wsdlMapping != null)
+ {
+ JavaXmlTypeMapping[] javaXmlMappings = wsdlMapping.getJavaXmlTypeMappings();
+ if (javaXmlMappings != null)
+ {
+ for (int i = 0; i < javaXmlMappings.length; ++i)
+ {
+ JavaXmlTypeMapping javaXmlMapping = javaXmlMappings[i];
+ VariableMapping[] variableMappings =
javaXmlMapping.getVariableMappings();
+
+ if (variableMappings != null)
+ {
+ String clsName = javaXmlMapping.getJavaType();
+ Class cls = JavaUtils.loadJavaType(clsName,
Thread.currentThread().getContextClassLoader());
+ QName clsQName = javaXmlMapping.getRootTypeQName();
+
+ if (clsQName != null)
+ {
+ // TODO: legacy API usage, see JBWS-1091
+ if
("complexType".equalsIgnoreCase(javaXmlMapping.getQnameScope()))
+ {
+ delegate.mapClassToXsiType(cls, clsQName.getNamespaceURI(),
clsQName.getLocalPart());
+ }
+ }
+
+ for (int j = 0; j < variableMappings.length; ++j)
+ {
+ VariableMapping variableMapping = variableMappings[j];
+ if (variableMapping.getXmlWildcard())
+ {
+ delegate.mapFieldToWildcard(cls, "_any",
JBossXBSupport.getWildcardMarshaller());
+ }
+ }
+ }
+ }
+ }
+ }
+
+ // the actual marshalling
+ SchemaBinding schemaBinding =
JBossXBSupport.getOrCreateSchemaBinding(properties);
+ schemaBinding.setXopMarshaller(new XOPMarshallerImpl());
+ delegate.marshal(schemaBinding, null, obj, writer);
+ }
+ catch (RuntimeException e)
+ {
+ throw e;
+ }
+ catch (Exception e)
+ {
+ throw new MarshalException(e);
+ }
+ }
+
+ /**
+ * Marshal the content tree rooted at obj into SAX2 events.
+ */
+ public void marshal(Object obj, ContentHandler handler)
+ {
+ throw new NotImplementedException();
+ }
+
+ /**
+ * Marshal the content tree rooted at obj into a DOM tree.
+ */
+ public void marshal(Object obj, Node node)
+ {
+ throw new NotImplementedException();
+ }
+
+ /**
+ * Marshal the content tree rooted at obj into an output stream.
+ */
+ public void marshal(Object obj, OutputStream os) throws MarshalException
+ {
+ marshal(obj, new OutputStreamWriter(os));
+ }
+
+ /**
+ * Get the particular property in the underlying implementation of
+ * Marshaller.
+ */
+ public Object getProperty(String name)
+ {
+ if (name == null)
+ throw new IllegalArgumentException("name parameter is null");
+
+ return properties.get(name);
+ }
+
+ /**
+ * Set the particular property in the underlying implementation of
+ * Marshaller.
+ *
+ */
+ public void setProperty(String name, Object value)
+ {
+ if (name == null)
+ throw new IllegalArgumentException("name parameter is null");
+
+ properties.put(name, value);
+ }
+
+ /**
+ * Get a DOM tree view of the content tree(Optional).
+ */
+ public Node getNode(Object contentTree)
+ {
+ throw new NotImplementedException();
+ }
+
+ /**
+ * Assert the required properties
+ */
+ private void assertRequiredProperties()
+ {
+ if (getProperty(JBossXBConstants.JBXB_SCHEMA_READER) == null &&
getProperty(JBossXBConstants.JBXB_XS_MODEL) == null)
+ throw new WSException("Cannot find required property: " +
JBossXBConstants.JBXB_XS_MODEL);
+
+ if (getProperty(JBossXBConstants.JBXB_JAVA_MAPPING) == null)
+ throw new WSException("Cannot find required property: " +
JBossXBConstants.JBXB_JAVA_MAPPING);
+
+ QName xmlName = (QName)getProperty(JBossXBConstants.JBXB_ROOT_QNAME);
+ if (xmlName == null)
+ throw new WSException("Cannot find required property: " +
JBossXBConstants.JBXB_ROOT_QNAME);
+
+ if (xmlName.getNamespaceURI().length() > 0 &&
xmlName.getPrefix().length() == 0)
+ throw new IllegalArgumentException("The given root element name must be
prefix qualified: " + xmlName);
+ }
+}
Deleted:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/jbossxb/JBossXBSupport.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/jbossxb/JBossXBSupport.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/jbossxb/JBossXBSupport.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -1,106 +0,0 @@
-package org.jboss.ws.core.binding.jbossxb;
-
-import java.util.Map;
-
-import javax.xml.namespace.QName;
-
-import org.jboss.ws.core.CommonMessageContext;
-import org.jboss.ws.core.metadata.jaxrpcmapping.JavaWsdlMapping;
-import org.jboss.ws.core.metadata.umdm.EndpointMetaData;
-import org.jboss.ws.core.metadata.umdm.OperationMetaData;
-import org.jboss.ws.core.metadata.umdm.ServiceMetaData;
-import org.jboss.ws.core.metadata.wsdl.xmlschema.JBossXSModel;
-import org.jboss.ws.core.soap.MessageContextAssociation;
-import org.jboss.xb.binding.MarshallingContext;
-import org.jboss.xb.binding.ObjectLocalMarshaller;
-import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding;
-import org.jboss.xb.util.Dom2Sax;
-import org.w3c.dom.Element;
-import org.xml.sax.ContentHandler;
-import org.xml.sax.SAXException;
-
-/**
- * @author Heiko Braun <heiko.braun(a)jboss.com>
- * @since May 31, 2006
- */
-public class JBossXBSupport {
-
- /**
- * Setup SchemaBinding associated with the ServiceMetaData.
- * In case of an unconfigured call it will be generated from JAXB properties.
- * <p>
- * The SchemaBinding expects to have an element binding for the
- * incomming xml element. Because the same element name can be reused
- * by various operations with different xml types, we have to add the
- * element binding on every invocation.
- *
- * @see JBossXBConstants#JBXB_ROOT_QNAME
- * @see JBossXBConstants#JBXB_TYPE_QNAME
- */
- public static SchemaBinding getOrCreateSchemaBinding(Map properties)
- {
- SchemaBinding schemaBinding = null;
- SchemaBindingBuilder bindingBuilder = new SchemaBindingBuilder();
-
- QName xmlName = (QName)properties.get(JBossXBConstants.JBXB_ROOT_QNAME);
- QName xmlType = (QName)properties.get(JBossXBConstants.JBXB_TYPE_QNAME);
-
- // Get the eagerly initialized SchemaBinding from the ServiceMetaData
- CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
- if (msgContext != null)
- {
- OperationMetaData opMetaData = msgContext.getOperationMetaData();
- EndpointMetaData epMetaData = opMetaData.getEndpointMetaData();
- ServiceMetaData serviceMetaData = epMetaData.getServiceMetaData();
- schemaBinding = serviceMetaData.getSchemaBinding();
- }
-
- // In case of an unconfigured call generate the SchemaBinding from JAXB properties
- if (schemaBinding == null)
- {
- JBossXSModel xsModel =
(JBossXSModel)properties.get(JBossXBConstants.JBXB_XS_MODEL);
- JavaWsdlMapping wsdlMapping =
(JavaWsdlMapping)properties.get(JBossXBConstants.JBXB_JAVA_MAPPING);
- schemaBinding = bindingBuilder.buildSchemaBinding(xsModel, wsdlMapping);
- }
-
- // The SchemaBinding expects to have an element binding for the
- // incomming xml element. Because the same element name can be reused
- // by various operations with different xml types, we have to add the
- // element binding on every invocation.
- bindingBuilder.bindParameterToElement(schemaBinding, xmlName, xmlType);
-
- return schemaBinding;
- }
-
- /**
- * Create a Marshaller that serializes
- * <code>org.w3c.dom.Element</code>'s to a
<code>org.xml.sax.ContentHandler</code>
- *
- * @return ObjectLocalMarshaller
- *
- * @see org.jboss.xb.binding.MarshallingContext#getContentHandler()
- */
- public static ObjectLocalMarshaller getWildcardMarshaller()
- {
- return new ObjectLocalMarshaller() {
- public void marshal(MarshallingContext ctx, Object o)
- {
- if (o == null)
- {
- return;
- }
-
- Element e = (Element)o;
- ContentHandler ch = ctx.getContentHandler();
- try
- {
- Dom2Sax.dom2sax(e, ch);
- }
- catch (SAXException e1)
- {
- throw new IllegalStateException("Failed to marshal DOM element "
+ new QName(e.getNamespaceURI(), e.getLocalName()) + ": " + e1.getMessage());
- }
- }
- };
- }
-}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/jbossxb/JBossXBSupport.java
(from rev 1591,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/jbossxb/JBossXBSupport.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/jbossxb/JBossXBSupport.java 2006-12-07
01:03:49 UTC (rev 1591)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/jbossxb/JBossXBSupport.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -0,0 +1,106 @@
+package org.jboss.ws.core.jaxrpc.binding.jbossxb;
+
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.ws.core.CommonMessageContext;
+import org.jboss.ws.core.metadata.jaxrpcmapping.JavaWsdlMapping;
+import org.jboss.ws.core.metadata.umdm.EndpointMetaData;
+import org.jboss.ws.core.metadata.umdm.OperationMetaData;
+import org.jboss.ws.core.metadata.umdm.ServiceMetaData;
+import org.jboss.ws.core.metadata.wsdl.xmlschema.JBossXSModel;
+import org.jboss.ws.core.soap.MessageContextAssociation;
+import org.jboss.xb.binding.MarshallingContext;
+import org.jboss.xb.binding.ObjectLocalMarshaller;
+import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding;
+import org.jboss.xb.util.Dom2Sax;
+import org.w3c.dom.Element;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.SAXException;
+
+/**
+ * @author Heiko Braun <heiko.braun(a)jboss.com>
+ * @since May 31, 2006
+ */
+public class JBossXBSupport {
+
+ /**
+ * Setup SchemaBinding associated with the ServiceMetaData.
+ * In case of an unconfigured call it will be generated from JAXB properties.
+ * <p>
+ * The SchemaBinding expects to have an element binding for the
+ * incomming xml element. Because the same element name can be reused
+ * by various operations with different xml types, we have to add the
+ * element binding on every invocation.
+ *
+ * @see JBossXBConstants#JBXB_ROOT_QNAME
+ * @see JBossXBConstants#JBXB_TYPE_QNAME
+ */
+ public static SchemaBinding getOrCreateSchemaBinding(Map properties)
+ {
+ SchemaBinding schemaBinding = null;
+ SchemaBindingBuilder bindingBuilder = new SchemaBindingBuilder();
+
+ QName xmlName = (QName)properties.get(JBossXBConstants.JBXB_ROOT_QNAME);
+ QName xmlType = (QName)properties.get(JBossXBConstants.JBXB_TYPE_QNAME);
+
+ // Get the eagerly initialized SchemaBinding from the ServiceMetaData
+ CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
+ if (msgContext != null)
+ {
+ OperationMetaData opMetaData = msgContext.getOperationMetaData();
+ EndpointMetaData epMetaData = opMetaData.getEndpointMetaData();
+ ServiceMetaData serviceMetaData = epMetaData.getServiceMetaData();
+ schemaBinding = serviceMetaData.getSchemaBinding();
+ }
+
+ // In case of an unconfigured call generate the SchemaBinding from JAXB properties
+ if (schemaBinding == null)
+ {
+ JBossXSModel xsModel =
(JBossXSModel)properties.get(JBossXBConstants.JBXB_XS_MODEL);
+ JavaWsdlMapping wsdlMapping =
(JavaWsdlMapping)properties.get(JBossXBConstants.JBXB_JAVA_MAPPING);
+ schemaBinding = bindingBuilder.buildSchemaBinding(xsModel, wsdlMapping);
+ }
+
+ // The SchemaBinding expects to have an element binding for the
+ // incomming xml element. Because the same element name can be reused
+ // by various operations with different xml types, we have to add the
+ // element binding on every invocation.
+ bindingBuilder.bindParameterToElement(schemaBinding, xmlName, xmlType);
+
+ return schemaBinding;
+ }
+
+ /**
+ * Create a Marshaller that serializes
+ * <code>org.w3c.dom.Element</code>'s to a
<code>org.xml.sax.ContentHandler</code>
+ *
+ * @return ObjectLocalMarshaller
+ *
+ * @see org.jboss.xb.binding.MarshallingContext#getContentHandler()
+ */
+ public static ObjectLocalMarshaller getWildcardMarshaller()
+ {
+ return new ObjectLocalMarshaller() {
+ public void marshal(MarshallingContext ctx, Object o)
+ {
+ if (o == null)
+ {
+ return;
+ }
+
+ Element e = (Element)o;
+ ContentHandler ch = ctx.getContentHandler();
+ try
+ {
+ Dom2Sax.dom2sax(e, ch);
+ }
+ catch (SAXException e1)
+ {
+ throw new IllegalStateException("Failed to marshal DOM element "
+ new QName(e.getNamespaceURI(), e.getLocalName()) + ": " + e1.getMessage());
+ }
+ }
+ };
+ }
+}
Deleted:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/jbossxb/JBossXBUnmarshaller.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/jbossxb/JBossXBUnmarshaller.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/jbossxb/JBossXBUnmarshaller.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -1,37 +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.binding.jbossxb;
-
-import java.io.InputStream;
-
-/**
- * @author Heiko Braun <heiko.braun(a)jboss.com>
- * @version $Id$
- * @since Jul 5, 2006
- */
-public interface JBossXBUnmarshaller {
- Object unmarshal(InputStream is) throws UnmarshalException;
-
- Object getProperty(String name);
-
- void setProperty(String name, Object value);
-}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/jbossxb/JBossXBUnmarshaller.java
(from rev 1591,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/jbossxb/JBossXBUnmarshaller.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/jbossxb/JBossXBUnmarshaller.java 2006-12-07
01:03:49 UTC (rev 1591)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/jbossxb/JBossXBUnmarshaller.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -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.jaxrpc.binding.jbossxb;
+
+import java.io.InputStream;
+
+/**
+ * @author Heiko Braun <heiko.braun(a)jboss.com>
+ * @version $Id$
+ * @since Jul 5, 2006
+ */
+public interface JBossXBUnmarshaller {
+ Object unmarshal(InputStream is) throws UnmarshalException;
+
+ Object getProperty(String name);
+
+ void setProperty(String name, Object value);
+}
Deleted:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/jbossxb/JBossXBUnmarshallerImpl.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/jbossxb/JBossXBUnmarshallerImpl.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/jbossxb/JBossXBUnmarshallerImpl.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -1,106 +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.binding.jbossxb;
-
-// $Id$
-
-import java.io.InputStream;
-import java.util.HashMap;
-
-import org.jboss.ws.WSException;
-import org.jboss.ws.extras.xop.jaxrpc.XOPUnmarshallerImpl;
-import org.jboss.xb.binding.JBossXBException;
-import org.jboss.xb.binding.UnmarshallerFactory;
-import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding;
-
-/**
- * An implementation of a JAXB Unmarshaller.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @author Alexey.Loubyansky(a)jboss.org
- * @since 18-Oct-2004
- */
-public class JBossXBUnmarshallerImpl implements JBossXBUnmarshaller
-{
- // The marshaller properties
- private HashMap<String, Object> properties = new HashMap<String,
Object>();
-
- /**
- * Unmarshal XML data from the specified InputStream and return the resulting content
tree.
- */
- public Object unmarshal(InputStream is) throws UnmarshalException
- {
- assertRequiredProperties();
-
- org.jboss.xb.binding.Unmarshaller unm =
UnmarshallerFactory.newInstance().newUnmarshaller();
- SchemaBinding schemaBinding = JBossXBSupport.getOrCreateSchemaBinding(properties);
- XOPUnmarshallerImpl xopUnmarshaller = new XOPUnmarshallerImpl();
- schemaBinding.setXopUnmarshaller(xopUnmarshaller);
-
- try
- {
- return unm.unmarshal(is, schemaBinding);
- }
- catch (JBossXBException e)
- {
- throw new UnmarshalException(e.getMessage(), e);
- }
- }
-
- /**
- * Get the particular property in the underlying implementation of Unmarshaller.
- */
- public Object getProperty(String name)
- {
- if (name == null)
- throw new IllegalArgumentException("name parameter is null");
-
- return properties.get(name);
- }
-
- /**
- * Set the particular property in the underlying implementation of Unmarshaller.
- */
- public void setProperty(String name, Object value)
- {
- if (name == null)
- throw new IllegalArgumentException("name parameter is null");
-
- properties.put(name, value);
- }
-
-
- /** Assert the required properties
- */
- private void assertRequiredProperties()
- {
- if (getProperty(JBossXBConstants.JBXB_XS_MODEL) == null)
- {
- throw new WSException("Cannot find required property: " +
JBossXBConstants.JBXB_XS_MODEL);
- }
-
- if (getProperty(JBossXBConstants.JBXB_JAVA_MAPPING) == null)
- {
- throw new WSException("Cannot find required property: " +
JBossXBConstants.JBXB_JAVA_MAPPING);
- }
- }
-}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/jbossxb/JBossXBUnmarshallerImpl.java
(from rev 1591,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/jbossxb/JBossXBUnmarshallerImpl.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/jbossxb/JBossXBUnmarshallerImpl.java 2006-12-07
01:03:49 UTC (rev 1591)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/jbossxb/JBossXBUnmarshallerImpl.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -0,0 +1,106 @@
+/*
+ * 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.jbossxb;
+
+// $Id$
+
+import java.io.InputStream;
+import java.util.HashMap;
+
+import org.jboss.ws.WSException;
+import org.jboss.ws.extentions.xop.jaxrpc.XOPUnmarshallerImpl;
+import org.jboss.xb.binding.JBossXBException;
+import org.jboss.xb.binding.UnmarshallerFactory;
+import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding;
+
+/**
+ * An implementation of a JAXB Unmarshaller.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @author Alexey.Loubyansky(a)jboss.org
+ * @since 18-Oct-2004
+ */
+public class JBossXBUnmarshallerImpl implements JBossXBUnmarshaller
+{
+ // The marshaller properties
+ private HashMap<String, Object> properties = new HashMap<String,
Object>();
+
+ /**
+ * Unmarshal XML data from the specified InputStream and return the resulting content
tree.
+ */
+ public Object unmarshal(InputStream is) throws UnmarshalException
+ {
+ assertRequiredProperties();
+
+ org.jboss.xb.binding.Unmarshaller unm =
UnmarshallerFactory.newInstance().newUnmarshaller();
+ SchemaBinding schemaBinding = JBossXBSupport.getOrCreateSchemaBinding(properties);
+ XOPUnmarshallerImpl xopUnmarshaller = new XOPUnmarshallerImpl();
+ schemaBinding.setXopUnmarshaller(xopUnmarshaller);
+
+ try
+ {
+ return unm.unmarshal(is, schemaBinding);
+ }
+ catch (JBossXBException e)
+ {
+ throw new UnmarshalException(e.getMessage(), e);
+ }
+ }
+
+ /**
+ * Get the particular property in the underlying implementation of Unmarshaller.
+ */
+ public Object getProperty(String name)
+ {
+ if (name == null)
+ throw new IllegalArgumentException("name parameter is null");
+
+ return properties.get(name);
+ }
+
+ /**
+ * Set the particular property in the underlying implementation of Unmarshaller.
+ */
+ public void setProperty(String name, Object value)
+ {
+ if (name == null)
+ throw new IllegalArgumentException("name parameter is null");
+
+ properties.put(name, value);
+ }
+
+
+ /** Assert the required properties
+ */
+ private void assertRequiredProperties()
+ {
+ if (getProperty(JBossXBConstants.JBXB_XS_MODEL) == null)
+ {
+ throw new WSException("Cannot find required property: " +
JBossXBConstants.JBXB_XS_MODEL);
+ }
+
+ if (getProperty(JBossXBConstants.JBXB_JAVA_MAPPING) == null)
+ {
+ throw new WSException("Cannot find required property: " +
JBossXBConstants.JBXB_JAVA_MAPPING);
+ }
+ }
+}
Deleted:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/jbossxb/MarshalException.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/jbossxb/MarshalException.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/jbossxb/MarshalException.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -1,52 +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.binding.jbossxb;
-
-/**
- * A marshal exception.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 06-Jun-2006
- */
-public class MarshalException extends Exception
-{
-
- public MarshalException()
- {
- super();
- }
-
- public MarshalException(String msg, Throwable th)
- {
- super(msg, th);
- }
-
- public MarshalException(String msg)
- {
- super(msg);
- }
-
- public MarshalException(Throwable th)
- {
- super(th);
- }
-}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/jbossxb/MarshalException.java
(from rev 1591,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/jbossxb/MarshalException.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/jbossxb/MarshalException.java 2006-12-07
01:03:49 UTC (rev 1591)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/jbossxb/MarshalException.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -0,0 +1,52 @@
+/*
+ * 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.jbossxb;
+
+/**
+ * A marshal exception.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 06-Jun-2006
+ */
+public class MarshalException extends Exception
+{
+
+ public MarshalException()
+ {
+ super();
+ }
+
+ public MarshalException(String msg, Throwable th)
+ {
+ super(msg, th);
+ }
+
+ public MarshalException(String msg)
+ {
+ super(msg);
+ }
+
+ public MarshalException(Throwable th)
+ {
+ super(th);
+ }
+}
Deleted:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/jbossxb/SchemaBindingBuilder.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/jbossxb/SchemaBindingBuilder.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/jbossxb/SchemaBindingBuilder.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -1,630 +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.binding.jbossxb;
-
-// $Id$
-
-import java.util.ArrayList;
-import java.util.Iterator;
-
-import javax.xml.namespace.NamespaceContext;
-import javax.xml.namespace.QName;
-import javax.xml.soap.SOAPElement;
-import javax.xml.soap.SOAPException;
-import javax.xml.soap.SOAPFactory;
-
-import org.apache.xerces.xs.XSModel;
-import org.jboss.logging.Logger;
-import org.jboss.util.xml.JBossEntityResolver;
-import org.jboss.ws.Constants;
-import org.jboss.ws.WSException;
-import org.jboss.ws.core.metadata.jaxrpcmapping.ExceptionMapping;
-import org.jboss.ws.core.metadata.jaxrpcmapping.JavaWsdlMapping;
-import org.jboss.ws.core.metadata.jaxrpcmapping.JavaXmlTypeMapping;
-import org.jboss.ws.core.metadata.jaxrpcmapping.PackageMapping;
-import org.jboss.ws.core.metadata.jaxrpcmapping.VariableMapping;
-import org.jboss.ws.core.utils.JBossWSEntityResolver;
-import org.jboss.ws.extras.xop.jaxrpc.JBossXBContentAdapter;
-import org.jboss.xb.binding.metadata.ClassMetaData;
-import org.jboss.xb.binding.metadata.PackageMetaData;
-import org.jboss.xb.binding.metadata.PropertyMetaData;
-import org.jboss.xb.binding.metadata.ValueMetaData;
-import org.jboss.xb.binding.sunday.unmarshalling.AttributeBinding;
-import org.jboss.xb.binding.sunday.unmarshalling.CharactersHandler;
-import org.jboss.xb.binding.sunday.unmarshalling.DefaultSchemaResolver;
-import org.jboss.xb.binding.sunday.unmarshalling.ElementBinding;
-import org.jboss.xb.binding.sunday.unmarshalling.ModelGroupBinding;
-import org.jboss.xb.binding.sunday.unmarshalling.ParticleBinding;
-import org.jboss.xb.binding.sunday.unmarshalling.ParticleHandler;
-import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding;
-import org.jboss.xb.binding.sunday.unmarshalling.SimpleTypeBinding;
-import org.jboss.xb.binding.sunday.unmarshalling.TermBinding;
-import org.jboss.xb.binding.sunday.unmarshalling.TypeBinding;
-import org.jboss.xb.binding.sunday.unmarshalling.WildcardBinding;
-import org.jboss.xb.binding.sunday.unmarshalling.XsdBinder;
-import org.jboss.xb.binding.sunday.unmarshalling.impl.runtime.RtElementHandler;
-import org.w3c.dom.Element;
-import org.w3c.dom.Text;
-import org.xml.sax.Attributes;
-
-/**
- * Create SchemaBinding from XSModel and jaxrpc-mapping.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @author Alexey.Loubyansky(a)jboss.org
- * @since 18-Oct-2004
- * @see XSModel
- * @see JavaWsdlMapping
- */
-public class SchemaBindingBuilder
-{
- // provide logging
- private static final Logger log = Logger.getLogger(SchemaBindingBuilder.class);
-
- /**
- * Creates and initializes an instance of SchemaBinding
- */
- public SchemaBinding buildSchemaBinding(XSModel model, JavaWsdlMapping wsdlMapping)
- {
- JBossEntityResolver resolver = new JBossWSEntityResolver();
- SchemaBinding schemaBinding = XsdBinder.bind(model, new
DefaultSchemaResolver(resolver));
-
- schemaBinding.setIgnoreLowLine(false);
- schemaBinding.setIgnoreUnresolvedFieldOrClass(false);
- schemaBinding.setUnmarshalListsToArrays(true); // note: default jaxb2.0 is false!
- schemaBinding.setSimpleContentProperty("_value");
- schemaBinding.setUseNoArgCtorIfFound(true);
- if (wsdlMapping != null)
- {
- bindSchemaToJava(schemaBinding, wsdlMapping);
- }
-
- // setup MTOM handler
- JBossXBContentAdapter.register(schemaBinding);
-
- return schemaBinding;
- }
-
- /** Merges JavaWsdlMapping into SchemaBinding
- */
- private void bindSchemaToJava(SchemaBinding schemaBinding, JavaWsdlMapping
wsdlMapping)
- {
- if (log.isTraceEnabled())
- log.trace("bindSchemaToJava: " + schemaBinding);
-
- for (PackageMapping packageMapping : wsdlMapping.getPackageMappings())
- {
- processPackageMapping(schemaBinding, packageMapping);
- }
-
- for (JavaXmlTypeMapping typeMapping : wsdlMapping.getJavaXmlTypeMappings())
- {
- processJavaXmlTypeMapping(schemaBinding, typeMapping);
- }
- }
-
- private void processPackageMapping(SchemaBinding schemaBinding, PackageMapping
packageMapping)
- {
- PackageMetaData packageMetaData = schemaBinding.getPackageMetaData();
- if (packageMetaData == null)
- {
- packageMetaData = new PackageMetaData();
- schemaBinding.setPackageMetaData(packageMetaData);
- }
-
- if (log.isTraceEnabled())
- log.trace("Bound namespace " + packageMapping.getNamespaceURI() +
" to package " + packageMapping.getPackageType());
-
- packageMetaData.setName(packageMapping.getPackageType());
- }
-
- private void processJavaXmlTypeMapping(SchemaBinding schemaBinding, JavaXmlTypeMapping
typeMapping)
- {
- String javaType = typeMapping.getJavaType();
- if (javaType.endsWith("[]"))
- {
- processArrayType(schemaBinding, typeMapping);
- }
- else
- {
- processNonArrayType(schemaBinding, typeMapping);
- }
- }
-
- private void processArrayType(SchemaBinding schemaBinding, JavaXmlTypeMapping
typeMapping)
- {
- QName xmlType = getXmlType(typeMapping);
- log.trace("Ignore array type: " + xmlType);
- }
-
- private void processNonArrayType(SchemaBinding schemaBinding, JavaXmlTypeMapping
typeMapping)
- {
- QName xmlType = getXmlType(typeMapping);
- String javaType = typeMapping.getJavaType();
- log.trace("processNonArrayType: [xmlType=" + xmlType +
",javaType=" + javaType + "]");
-
- TypeBinding typeBinding = getTypeBinding(schemaBinding, typeMapping);
- if (typeBinding != null)
- {
- // Set the java type, but skip SimpleTypes
- boolean isSimpleTypeBinding = (typeBinding instanceof SimpleTypeBinding);
- if(isSimpleTypeBinding == false)
- {
- ClassMetaData classMetaData = typeBinding.getClassMetaData();
- if (classMetaData == null)
- {
- classMetaData = new ClassMetaData();
- typeBinding.setClassMetaData(classMetaData);
- }
- classMetaData.setImpl(javaType);
-
- // exception mapping drives whether we should use the noarg ctor
- JavaWsdlMapping wsdlMapping = typeMapping.getJavaWsdlMapping();
- for (ExceptionMapping aux : wsdlMapping.getExceptionMappings())
- {
- if (javaType.equals(aux.getExceptionType()))
- {
- classMetaData.setUseNoArgCtor(false);
- break;
- }
- }
-
- if (log.isTraceEnabled())
- {
- QName typeQName = typeBinding.getQName();
- log.trace("Bound: [xmlType=" + typeQName + ",javaType=" +
javaType + "]");
- }
- }
-
- VariableMapping[] variableMappings = typeMapping.getVariableMappings();
- for (VariableMapping varMapping : variableMappings)
- {
- if (varMapping.getXmlElementName() != null)
- {
- processXmlElementName(typeBinding, varMapping);
- }
- else if (varMapping.getXmlAttributeName() != null)
- {
- processXmlAttributeName(typeBinding, varMapping);
- }
- else if (varMapping.getXmlWildcard())
- {
- processWildcard(typeBinding, varMapping);
- }
- }
- }
- else
- {
- log.warn("Cannot obtain type binding for: " + xmlType);
- }
- }
-
- private void processXmlAttributeName(TypeBinding typeBinding, VariableMapping
varMapping)
- {
- String xmlAttrName = varMapping.getXmlAttributeName();
- log.trace("processXmlAttributeName: " + xmlAttrName);
-
- QName xmlName = new QName(xmlAttrName);
- AttributeBinding attrBinding = typeBinding.getAttribute(xmlName);
- if (attrBinding == null)
- {
- Iterator i = typeBinding.getAttributes().iterator();
- while (i.hasNext())
- {
- AttributeBinding auxBinding = (AttributeBinding)i.next();
- if (auxBinding.getQName().getLocalPart().equals(xmlAttrName))
- {
- if (attrBinding != null)
- log.warn("Ambiguous binding for attribute: " + xmlAttrName);
-
- attrBinding = auxBinding;
- }
- }
- }
-
- if (attrBinding == null)
- {
- // attributeFormDefault="qualified"
- String nsURI = typeBinding.getQName().getNamespaceURI();
- if (Constants.SOAP11_ATTR_MUST_UNDERSTAND.equals(xmlAttrName) ||
Constants.SOAP11_ATTR_ACTOR.equals(xmlAttrName)
- || Constants.SOAP11_ATTR_ROLE.equals(xmlAttrName))
- {
- nsURI = Constants.NS_SOAP11_ENV;
- }
- QName auxName = new QName(nsURI, xmlAttrName);
- attrBinding = typeBinding.getAttribute(auxName);
- }
-
- if (attrBinding == null)
- {
- QName typeQName = typeBinding.getQName();
- throw new WSException("Attribute " + xmlName + " found in
jaxrpc-mapping but not in the schema: " + typeQName);
- }
-
- String javaVariableName = varMapping.getJavaVariableName();
- PropertyMetaData prop = new PropertyMetaData();
- prop.setName(javaVariableName);
- attrBinding.setPropertyMetaData(prop);
-
- if (log.isTraceEnabled())
- log.trace("Bound attribute " + xmlName + " to property " +
prop.getName());
- }
-
- private void processXmlElementName(TypeBinding typeBinding, VariableMapping
varMapping)
- {
- QName xmlName = new QName(varMapping.getXmlElementName());
- log.trace("processXmlElementName: " + xmlName);
-
- ElementBinding element = typeBinding.getElement(xmlName);
- QName typeQName = typeBinding.getQName();
- if (element == null && typeQName != null)
- {
- // elementFormDefault="qualified"
- String nsURI = typeQName.getNamespaceURI();
- QName auxName = new QName(nsURI, varMapping.getXmlElementName());
- element = typeBinding.getElement(auxName);
- }
-
- if (element == null)
- {
- // <element ref=
- ParticleBinding particle = typeBinding.getParticle();
- if (particle != null)
- {
- TermBinding term = particle.getTerm();
- if (term instanceof ModelGroupBinding)
- {
- Iterator iterator = ((ModelGroupBinding)term).getParticles().iterator();
- element = findLocalPathElement(iterator, new String[] {
varMapping.getXmlElementName() }, 0);
- }
- }
- }
-
- if (element == null)
- throw new WSException("Element " + xmlName + " found in
jaxrpc-mapping but not in the schema: " + typeQName);
-
- String javaVariableName = varMapping.getJavaVariableName();
- if (javaVariableName != null)
- {
- PropertyMetaData prop = new PropertyMetaData();
- prop.setName(javaVariableName);
- element.setPropertyMetaData(prop);
-
- if (log.isTraceEnabled())
- log.trace("Bound element " + xmlName + " to property " +
prop.getName());
- }
- }
-
- private void processWildcard(TypeBinding typeBinding, VariableMapping varMapping)
- {
- log.trace("processWildcard: " + typeBinding.getQName());
-
- PropertyMetaData prop = null;
- String javaVariableName = varMapping.getJavaVariableName();
- if (javaVariableName != null)
- {
- prop = new PropertyMetaData();
- prop.setName(javaVariableName);
- }
-
- if (prop == null)
- {
- prop = new PropertyMetaData();
- prop.setName("_any");
- }
-
- WildcardBinding wildcard = typeBinding.getWildcard();
- wildcard.setUnresolvedElementHandler(new SoapElementHandler());
- wildcard.setUnresolvedCharactersHandler(new SoapCharactersHandler());
- wildcard.setPropertyMetaData(prop);
-
- if (log.isTraceEnabled())
- log.trace("Bound wildcard of " + typeBinding.getQName() + " to
property " + prop.getName());
- }
-
- private TypeBinding getTypeBinding(SchemaBinding schemaBinding, JavaXmlTypeMapping
typeMapping)
- {
- String qnameScope = typeMapping.getQnameScope();
- QName anonymousTypeQName = typeMapping.getAnonymousTypeQName();
- if (anonymousTypeQName != null)
- {
- return getAnonymousTypeBinding(schemaBinding, anonymousTypeQName);
- }
-
- QName xmlType = typeMapping.getRootTypeQName();
-
- TypeBinding typeBinding = null;
- if ("complexType".equals(qnameScope) ||
"simpleType".equals(qnameScope))
- {
- typeBinding = schemaBinding.getType(xmlType);
- if (typeBinding == null)
- {
- log.warn("Type definition not found in schema: " + xmlType);
- }
- }
- else if ("element".equals(qnameScope))
- {
- ElementBinding element = schemaBinding.getElement(xmlType);
- if (element != null)
- {
- typeBinding = element.getType();
- }
- else
- {
- log.warn("Global element not found in schema: " + xmlType);
- }
- }
- else
- {
- throw new WSException("Unexpected qname-scope for " +
typeMapping.getJavaType() + ": " + qnameScope);
- }
- return typeBinding;
- }
-
- public TypeBinding getAnonymousTypeBinding(SchemaBinding schemaBinding, QName
typeQName)
- {
- String expression = typeQName.getLocalPart();
- if (log.isTraceEnabled())
- log.trace("Searching for anonymous expression: " + expression);
-
- ArrayList list = new ArrayList(10);
-
- for (int i = 0, begin = -1; i < expression.length(); i++)
- {
- if (expression.charAt(i) == '>')
- {
- if (begin != -1)
- {
- list.add(expression.substring(begin, i));
- begin = -1;
- }
- }
- else
- {
- if (begin == -1)
- begin = i;
- else if (i == expression.length() - 1)
- list.add(expression.substring(begin));
- }
- }
-
- ElementBinding element = findLocalPathElement(schemaBinding.getElements(),
((String[])list.toArray(new String[0])));
- if (element == null)
- element = findLocalPathElementInTypes(schemaBinding.getTypes(),
((String[])list.toArray(new String[0])));
-
- if (element == null)
- return null;
-
- return element.getType();
- }
-
- public void bindParameterToElement(SchemaBinding schemaBinding, QName xmlName, QName
xmlType)
- {
- TypeBinding typeBinding;
- boolean isAnonymousType = xmlType.getLocalPart().startsWith(">");
- if (isAnonymousType)
- {
- typeBinding = getAnonymousTypeBinding(schemaBinding, xmlType);
- }
- else
- {
- typeBinding = schemaBinding.getType(xmlType);
- }
-
- if (typeBinding != null)
- {
- if(!isAnonymousType)
- schemaBinding.addElement(xmlName, typeBinding);
- }
- else if (xmlType.equals(Constants.TYPE_LITERAL_ANYTYPE) == false)
- {
- throw new WSException("Root type " + xmlType + " not found in the
schema.");
- }
- }
-
- private ElementBinding findLocalPathElement(Iterator elements, String[] path)
- {
- while (elements.hasNext())
- {
- ElementBinding element = (ElementBinding)elements.next();
- element = findLocalPathElement(element, path, 0);
- if (element != null)
- return element;
- }
-
- return null;
- }
-
- private ElementBinding findLocalPathElementInTypes(Iterator types, String[] path)
- {
- while (types.hasNext())
- {
- TypeBinding type = (TypeBinding)types.next();
- if (type.getQName().getLocalPart().equals(path[0]))
- {
- ParticleBinding particle = type.getParticle();
- if (particle == null)
- continue;
-
- TermBinding term = particle.getTerm();
- if (!term.isModelGroup())
- continue;
-
- return
findLocalPathElement(((ModelGroupBinding)term).getParticles().iterator(), path, 1);
- }
- }
-
- return null;
- }
-
- private ElementBinding findLocalPathElement(ElementBinding element, String[] path, int
pos)
- {
- String name = path[pos];
- if (!name.equals(element.getQName().getLocalPart()))
- return null;
-
- // End of path
- if (path.length - 1 == pos)
- return element;
-
- ParticleBinding particle = element.getType().getParticle();
- if (particle == null)
- return null;
-
- TermBinding term = particle.getTerm();
- if (!term.isModelGroup())
- return null;
-
- ModelGroupBinding group = (ModelGroupBinding)term;
- Iterator i = group.getParticles().iterator();
-
- // Increase depth
- return findLocalPathElement(i, path, pos + 1);
- }
-
- private ElementBinding findLocalPathElement(Iterator particles, String[] path, int
pos)
- {
- while (particles.hasNext())
- {
- TermBinding term = ((ParticleBinding)particles.next()).getTerm();
- if (term instanceof ElementBinding)
- {
- ElementBinding element = (ElementBinding)term;
- element = findLocalPathElement(element, path, pos);
- if (element != null)
- return element;
-
- }
- else if (term instanceof ModelGroupBinding)
- {
- Iterator i = ((ModelGroupBinding)term).getParticles().iterator();
- ElementBinding element = findLocalPathElement(i, path, pos);
- if (element != null)
- return element;
- }
- }
-
- return null;
- }
-
- /** Get the <root-type-qname>, fall back to <anonymous-type-qname>
- */
- private QName getXmlType(JavaXmlTypeMapping typeMapping)
- {
- QName xmlType = typeMapping.getRootTypeQName();
- if (xmlType == null && typeMapping.getAnonymousTypeQName() != null)
- xmlType = typeMapping.getAnonymousTypeQName();
-
- return xmlType;
- }
-
- // Inner
-
- public static class SoapCharactersHandler extends CharactersHandler
- {
- public Object unmarshalEmpty(QName qName, TypeBinding typeBinding, NamespaceContext
nsCtx, ValueMetaData valueMetaData)
- {
- return "";
- }
-
- public Object unmarshal(QName qName, TypeBinding typeBinding, NamespaceContext
nsCtx, ValueMetaData valueMetaData, String value)
- {
- return value;
- }
-
- public void setValue(QName qName, ElementBinding element, Object owner, Object
value)
- {
- SOAPElement e = (SOAPElement)owner;
- Text textNode = e.getOwnerDocument().createTextNode((String)value);
- e.appendChild(textNode);
- }
- }
-
- public static class SoapElementHandler extends RtElementHandler implements
ParticleHandler
- {
- private SOAPFactory factory;
-
- public Object startParticle(Object parent, QName elementName, ParticleBinding
particle, Attributes attrs, NamespaceContext nsCtx)
- {
- SOAPFactory factory = getFactory();
- SOAPElement element = null;
- try
- {
- String prefix = elementName.getPrefix();
- String ns = elementName.getNamespaceURI();
- if (ns != null && ns.length() > 0)
- {
- prefix = nsCtx.getPrefix(ns);
- }
-
- element = factory.createElement(elementName.getLocalPart(), prefix, ns);
- }
- catch (SOAPException e)
- {
- throw new IllegalStateException("Failed to create SOAPElement",
e);
- }
-
- if (attrs != null)
- {
- for (int i = 0; i < attrs.getLength(); ++i)
- {
- element.setAttribute(attrs.getLocalName(i), attrs.getValue(i));
- }
- }
-
- return element;
- }
-
- public Object endParticle(Object o, QName elementName, ParticleBinding particle)
- {
- return o;
- }
-
- public void setParent(Object parent, Object o, QName elementName, ParticleBinding
particle, ParticleBinding parentParticle)
- {
- if (parent instanceof SOAPElement)
- {
- ((SOAPElement)parent).appendChild((Element)o);
- }
- else
- {
- super.setParent(parent, o, elementName, particle, parentParticle);
- }
- }
-
- private SOAPFactory getFactory()
- {
- if (factory == null)
- {
- try
- {
- factory = SOAPFactory.newInstance();
- }
- catch (SOAPException e)
- {
- throw new IllegalStateException("Failed to create soap element
factory", e);
- }
- }
- return factory;
- }
- }
-}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/jbossxb/SchemaBindingBuilder.java
(from rev 1591,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/jbossxb/SchemaBindingBuilder.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/jbossxb/SchemaBindingBuilder.java 2006-12-07
01:03:49 UTC (rev 1591)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/jbossxb/SchemaBindingBuilder.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -0,0 +1,630 @@
+/*
+ * 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.jbossxb;
+
+// $Id$
+
+import java.util.ArrayList;
+import java.util.Iterator;
+
+import javax.xml.namespace.NamespaceContext;
+import javax.xml.namespace.QName;
+import javax.xml.soap.SOAPElement;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPFactory;
+
+import org.apache.xerces.xs.XSModel;
+import org.jboss.logging.Logger;
+import org.jboss.util.xml.JBossEntityResolver;
+import org.jboss.ws.Constants;
+import org.jboss.ws.WSException;
+import org.jboss.ws.core.metadata.jaxrpcmapping.ExceptionMapping;
+import org.jboss.ws.core.metadata.jaxrpcmapping.JavaWsdlMapping;
+import org.jboss.ws.core.metadata.jaxrpcmapping.JavaXmlTypeMapping;
+import org.jboss.ws.core.metadata.jaxrpcmapping.PackageMapping;
+import org.jboss.ws.core.metadata.jaxrpcmapping.VariableMapping;
+import org.jboss.ws.core.utils.JBossWSEntityResolver;
+import org.jboss.ws.extentions.xop.jaxrpc.JBossXBContentAdapter;
+import org.jboss.xb.binding.metadata.ClassMetaData;
+import org.jboss.xb.binding.metadata.PackageMetaData;
+import org.jboss.xb.binding.metadata.PropertyMetaData;
+import org.jboss.xb.binding.metadata.ValueMetaData;
+import org.jboss.xb.binding.sunday.unmarshalling.AttributeBinding;
+import org.jboss.xb.binding.sunday.unmarshalling.CharactersHandler;
+import org.jboss.xb.binding.sunday.unmarshalling.DefaultSchemaResolver;
+import org.jboss.xb.binding.sunday.unmarshalling.ElementBinding;
+import org.jboss.xb.binding.sunday.unmarshalling.ModelGroupBinding;
+import org.jboss.xb.binding.sunday.unmarshalling.ParticleBinding;
+import org.jboss.xb.binding.sunday.unmarshalling.ParticleHandler;
+import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding;
+import org.jboss.xb.binding.sunday.unmarshalling.SimpleTypeBinding;
+import org.jboss.xb.binding.sunday.unmarshalling.TermBinding;
+import org.jboss.xb.binding.sunday.unmarshalling.TypeBinding;
+import org.jboss.xb.binding.sunday.unmarshalling.WildcardBinding;
+import org.jboss.xb.binding.sunday.unmarshalling.XsdBinder;
+import org.jboss.xb.binding.sunday.unmarshalling.impl.runtime.RtElementHandler;
+import org.w3c.dom.Element;
+import org.w3c.dom.Text;
+import org.xml.sax.Attributes;
+
+/**
+ * Create SchemaBinding from XSModel and jaxrpc-mapping.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @author Alexey.Loubyansky(a)jboss.org
+ * @since 18-Oct-2004
+ * @see XSModel
+ * @see JavaWsdlMapping
+ */
+public class SchemaBindingBuilder
+{
+ // provide logging
+ private static final Logger log = Logger.getLogger(SchemaBindingBuilder.class);
+
+ /**
+ * Creates and initializes an instance of SchemaBinding
+ */
+ public SchemaBinding buildSchemaBinding(XSModel model, JavaWsdlMapping wsdlMapping)
+ {
+ JBossEntityResolver resolver = new JBossWSEntityResolver();
+ SchemaBinding schemaBinding = XsdBinder.bind(model, new
DefaultSchemaResolver(resolver));
+
+ schemaBinding.setIgnoreLowLine(false);
+ schemaBinding.setIgnoreUnresolvedFieldOrClass(false);
+ schemaBinding.setUnmarshalListsToArrays(true); // note: default jaxb2.0 is false!
+ schemaBinding.setSimpleContentProperty("_value");
+ schemaBinding.setUseNoArgCtorIfFound(true);
+ if (wsdlMapping != null)
+ {
+ bindSchemaToJava(schemaBinding, wsdlMapping);
+ }
+
+ // setup MTOM handler
+ JBossXBContentAdapter.register(schemaBinding);
+
+ return schemaBinding;
+ }
+
+ /** Merges JavaWsdlMapping into SchemaBinding
+ */
+ private void bindSchemaToJava(SchemaBinding schemaBinding, JavaWsdlMapping
wsdlMapping)
+ {
+ if (log.isTraceEnabled())
+ log.trace("bindSchemaToJava: " + schemaBinding);
+
+ for (PackageMapping packageMapping : wsdlMapping.getPackageMappings())
+ {
+ processPackageMapping(schemaBinding, packageMapping);
+ }
+
+ for (JavaXmlTypeMapping typeMapping : wsdlMapping.getJavaXmlTypeMappings())
+ {
+ processJavaXmlTypeMapping(schemaBinding, typeMapping);
+ }
+ }
+
+ private void processPackageMapping(SchemaBinding schemaBinding, PackageMapping
packageMapping)
+ {
+ PackageMetaData packageMetaData = schemaBinding.getPackageMetaData();
+ if (packageMetaData == null)
+ {
+ packageMetaData = new PackageMetaData();
+ schemaBinding.setPackageMetaData(packageMetaData);
+ }
+
+ if (log.isTraceEnabled())
+ log.trace("Bound namespace " + packageMapping.getNamespaceURI() +
" to package " + packageMapping.getPackageType());
+
+ packageMetaData.setName(packageMapping.getPackageType());
+ }
+
+ private void processJavaXmlTypeMapping(SchemaBinding schemaBinding, JavaXmlTypeMapping
typeMapping)
+ {
+ String javaType = typeMapping.getJavaType();
+ if (javaType.endsWith("[]"))
+ {
+ processArrayType(schemaBinding, typeMapping);
+ }
+ else
+ {
+ processNonArrayType(schemaBinding, typeMapping);
+ }
+ }
+
+ private void processArrayType(SchemaBinding schemaBinding, JavaXmlTypeMapping
typeMapping)
+ {
+ QName xmlType = getXmlType(typeMapping);
+ log.trace("Ignore array type: " + xmlType);
+ }
+
+ private void processNonArrayType(SchemaBinding schemaBinding, JavaXmlTypeMapping
typeMapping)
+ {
+ QName xmlType = getXmlType(typeMapping);
+ String javaType = typeMapping.getJavaType();
+ log.trace("processNonArrayType: [xmlType=" + xmlType +
",javaType=" + javaType + "]");
+
+ TypeBinding typeBinding = getTypeBinding(schemaBinding, typeMapping);
+ if (typeBinding != null)
+ {
+ // Set the java type, but skip SimpleTypes
+ boolean isSimpleTypeBinding = (typeBinding instanceof SimpleTypeBinding);
+ if(isSimpleTypeBinding == false)
+ {
+ ClassMetaData classMetaData = typeBinding.getClassMetaData();
+ if (classMetaData == null)
+ {
+ classMetaData = new ClassMetaData();
+ typeBinding.setClassMetaData(classMetaData);
+ }
+ classMetaData.setImpl(javaType);
+
+ // exception mapping drives whether we should use the noarg ctor
+ JavaWsdlMapping wsdlMapping = typeMapping.getJavaWsdlMapping();
+ for (ExceptionMapping aux : wsdlMapping.getExceptionMappings())
+ {
+ if (javaType.equals(aux.getExceptionType()))
+ {
+ classMetaData.setUseNoArgCtor(false);
+ break;
+ }
+ }
+
+ if (log.isTraceEnabled())
+ {
+ QName typeQName = typeBinding.getQName();
+ log.trace("Bound: [xmlType=" + typeQName + ",javaType=" +
javaType + "]");
+ }
+ }
+
+ VariableMapping[] variableMappings = typeMapping.getVariableMappings();
+ for (VariableMapping varMapping : variableMappings)
+ {
+ if (varMapping.getXmlElementName() != null)
+ {
+ processXmlElementName(typeBinding, varMapping);
+ }
+ else if (varMapping.getXmlAttributeName() != null)
+ {
+ processXmlAttributeName(typeBinding, varMapping);
+ }
+ else if (varMapping.getXmlWildcard())
+ {
+ processWildcard(typeBinding, varMapping);
+ }
+ }
+ }
+ else
+ {
+ log.warn("Cannot obtain type binding for: " + xmlType);
+ }
+ }
+
+ private void processXmlAttributeName(TypeBinding typeBinding, VariableMapping
varMapping)
+ {
+ String xmlAttrName = varMapping.getXmlAttributeName();
+ log.trace("processXmlAttributeName: " + xmlAttrName);
+
+ QName xmlName = new QName(xmlAttrName);
+ AttributeBinding attrBinding = typeBinding.getAttribute(xmlName);
+ if (attrBinding == null)
+ {
+ Iterator i = typeBinding.getAttributes().iterator();
+ while (i.hasNext())
+ {
+ AttributeBinding auxBinding = (AttributeBinding)i.next();
+ if (auxBinding.getQName().getLocalPart().equals(xmlAttrName))
+ {
+ if (attrBinding != null)
+ log.warn("Ambiguous binding for attribute: " + xmlAttrName);
+
+ attrBinding = auxBinding;
+ }
+ }
+ }
+
+ if (attrBinding == null)
+ {
+ // attributeFormDefault="qualified"
+ String nsURI = typeBinding.getQName().getNamespaceURI();
+ if (Constants.SOAP11_ATTR_MUST_UNDERSTAND.equals(xmlAttrName) ||
Constants.SOAP11_ATTR_ACTOR.equals(xmlAttrName)
+ || Constants.SOAP11_ATTR_ROLE.equals(xmlAttrName))
+ {
+ nsURI = Constants.NS_SOAP11_ENV;
+ }
+ QName auxName = new QName(nsURI, xmlAttrName);
+ attrBinding = typeBinding.getAttribute(auxName);
+ }
+
+ if (attrBinding == null)
+ {
+ QName typeQName = typeBinding.getQName();
+ throw new WSException("Attribute " + xmlName + " found in
jaxrpc-mapping but not in the schema: " + typeQName);
+ }
+
+ String javaVariableName = varMapping.getJavaVariableName();
+ PropertyMetaData prop = new PropertyMetaData();
+ prop.setName(javaVariableName);
+ attrBinding.setPropertyMetaData(prop);
+
+ if (log.isTraceEnabled())
+ log.trace("Bound attribute " + xmlName + " to property " +
prop.getName());
+ }
+
+ private void processXmlElementName(TypeBinding typeBinding, VariableMapping
varMapping)
+ {
+ QName xmlName = new QName(varMapping.getXmlElementName());
+ log.trace("processXmlElementName: " + xmlName);
+
+ ElementBinding element = typeBinding.getElement(xmlName);
+ QName typeQName = typeBinding.getQName();
+ if (element == null && typeQName != null)
+ {
+ // elementFormDefault="qualified"
+ String nsURI = typeQName.getNamespaceURI();
+ QName auxName = new QName(nsURI, varMapping.getXmlElementName());
+ element = typeBinding.getElement(auxName);
+ }
+
+ if (element == null)
+ {
+ // <element ref=
+ ParticleBinding particle = typeBinding.getParticle();
+ if (particle != null)
+ {
+ TermBinding term = particle.getTerm();
+ if (term instanceof ModelGroupBinding)
+ {
+ Iterator iterator = ((ModelGroupBinding)term).getParticles().iterator();
+ element = findLocalPathElement(iterator, new String[] {
varMapping.getXmlElementName() }, 0);
+ }
+ }
+ }
+
+ if (element == null)
+ throw new WSException("Element " + xmlName + " found in
jaxrpc-mapping but not in the schema: " + typeQName);
+
+ String javaVariableName = varMapping.getJavaVariableName();
+ if (javaVariableName != null)
+ {
+ PropertyMetaData prop = new PropertyMetaData();
+ prop.setName(javaVariableName);
+ element.setPropertyMetaData(prop);
+
+ if (log.isTraceEnabled())
+ log.trace("Bound element " + xmlName + " to property " +
prop.getName());
+ }
+ }
+
+ private void processWildcard(TypeBinding typeBinding, VariableMapping varMapping)
+ {
+ log.trace("processWildcard: " + typeBinding.getQName());
+
+ PropertyMetaData prop = null;
+ String javaVariableName = varMapping.getJavaVariableName();
+ if (javaVariableName != null)
+ {
+ prop = new PropertyMetaData();
+ prop.setName(javaVariableName);
+ }
+
+ if (prop == null)
+ {
+ prop = new PropertyMetaData();
+ prop.setName("_any");
+ }
+
+ WildcardBinding wildcard = typeBinding.getWildcard();
+ wildcard.setUnresolvedElementHandler(new SoapElementHandler());
+ wildcard.setUnresolvedCharactersHandler(new SoapCharactersHandler());
+ wildcard.setPropertyMetaData(prop);
+
+ if (log.isTraceEnabled())
+ log.trace("Bound wildcard of " + typeBinding.getQName() + " to
property " + prop.getName());
+ }
+
+ private TypeBinding getTypeBinding(SchemaBinding schemaBinding, JavaXmlTypeMapping
typeMapping)
+ {
+ String qnameScope = typeMapping.getQnameScope();
+ QName anonymousTypeQName = typeMapping.getAnonymousTypeQName();
+ if (anonymousTypeQName != null)
+ {
+ return getAnonymousTypeBinding(schemaBinding, anonymousTypeQName);
+ }
+
+ QName xmlType = typeMapping.getRootTypeQName();
+
+ TypeBinding typeBinding = null;
+ if ("complexType".equals(qnameScope) ||
"simpleType".equals(qnameScope))
+ {
+ typeBinding = schemaBinding.getType(xmlType);
+ if (typeBinding == null)
+ {
+ log.warn("Type definition not found in schema: " + xmlType);
+ }
+ }
+ else if ("element".equals(qnameScope))
+ {
+ ElementBinding element = schemaBinding.getElement(xmlType);
+ if (element != null)
+ {
+ typeBinding = element.getType();
+ }
+ else
+ {
+ log.warn("Global element not found in schema: " + xmlType);
+ }
+ }
+ else
+ {
+ throw new WSException("Unexpected qname-scope for " +
typeMapping.getJavaType() + ": " + qnameScope);
+ }
+ return typeBinding;
+ }
+
+ public TypeBinding getAnonymousTypeBinding(SchemaBinding schemaBinding, QName
typeQName)
+ {
+ String expression = typeQName.getLocalPart();
+ if (log.isTraceEnabled())
+ log.trace("Searching for anonymous expression: " + expression);
+
+ ArrayList list = new ArrayList(10);
+
+ for (int i = 0, begin = -1; i < expression.length(); i++)
+ {
+ if (expression.charAt(i) == '>')
+ {
+ if (begin != -1)
+ {
+ list.add(expression.substring(begin, i));
+ begin = -1;
+ }
+ }
+ else
+ {
+ if (begin == -1)
+ begin = i;
+ else if (i == expression.length() - 1)
+ list.add(expression.substring(begin));
+ }
+ }
+
+ ElementBinding element = findLocalPathElement(schemaBinding.getElements(),
((String[])list.toArray(new String[0])));
+ if (element == null)
+ element = findLocalPathElementInTypes(schemaBinding.getTypes(),
((String[])list.toArray(new String[0])));
+
+ if (element == null)
+ return null;
+
+ return element.getType();
+ }
+
+ public void bindParameterToElement(SchemaBinding schemaBinding, QName xmlName, QName
xmlType)
+ {
+ TypeBinding typeBinding;
+ boolean isAnonymousType = xmlType.getLocalPart().startsWith(">");
+ if (isAnonymousType)
+ {
+ typeBinding = getAnonymousTypeBinding(schemaBinding, xmlType);
+ }
+ else
+ {
+ typeBinding = schemaBinding.getType(xmlType);
+ }
+
+ if (typeBinding != null)
+ {
+ if(!isAnonymousType)
+ schemaBinding.addElement(xmlName, typeBinding);
+ }
+ else if (xmlType.equals(Constants.TYPE_LITERAL_ANYTYPE) == false)
+ {
+ throw new WSException("Root type " + xmlType + " not found in the
schema.");
+ }
+ }
+
+ private ElementBinding findLocalPathElement(Iterator elements, String[] path)
+ {
+ while (elements.hasNext())
+ {
+ ElementBinding element = (ElementBinding)elements.next();
+ element = findLocalPathElement(element, path, 0);
+ if (element != null)
+ return element;
+ }
+
+ return null;
+ }
+
+ private ElementBinding findLocalPathElementInTypes(Iterator types, String[] path)
+ {
+ while (types.hasNext())
+ {
+ TypeBinding type = (TypeBinding)types.next();
+ if (type.getQName().getLocalPart().equals(path[0]))
+ {
+ ParticleBinding particle = type.getParticle();
+ if (particle == null)
+ continue;
+
+ TermBinding term = particle.getTerm();
+ if (!term.isModelGroup())
+ continue;
+
+ return
findLocalPathElement(((ModelGroupBinding)term).getParticles().iterator(), path, 1);
+ }
+ }
+
+ return null;
+ }
+
+ private ElementBinding findLocalPathElement(ElementBinding element, String[] path, int
pos)
+ {
+ String name = path[pos];
+ if (!name.equals(element.getQName().getLocalPart()))
+ return null;
+
+ // End of path
+ if (path.length - 1 == pos)
+ return element;
+
+ ParticleBinding particle = element.getType().getParticle();
+ if (particle == null)
+ return null;
+
+ TermBinding term = particle.getTerm();
+ if (!term.isModelGroup())
+ return null;
+
+ ModelGroupBinding group = (ModelGroupBinding)term;
+ Iterator i = group.getParticles().iterator();
+
+ // Increase depth
+ return findLocalPathElement(i, path, pos + 1);
+ }
+
+ private ElementBinding findLocalPathElement(Iterator particles, String[] path, int
pos)
+ {
+ while (particles.hasNext())
+ {
+ TermBinding term = ((ParticleBinding)particles.next()).getTerm();
+ if (term instanceof ElementBinding)
+ {
+ ElementBinding element = (ElementBinding)term;
+ element = findLocalPathElement(element, path, pos);
+ if (element != null)
+ return element;
+
+ }
+ else if (term instanceof ModelGroupBinding)
+ {
+ Iterator i = ((ModelGroupBinding)term).getParticles().iterator();
+ ElementBinding element = findLocalPathElement(i, path, pos);
+ if (element != null)
+ return element;
+ }
+ }
+
+ return null;
+ }
+
+ /** Get the <root-type-qname>, fall back to <anonymous-type-qname>
+ */
+ private QName getXmlType(JavaXmlTypeMapping typeMapping)
+ {
+ QName xmlType = typeMapping.getRootTypeQName();
+ if (xmlType == null && typeMapping.getAnonymousTypeQName() != null)
+ xmlType = typeMapping.getAnonymousTypeQName();
+
+ return xmlType;
+ }
+
+ // Inner
+
+ public static class SoapCharactersHandler extends CharactersHandler
+ {
+ public Object unmarshalEmpty(QName qName, TypeBinding typeBinding, NamespaceContext
nsCtx, ValueMetaData valueMetaData)
+ {
+ return "";
+ }
+
+ public Object unmarshal(QName qName, TypeBinding typeBinding, NamespaceContext
nsCtx, ValueMetaData valueMetaData, String value)
+ {
+ return value;
+ }
+
+ public void setValue(QName qName, ElementBinding element, Object owner, Object
value)
+ {
+ SOAPElement e = (SOAPElement)owner;
+ Text textNode = e.getOwnerDocument().createTextNode((String)value);
+ e.appendChild(textNode);
+ }
+ }
+
+ public static class SoapElementHandler extends RtElementHandler implements
ParticleHandler
+ {
+ private SOAPFactory factory;
+
+ public Object startParticle(Object parent, QName elementName, ParticleBinding
particle, Attributes attrs, NamespaceContext nsCtx)
+ {
+ SOAPFactory factory = getFactory();
+ SOAPElement element = null;
+ try
+ {
+ String prefix = elementName.getPrefix();
+ String ns = elementName.getNamespaceURI();
+ if (ns != null && ns.length() > 0)
+ {
+ prefix = nsCtx.getPrefix(ns);
+ }
+
+ element = factory.createElement(elementName.getLocalPart(), prefix, ns);
+ }
+ catch (SOAPException e)
+ {
+ throw new IllegalStateException("Failed to create SOAPElement",
e);
+ }
+
+ if (attrs != null)
+ {
+ for (int i = 0; i < attrs.getLength(); ++i)
+ {
+ element.setAttribute(attrs.getLocalName(i), attrs.getValue(i));
+ }
+ }
+
+ return element;
+ }
+
+ public Object endParticle(Object o, QName elementName, ParticleBinding particle)
+ {
+ return o;
+ }
+
+ public void setParent(Object parent, Object o, QName elementName, ParticleBinding
particle, ParticleBinding parentParticle)
+ {
+ if (parent instanceof SOAPElement)
+ {
+ ((SOAPElement)parent).appendChild((Element)o);
+ }
+ else
+ {
+ super.setParent(parent, o, elementName, particle, parentParticle);
+ }
+ }
+
+ private SOAPFactory getFactory()
+ {
+ if (factory == null)
+ {
+ try
+ {
+ factory = SOAPFactory.newInstance();
+ }
+ catch (SOAPException e)
+ {
+ throw new IllegalStateException("Failed to create soap element
factory", e);
+ }
+ }
+ return factory;
+ }
+ }
+}
Deleted:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/jbossxb/UnmarshalException.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/jbossxb/UnmarshalException.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/jbossxb/UnmarshalException.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -1,52 +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.binding.jbossxb;
-
-/**
- * A marshal exception.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 06-Jun-2006
- */
-public class UnmarshalException extends Exception
-{
-
- public UnmarshalException()
- {
- super();
- }
-
- public UnmarshalException(String msg, Throwable th)
- {
- super(msg, th);
- }
-
- public UnmarshalException(String msg)
- {
- super(msg);
- }
-
- public UnmarshalException(Throwable th)
- {
- super(th);
- }
-}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/jbossxb/UnmarshalException.java
(from rev 1591,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/jbossxb/UnmarshalException.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/jbossxb/UnmarshalException.java 2006-12-07
01:03:49 UTC (rev 1591)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/jbossxb/UnmarshalException.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -0,0 +1,52 @@
+/*
+ * 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.jbossxb;
+
+/**
+ * A marshal exception.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 06-Jun-2006
+ */
+public class UnmarshalException extends Exception
+{
+
+ public UnmarshalException()
+ {
+ super();
+ }
+
+ public UnmarshalException(String msg, Throwable th)
+ {
+ super(msg, th);
+ }
+
+ public UnmarshalException(String msg)
+ {
+ super(msg);
+ }
+
+ public UnmarshalException(Throwable th)
+ {
+ super(th);
+ }
+}
Deleted:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/jbossxb/XercesXSMarshallerImpl.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/jbossxb/XercesXSMarshallerImpl.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/jbossxb/XercesXSMarshallerImpl.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -1,251 +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.binding.jbossxb;
-
-// $Id$
-
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-import java.io.Writer;
-import java.util.HashMap;
-
-import javax.xml.namespace.QName;
-
-import org.apache.xerces.xs.XSModel;
-import org.jboss.logging.Logger;
-import org.jboss.util.NotImplementedException;
-import org.jboss.ws.WSException;
-import org.jboss.ws.core.metadata.jaxrpcmapping.JavaWsdlMapping;
-import org.jboss.ws.core.metadata.jaxrpcmapping.JavaXmlTypeMapping;
-import org.jboss.ws.core.metadata.jaxrpcmapping.VariableMapping;
-import org.jboss.ws.core.utils.JavaUtils;
-import org.jboss.xb.binding.Constants;
-import org.jboss.xb.binding.MappingObjectModelProvider;
-import org.jboss.xb.binding.XercesXsMarshaller;
-import org.w3c.dom.Node;
-import org.xml.sax.ContentHandler;
-
-/**
- * An implementation of a JAXB Marshaller that user XercesXSMarshaller impl.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 18-Oct-2004
- */
-public class XercesXSMarshallerImpl implements JBossXBMarshaller
-{
-
- // provide logging
- private static final Logger log = Logger.getLogger(XercesXSMarshallerImpl.class);
-
- // The marshaller properties
- private HashMap properties = new HashMap();
-
- private XercesXsMarshaller delegate;
-
- public XercesXSMarshallerImpl()
- {
- delegate = new XercesXsMarshaller();
- delegate.setProperty(XercesXsMarshaller.PROP_OUTPUT_XML_VERSION,
"false");
- delegate.setProperty(XercesXsMarshaller.PROP_OUTPUT_INDENTATION,
"false");
- delegate.declareNamespace("xsi", Constants.NS_XML_SCHEMA_INSTANCE);
- delegate.setSupportNil(true);
- delegate.setSimpleContentProperty("_value");
- }
-
- /**
- * Marshal the content tree rooted at obj into a Writer.
- */
- public void marshal(Object obj, Writer writer) throws MarshalException
- {
- assertRequiredProperties();
-
- try
- {
- QName xmlName = (QName)getProperty(JBossXBConstants.JBXB_ROOT_QNAME);
- delegate.addRootElement(xmlName);
-
- QName xmlType = (QName)getProperty(JBossXBConstants.JBXB_TYPE_QNAME);
- if (xmlType != null)
- {
- delegate.setRootTypeQName(xmlType);
- }
-
- if (xmlName.getNamespaceURI().length() > 0)
- {
- String prefix = xmlName.getPrefix();
- String nsURI = xmlName.getNamespaceURI();
- delegate.declareNamespace(prefix, nsURI);
- }
-
- MappingObjectModelProvider provider = new MappingObjectModelProvider();
- provider.setIgnoreLowLine(false);
- provider.setIgnoreNotFoundField(false);
-
- // todo complete wsdl mapping merge
- JavaWsdlMapping wsdlMapping =
(JavaWsdlMapping)getProperty(JBossXBConstants.JBXB_JAVA_MAPPING);
- if (wsdlMapping != null)
- {
- JavaXmlTypeMapping[] javaXmlMappings = wsdlMapping.getJavaXmlTypeMappings();
- if (javaXmlMappings != null)
- {
- for (int i = 0; i < javaXmlMappings.length; ++i)
- {
- JavaXmlTypeMapping javaXmlMapping = javaXmlMappings[i];
- VariableMapping[] variableMappings =
javaXmlMapping.getVariableMappings();
- if (variableMappings != null)
- {
- String clsName = javaXmlMapping.getJavaType();
- Class cls = JavaUtils.loadJavaType(clsName,
Thread.currentThread().getContextClassLoader());
- QName clsQName = javaXmlMapping.getRootTypeQName();
-
- if (clsQName != null)
- {
- if ("element".equals(javaXmlMapping.getQnameScope()))
- {
- delegate.mapClassToGlobalElement(cls, clsQName.getLocalPart(),
clsQName.getNamespaceURI(), null, provider);
- }
- else
- {
- delegate.mapClassToGlobalType(cls, clsQName.getLocalPart(),
clsQName.getNamespaceURI(), null, provider);
- delegate.mapClassToXsiType(cls, clsQName.getNamespaceURI(),
clsQName.getLocalPart());
- }
- }
-
- for (int j = 0; j < variableMappings.length; ++j)
- {
- VariableMapping variableMapping = variableMappings[j];
- String javaName = variableMapping.getJavaVariableName();
- if (variableMapping.getXmlElementName() != null)
- {
- String xmlElementName = variableMapping.getXmlElementName();
- provider.mapFieldToElement(cls, javaName, "",
xmlElementName, null);
- }
- else if (variableMapping.getXmlAttributeName() != null)
- {
- log.trace("Unmapped attribute: " + javaName);
- }
- else if (variableMapping.getXmlWildcard())
- {
- delegate.mapFieldToWildcard(cls, "_any",
JBossXBSupport.getWildcardMarshaller());
- }
- else
- {
- log.warn("Unmapped variable: " + javaName);
- }
- }
- }
- }
- }
- }
-
- if (getProperty(JBossXBConstants.JBXB_XS_MODEL) != null)
- {
- XSModel model = (XSModel)getProperty(JBossXBConstants.JBXB_XS_MODEL);
- delegate.marshal(model, provider, obj, writer);
- }
- }
- catch (RuntimeException e)
- {
- throw e;
- }
- catch (Exception e)
- {
- throw new MarshalException(e);
- }
- }
-
- /**
- * Marshal the content tree rooted at obj into SAX2 events.
- */
- public void marshal(Object obj, ContentHandler handler)
- {
- throw new NotImplementedException();
- }
-
- /**
- * Marshal the content tree rooted at obj into a DOM tree.
- */
- public void marshal(Object obj, Node node)
- {
- throw new NotImplementedException();
- }
-
- /**
- * Marshal the content tree rooted at obj into an output stream.
- */
- public void marshal(Object obj, OutputStream os) throws MarshalException
- {
- marshal(obj, new OutputStreamWriter(os));
- }
-
- /**
- * Get the particular property in the underlying implementation of
- * Marshaller.
- */
- public Object getProperty(String name)
- {
- if (name == null)
- throw new IllegalArgumentException("name parameter is null");
-
- return properties.get(name);
- }
-
- /**
- * Set the particular property in the underlying implementation of
- * Marshaller.
- *
- */
- public void setProperty(String name, Object value)
- {
- if (name == null)
- throw new IllegalArgumentException("name parameter is null");
-
- properties.put(name, value);
- }
-
- /**
- * Get a DOM tree view of the content tree(Optional).
- */
- public Node getNode(Object contentTree)
- {
- throw new NotImplementedException();
- }
-
- /**
- * Assert the required properties
- */
- private void assertRequiredProperties()
- {
- if (getProperty(JBossXBConstants.JBXB_SCHEMA_READER) == null &&
getProperty(JBossXBConstants.JBXB_XS_MODEL) == null)
- throw new WSException("Cannot find required property: " +
JBossXBConstants.JBXB_XS_MODEL);
-
- if (getProperty(JBossXBConstants.JBXB_JAVA_MAPPING) == null)
- throw new WSException("Cannot find required property: " +
JBossXBConstants.JBXB_JAVA_MAPPING);
-
- QName xmlName = (QName)getProperty(JBossXBConstants.JBXB_ROOT_QNAME);
- if (xmlName == null)
- throw new WSException("Cannot find required property: " +
JBossXBConstants.JBXB_ROOT_QNAME);
-
- if (xmlName.getNamespaceURI().length() > 0 &&
xmlName.getPrefix().length() == 0)
- throw new IllegalArgumentException("The given root element name must be
prefix qualified: " + xmlName);
- }
-}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/jbossxb/XercesXSMarshallerImpl.java
(from rev 1591,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/jbossxb/XercesXSMarshallerImpl.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/jbossxb/XercesXSMarshallerImpl.java 2006-12-07
01:03:49 UTC (rev 1591)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/jbossxb/XercesXSMarshallerImpl.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -0,0 +1,251 @@
+/*
+ * 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.jbossxb;
+
+// $Id$
+
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.Writer;
+import java.util.HashMap;
+
+import javax.xml.namespace.QName;
+
+import org.apache.xerces.xs.XSModel;
+import org.jboss.logging.Logger;
+import org.jboss.util.NotImplementedException;
+import org.jboss.ws.WSException;
+import org.jboss.ws.core.metadata.jaxrpcmapping.JavaWsdlMapping;
+import org.jboss.ws.core.metadata.jaxrpcmapping.JavaXmlTypeMapping;
+import org.jboss.ws.core.metadata.jaxrpcmapping.VariableMapping;
+import org.jboss.ws.core.utils.JavaUtils;
+import org.jboss.xb.binding.Constants;
+import org.jboss.xb.binding.MappingObjectModelProvider;
+import org.jboss.xb.binding.XercesXsMarshaller;
+import org.w3c.dom.Node;
+import org.xml.sax.ContentHandler;
+
+/**
+ * An implementation of a JAXB Marshaller that user XercesXSMarshaller impl.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 18-Oct-2004
+ */
+public class XercesXSMarshallerImpl implements JBossXBMarshaller
+{
+
+ // provide logging
+ private static final Logger log = Logger.getLogger(XercesXSMarshallerImpl.class);
+
+ // The marshaller properties
+ private HashMap properties = new HashMap();
+
+ private XercesXsMarshaller delegate;
+
+ public XercesXSMarshallerImpl()
+ {
+ delegate = new XercesXsMarshaller();
+ delegate.setProperty(XercesXsMarshaller.PROP_OUTPUT_XML_VERSION,
"false");
+ delegate.setProperty(XercesXsMarshaller.PROP_OUTPUT_INDENTATION,
"false");
+ delegate.declareNamespace("xsi", Constants.NS_XML_SCHEMA_INSTANCE);
+ delegate.setSupportNil(true);
+ delegate.setSimpleContentProperty("_value");
+ }
+
+ /**
+ * Marshal the content tree rooted at obj into a Writer.
+ */
+ public void marshal(Object obj, Writer writer) throws MarshalException
+ {
+ assertRequiredProperties();
+
+ try
+ {
+ QName xmlName = (QName)getProperty(JBossXBConstants.JBXB_ROOT_QNAME);
+ delegate.addRootElement(xmlName);
+
+ QName xmlType = (QName)getProperty(JBossXBConstants.JBXB_TYPE_QNAME);
+ if (xmlType != null)
+ {
+ delegate.setRootTypeQName(xmlType);
+ }
+
+ if (xmlName.getNamespaceURI().length() > 0)
+ {
+ String prefix = xmlName.getPrefix();
+ String nsURI = xmlName.getNamespaceURI();
+ delegate.declareNamespace(prefix, nsURI);
+ }
+
+ MappingObjectModelProvider provider = new MappingObjectModelProvider();
+ provider.setIgnoreLowLine(false);
+ provider.setIgnoreNotFoundField(false);
+
+ // todo complete wsdl mapping merge
+ JavaWsdlMapping wsdlMapping =
(JavaWsdlMapping)getProperty(JBossXBConstants.JBXB_JAVA_MAPPING);
+ if (wsdlMapping != null)
+ {
+ JavaXmlTypeMapping[] javaXmlMappings = wsdlMapping.getJavaXmlTypeMappings();
+ if (javaXmlMappings != null)
+ {
+ for (int i = 0; i < javaXmlMappings.length; ++i)
+ {
+ JavaXmlTypeMapping javaXmlMapping = javaXmlMappings[i];
+ VariableMapping[] variableMappings =
javaXmlMapping.getVariableMappings();
+ if (variableMappings != null)
+ {
+ String clsName = javaXmlMapping.getJavaType();
+ Class cls = JavaUtils.loadJavaType(clsName,
Thread.currentThread().getContextClassLoader());
+ QName clsQName = javaXmlMapping.getRootTypeQName();
+
+ if (clsQName != null)
+ {
+ if ("element".equals(javaXmlMapping.getQnameScope()))
+ {
+ delegate.mapClassToGlobalElement(cls, clsQName.getLocalPart(),
clsQName.getNamespaceURI(), null, provider);
+ }
+ else
+ {
+ delegate.mapClassToGlobalType(cls, clsQName.getLocalPart(),
clsQName.getNamespaceURI(), null, provider);
+ delegate.mapClassToXsiType(cls, clsQName.getNamespaceURI(),
clsQName.getLocalPart());
+ }
+ }
+
+ for (int j = 0; j < variableMappings.length; ++j)
+ {
+ VariableMapping variableMapping = variableMappings[j];
+ String javaName = variableMapping.getJavaVariableName();
+ if (variableMapping.getXmlElementName() != null)
+ {
+ String xmlElementName = variableMapping.getXmlElementName();
+ provider.mapFieldToElement(cls, javaName, "",
xmlElementName, null);
+ }
+ else if (variableMapping.getXmlAttributeName() != null)
+ {
+ log.trace("Unmapped attribute: " + javaName);
+ }
+ else if (variableMapping.getXmlWildcard())
+ {
+ delegate.mapFieldToWildcard(cls, "_any",
JBossXBSupport.getWildcardMarshaller());
+ }
+ else
+ {
+ log.warn("Unmapped variable: " + javaName);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ if (getProperty(JBossXBConstants.JBXB_XS_MODEL) != null)
+ {
+ XSModel model = (XSModel)getProperty(JBossXBConstants.JBXB_XS_MODEL);
+ delegate.marshal(model, provider, obj, writer);
+ }
+ }
+ catch (RuntimeException e)
+ {
+ throw e;
+ }
+ catch (Exception e)
+ {
+ throw new MarshalException(e);
+ }
+ }
+
+ /**
+ * Marshal the content tree rooted at obj into SAX2 events.
+ */
+ public void marshal(Object obj, ContentHandler handler)
+ {
+ throw new NotImplementedException();
+ }
+
+ /**
+ * Marshal the content tree rooted at obj into a DOM tree.
+ */
+ public void marshal(Object obj, Node node)
+ {
+ throw new NotImplementedException();
+ }
+
+ /**
+ * Marshal the content tree rooted at obj into an output stream.
+ */
+ public void marshal(Object obj, OutputStream os) throws MarshalException
+ {
+ marshal(obj, new OutputStreamWriter(os));
+ }
+
+ /**
+ * Get the particular property in the underlying implementation of
+ * Marshaller.
+ */
+ public Object getProperty(String name)
+ {
+ if (name == null)
+ throw new IllegalArgumentException("name parameter is null");
+
+ return properties.get(name);
+ }
+
+ /**
+ * Set the particular property in the underlying implementation of
+ * Marshaller.
+ *
+ */
+ public void setProperty(String name, Object value)
+ {
+ if (name == null)
+ throw new IllegalArgumentException("name parameter is null");
+
+ properties.put(name, value);
+ }
+
+ /**
+ * Get a DOM tree view of the content tree(Optional).
+ */
+ public Node getNode(Object contentTree)
+ {
+ throw new NotImplementedException();
+ }
+
+ /**
+ * Assert the required properties
+ */
+ private void assertRequiredProperties()
+ {
+ if (getProperty(JBossXBConstants.JBXB_SCHEMA_READER) == null &&
getProperty(JBossXBConstants.JBXB_XS_MODEL) == null)
+ throw new WSException("Cannot find required property: " +
JBossXBConstants.JBXB_XS_MODEL);
+
+ if (getProperty(JBossXBConstants.JBXB_JAVA_MAPPING) == null)
+ throw new WSException("Cannot find required property: " +
JBossXBConstants.JBXB_JAVA_MAPPING);
+
+ QName xmlName = (QName)getProperty(JBossXBConstants.JBXB_ROOT_QNAME);
+ if (xmlName == null)
+ throw new WSException("Cannot find required property: " +
JBossXBConstants.JBXB_ROOT_QNAME);
+
+ if (xmlName.getNamespaceURI().length() > 0 &&
xmlName.getPrefix().length() == 0)
+ throw new IllegalArgumentException("The given root element name must be
prefix qualified: " + xmlName);
+ }
+}
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/handler/MessageContextJAXRPC.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/handler/MessageContextJAXRPC.java 2006-12-07
01:03:49 UTC (rev 1591)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/handler/MessageContextJAXRPC.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -27,8 +27,8 @@
import javax.xml.soap.SOAPMessage;
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.core.metadata.umdm.EndpointMetaData;
import org.jboss.ws.core.metadata.umdm.ServiceMetaData;
import org.jboss.xb.binding.NamespaceRegistry;
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/JAXBDeserializer.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/JAXBDeserializer.java 2006-12-07
01:03:49 UTC (rev 1591)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/JAXBDeserializer.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -33,10 +33,10 @@
import javax.xml.ws.WebServiceException;
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.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.extentions.xop.jaxws.AttachmentUnmarshallerImpl;
/**
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/JAXBDeserializerFactory.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/JAXBDeserializerFactory.java 2006-12-07
01:03:49 UTC (rev 1591)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/JAXBDeserializerFactory.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -21,9 +21,9 @@
*/
package org.jboss.ws.core.jaxws;
-import org.jboss.ws.core.binding.BindingException;
-import org.jboss.ws.core.binding.DeserializerFactoryBase;
-import org.jboss.ws.core.binding.DeserializerSupport;
+import org.jboss.ws.core.jaxrpc.binding.BindingException;
+import org.jboss.ws.core.jaxrpc.binding.DeserializerFactoryBase;
+import org.jboss.ws.core.jaxrpc.binding.DeserializerSupport;
// $Id$
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/JAXBSerializer.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/JAXBSerializer.java 2006-12-07
01:03:49 UTC (rev 1591)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/JAXBSerializer.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -32,10 +32,10 @@
import javax.xml.ws.WebServiceException;
import org.jboss.logging.Logger;
-import org.jboss.ws.core.binding.BindingException;
-import org.jboss.ws.core.binding.ComplexTypeSerializer;
-import org.jboss.ws.core.binding.SerializationContext;
import org.jboss.ws.core.jaxrpc.TypeMappingImpl;
+import org.jboss.ws.core.jaxrpc.binding.BindingException;
+import org.jboss.ws.core.jaxrpc.binding.ComplexTypeSerializer;
+import org.jboss.ws.core.jaxrpc.binding.SerializationContext;
import org.jboss.ws.extentions.xop.jaxws.AttachmentMarshallerImpl;
import org.w3c.dom.NamedNodeMap;
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/JAXBSerializerFactory.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/JAXBSerializerFactory.java 2006-12-07
01:03:49 UTC (rev 1591)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/JAXBSerializerFactory.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -21,9 +21,9 @@
*/
package org.jboss.ws.core.jaxws;
-import org.jboss.ws.core.binding.BindingException;
-import org.jboss.ws.core.binding.SerializerFactoryBase;
-import org.jboss.ws.core.binding.SerializerSupport;
+import org.jboss.ws.core.jaxrpc.binding.BindingException;
+import org.jboss.ws.core.jaxrpc.binding.SerializerFactoryBase;
+import org.jboss.ws.core.jaxrpc.binding.SerializerSupport;
// $Id$
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/SOAPFaultHelperJAXWS.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/SOAPFaultHelperJAXWS.java 2006-12-07
01:03:49 UTC (rev 1591)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/SOAPFaultHelperJAXWS.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -40,13 +40,13 @@
import org.jboss.logging.Logger;
import org.jboss.ws.Constants;
import org.jboss.ws.core.CommonMessageContext;
-import org.jboss.ws.core.binding.BindingException;
-import org.jboss.ws.core.binding.DeserializerFactoryBase;
-import org.jboss.ws.core.binding.DeserializerSupport;
-import org.jboss.ws.core.binding.SerializationContext;
-import org.jboss.ws.core.binding.SerializerFactoryBase;
-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.metadata.umdm.FaultMetaData;
import org.jboss.ws.core.metadata.umdm.OperationMetaData;
import org.jboss.ws.core.soap.MessageContextAssociation;
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/SerializationContextJAXWS.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/SerializationContextJAXWS.java 2006-12-07
01:03:49 UTC (rev 1591)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/SerializationContextJAXWS.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -24,7 +24,7 @@
// $Id$
import org.jboss.logging.Logger;
-import org.jboss.ws.core.binding.SerializationContext;
+import org.jboss.ws.core.jaxrpc.binding.SerializationContext;
/**
* The serialization context for JAXWS endpoints/clients
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/binding/BindingProviderImpl.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/binding/BindingProviderImpl.java 2006-12-07
01:03:49 UTC (rev 1591)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/binding/BindingProviderImpl.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -33,7 +33,7 @@
import javax.xml.ws.http.HTTPBinding;
import javax.xml.ws.soap.SOAPBinding;
-import org.jboss.ws.core.binding.CommonBindingProvider;
+import org.jboss.ws.core.jaxrpc.binding.CommonBindingProvider;
import org.jboss.ws.core.metadata.umdm.EndpointMetaData;
import org.jboss.ws.core.metadata.umdm.EndpointMetaData.Type;
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/binding/HTTPBindingJAXWS.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/binding/HTTPBindingJAXWS.java 2006-12-07
01:03:49 UTC (rev 1591)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/binding/HTTPBindingJAXWS.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -32,8 +32,8 @@
import org.jboss.util.NotImplementedException;
import org.jboss.ws.core.EndpointInvocation;
-import org.jboss.ws.core.binding.BindingException;
-import org.jboss.ws.core.binding.CommonBinding;
+import org.jboss.ws.core.jaxrpc.binding.BindingException;
+import org.jboss.ws.core.jaxrpc.binding.CommonBinding;
import org.jboss.ws.core.metadata.umdm.OperationMetaData;
import org.jboss.ws.core.metadata.umdm.HandlerMetaData.HandlerType;
import org.jboss.ws.core.soap.UnboundHeader;
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/binding/MessageBinding.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/binding/MessageBinding.java 2006-12-07
01:03:49 UTC (rev 1591)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/binding/MessageBinding.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -34,8 +34,8 @@
import org.jboss.util.NotImplementedException;
import org.jboss.ws.WSException;
import org.jboss.ws.core.EndpointInvocation;
-import org.jboss.ws.core.binding.BindingException;
-import org.jboss.ws.core.binding.CommonBinding;
+import org.jboss.ws.core.jaxrpc.binding.BindingException;
+import org.jboss.ws.core.jaxrpc.binding.CommonBinding;
import org.jboss.ws.core.jaxws.handler.SOAPMessageContextJAXWS;
import org.jboss.ws.core.metadata.umdm.OperationMetaData;
import org.jboss.ws.core.metadata.umdm.ParameterMetaData;
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/binding/PayloadBinding.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/binding/PayloadBinding.java 2006-12-07
01:03:49 UTC (rev 1591)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/binding/PayloadBinding.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -36,8 +36,8 @@
import org.jboss.ws.Constants;
import org.jboss.ws.WSException;
import org.jboss.ws.core.EndpointInvocation;
-import org.jboss.ws.core.binding.BindingException;
-import org.jboss.ws.core.binding.CommonBinding;
+import org.jboss.ws.core.jaxrpc.binding.BindingException;
+import org.jboss.ws.core.jaxrpc.binding.CommonBinding;
import org.jboss.ws.core.jaxws.handler.SOAPMessageContextJAXWS;
import org.jboss.ws.core.metadata.umdm.OperationMetaData;
import org.jboss.ws.core.metadata.umdm.ParameterMetaData;
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/binding/SOAP11BindingJAXWS.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/binding/SOAP11BindingJAXWS.java 2006-12-07
01:03:49 UTC (rev 1591)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/binding/SOAP11BindingJAXWS.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -33,7 +33,7 @@
import javax.xml.ws.soap.SOAPBinding;
import org.jboss.ws.Constants;
-import org.jboss.ws.core.binding.CommonSOAP11Binding;
+import org.jboss.ws.core.jaxrpc.binding.CommonSOAP11Binding;
import org.jboss.ws.core.jaxws.SOAPFaultHelperJAXWS;
import org.jboss.ws.core.metadata.umdm.OperationMetaData;
import org.jboss.ws.core.metadata.umdm.HandlerMetaData.HandlerType;
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/binding/SOAP12BindingJAXWS.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/binding/SOAP12BindingJAXWS.java 2006-12-07
01:03:49 UTC (rev 1591)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/binding/SOAP12BindingJAXWS.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -34,7 +34,7 @@
import javax.xml.ws.soap.SOAPBinding;
import org.jboss.ws.Constants;
-import org.jboss.ws.core.binding.CommonSOAP12Binding;
+import org.jboss.ws.core.jaxrpc.binding.CommonSOAP12Binding;
import org.jboss.ws.core.jaxws.SOAPFaultHelperJAXWS;
import org.jboss.ws.core.metadata.umdm.OperationMetaData;
import org.jboss.ws.core.metadata.umdm.HandlerMetaData.HandlerType;
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/client/ClientImpl.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/client/ClientImpl.java 2006-12-07
01:03:49 UTC (rev 1591)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/client/ClientImpl.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -42,7 +42,7 @@
import org.jboss.logging.Logger;
import org.jboss.ws.core.CommonClient;
import org.jboss.ws.core.CommonMessageContext;
-import org.jboss.ws.core.binding.CommonBindingProvider;
+import org.jboss.ws.core.jaxrpc.binding.CommonBindingProvider;
import org.jboss.ws.core.jaxws.binding.BindingExt;
import org.jboss.ws.core.jaxws.binding.BindingProviderImpl;
import org.jboss.ws.core.jaxws.handler.HandlerChainExecutor;
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/handler/MessageContextJAXWS.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/handler/MessageContextJAXWS.java 2006-12-07
01:03:49 UTC (rev 1591)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/handler/MessageContextJAXWS.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -31,7 +31,7 @@
import javax.xml.ws.handler.MessageContext;
import org.jboss.ws.core.CommonMessageContext;
-import org.jboss.ws.core.binding.SerializationContext;
+import org.jboss.ws.core.jaxrpc.binding.SerializationContext;
import org.jboss.ws.core.jaxws.SerializationContextJAXWS;
import org.jboss.ws.core.metadata.umdm.EndpointMetaData;
import org.jboss.ws.core.metadata.umdm.ServiceMetaData;
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/metadata/builder/MetaDataBuilder.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/metadata/builder/MetaDataBuilder.java 2006-12-07
01:03:49 UTC (rev 1591)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/metadata/builder/MetaDataBuilder.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -45,8 +45,8 @@
import org.jboss.logging.Logger;
import org.jboss.ws.Constants;
import org.jboss.ws.WSException;
-import org.jboss.ws.core.binding.CommonSOAPBinding;
import org.jboss.ws.core.jaxrpc.Use;
+import org.jboss.ws.core.jaxrpc.binding.CommonSOAPBinding;
import org.jboss.ws.core.metadata.j2ee.UnifiedApplicationMetaData;
import org.jboss.ws.core.metadata.j2ee.UnifiedBeanMetaData;
import org.jboss.ws.core.metadata.j2ee.UnifiedEjbPortComponentMetaData;
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/metadata/umdm/EndpointMetaData.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/metadata/umdm/EndpointMetaData.java 2006-12-07
01:03:49 UTC (rev 1591)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/metadata/umdm/EndpointMetaData.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -39,13 +39,13 @@
import org.jboss.logging.Logger;
import org.jboss.ws.Constants;
import org.jboss.ws.WSException;
-import org.jboss.ws.core.binding.JBossXBDeserializerFactory;
-import org.jboss.ws.core.binding.JBossXBSerializerFactory;
-import org.jboss.ws.core.binding.SOAPArrayDeserializerFactory;
-import org.jboss.ws.core.binding.SOAPArraySerializerFactory;
import org.jboss.ws.core.jaxrpc.Style;
import org.jboss.ws.core.jaxrpc.TypeMappingImpl;
import org.jboss.ws.core.jaxrpc.Use;
+import org.jboss.ws.core.jaxrpc.binding.JBossXBDeserializerFactory;
+import org.jboss.ws.core.jaxrpc.binding.JBossXBSerializerFactory;
+import org.jboss.ws.core.jaxrpc.binding.SOAPArrayDeserializerFactory;
+import org.jboss.ws.core.jaxrpc.binding.SOAPArraySerializerFactory;
import org.jboss.ws.core.jaxws.JAXBDeserializerFactory;
import org.jboss.ws.core.jaxws.JAXBSerializerFactory;
import org.jboss.ws.core.metadata.config.WSCommonConfig;
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/metadata/umdm/ServiceMetaData.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/metadata/umdm/ServiceMetaData.java 2006-12-07
01:03:49 UTC (rev 1591)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/metadata/umdm/ServiceMetaData.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -37,10 +37,10 @@
import org.jboss.logging.Logger;
import org.jboss.ws.WSException;
-import org.jboss.ws.core.binding.jbossxb.SchemaBindingBuilder;
import org.jboss.ws.core.jaxrpc.TypeMappingImpl;
import org.jboss.ws.core.jaxrpc.TypeMappingRegistryImpl;
import org.jboss.ws.core.jaxrpc.Use;
+import org.jboss.ws.core.jaxrpc.binding.jbossxb.SchemaBindingBuilder;
import org.jboss.ws.core.metadata.jaxrpcmapping.JavaWsdlMapping;
import org.jboss.ws.core.metadata.jaxrpcmapping.JavaWsdlMappingFactory;
import org.jboss.ws.core.metadata.umdm.HandlerMetaData.HandlerType;
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/AbstractServiceEndpointInvoker.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/AbstractServiceEndpointInvoker.java 2006-12-07
01:03:49 UTC (rev 1591)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/AbstractServiceEndpointInvoker.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -44,9 +44,9 @@
import org.jboss.ws.Constants;
import org.jboss.ws.core.CommonMessageContext;
import org.jboss.ws.core.EndpointInvocation;
-import org.jboss.ws.core.binding.CommonBinding;
-import org.jboss.ws.core.binding.CommonBindingProvider;
-import org.jboss.ws.core.binding.CommonSOAPBinding;
+import org.jboss.ws.core.jaxrpc.binding.CommonBinding;
+import org.jboss.ws.core.jaxrpc.binding.CommonBindingProvider;
+import org.jboss.ws.core.jaxrpc.binding.CommonSOAPBinding;
import org.jboss.ws.core.jaxrpc.handler.HandlerDelegateJAXRPC;
import org.jboss.ws.core.jaxws.binding.BindingProviderImpl;
import org.jboss.ws.core.jaxws.handler.HandlerDelegateJAXWS;
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/ServiceEndpoint.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/ServiceEndpoint.java 2006-12-07
01:03:49 UTC (rev 1591)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/ServiceEndpoint.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -39,9 +39,9 @@
import org.jboss.logging.Logger;
import org.jboss.ws.Constants;
import org.jboss.ws.core.CommonMessageContext;
-import org.jboss.ws.core.binding.BindingException;
-import org.jboss.ws.core.binding.CommonBindingProvider;
-import org.jboss.ws.core.binding.CommonSOAPBinding;
+import org.jboss.ws.core.jaxrpc.binding.BindingException;
+import org.jboss.ws.core.jaxrpc.binding.CommonBindingProvider;
+import org.jboss.ws.core.jaxrpc.binding.CommonSOAPBinding;
import org.jboss.ws.core.metadata.umdm.EndpointMetaData;
import org.jboss.ws.core.metadata.umdm.ServerEndpointMetaData;
import org.jboss.ws.core.metadata.umdm.UnifiedMetaData;
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/SOAPContentElement.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/SOAPContentElement.java 2006-12-07
01:03:49 UTC (rev 1591)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/SOAPContentElement.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -42,14 +42,14 @@
import org.jboss.ws.Constants;
import org.jboss.ws.WSException;
import org.jboss.ws.core.CommonMessageContext;
-import org.jboss.ws.core.binding.BindingException;
-import org.jboss.ws.core.binding.DeserializerFactoryBase;
-import org.jboss.ws.core.binding.DeserializerSupport;
-import org.jboss.ws.core.binding.NullValueSerializer;
-import org.jboss.ws.core.binding.SerializationContext;
-import org.jboss.ws.core.binding.SerializerFactoryBase;
-import org.jboss.ws.core.binding.SerializerSupport;
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.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.ws.core.metadata.umdm.ParameterMetaData;
import org.jboss.ws.core.metadata.umdm.UnifiedMetaData;
import org.jboss.ws.core.soap.attachment.SwapableMemoryDataSource;
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/SOAPFactoryImpl.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/SOAPFactoryImpl.java 2006-12-07
01:03:49 UTC (rev 1591)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/SOAPFactoryImpl.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -29,7 +29,7 @@
import javax.xml.soap.SOAPException;
import javax.xml.soap.SOAPFactory;
-import org.jboss.ws.core.binding.SOAPElementDeserializer;
+import org.jboss.ws.core.jaxrpc.binding.SOAPElementDeserializer;
import org.w3c.dom.Element;
/**
Modified: branches/tdiesler/trunk/src/main/java/org/jboss/ws/tools/ToolsUtils.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/tools/ToolsUtils.java 2006-12-07
01:03:49 UTC (rev 1591)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/tools/ToolsUtils.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -42,9 +42,9 @@
import org.jboss.logging.Logger;
import org.jboss.ws.Constants;
import org.jboss.ws.WSException;
-import org.jboss.ws.core.binding.SimpleDeserializerFactory;
-import org.jboss.ws.core.binding.SimpleSerializerFactory;
import org.jboss.ws.core.jaxrpc.LiteralTypeMapping;
+import org.jboss.ws.core.jaxrpc.binding.SimpleDeserializerFactory;
+import org.jboss.ws.core.jaxrpc.binding.SimpleSerializerFactory;
import org.jboss.ws.core.metadata.wsdl.WSDLUtils;
import org.jboss.ws.core.metadata.wsdl.xsd.SchemaUtils;
import org.jboss.ws.core.utils.JavaUtils;
Modified:
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/binding/SOAPBindingTestCase.java
===================================================================
---
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/binding/SOAPBindingTestCase.java 2006-12-07
01:03:49 UTC (rev 1591)
+++
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/binding/SOAPBindingTestCase.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -38,10 +38,10 @@
import org.jboss.ws.Constants;
import org.jboss.ws.core.CommonMessageContext;
import org.jboss.ws.core.EndpointInvocation;
-import org.jboss.ws.core.binding.CommonBinding;
-import org.jboss.ws.core.binding.CommonBindingProvider;
-import org.jboss.ws.core.binding.CommonSOAPBinding;
import org.jboss.ws.core.jaxrpc.CallImpl;
+import org.jboss.ws.core.jaxrpc.binding.CommonBinding;
+import org.jboss.ws.core.jaxrpc.binding.CommonBindingProvider;
+import org.jboss.ws.core.jaxrpc.binding.CommonSOAPBinding;
import org.jboss.ws.core.jaxrpc.handler.SOAPMessageContextJAXRPC;
import org.jboss.ws.core.metadata.umdm.OperationMetaData;
import org.jboss.ws.core.metadata.umdm.ParameterMetaData;
Modified:
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/jbossxb/SerializerDeserializerTestCase.java
===================================================================
---
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/jbossxb/SerializerDeserializerTestCase.java 2006-12-07
01:03:49 UTC (rev 1591)
+++
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/jbossxb/SerializerDeserializerTestCase.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -32,14 +32,14 @@
import org.jboss.test.ws.JBossWSTest;
import org.jboss.ws.Constants;
-import org.jboss.ws.core.binding.DeserializerFactoryBase;
-import org.jboss.ws.core.binding.DeserializerSupport;
-import org.jboss.ws.core.binding.SerializationContext;
-import org.jboss.ws.core.binding.SerializerFactoryBase;
-import org.jboss.ws.core.binding.SerializerSupport;
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.xb.binding.NamespaceRegistry;
/**
Modified:
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/jbossxb/array/BigDecimalArrayMarshallerTestCase.java
===================================================================
---
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/jbossxb/array/BigDecimalArrayMarshallerTestCase.java 2006-12-07
01:03:49 UTC (rev 1591)
+++
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/jbossxb/array/BigDecimalArrayMarshallerTestCase.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -28,8 +28,8 @@
import org.apache.xerces.xs.XSModel;
import org.jboss.test.ws.tools.WSToolsTest;
-import org.jboss.ws.core.binding.jbossxb.JBossXBConstants;
-import org.jboss.ws.core.binding.jbossxb.JBossXBMarshallerImpl;
+import org.jboss.ws.core.jaxrpc.binding.jbossxb.JBossXBConstants;
+import org.jboss.ws.core.jaxrpc.binding.jbossxb.JBossXBMarshallerImpl;
import org.jboss.ws.core.metadata.jaxrpcmapping.JavaWsdlMapping;
import org.jboss.ws.core.utils.DOMUtils;
Modified:
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/jbossxb/array/BigDecimalArrayUnmarshallerTestCase.java
===================================================================
---
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/jbossxb/array/BigDecimalArrayUnmarshallerTestCase.java 2006-12-07
01:03:49 UTC (rev 1591)
+++
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/jbossxb/array/BigDecimalArrayUnmarshallerTestCase.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -28,8 +28,8 @@
import org.apache.xerces.xs.XSModel;
import org.jboss.test.ws.tools.WSToolsTest;
-import org.jboss.ws.core.binding.jbossxb.JBossXBConstants;
-import org.jboss.ws.core.binding.jbossxb.JBossXBUnmarshallerImpl;
+import org.jboss.ws.core.jaxrpc.binding.jbossxb.JBossXBConstants;
+import org.jboss.ws.core.jaxrpc.binding.jbossxb.JBossXBUnmarshallerImpl;
import org.jboss.ws.core.metadata.jaxrpcmapping.JavaWsdlMapping;
import org.jboss.ws.core.utils.DOMUtils;
Modified:
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/jbossxb/array/CalendarArrayMarshallerTestCase.java
===================================================================
---
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/jbossxb/array/CalendarArrayMarshallerTestCase.java 2006-12-07
01:03:49 UTC (rev 1591)
+++
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/jbossxb/array/CalendarArrayMarshallerTestCase.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -30,8 +30,8 @@
import org.apache.xerces.xs.XSModel;
import org.jboss.test.ws.tools.WSToolsTest;
-import org.jboss.ws.core.binding.jbossxb.JBossXBConstants;
-import org.jboss.ws.core.binding.jbossxb.JBossXBMarshallerImpl;
+import org.jboss.ws.core.jaxrpc.binding.jbossxb.JBossXBConstants;
+import org.jboss.ws.core.jaxrpc.binding.jbossxb.JBossXBMarshallerImpl;
import org.jboss.ws.core.metadata.jaxrpcmapping.JavaWsdlMapping;
import org.jboss.ws.core.utils.DOMUtils;
Modified:
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/jbossxb/array/CalendarArrayUnmarshallerTestCase.java
===================================================================
---
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/jbossxb/array/CalendarArrayUnmarshallerTestCase.java 2006-12-07
01:03:49 UTC (rev 1591)
+++
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/jbossxb/array/CalendarArrayUnmarshallerTestCase.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -30,8 +30,8 @@
import org.apache.xerces.xs.XSModel;
import org.jboss.test.ws.tools.WSToolsTest;
-import org.jboss.ws.core.binding.jbossxb.JBossXBConstants;
-import org.jboss.ws.core.binding.jbossxb.JBossXBUnmarshallerImpl;
+import org.jboss.ws.core.jaxrpc.binding.jbossxb.JBossXBConstants;
+import org.jboss.ws.core.jaxrpc.binding.jbossxb.JBossXBUnmarshallerImpl;
import org.jboss.ws.core.metadata.jaxrpcmapping.JavaWsdlMapping;
import org.jboss.ws.core.utils.DOMUtils;
Modified:
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/jbossxb/array/QNameArrayMarshallerTestCase.java
===================================================================
---
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/jbossxb/array/QNameArrayMarshallerTestCase.java 2006-12-07
01:03:49 UTC (rev 1591)
+++
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/jbossxb/array/QNameArrayMarshallerTestCase.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -27,8 +27,8 @@
import org.apache.xerces.xs.XSModel;
import org.jboss.test.ws.tools.WSToolsTest;
-import org.jboss.ws.core.binding.jbossxb.JBossXBConstants;
-import org.jboss.ws.core.binding.jbossxb.JBossXBMarshallerImpl;
+import org.jboss.ws.core.jaxrpc.binding.jbossxb.JBossXBConstants;
+import org.jboss.ws.core.jaxrpc.binding.jbossxb.JBossXBMarshallerImpl;
import org.jboss.ws.core.metadata.jaxrpcmapping.JavaWsdlMapping;
import org.jboss.ws.core.utils.DOMUtils;
Modified:
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/jbossxb/array/QNameArrayUnmarshallerTestCase.java
===================================================================
---
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/jbossxb/array/QNameArrayUnmarshallerTestCase.java 2006-12-07
01:03:49 UTC (rev 1591)
+++
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/jbossxb/array/QNameArrayUnmarshallerTestCase.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -27,8 +27,8 @@
import org.apache.xerces.xs.XSModel;
import org.jboss.test.ws.tools.WSToolsTest;
-import org.jboss.ws.core.binding.jbossxb.JBossXBConstants;
-import org.jboss.ws.core.binding.jbossxb.JBossXBUnmarshallerImpl;
+import org.jboss.ws.core.jaxrpc.binding.jbossxb.JBossXBConstants;
+import org.jboss.ws.core.jaxrpc.binding.jbossxb.JBossXBUnmarshallerImpl;
import org.jboss.ws.core.metadata.jaxrpcmapping.JavaWsdlMapping;
import org.jboss.ws.core.utils.DOMUtils;
Modified:
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/jbossxb/complex/ComplexTypeMarshallerTestCase.java
===================================================================
---
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/jbossxb/complex/ComplexTypeMarshallerTestCase.java 2006-12-07
01:03:49 UTC (rev 1591)
+++
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/jbossxb/complex/ComplexTypeMarshallerTestCase.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -30,8 +30,8 @@
import org.apache.xerces.xs.XSModel;
import org.jboss.test.ws.tools.WSToolsTest;
-import org.jboss.ws.core.binding.jbossxb.JBossXBConstants;
-import org.jboss.ws.core.binding.jbossxb.JBossXBMarshallerImpl;
+import org.jboss.ws.core.jaxrpc.binding.jbossxb.JBossXBConstants;
+import org.jboss.ws.core.jaxrpc.binding.jbossxb.JBossXBMarshallerImpl;
import org.jboss.ws.core.metadata.jaxrpcmapping.JavaWsdlMapping;
import org.jboss.ws.core.metadata.jaxrpcmapping.JavaWsdlMappingFactory;
import org.jboss.ws.core.utils.DOMUtils;
Modified:
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/jbossxb/complex/ComplexTypeUnmarshallerTestCase.java
===================================================================
---
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/jbossxb/complex/ComplexTypeUnmarshallerTestCase.java 2006-12-07
01:03:49 UTC (rev 1591)
+++
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/jbossxb/complex/ComplexTypeUnmarshallerTestCase.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -30,8 +30,8 @@
import org.apache.xerces.xs.XSModel;
import org.jboss.test.ws.tools.WSToolsTest;
-import org.jboss.ws.core.binding.jbossxb.JBossXBConstants;
-import org.jboss.ws.core.binding.jbossxb.JBossXBUnmarshallerImpl;
+import org.jboss.ws.core.jaxrpc.binding.jbossxb.JBossXBConstants;
+import org.jboss.ws.core.jaxrpc.binding.jbossxb.JBossXBUnmarshallerImpl;
import org.jboss.ws.core.metadata.jaxrpcmapping.JavaWsdlMapping;
import org.jboss.ws.core.metadata.jaxrpcmapping.JavaWsdlMappingFactory;
import org.jboss.ws.tools.JavaToXSD;
Modified:
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/jbossxb/docstyle/DocumentStyleMarshallerTestCase.java
===================================================================
---
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/jbossxb/docstyle/DocumentStyleMarshallerTestCase.java 2006-12-07
01:03:49 UTC (rev 1591)
+++
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/jbossxb/docstyle/DocumentStyleMarshallerTestCase.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -30,8 +30,8 @@
import org.apache.xerces.xs.XSModel;
import org.jboss.test.ws.tools.WSToolsTest;
-import org.jboss.ws.core.binding.jbossxb.JBossXBConstants;
-import org.jboss.ws.core.binding.jbossxb.JBossXBMarshallerImpl;
+import org.jboss.ws.core.jaxrpc.binding.jbossxb.JBossXBConstants;
+import org.jboss.ws.core.jaxrpc.binding.jbossxb.JBossXBMarshallerImpl;
import org.jboss.ws.core.metadata.jaxrpcmapping.JavaWsdlMapping;
import org.jboss.ws.core.metadata.jaxrpcmapping.JavaWsdlMappingFactory;
import org.jboss.ws.core.utils.DOMUtils;
Modified:
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/jbossxb/docstyle/DocumentStyleUnmarshallerTestCase.java
===================================================================
---
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/jbossxb/docstyle/DocumentStyleUnmarshallerTestCase.java 2006-12-07
01:03:49 UTC (rev 1591)
+++
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/jbossxb/docstyle/DocumentStyleUnmarshallerTestCase.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -29,8 +29,8 @@
import org.apache.xerces.xs.XSModel;
import org.jboss.test.ws.tools.WSToolsTest;
-import org.jboss.ws.core.binding.jbossxb.JBossXBConstants;
-import org.jboss.ws.core.binding.jbossxb.JBossXBUnmarshallerImpl;
+import org.jboss.ws.core.jaxrpc.binding.jbossxb.JBossXBConstants;
+import org.jboss.ws.core.jaxrpc.binding.jbossxb.JBossXBUnmarshallerImpl;
import org.jboss.ws.core.metadata.jaxrpcmapping.JavaWsdlMapping;
import org.jboss.ws.core.metadata.jaxrpcmapping.JavaWsdlMappingFactory;
Modified:
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/jbossxb/simple/SimpleUserTypeMarshallerTestCase.java
===================================================================
---
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/jbossxb/simple/SimpleUserTypeMarshallerTestCase.java 2006-12-07
01:03:49 UTC (rev 1591)
+++
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/jbossxb/simple/SimpleUserTypeMarshallerTestCase.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -27,8 +27,8 @@
import org.apache.xerces.xs.XSModel;
import org.jboss.test.ws.tools.WSToolsTest;
-import org.jboss.ws.core.binding.jbossxb.JBossXBConstants;
-import org.jboss.ws.core.binding.jbossxb.JBossXBMarshallerImpl;
+import org.jboss.ws.core.jaxrpc.binding.jbossxb.JBossXBConstants;
+import org.jboss.ws.core.jaxrpc.binding.jbossxb.JBossXBMarshallerImpl;
import org.jboss.ws.core.metadata.jaxrpcmapping.JavaWsdlMapping;
import org.jboss.ws.core.metadata.jaxrpcmapping.PackageMapping;
import org.jboss.ws.core.utils.DOMUtils;
Modified:
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/jbossxb/simple/SimpleUserTypeUnmarshallerTestCase.java
===================================================================
---
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/jbossxb/simple/SimpleUserTypeUnmarshallerTestCase.java 2006-12-07
01:03:49 UTC (rev 1591)
+++
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/jbossxb/simple/SimpleUserTypeUnmarshallerTestCase.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -27,8 +27,8 @@
import org.apache.xerces.xs.XSModel;
import org.jboss.test.ws.tools.WSToolsTest;
-import org.jboss.ws.core.binding.jbossxb.JBossXBConstants;
-import org.jboss.ws.core.binding.jbossxb.JBossXBUnmarshallerImpl;
+import org.jboss.ws.core.jaxrpc.binding.jbossxb.JBossXBConstants;
+import org.jboss.ws.core.jaxrpc.binding.jbossxb.JBossXBUnmarshallerImpl;
import org.jboss.ws.core.metadata.jaxrpcmapping.JavaWsdlMapping;
import org.jboss.ws.core.metadata.jaxrpcmapping.PackageMapping;
import org.jboss.ws.core.utils.DOMUtils;
Modified:
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/soap/attachment/GenericAttachmentTestCase.java
===================================================================
---
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/soap/attachment/GenericAttachmentTestCase.java 2006-12-07
01:03:49 UTC (rev 1591)
+++
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/soap/attachment/GenericAttachmentTestCase.java 2006-12-07
01:09:03 UTC (rev 1592)
@@ -42,10 +42,10 @@
import org.jboss.test.ws.JBossWSTest;
import org.jboss.ws.Constants;
import org.jboss.ws.core.EndpointInvocation;
-import org.jboss.ws.core.binding.CommonBinding;
-import org.jboss.ws.core.binding.CommonBindingProvider;
-import org.jboss.ws.core.binding.CommonSOAPBinding;
import org.jboss.ws.core.jaxrpc.CallImpl;
+import org.jboss.ws.core.jaxrpc.binding.CommonBinding;
+import org.jboss.ws.core.jaxrpc.binding.CommonBindingProvider;
+import org.jboss.ws.core.jaxrpc.binding.CommonSOAPBinding;
import org.jboss.ws.core.jaxrpc.handler.SOAPMessageContextJAXRPC;
import org.jboss.ws.core.metadata.umdm.OperationMetaData;
import org.jboss.ws.core.metadata.umdm.EndpointMetaData.Type;