[jboss-svn-commits] JBossWS SVN: r910 - in branches/tdiesler/jbossws-1.0/src: main/java/javax/xml/ws main/java/javax/xml/ws/handler main/java/javax/xml/ws/http main/java/javax/xml/ws/soap main/java/org/jboss/ws main/java/org/jboss/ws/addressing main/java/org/jboss/ws/addressing/jaxrpc main/java/org/jboss/ws/addressing/soap main/java/org/jboss/ws/binding main/java/org/jboss/ws/binding/soap main/java/org/jboss/ws/common main/java/org/jboss/ws/deployment main/java/org/jboss/ws/handler main/java/org/jboss/ws/integration main/java/org/jboss/ws/integration/jboss main/java/org/jboss/ws/integration/jboss/jms main/java/org/jboss/ws/integration/other main/java/org/jboss/ws/integration/tomcat main/java/org/jboss/ws/jaxb main/java/org/jboss/ws/jaxrpc main/java/org/jboss/ws/jaxrpc/encoding main/java/org/jboss/ws/jaxrpc/handler main/java/org/jboss/ws/jaxws main/java/org/jboss/ws/jaxws/core main/java/org/jboss/ws/jbossxb main/java/org/jboss/ws/metadata main/java/org/jboss/ws/metadata/config main/jav! a/org/jboss/ws/metadata/config/jaxrpc main/java/org/jboss/ws/metadata/j2ee main/java/org/jboss/ws/metadata/jsr181 main/java/org/jboss/ws/metadata/wsdl main/java/org/jboss/ws/server main/java/org/jboss/ws/soap main/java/org/jboss/ws/transport/jms main/java/org/jboss/ws/wsse main/java/org/jboss/ws/wsse/jaxrpc main/resources/jbossws.sar/META-INF main/resources/schema test/java/org/jboss/test/ws test/java/org/jboss/test/ws/jaxb test/java/org/jboss/test/ws/jaxb/array test/java/org/jboss/test/ws/jaxb/complex test/java/org/jboss/test/ws/jaxb/docstyle test/java/org/jboss/test/ws/jaxb/holders test/java/org/jboss/test/ws/jaxb/multixsd test/java/org/jboss/test/ws/jaxb/multixsd/packa test/java/org/jboss/test/ws/jaxb/multixsd/packb test/java/org/jboss/test/ws/jaxb/simple test/java/org/jboss/test/ws/jbossxb test/java/org/jboss/test/ws/jbossxb/array test/java/org/jboss/test/ws/jbossxb/complex test/java/org/jboss/test/ws/jbossxb/docstyle test/java/org/jboss/test/ws/jbossxb/holders test/jav! a/org/jboss/test/ws/jbossxb/multixsd test/java/org/jboss/test/ws/jbossxb/multixsd/packa test/java/org/jboss/test/ws/jbossxb/multixsd/packb test/java/org/jboss/test/ws/jbossxb/simple test/java/org/jboss/test/ws/soap test/java/org/jboss/test/ws/util
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Thu Sep 7 05:52:05 EDT 2006
Author: thomas.diesler at jboss.com
Date: 2006-09-07 05:49:54 -0400 (Thu, 07 Sep 2006)
New Revision: 910
Added:
branches/tdiesler/jbossws-1.0/src/main/java/javax/xml/ws/Binding.java
branches/tdiesler/jbossws-1.0/src/main/java/javax/xml/ws/BindingProvider.java
branches/tdiesler/jbossws-1.0/src/main/java/javax/xml/ws/BindingType.java
branches/tdiesler/jbossws-1.0/src/main/java/javax/xml/ws/RequestWrapper.java
branches/tdiesler/jbossws-1.0/src/main/java/javax/xml/ws/ResponseWrapper.java
branches/tdiesler/jbossws-1.0/src/main/java/javax/xml/ws/WebServiceException.java
branches/tdiesler/jbossws-1.0/src/main/java/javax/xml/ws/handler/
branches/tdiesler/jbossws-1.0/src/main/java/javax/xml/ws/handler/Handler.java
branches/tdiesler/jbossws-1.0/src/main/java/javax/xml/ws/handler/MessageContext.java
branches/tdiesler/jbossws-1.0/src/main/java/javax/xml/ws/http/
branches/tdiesler/jbossws-1.0/src/main/java/javax/xml/ws/http/HTTPBinding.java
branches/tdiesler/jbossws-1.0/src/main/java/javax/xml/ws/soap/
branches/tdiesler/jbossws-1.0/src/main/java/javax/xml/ws/soap/SOAPBinding.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/addressing/jaxrpc/
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/addressing/jaxrpc/WSAddressingClientHandler.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/addressing/jaxrpc/WSAddressingServerHandler.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/binding/ComplexTypeDeserializer.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/binding/ComplexTypeSerializer.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/binding/DeserializerSupport.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/binding/SerializationContext.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/binding/SerializerSupport.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/common/
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/common/CommonClient.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/common/CommonMessageContext.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/deployment/AnnotationsMetaDataBuilder.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/deployment/MetaDataBuilder.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/jboss/ServiceEndpointGeneratorEJB.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/jboss/jms/
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/jboss/jms/JMSMessageDispatcher.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/jboss/jms/JMSTransportSupport.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/jboss/jms/MessageDispatcher.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/tomcat/
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/tomcat/ContextServlet.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/tomcat/CrossContextLoader.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/tomcat/DeploymentInfoAdaptor.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/tomcat/KernelBootstrap.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/tomcat/ServerConfigImpl.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/tomcat/TomcatServiceEndpointPublisher.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/tomcat/TomcatServiceEndpointServlet.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/tomcat/wspublish.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxrpc/SerializationContextJAXRPC.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxrpc/ServletEndpointContextImpl.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxrpc/handler/
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxrpc/handler/ClientHandlerChain.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxrpc/handler/HandlerChainBaseImpl.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxrpc/handler/HandlerDelegateJAXRPC.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxrpc/handler/HandlerWrapper.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxrpc/handler/MessageContextJAXRPC.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxrpc/handler/SOAPMessageContextJAXRPC.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxrpc/handler/ServerHandlerChain.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxws/
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxws/core/
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxws/core/BindingImpl.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxws/core/BindingProviderImpl.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxws/core/HTTPBindingImpl.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxws/core/SOAP11BindingImpl.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxws/core/SOAP12BindingImpl.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxws/core/SOAPBindingImpl.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jbossxb/
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jbossxb/JBossXBConstants.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jbossxb/JBossXBDeserializer.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jbossxb/JBossXBDeserializerFactory.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jbossxb/JBossXBMarshaller.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jbossxb/JBossXBMarshallerImpl.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jbossxb/JBossXBSerializer.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jbossxb/JBossXBSerializerFactory.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jbossxb/JBossXBSupport.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jbossxb/JBossXBUnmarshaller.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jbossxb/JBossXBUnmarshallerImpl.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jbossxb/MarshalException.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jbossxb/SchemaBindingBuilder.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jbossxb/UnmarshalException.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jbossxb/XercesXSMarshallerImpl.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/HandlerMetaData.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/HandlerMetaDataJAXRPC.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/config/jaxrpc/
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/config/jaxrpc/WSClientConfigJAXRPC.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/config/jaxrpc/WSCommonConfigJAXRPC.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/config/jaxrpc/WSConfigFactoryJAXRPC.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/config/jaxrpc/WSConfigRootJAXRPC.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/config/jaxrpc/WSEndpointConfigJAXRPC.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/jsr181/HandlerChainFactory.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/jsr181/HandlerChainsMetaData.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/wsdl/DOMTypes.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/wsdl/XSModelTypes.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/server/AbstractServiceEndpointInvoker.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/server/EndpointContext.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/server/HandlerDelegate.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/soap/PayloadBuilder.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/soap/SAAJPayloadBuilderDOM.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/soap/SAAJPayloadBuilderStax.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/soap/SOAPElementWriter.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/wsse/jaxrpc/
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/wsse/jaxrpc/WSSecurityHandler.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/wsse/jaxrpc/WSSecurityHandlerInbound.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/wsse/jaxrpc/WSSecurityHandlerOutbound.java
branches/tdiesler/jbossws-1.0/src/main/resources/jbossws.sar/META-INF/standard-jaxrpc-client-config.xml
branches/tdiesler/jbossws-1.0/src/main/resources/jbossws.sar/META-INF/standard-jaxrpc-endpoint-config.xml
branches/tdiesler/jbossws-1.0/src/main/resources/schema/handler-chain.xsd
branches/tdiesler/jbossws-1.0/src/main/resources/schema/javaee_5.xsd
branches/tdiesler/jbossws-1.0/src/main/resources/schema/jaxrpc-config_2_0.xsd
branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/
branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/SerializerDeserializerTestCase.java
branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/array/
branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/array/BigDecimalArray.java
branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/array/BigDecimalArrayMarshallerTestCase.java
branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/array/BigDecimalArrayUnmarshallerTestCase.java
branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/array/CalendarArrayMarshallerTestCase.java
branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/array/CalendarArrayUnmarshallerTestCase.java
branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/array/QNameArrayMarshallerTestCase.java
branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/array/QNameArrayUnmarshallerTestCase.java
branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/complex/
branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/complex/Base.java
branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/complex/ComplexTypeMarshallerGenTestCase.java
branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/complex/ComplexTypeMarshallerTestCase.java
branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/complex/ComplexTypeUnmarshallerGenTestCase.java
branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/complex/ComplexTypeUnmarshallerTestCase.java
branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/complex/ComplexTypes.java
branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/complex/Composite.java
branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/complex/Derived.java
branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/docstyle/
branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/docstyle/DocumentStyleMarshallerTestCase.java
branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/docstyle/DocumentStyleUnmarshallerTestCase.java
branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/docstyle/EchoString_RequestStruct.java
branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/docstyle/EchoString_ResponseStruct.java
branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/holders/
branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/holders/HoldersServiceInterface.java
branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/multixsd/
branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/multixsd/Order.java
branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/multixsd/packa/
branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/multixsd/packa/Person.java
branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/multixsd/packb/
branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/multixsd/packb/Item.java
branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/simple/
branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/simple/EchoSimpleUserType_RequestStruct.java
branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/simple/EchoSimpleUserType_ResponseStruct.java
branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/simple/SimpleUserType.java
branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/simple/SimpleUserTypeMarshallerTestCase.java
branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/simple/SimpleUserTypeUnmarshallerTestCase.java
branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/util/DOMWriterTestCase.java
Removed:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/addressing/soap/SOAPClientHandler.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/addressing/soap/SOAPServerHandler.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/binding/AttachmentMarshallerSupport.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/binding/BindingProvider.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/binding/BindingProviderRegistry.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/binding/soap/SOAP11BindingProvider.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/binding/soap/SOAP12BindingProvider.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/binding/soap/SOAPBindingProvider.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/deployment/AbstractMetaDataBuilder.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/handler/ClientHandlerChain.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/handler/HandlerChainBaseImpl.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/handler/HandlerWrapper.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/handler/MessageContextImpl.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/handler/ServerHandlerChain.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/jboss/ServiceEndpointGenerator.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/other/ContextServlet.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/other/CrossContextLoader.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/other/DeploymentInfoAdaptor.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/other/GenericServiceEndpointPublisher.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/other/GenericServiceEndpointServlet.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/other/KernelBootstrap.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/other/ServerConfigImpl.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/other/wspublish.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxb/JAXBConstants.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxb/JAXBMarshaller.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxb/JAXBUnmarshaller.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxb/JBossXBMarshallerImpl.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxb/JBossXBSupport.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxb/JBossXBUnmarshallerImpl.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxb/MarshalException.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxb/SchemaBindingBuilder.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxb/UnmarshalException.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxb/XercesXSMarshallerImpl.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxrpc/encoding/DeserializerSupport.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxrpc/encoding/JAXBDeserializer.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxrpc/encoding/JAXBDeserializerFactory.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxrpc/encoding/JAXBSerializer.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxrpc/encoding/JAXBSerializerFactory.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxrpc/encoding/SerializationContextImpl.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxrpc/encoding/SerializerSupport.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxrpc/encoding/XOPDeserializer.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxrpc/encoding/XOPSerializer.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/config/WSClientConfig.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/config/WSConfig.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/config/WSEndpointConfig.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/config/WSHandlerChainConfig.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/j2ee/UnifiedInitParamMetaData.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/jsr181/HandlerConfigFactory.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/jsr181/HandlerConfigMetaData.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/server/ServiceEndpointInterceptor.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/server/ServletEndpointContextImpl.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/soap/DOMEnvelopeBuilder.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/soap/SAAJElementWriter.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/soap/SAAJEnvelopeBuilder.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/soap/SAAJEnvelopeBuilderFactory.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/soap/SOAPMessageContextImpl.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/soap/STAXEnvelopeBuilder.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/transport/jms/JMSMessageDispatcher.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/wsse/WSSecurityHandler.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/wsse/WSSecurityHandlerInbound.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/wsse/WSSecurityHandlerOutbound.java
branches/tdiesler/jbossws-1.0/src/main/resources/jbossws.sar/META-INF/standard-jbossws-client-config.xml
branches/tdiesler/jbossws-1.0/src/main/resources/jbossws.sar/META-INF/standard-jbossws-endpoint-config.xml
branches/tdiesler/jbossws-1.0/src/main/resources/schema/handler-config_1_0.xsd
branches/tdiesler/jbossws-1.0/src/main/resources/schema/jbossws-config_1_0.xsd
branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/SerializerDeserializerTestCase.java
branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/array/BigDecimalArray.java
branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/array/BigDecimalArrayMarshallerTestCase.java
branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/array/BigDecimalArrayUnmarshallerTestCase.java
branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/array/CalendarArrayMarshallerTestCase.java
branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/array/CalendarArrayUnmarshallerTestCase.java
branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/array/QNameArrayMarshallerTestCase.java
branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/array/QNameArrayUnmarshallerTestCase.java
branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/complex/Base.java
branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/complex/ComplexTypeMarshallerGenTestCase.java
branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/complex/ComplexTypeMarshallerTestCase.java
branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/complex/ComplexTypeUnmarshallerGenTestCase.java
branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/complex/ComplexTypeUnmarshallerTestCase.java
branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/complex/ComplexTypes.java
branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/complex/Composite.java
branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/complex/Derived.java
branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/docstyle/DocumentStyleMarshallerTestCase.java
branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/docstyle/DocumentStyleUnmarshallerTestCase.java
branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/docstyle/EchoString_RequestStruct.java
branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/docstyle/EchoString_ResponseStruct.java
branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/holders/HoldersServiceInterface.java
branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/multixsd/Order.java
branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/multixsd/packa/Person.java
branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/multixsd/packb/Item.java
branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/simple/EchoSimpleUserType_RequestStruct.java
branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/simple/EchoSimpleUserType_ResponseStruct.java
branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/simple/SimpleUserType.java
branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/simple/SimpleUserTypeMarshallerTestCase.java
branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/simple/SimpleUserTypeUnmarshallerTestCase.java
branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/soap/SAAJElementWriterTestCase.java
Log:
Import jbossws-1.0
Added: branches/tdiesler/jbossws-1.0/src/main/java/javax/xml/ws/Binding.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/javax/xml/ws/Binding.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/javax/xml/ws/Binding.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -0,0 +1,45 @@
+/*
+ * 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 javax.xml.ws;
+
+import java.util.List;
+
+import javax.xml.ws.handler.Handler;
+
+/**
+ * The Binding interface is the base interface for JAX-WS protocol bindings.
+ *
+ * @author Thomas.Diesler at jboss.com
+ * @since 03-May-2006
+ */
+public interface Binding
+{
+
+ /**
+ * Gets a copy of the handler chain for a protocol binding instance.
+ * If the returned chain is modified a call to setHandlerChain
+ * is required to configure the binding instance with the new chain.
+ */
+ List<Handler> getHandlerChain();
+
+ void setHandlerChain(List<Handler> list);
+}
\ No newline at end of file
Property changes on: branches/tdiesler/jbossws-1.0/src/main/java/javax/xml/ws/Binding.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/tdiesler/jbossws-1.0/src/main/java/javax/xml/ws/BindingProvider.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/javax/xml/ws/BindingProvider.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/javax/xml/ws/BindingProvider.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -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 javax.xml.ws;
+
+import java.util.Map;
+
+/**
+ * The BindingProvider interface provides access to the protocol binding and
+ * associated context objects for request and response message processing.
+ *
+ * @author Thomas.Diesler at jboss.com
+ * @since 03-May-2006
+ */
+public interface BindingProvider
+{
+ public static final String USERNAME_PROPERTY = "javax.xml.ws.security.auth.username";
+ public static final String PASSWORD_PROPERTY = "javax.xml.ws.security.auth.password";
+ public static final String ENDPOINT_ADDRESS_PROPERTY = "javax.xml.ws.service.endpoint.address";
+ public static final String SESSION_MAINTAIN_PROPERTY = "javax.xml.ws.session.maintain";
+ public static final String SOAPACTION_USE_PROPERTY = "javax.xml.ws.soap.http.soapaction.use";
+ public static final String SOAPACTION_URI_PROPERTY = "javax.xml.ws.soap.http.soapaction.uri";
+
+ Map<String, Object> getRequestContext();
+
+ Map<String, Object> getResponseContext();
+
+ Binding getBinding();
+
+}
\ No newline at end of file
Property changes on: branches/tdiesler/jbossws-1.0/src/main/java/javax/xml/ws/BindingProvider.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/tdiesler/jbossws-1.0/src/main/java/javax/xml/ws/BindingType.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/javax/xml/ws/BindingType.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/javax/xml/ws/BindingType.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -0,0 +1,51 @@
+/*
+ * 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 javax.xml.ws;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * The BindingType annotation is used to specify the binding to use for a web service
+ * endpoint implementation class.
+ *
+ * This annotation may be overriden programmatically or via deployment descriptors,
+ * depending on the platform in use.
+ *
+ * @author Thomas.Diesler at jboss.com
+ * @since 03-May-2006
+ */
+ at Target( { ElementType.TYPE })
+ at Retention(value = RetentionPolicy.RUNTIME)
+public @interface BindingType
+{
+
+ /** A binding identifier (a URI).
+ * If not specified, the default is the SOAP 1.1 / HTTP binding.
+ *
+ * See the SOAPBinding and HTTPBinding for the definition of the standard
+ * binding identifiers.
+ */
+ String value() default "";
+}
\ No newline at end of file
Property changes on: branches/tdiesler/jbossws-1.0/src/main/java/javax/xml/ws/BindingType.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/tdiesler/jbossws-1.0/src/main/java/javax/xml/ws/RequestWrapper.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/javax/xml/ws/RequestWrapper.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/javax/xml/ws/RequestWrapper.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -0,0 +1,51 @@
+/*
+ * 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 javax.xml.ws;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Used to annotate methods in the Service Endpoint Interface with the request wrapper
+ * bean to be used at runtime. The default value of the localName is the operationName,
+ * as defined in WebMethod annotation and the targetNamespace is the target namespace of
+ * the SEI.
+ *
+ * When starting from Java this annotation is used resolve overloading conflicts in
+ * document literal mode. Only the className is required in this case.
+ *
+ * @author Thomas.Diesler at jboss.com
+ * @since 03-May-2006
+ */
+ at Target( { ElementType.METHOD })
+ at Retention(value = RetentionPolicy.RUNTIME)
+public @interface RequestWrapper
+{
+
+ String localName() default "";
+
+ String targetNamespace() default "";
+
+ String className() default "";
+}
\ No newline at end of file
Property changes on: branches/tdiesler/jbossws-1.0/src/main/java/javax/xml/ws/RequestWrapper.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/tdiesler/jbossws-1.0/src/main/java/javax/xml/ws/ResponseWrapper.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/javax/xml/ws/ResponseWrapper.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/javax/xml/ws/ResponseWrapper.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -0,0 +1,50 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package javax.xml.ws;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Used to annotate methods in the Service Endpoint Interface with the response
+ * wrapper bean to be used at runtime.The default value of the localName is the
+ * operationName as defined in WebMethod annotation appended with Response and
+ * the targetNamespace is the target namespace of the SEI.
+ *
+ * When starting from Java this annotation is used resolve overloading conflicts
+ * in document literal mode. Only the className is required in this case.
+ *
+ * @author Thomas.Diesler at jboss.com
+ * @since 03-May-2006
+ */
+ at Target( { ElementType.METHOD })
+ at Retention(value = RetentionPolicy.RUNTIME)
+public @interface ResponseWrapper
+{
+ String localName() default "";
+
+ String targetNamespace() default "";
+
+ String className() default "";
+}
\ No newline at end of file
Property changes on: branches/tdiesler/jbossws-1.0/src/main/java/javax/xml/ws/ResponseWrapper.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/tdiesler/jbossws-1.0/src/main/java/javax/xml/ws/WebServiceException.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/javax/xml/ws/WebServiceException.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/javax/xml/ws/WebServiceException.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -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 javax.xml.ws;
+
+// $Id$
+
+/**
+ * The WebServiceException class is the base exception class for all JAX-WS
+ * API runtime exceptions.
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 14-Nov-2005
+ */
+public class WebServiceException extends RuntimeException
+{
+ public WebServiceException()
+ {
+ }
+
+ public WebServiceException(String message)
+ {
+ super(message);
+ }
+
+ public WebServiceException(Throwable cause)
+ {
+ super(cause);
+ }
+
+ public WebServiceException(String message, Throwable cause)
+ {
+ super(message, cause);
+ }
+}
Property changes on: branches/tdiesler/jbossws-1.0/src/main/java/javax/xml/ws/WebServiceException.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/tdiesler/jbossws-1.0/src/main/java/javax/xml/ws/handler/Handler.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/javax/xml/ws/handler/Handler.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/javax/xml/ws/handler/Handler.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -0,0 +1,49 @@
+/*
+ * 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 javax.xml.ws.handler;
+
+/**
+ * The Handler interface is the base interface for JAX-WS handlers.
+ *
+ * @author Thomas.Diesler at jboss.com
+ * @since 03-May-2006
+ */
+public interface Handler<C extends MessageContext>
+{
+ /**
+ * The handleMessage method is invoked for normal processing of inbound and outbound messages.
+ * Refer to the description of the handler framework in the JAX-WS specification for full details.
+ */
+ boolean handleMessage(C msgContext);
+
+ /**
+ * The handleFault method is invoked for fault message processing. Refer to the description of the
+ * handler framework in the JAX-WS specification for full details.
+ */
+ boolean handleFault(C msgContext);
+
+ /**
+ * Called at the conclusion of a message exchange pattern just prior to the JAX-WS runtime disptaching a message,
+ * fault or exception. Refer to the description of the handler framework in the JAX-WS specification for full details.
+ */
+ void close(C msgContext);
+}
\ No newline at end of file
Property changes on: branches/tdiesler/jbossws-1.0/src/main/java/javax/xml/ws/handler/Handler.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/tdiesler/jbossws-1.0/src/main/java/javax/xml/ws/handler/MessageContext.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/javax/xml/ws/handler/MessageContext.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/javax/xml/ws/handler/MessageContext.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -0,0 +1,66 @@
+/*
+ * 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 javax.xml.ws.handler;
+
+import java.util.Map;
+
+/**
+ * The interface MessageContext abstracts the message context that is processed by a
+ * handler in the handle method.
+ *
+ * The MessageContext interface provides methods to manage a property set.
+ * MessageContext properties enable handlers in a handler chain to share
+ * processing related state.
+ *
+ * @author Thomas.Diesler at jboss.com
+ * @since 03-May-2006
+ */
+public interface MessageContext extends Map<String, Object>
+{
+ public static final String MESSAGE_OUTBOUND_PROPERTY = "javax.xml.ws.handler.message.outbound";
+ public static final String INBOUND_MESSAGE_ATTACHMENTS = "javax.xml.ws.binding.attachments.inbound";
+ public static final String OUTBOUND_MESSAGE_ATTACHMENTS = "javax.xml.ws.binding.attachments.outbound";
+ public static final String WSDL_DESCRIPTION = "javax.xml.ws.wsdl.description";
+ public static final String WSDL_SERVICE = "javax.xml.ws.wsdl.service";
+ public static final String WSDL_PORT = "javax.xml.ws.wsdl.port";
+ public static final String WSDL_INTERFACE = "javax.xml.ws.wsdl.interface";
+ public static final String WSDL_OPERATION = "javax.xml.ws.wsdl.operation";
+ public static final String HTTP_RESPONSE_CODE = "javax.xml.ws.http.response.code";
+ public static final String HTTP_REQUEST_HEADERS = "javax.xml.ws.http.request.headers";
+ public static final String HTTP_RESPONSE_HEADERS = "javax.xml.ws.http.response.headers";
+ public static final String HTTP_REQUEST_METHOD = "javax.xml.ws.http.request.method";
+ public static final String SERVLET_REQUEST = "javax.xml.ws.servlet.request";
+ public static final String SERVLET_RESPONSE = "javax.xml.ws.servlet.response";
+ public static final String SERVLET_SESSION = "javax.xml.ws.servlet.session";
+ public static final String SERVLET_CONTEXT = "javax.xml.ws.servlet.context";
+ public static final String QUERY_STRING = "javax.xml.ws.http.request.querystring";
+ public static final String PATH_INFO = "javax.xml.ws.http.request.pathinfo";
+
+ public enum Scope
+ {
+ APPLICATION, HANDLER;
+ }
+
+ void setScope(String s, Scope scope);
+
+ Scope getScope(String s);
+}
\ No newline at end of file
Property changes on: branches/tdiesler/jbossws-1.0/src/main/java/javax/xml/ws/handler/MessageContext.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/tdiesler/jbossws-1.0/src/main/java/javax/xml/ws/http/HTTPBinding.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/javax/xml/ws/http/HTTPBinding.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/javax/xml/ws/http/HTTPBinding.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -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 javax.xml.ws.http;
+
+import javax.xml.ws.Binding;
+
+/**
+ * The HTTPBinding interface is an abstraction for the XML/HTTP binding.
+ *
+ * @author Thomas.Diesler at jboss.com
+ * @since 03-May-2006
+ */
+public interface HTTPBinding extends Binding
+{
+
+ public static final String HTTP_BINDING = "http://www.w3.org/2004/08/wsdl/http";
+}
\ No newline at end of file
Property changes on: branches/tdiesler/jbossws-1.0/src/main/java/javax/xml/ws/http/HTTPBinding.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/tdiesler/jbossws-1.0/src/main/java/javax/xml/ws/soap/SOAPBinding.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/javax/xml/ws/soap/SOAPBinding.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/javax/xml/ws/soap/SOAPBinding.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -0,0 +1,57 @@
+/*
+ * 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 javax.xml.ws.soap;
+
+import java.net.URI;
+import java.util.Set;
+
+import javax.xml.soap.MessageFactory;
+import javax.xml.soap.SOAPFactory;
+import javax.xml.ws.Binding;
+
+/**
+ * The SOAPBinding interface is an abstraction for the SOAP binding.
+ *
+ * @author Thomas.Diesler at jboss.com
+ * @since 03-May-2006
+ */
+public interface SOAPBinding extends Binding
+{
+ /** A constant representing the identity of the SOAP 1.1 over HTTP binding. */
+ public static String SOAP11HTTP_BINDING = "http://schemas.xmlsoap.org/wsdl/soap/http";
+
+ /** A constant representing the identity of the SOAP 1.2 over HTTP binding. */
+ public static String SOAP12HTTP_BINDING = "http://www.w3.org/2003/05/soap/bindings/HTTP/";
+
+ public abstract Set<URI> getRoles();
+
+ public abstract void setRoles(Set<URI> set);
+
+ public abstract boolean isMTOMEnabled();
+
+ public abstract void setMTOMEnabled(boolean flag);
+
+ public abstract SOAPFactory getSOAPFactory();
+
+ public abstract MessageFactory getMessageFactory();
+
+}
\ No newline at end of file
Property changes on: branches/tdiesler/jbossws-1.0/src/main/java/javax/xml/ws/soap/SOAPBinding.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/addressing/jaxrpc/WSAddressingClientHandler.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/addressing/jaxrpc/WSAddressingClientHandler.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/addressing/jaxrpc/WSAddressingClientHandler.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -0,0 +1,130 @@
+/*
+ * 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.addressing.jaxrpc;
+
+import javax.xml.namespace.QName;
+import javax.xml.rpc.handler.GenericHandler;
+import javax.xml.rpc.handler.HandlerInfo;
+import javax.xml.rpc.handler.MessageContext;
+import javax.xml.rpc.handler.soap.SOAPMessageContext;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.ws.addressing.AddressingBuilder;
+import javax.xml.ws.addressing.AddressingException;
+import javax.xml.ws.addressing.JAXWSAConstants;
+import javax.xml.ws.addressing.soap.SOAPAddressingBuilder;
+import javax.xml.ws.addressing.soap.SOAPAddressingProperties;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.addressing.soap.SOAPAddressingPropertiesImpl;
+
+/**
+ * A client side handler that reads/writes the addressing properties
+ * and puts then into the message context.
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 24-Nov-2005
+ */
+public class WSAddressingClientHandler extends GenericHandler
+{
+ // Provide logging
+ private static Logger log = Logger.getLogger(WSAddressingClientHandler.class);
+
+ // addressing builder & constants
+ private AddressingBuilder addrBuilder;
+
+ // should the request be normalized according to the specifications
+ private boolean normalize;
+
+ public WSAddressingClientHandler()
+ {
+ addrBuilder = AddressingBuilder.getAddressingBuilder();
+ }
+
+ public QName[] getHeaders()
+ {
+ return new QName[] {};
+ }
+
+ public void init(HandlerInfo handlerInfo)
+ {
+ super.init(handlerInfo);
+ normalize = "true".equals(handlerInfo.getHandlerConfig().get("normalize"));
+
+ }
+
+ public boolean handleRequest(MessageContext msgContext)
+ {
+ log.debug("handleRequest");
+
+ SOAPAddressingProperties addrProps = (SOAPAddressingProperties)msgContext.getProperty(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES_OUTBOUND);
+
+ if (addrProps != null)
+ {
+ if (normalize)
+ normalizeRequest(msgContext, addrProps);
+
+ SOAPMessage soapMessage = ((SOAPMessageContext)msgContext).getMessage();
+ addrProps.writeHeaders(soapMessage);
+ }
+ else
+ {
+ // supply default addressing properties
+ addrProps = (SOAPAddressingPropertiesImpl)addrBuilder.newAddressingProperties();
+ msgContext.setProperty(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES_OUTBOUND, addrProps);
+
+ if (normalize)
+ normalizeRequest(msgContext, addrProps);
+ }
+
+ return true;
+ }
+
+ /* supply the default addressing properties in case elements are missing */
+ private void normalizeRequest(MessageContext msgContext, SOAPAddressingProperties addrProps)
+ {
+ // TODO: supply default header
+ }
+
+ public boolean handleResponse(MessageContext msgContext)
+ {
+ log.debug("handleResponse");
+
+ try
+ {
+ SOAPMessage soapMessage = ((SOAPMessageContext)msgContext).getMessage();
+ if (soapMessage.getSOAPPart().getEnvelope() != null)
+ {
+ SOAPAddressingBuilder builder = (SOAPAddressingBuilder)SOAPAddressingBuilder.getAddressingBuilder();
+ SOAPAddressingProperties addrProps = (SOAPAddressingProperties)builder.newAddressingProperties();
+ addrProps.readHeaders(soapMessage);
+ msgContext.setProperty(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES_INBOUND, addrProps);
+ }
+ }
+ catch (SOAPException ex)
+ {
+ throw new AddressingException("Cannot handle response", ex);
+ }
+
+ return true;
+ }
+}
Property changes on: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/addressing/jaxrpc/WSAddressingClientHandler.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/addressing/jaxrpc/WSAddressingServerHandler.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/addressing/jaxrpc/WSAddressingServerHandler.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/addressing/jaxrpc/WSAddressingServerHandler.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -0,0 +1,179 @@
+/*
+ * 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.addressing.jaxrpc;
+
+import java.net.URISyntaxException;
+
+import javax.xml.namespace.QName;
+import javax.xml.rpc.handler.GenericHandler;
+import javax.xml.rpc.handler.HandlerInfo;
+import javax.xml.rpc.handler.MessageContext;
+import javax.xml.rpc.handler.soap.SOAPMessageContext;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.ws.addressing.AddressingBuilder;
+import javax.xml.ws.addressing.JAXWSAConstants;
+import javax.xml.ws.addressing.soap.SOAPAddressingBuilder;
+import javax.xml.ws.addressing.soap.SOAPAddressingProperties;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.addressing.AddressingConstantsImpl;
+import org.jboss.ws.addressing.metadata.AddressingOpMetaExt;
+import org.jboss.ws.jaxrpc.handler.SOAPMessageContextJAXRPC;
+import org.jboss.ws.metadata.OperationMetaData;
+
+/**
+ * A server side handler that reads/writes the addressing properties
+ * and puts then into the message context.
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 24-Nov-2005
+ */
+public class WSAddressingServerHandler extends GenericHandler
+{
+ // Provide logging
+ private static Logger log = Logger.getLogger(WSAddressingServerHandler.class);
+
+ // should the request be validated?
+ private boolean validate = true;
+
+ private static AddressingBuilder ADDR_BUILDER;
+ private static AddressingConstantsImpl ADDR_CONSTANTS;
+ static
+ {
+ ADDR_CONSTANTS = new AddressingConstantsImpl();
+ ADDR_BUILDER = AddressingBuilder.getAddressingBuilder();
+ }
+
+ public QName[] getHeaders()
+ {
+ return new QName[] {};
+ }
+
+ public void init(HandlerInfo handlerInfo)
+ {
+ super.init(handlerInfo);
+ String strValidate = (String)handlerInfo.getHandlerConfig().get("validate");
+ validate = "true".equals(strValidate);
+ }
+
+ /**
+ * Read the addressing headers from the incomming message and put a
+ * SOAPAddressingProperties object into the message context
+ */
+ public boolean handleRequest(MessageContext msgContext)
+ {
+ log.debug("handleRequest");
+
+ SOAPAddressingProperties addrProps = (SOAPAddressingProperties)ADDR_BUILDER.newAddressingProperties();
+ SOAPMessage soapMessage = ((SOAPMessageContext)msgContext).getMessage();
+ addrProps.readHeaders(soapMessage);
+ msgContext.setProperty(JAXWSAConstants.SERVER_ADDRESSING_PROPERTIES_INBOUND, addrProps);
+
+ if (validate)
+ validateRequest(addrProps);
+
+ return true;
+ }
+
+ /**
+ * Get a SOAPAddressingProperties object from the message context
+ * and write the adressing headers
+ */
+ public boolean handleResponse(MessageContext msgContext)
+ {
+ log.debug("handleResponse");
+ handleResponseOrFault(msgContext, false);
+ return true;
+ }
+
+ /**
+ * Get a SOAPAddressingProperties object from the message context
+ * and write the adressing headers
+ */
+ public boolean handleFault(MessageContext msgContext)
+ {
+ log.debug("handleFault");
+ handleResponseOrFault(msgContext, true);
+ return true;
+ }
+
+ private void handleResponseOrFault(MessageContext msgContext, boolean isFault)
+ {
+ SOAPAddressingBuilder builder = (SOAPAddressingBuilder)SOAPAddressingBuilder.getAddressingBuilder();
+ SOAPMessage soapMessage = ((SOAPMessageContext)msgContext).getMessage();
+
+ SOAPAddressingProperties inProps = (SOAPAddressingProperties)msgContext.getProperty(JAXWSAConstants.SERVER_ADDRESSING_PROPERTIES_INBOUND);
+ SOAPAddressingProperties outProps = (SOAPAddressingProperties)msgContext.getProperty(JAXWSAConstants.SERVER_ADDRESSING_PROPERTIES_OUTBOUND);
+
+ if (outProps == null)
+ {
+ // create new response properties
+ outProps = (SOAPAddressingProperties)builder.newAddressingProperties();
+ msgContext.setProperty(JAXWSAConstants.SERVER_ADDRESSING_PROPERTIES_OUTBOUND, outProps);
+ }
+
+ outProps.initializeAsReply(inProps, isFault);
+
+ try
+ {
+ // supply the response action
+
+ OperationMetaData opMetaData = ((SOAPMessageContextJAXRPC)msgContext).getOperationMetaData();
+
+ if (!isFault && !opMetaData.isOneWayOperation())
+ {
+
+ AddressingOpMetaExt addrExt = (AddressingOpMetaExt)opMetaData.getExtension(ADDR_CONSTANTS.getNamespaceURI());
+ if (addrExt != null)
+ {
+ outProps.setAction(ADDR_BUILDER.newURI(addrExt.getOutboundAction()));
+ }
+ else
+ {
+ log.warn("Unable to resolve replyAction for " + opMetaData.getQName());
+ }
+
+ }
+ else if (isFault)
+ {
+ outProps.setAction(ADDR_BUILDER.newURI(ADDR_CONSTANTS.getDefaultFaultAction()));
+ }
+
+ }
+ catch (URISyntaxException e)
+ {
+ log.error("Error setting response action", e);
+ }
+
+ outProps.writeHeaders(soapMessage);
+ }
+
+ /* check wsa formal constraints */
+ private void validateRequest(SOAPAddressingProperties addrProps)
+ {
+
+ // If wsa:ReplyTo is supplied and the message lacks a [message id] property, the processor MUST fault.
+ if (addrProps.getReplyTo() != null && addrProps.getMessageID() == null)
+ throw new IllegalArgumentException("wsa:MessageId is required when wsa:ReplyTo is supplied");
+
+ }
+}
Property changes on: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/addressing/jaxrpc/WSAddressingServerHandler.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Deleted: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/addressing/soap/SOAPClientHandler.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/addressing/soap/SOAPClientHandler.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/addressing/soap/SOAPClientHandler.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -1,129 +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.addressing.soap;
-
-import javax.xml.namespace.QName;
-import javax.xml.rpc.handler.GenericHandler;
-import javax.xml.rpc.handler.HandlerInfo;
-import javax.xml.rpc.handler.MessageContext;
-import javax.xml.rpc.handler.soap.SOAPMessageContext;
-import javax.xml.soap.SOAPException;
-import javax.xml.soap.SOAPMessage;
-import javax.xml.ws.addressing.AddressingBuilder;
-import javax.xml.ws.addressing.AddressingException;
-import javax.xml.ws.addressing.JAXWSAConstants;
-import javax.xml.ws.addressing.soap.SOAPAddressingBuilder;
-import javax.xml.ws.addressing.soap.SOAPAddressingProperties;
-
-import org.jboss.logging.Logger;
-
-/**
- * A client side handler that reads/writes the addressing properties
- * and puts then into the message context.
- *
- * @author Thomas.Diesler at jboss.org
- * @since 24-Nov-2005
- */
-public class SOAPClientHandler extends GenericHandler
-{
- // Provide logging
- private static Logger log = Logger.getLogger(SOAPClientHandler.class);
-
- // addressing builder & constants
- private AddressingBuilder addrBuilder;
-
- // should the request be normalized according to the specifications
- private boolean normalize;
-
- public SOAPClientHandler()
- {
- addrBuilder = AddressingBuilder.getAddressingBuilder();
- }
-
- public QName[] getHeaders()
- {
- return new QName[] {};
- }
-
- public void init(HandlerInfo handlerInfo)
- {
- super.init(handlerInfo);
- normalize = "true".equals(handlerInfo.getHandlerConfig().get("normalize"));
-
- }
-
- public boolean handleRequest(MessageContext msgContext)
- {
- log.debug("handleRequest");
-
- SOAPAddressingProperties addrProps = (SOAPAddressingProperties)msgContext.getProperty(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES_OUTBOUND);
-
- if (addrProps != null)
- {
- if (normalize)
- normalizeRequest(msgContext, addrProps);
-
- SOAPMessage soapMessage = ((SOAPMessageContext)msgContext).getMessage();
- addrProps.writeHeaders(soapMessage);
- }
- else
- {
- // supply default addressing properties
- addrProps = (SOAPAddressingPropertiesImpl)addrBuilder.newAddressingProperties();
- msgContext.setProperty(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES_OUTBOUND, addrProps);
-
- if (normalize)
- normalizeRequest(msgContext, addrProps);
- }
-
- return true;
- }
-
- /* supply the default addressing properties in case elements are missing */
- private void normalizeRequest(MessageContext msgContext, SOAPAddressingProperties addrProps)
- {
- // TODO: supply default header
- }
-
- public boolean handleResponse(MessageContext msgContext)
- {
- log.debug("handleResponse");
-
- try
- {
- SOAPMessage soapMessage = ((SOAPMessageContext)msgContext).getMessage();
- if (soapMessage.getSOAPPart().getEnvelope() != null)
- {
- SOAPAddressingBuilder builder = (SOAPAddressingBuilder)SOAPAddressingBuilder.getAddressingBuilder();
- SOAPAddressingProperties addrProps = (SOAPAddressingProperties)builder.newAddressingProperties();
- addrProps.readHeaders(soapMessage);
- msgContext.setProperty(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES_INBOUND, addrProps);
- }
- }
- catch (SOAPException ex)
- {
- throw new AddressingException("Cannot handle response", ex);
- }
-
- return true;
- }
-}
Deleted: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/addressing/soap/SOAPServerHandler.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/addressing/soap/SOAPServerHandler.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/addressing/soap/SOAPServerHandler.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -1,182 +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.addressing.soap;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.metadata.OperationMetaData;
-import org.jboss.ws.soap.SOAPMessageContextImpl;
-import org.jboss.ws.addressing.AddressingConstantsImpl;
-import org.jboss.ws.addressing.metadata.AddressingOpMetaExt;
-
-import javax.xml.namespace.QName;
-import javax.xml.rpc.handler.GenericHandler;
-import javax.xml.rpc.handler.HandlerInfo;
-import javax.xml.rpc.handler.MessageContext;
-import javax.xml.rpc.handler.soap.SOAPMessageContext;
-import javax.xml.soap.SOAPMessage;
-import javax.xml.ws.addressing.AddressingBuilder;
-import javax.xml.ws.addressing.JAXWSAConstants;
-import javax.xml.ws.addressing.soap.SOAPAddressingBuilder;
-import javax.xml.ws.addressing.soap.SOAPAddressingProperties;
-import java.net.URISyntaxException;
-
-/**
- * A server side handler that reads/writes the addressing properties
- * and puts then into the message context.
- *
- * @author Thomas.Diesler at jboss.org
- * @since 24-Nov-2005
- */
-public class SOAPServerHandler extends GenericHandler
-{
- // Provide logging
- private static Logger log = Logger.getLogger(SOAPServerHandler.class);
-
- // should the request be validated?
- private boolean validate = true;
-
- // handler configuration
- private HandlerInfo handlerInfo;
-
- private static AddressingBuilder ADDR_BUILDER;
-
- private static AddressingConstantsImpl ADDR_CONSTANTS;
-
- static {
- ADDR_CONSTANTS = new AddressingConstantsImpl();
- ADDR_BUILDER = AddressingBuilder.getAddressingBuilder();
- }
-
- public QName[] getHeaders()
- {
- return new QName[]{};
- }
-
- public void init(HandlerInfo handlerInfo) {
- super.init(handlerInfo);
- this.handlerInfo = handlerInfo;
-
- String validateParam = handlerInfo.getHandlerConfig().get("validate") != null ?
- (String)handlerInfo.getHandlerConfig().get("validate") : Boolean.TRUE.toString();
- if(Boolean.FALSE.toString().equals(validateParam)) validate = false;
-
- }
- /**
- * Read the addressing headers from the incomming message and put a
- * SOAPAddressingProperties object into the message context
- */
- public boolean handleRequest(MessageContext msgContext)
- {
- log.debug("handleRequest");
-
- SOAPAddressingProperties addrProps = (SOAPAddressingProperties)ADDR_BUILDER.newAddressingProperties();
- SOAPMessage soapMessage = ((SOAPMessageContext)msgContext).getMessage();
- addrProps.readHeaders(soapMessage);
- msgContext.setProperty(JAXWSAConstants.SERVER_ADDRESSING_PROPERTIES_INBOUND, addrProps);
-
- if(validate) validateRequest(addrProps);
-
- return true;
- }
-
- /**
- * Get a SOAPAddressingProperties object from the message context
- * and write the adressing headers
- */
- public boolean handleResponse(MessageContext msgContext)
- {
- log.debug("handleRequest");
-
- handleResponseOrFault(msgContext, false);
-
- return true;
- }
-
- /**
- * Get a SOAPAddressingProperties object from the message context
- * and write the adressing headers
- */
- public boolean handleFault(MessageContext msgContext)
- {
- log.debug("handleFault");
-
- handleResponseOrFault(msgContext, true);
-
- return true;
- }
-
- private void handleResponseOrFault(MessageContext msgContext, boolean isFault)
- {
- SOAPAddressingBuilder builder = (SOAPAddressingBuilder)SOAPAddressingBuilder.getAddressingBuilder();
- SOAPMessage soapMessage = ((SOAPMessageContext)msgContext).getMessage();
-
- SOAPAddressingProperties inProps = (SOAPAddressingProperties)msgContext.getProperty(JAXWSAConstants.SERVER_ADDRESSING_PROPERTIES_INBOUND);
- SOAPAddressingProperties outProps = (SOAPAddressingProperties)msgContext.getProperty(JAXWSAConstants.SERVER_ADDRESSING_PROPERTIES_OUTBOUND);
-
- if (outProps == null)
- {
- // create new response properties
- outProps = (SOAPAddressingProperties)builder.newAddressingProperties();
- msgContext.setProperty(JAXWSAConstants.SERVER_ADDRESSING_PROPERTIES_OUTBOUND, outProps);
- }
-
- outProps.initializeAsReply(inProps, isFault);
-
- try
- {
- // supply the response action
-
- OperationMetaData opMetaData = ((SOAPMessageContextImpl)msgContext).getOperationMetaData();
-
- if(!isFault && !opMetaData.isOneWayOperation()) {
-
- AddressingOpMetaExt addrExt = (AddressingOpMetaExt)opMetaData.getExtension(ADDR_CONSTANTS.getNamespaceURI());
- if(addrExt!=null) {
- outProps.setAction(ADDR_BUILDER.newURI(addrExt.getOutboundAction()));
- }
- else {
- log.warn("Unable to resolve replyAction for "+opMetaData.getXmlName());
- }
-
- }
- else if(isFault) {
- outProps.setAction(ADDR_BUILDER.newURI(ADDR_CONSTANTS.getDefaultFaultAction()));
- }
-
- }
- catch (URISyntaxException e)
- {
- log.error("Error setting response action", e);
- }
-
- outProps.writeHeaders(soapMessage);
- }
-
- /* check wsa formal constraints */
- private void validateRequest(SOAPAddressingProperties addrProps) {
-
- // If wsa:ReplyTo is supplied and the message lacks a [message id] property, the processor MUST fault.
- if(addrProps.getReplyTo() != null && addrProps.getMessageID() == null)
- throw new IllegalArgumentException("wsa:MessageId is required when wsa:ReplyTo is supplied");
-
- }
-}
Deleted: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/binding/AttachmentMarshallerSupport.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/binding/AttachmentMarshallerSupport.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/binding/AttachmentMarshallerSupport.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -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.binding;
-
-import org.jboss.ws.soap.SOAPMessageContextImpl;
-import org.jboss.ws.soap.MessageContextAssociation;
-import org.jboss.ws.soap.SOAPMessageImpl;
-
-/**
- * @author Heiko Braun <heiko.braun at jboss.com>
- * @since May 10, 2006
- */
-public class AttachmentMarshallerSupport {
-
- public static boolean isXOPPackage() {
- boolean isXOP = false;
- SOAPMessageContextImpl msgContext = MessageContextAssociation.peekMessageContext();
- if(msgContext!=null) {
- SOAPMessageImpl soapMessage = (SOAPMessageImpl)msgContext.getMessage();
- isXOP = (soapMessage != null && soapMessage.isXOPMessage());
- }
- return isXOP;
- }
-}
Deleted: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/binding/BindingProvider.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/binding/BindingProvider.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/binding/BindingProvider.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -1,51 +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.binding;
-
-// $Id$
-
-import java.util.Map;
-
-import javax.xml.namespace.QName;
-import javax.xml.soap.SOAPMessage;
-
-import org.jboss.ws.metadata.OperationMetaData;
-
-/** An implementation of this interface transforms the Java call parameters to a SOAPMessage and vice versa.
- *
- * @author Thomas.Diesler at jboss.org
- * @since 16-Oct-2004
- */
-public interface BindingProvider
-{
- /** On the client side, generate the SOAPMessage from IN parameters. */
- SOAPMessage bindRequestMessage(OperationMetaData opMetaData, EndpointInvocation epInv, Map<QName, UnboundHeader> unboundHeaders) throws BindingException;
-
- /** On the server side, extract the IN parameters from the SOAPMessage and populate an Invocation object */
- EndpointInvocation unbindRequestMessage(OperationMetaData opMetaData, SOAPMessage reqMessage) throws BindingException;
-
- /** On the server side, generate the SOAPMessage from OUT parameters in the Invocation object. */
- SOAPMessage bindResponseMessage(OperationMetaData opMetaData, EndpointInvocation epInv) throws BindingException;
-
- /** On the client side, extract the OUT parameters from the SOAPMessage and return them to the client. */
- void unbindResponseMessage(OperationMetaData opMetaData, SOAPMessage resMessage, EndpointInvocation epInv, Map<QName, UnboundHeader> unboundHeaders) throws BindingException;
-}
Deleted: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/binding/BindingProviderRegistry.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/binding/BindingProviderRegistry.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/binding/BindingProviderRegistry.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -1,89 +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.binding;
-
-// $Id$
-
-import java.util.HashMap;
-
-import javax.xml.rpc.JAXRPCException;
-
-import org.jboss.ws.Constants;
-import org.jboss.ws.binding.soap.SOAP11BindingProvider;
-
-/** A registry of binding providers.
- *
- * @author Thomas.Diesler at jboss.org
- * @since 16-Oct-2004
- */
-public class BindingProviderRegistry
-{
- private static Class defaultProvider = SOAP11BindingProvider.class;
- private static HashMap providers = new HashMap();
-
- // Put the default provider in the map
- static
- {
- providers.put(Constants.NS_SOAP11_ENV, defaultProvider);
- }
-
- /** Get a binding provider for a given URI
- */
- public static BindingProvider getProvider(String bindingURI)
- {
- if (bindingURI == null)
- return getDefaultProvider();
-
- try
- {
- Class provClass = (Class)providers.get(bindingURI);
- BindingProvider prov = (BindingProvider)provClass.newInstance();
- return prov;
- }
- catch (RuntimeException e)
- {
- throw e;
- }
- catch (Exception e)
- {
- throw new JAXRPCException(e);
- }
- }
-
- /** Get the default binding provider */
- public static BindingProvider getDefaultProvider()
- {
- try
- {
- BindingProvider prov = (BindingProvider)defaultProvider.newInstance();
- return prov;
- }
- catch (RuntimeException e)
- {
- throw e;
- }
- catch (Exception e)
- {
- throw new JAXRPCException(e);
- }
- }
-}
Added: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/binding/ComplexTypeDeserializer.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/binding/ComplexTypeDeserializer.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/binding/ComplexTypeDeserializer.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -0,0 +1,35 @@
+/*
+ * 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.binding;
+
+// $Id$
+
+/**
+ * A Deserializer that can handle complex types by delegating to JAXB.
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 04-Dec-2004
+ */
+public abstract class ComplexTypeDeserializer extends DeserializerSupport
+{
+
+}
Property changes on: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/binding/ComplexTypeDeserializer.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/binding/ComplexTypeSerializer.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/binding/ComplexTypeSerializer.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/binding/ComplexTypeSerializer.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -0,0 +1,35 @@
+/*
+ * 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.binding;
+
+// $Id$
+
+/**
+ * A Serializer that can handle complex types by delegating to JAXB.
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 04-Dec-2004
+ */
+public abstract class ComplexTypeSerializer extends SerializerSupport
+{
+
+}
Property changes on: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/binding/ComplexTypeSerializer.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/binding/DeserializerSupport.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/binding/DeserializerSupport.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/binding/DeserializerSupport.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -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.binding;
+
+// $Id$
+
+import javax.xml.namespace.QName;
+import javax.xml.rpc.encoding.Deserializer;
+
+import org.jboss.util.NotImplementedException;
+import org.jboss.ws.utils.XMLPredefinedEntityReferenceResolver;
+
+/** The base class for all Deserializers.
+ *
+ * @author Thomas.Diesler at 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();
+ }
+}
Property changes on: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/binding/DeserializerSupport.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/binding/SerializationContext.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/binding/SerializationContext.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/binding/SerializationContext.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -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.binding;
+
+// $Id$
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.jboss.ws.jaxrpc.TypeMappingImpl;
+import org.jboss.xb.binding.NamespaceRegistry;
+
+/**
+ * An abstract serialization context
+ *
+ * @author Thomas.Diesler at 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;
+ }
+}
Property changes on: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/binding/SerializationContext.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/binding/SerializerSupport.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/binding/SerializerSupport.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/binding/SerializerSupport.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -0,0 +1,163 @@
+/*
+ * 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.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 at jboss.org
+ * @author <a href="mailto:jason.greene at 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)
+ {
+ 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
+ {
+ 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
Property changes on: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/binding/SerializerSupport.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Deleted: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/binding/soap/SOAP11BindingProvider.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/binding/soap/SOAP11BindingProvider.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/binding/soap/SOAP11BindingProvider.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -1,92 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.ws.binding.soap;
-
-// $Id$
-
-import java.util.Map;
-
-import javax.xml.namespace.QName;
-import javax.xml.rpc.Call;
-import javax.xml.soap.MimeHeaders;
-import javax.xml.soap.SOAPException;
-import javax.xml.soap.SOAPMessage;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.Constants;
-import org.jboss.ws.binding.BindingException;
-import org.jboss.ws.binding.EndpointInvocation;
-import org.jboss.ws.binding.UnboundHeader;
-import org.jboss.ws.metadata.OperationMetaData;
-import org.jboss.ws.soap.MessageContextAssociation;
-import org.jboss.ws.soap.MessageFactoryImpl;
-import org.jboss.ws.soap.SOAPMessageContextImpl;
-
-/** A BindingProvider that implements the SOAP-1.1 specifics.
- *
- * @author Thomas.Diesler at jboss.org
- * @since 09-Nov-2004
- */
-public class SOAP11BindingProvider extends SOAPBindingProvider
-{
- // provide logging
- private static final Logger log = Logger.getLogger(SOAP11BindingProvider.class);
-
- /** Create the SOAP-1.1 message */
- protected SOAPMessage createMessage(OperationMetaData opMetaData) throws SOAPException
- {
- MessageFactoryImpl factory = new MessageFactoryImpl();
- factory.setEnvelopeURI(Constants.NS_SOAP11_ENV);
- return factory.createMessage();
- }
-
- /** On the client side, generate the payload from IN parameters. */
- public SOAPMessage bindRequestMessage(OperationMetaData opMetaData, EndpointInvocation epInv, Map<QName, UnboundHeader> unboundHeaders) throws BindingException
- {
- SOAPMessage reqMessage = super.bindRequestMessage(opMetaData, epInv, unboundHeaders);
-
- // Set the SOAPAction
- MimeHeaders mimeHeaders = reqMessage.getMimeHeaders();
- String soapAction = opMetaData.getSOAPAction();
-
- // R2744 A HTTP request MESSAGE MUST contain a SOAPAction HTTP header field
- // with a quoted value equal to the value of the soapAction attribute of
- // soapbind:operation, if present in the corresponding WSDL description.
-
- // R2745 A HTTP request MESSAGE MUST contain a SOAPAction HTTP header field
- // with a quoted empty string value, if in the corresponding WSDL description,
- // the soapAction attribute of soapbind:operation is either not present, or
- // present with an empty string as its value.
-
- SOAPMessageContextImpl msgContext = MessageContextAssociation.peekMessageContext();
- if (msgContext.getProperty(Call.SOAPACTION_USE_PROPERTY) != null)
- log.info("Ignore Call.SOAPACTION_USE_PROPERTY because of BP-1.0 R2745, R2745");
-
- String soapActionProperty = (String)msgContext.getProperty(Call.SOAPACTION_URI_PROPERTY);
- if (soapActionProperty != null)
- soapAction = soapActionProperty;
-
- mimeHeaders.addHeader("SOAPAction", soapAction != null ? soapAction : "");
-
- return reqMessage;
- }
-}
Deleted: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/binding/soap/SOAP12BindingProvider.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/binding/soap/SOAP12BindingProvider.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/binding/soap/SOAP12BindingProvider.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -1,47 +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.binding.soap;
-
-// $Id$
-
-import javax.xml.soap.SOAPException;
-import javax.xml.soap.SOAPMessage;
-
-import org.jboss.ws.Constants;
-import org.jboss.ws.metadata.OperationMetaData;
-import org.jboss.ws.soap.MessageFactoryImpl;
-
-/** A BindingProvider that implements the SOAP-1.2 specifics.
- *
- * @author Thomas.Diesler at jboss.org
- * @since 09-Nov-2004
- */
-public class SOAP12BindingProvider extends SOAPBindingProvider
-{
- /** Create the SOAP-1.2 message */
- protected SOAPMessage createMessage(OperationMetaData opMetaData) throws SOAPException
- {
- MessageFactoryImpl factory = new MessageFactoryImpl();
- factory.setEnvelopeURI(Constants.NS_SOAP12_ENV);
- return factory.createMessage();
- }
-}
Deleted: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/binding/soap/SOAPBindingProvider.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/binding/soap/SOAPBindingProvider.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/binding/soap/SOAPBindingProvider.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -1,821 +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.binding.soap;
-
-// $Id$
-
-import org.apache.xerces.xs.XSElementDeclaration;
-import org.apache.xerces.xs.XSTypeDefinition;
-import org.jboss.logging.Logger;
-import org.jboss.ws.utils.DOMUtils;
-import org.jboss.ws.Constants;
-import org.jboss.ws.WSException;
-import org.jboss.ws.binding.BindingException;
-import org.jboss.ws.binding.BindingProvider;
-import org.jboss.ws.binding.EndpointInvocation;
-import org.jboss.ws.binding.UnboundHeader;
-import org.jboss.ws.jaxrpc.ParameterWrapping;
-import org.jboss.ws.jaxrpc.SOAPFaultExceptionHelper;
-import org.jboss.ws.jaxrpc.Style;
-import org.jboss.ws.metadata.OperationMetaData;
-import org.jboss.ws.metadata.ParameterMetaData;
-import org.jboss.ws.metadata.TypesMetaData;
-import org.jboss.ws.soap.*;
-import org.jboss.ws.soap.attachment.AttachmentPartImpl;
-import org.jboss.ws.soap.attachment.CIDGenerator;
-import org.jboss.ws.utils.JavaUtils;
-import org.jboss.ws.utils.MimeUtils;
-import org.jboss.ws.utils.ThreadLocalAssociation;
-import org.jboss.xb.binding.NamespaceRegistry;
-import org.w3c.dom.Element;
-
-import javax.activation.DataHandler;
-import javax.xml.namespace.QName;
-import javax.xml.rpc.JAXRPCException;
-import javax.xml.rpc.ParameterMode;
-import javax.xml.rpc.soap.SOAPFaultException;
-import javax.xml.soap.*;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-
-/** An abstract BindingProvider for SOAP that is independent of the SOAP version.
- *
- * @author Thomas.Diesler at jboss.org
- * @since 16-Oct-2004
- */
-public abstract class SOAPBindingProvider implements BindingProvider
-{
- // provide logging
- private static final Logger log = Logger.getLogger(SOAPBindingProvider.class);
-
- /** Create the SOAPMessage */
- protected abstract SOAPMessage createMessage(OperationMetaData opMetaData) throws SOAPException;
-
- /** On the client side, generate the payload from IN parameters. */
- public SOAPMessage bindRequestMessage(OperationMetaData opMetaData, EndpointInvocation epInv, Map<QName, UnboundHeader> unboundHeaders) throws BindingException
- {
- log.debug("bindRequestMessage: " + opMetaData.getXmlName());
-
- try
- {
- // disable DOMExpansion
- ThreadLocalAssociation.localDomExpansion().set(Boolean.FALSE);
- SOAPMessageContextImpl msgContext = MessageContextAssociation.peekMessageContext();
- if (msgContext == null)
- throw new WSException("MessageContext not available");
-
- // Associate current message with message context
- SOAPMessageImpl reqMessage = (SOAPMessageImpl)createMessage(opMetaData);
- msgContext.setMessage(reqMessage);
-
- SOAPEnvelopeImpl soapEnvelope = (SOAPEnvelopeImpl)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.getXmlName();
- 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;
- SOAPContentElement contentElement = 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());
-
- SOAPContentElement contentElement = new SOAPHeaderElementImpl(soapName);
- contentElement.setParamMetaData(unboundHeader.toParameterMetaData(opMetaData));
- contentElement.setObjectValue(value);
-
- log.debug("Add unboundHeader element: " + soapName);
- soapHeader.addChildElement(contentElement);
- }
- }
- }
-
- return reqMessage;
- }
- catch (Exception e)
- {
- handleException(e);
- return null;
- }
- finally{
- ThreadLocalAssociation.localDomExpansion().set(Boolean.TRUE);
- }
- }
-
- /** On the server side, extract the IN parameters from the payload and populate an Invocation object */
- public EndpointInvocation unbindRequestMessage(OperationMetaData opMetaData, SOAPMessage reqMessage) throws BindingException
- {
- log.debug("unbindRequestMessage: " + opMetaData.getXmlName());
-
- try
- {
- // Read the SOAPEnvelope from the reqMessage
- SOAPEnvelope soapEnvelope = reqMessage.getSOAPPart().getEnvelope();
- SOAPHeader soapHeader = soapEnvelope.getHeader();
- SOAPBody soapBody = soapEnvelope.getBody();
-
- // Construct the endpoint invocation object
- EndpointInvocation epInv = new EndpointInvocation(opMetaData);
-
- SOAPMessageContextImpl msgContext = MessageContextAssociation.peekMessageContext();
- if (msgContext == null)
- throw new WSException("MessageContext not available");
-
- // 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 SOAPMessage bindResponseMessage(OperationMetaData opMetaData, EndpointInvocation epInv) throws BindingException
- {
- log.debug("bindResponseMessage: " + opMetaData.getXmlName());
-
- try
- {
- ThreadLocalAssociation.localDomExpansion().set(Boolean.FALSE);
- SOAPMessageContextImpl msgContext = MessageContextAssociation.peekMessageContext();
- if (msgContext == null)
- throw new WSException("MessageContext not available");
-
- // Associate current message with message context
- SOAPMessageImpl resMessage = (SOAPMessageImpl)createMessage(opMetaData);
- msgContext.setMessage(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.isOneWayOperation())
- {
- 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.wrapResponseParameter(opMetaData, value);
-
- 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;
- }
- finally {
- ThreadLocalAssociation.localDomExpansion().set(Boolean.TRUE);
- }
- }
-
- /** On the client side, extract the OUT parameters from the payload and return them to the client. */
- public void unbindResponseMessage(OperationMetaData opMetaData, SOAPMessage resMessage, EndpointInvocation epInv, Map<QName, UnboundHeader> unboundHeaders)
- throws BindingException
- {
- log.debug("unbindResponseMessage: " + opMetaData.getXmlName());
-
- try
- {
- ThreadLocalAssociation.localDomExpansion().set(Boolean.FALSE);
- // 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.isOneWayOperation() == true)
- {
- return;
- }
-
- // WS-Addressing might redirect the response, which results in an empty envelope
- SOAPEnvelope soapEnvelope = resMessage.getSOAPPart().getEnvelope();
- if (soapEnvelope == null)
- {
- return;
- }
-
- // Get the SOAP message context that is associated with the current thread
- SOAPMessageContextImpl msgContext = MessageContextAssociation.peekMessageContext();
- if (msgContext == null)
- throw new WSException("MessageContext not available");
-
- 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)
- {
- SOAPFaultImpl soapFault = (SOAPFaultImpl)soapBodyElement;
- SOAPFaultException faultEx = SOAPFaultExceptionHelper.getSOAPFaultException(soapFault);
- throw faultEx;
- }
-
- // 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)
- {
- 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);
- }
- finally{
- ThreadLocalAssociation.localDomExpansion().set(Boolean.TRUE);
- }
- }
-
- 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)
- {
- SOAPMessageContextImpl 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())
- contentElement.addNamespaceDeclaration(Constants.PREFIX_SOAP11_ENC, Constants.URI_SOAP11_ENC);
-
- // The object value needs to be set after xmime:contentType
- if (paramMetaData.isXOP() )
- {
- SOAPMessageImpl soapMessage = (SOAPMessageImpl)
- MessageContextAssociation.peekMessageContext().getMessage();
- soapMessage.setXOPMessage(true);
- }
-
- contentElement.setObjectValue(value);
-
- return contentElement;
- }
-
- /** Unmarshall a message element and add it to the parameter list
- * @param optional
- **/
- private Object getParameterFromMessage(ParameterMetaData paramMetaData, SOAPElement soapElement, boolean optional) throws BindingException
- {
- Name xmlName = new NameImpl(paramMetaData.getXmlName());
- Name soapArrayName = new NameImpl("Array", Constants.PREFIX_SOAP11_ENC, Constants.URI_SOAP11_ENC);
-
- 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 (soapArrayName.equals(elName))
- {
- Boolean domExpansion = ThreadLocalAssociation.localDomExpansion().get();
- ThreadLocalAssociation.localDomExpansion().set(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
- {
- ThreadLocalAssociation.localDomExpansion().set(domExpansion);
- }
- }
- }
-
- // 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 JAXRPCException("Cannot find child element: " + xmlName);
-
- if(paramMetaData.isXOP())
- {
- SOAPMessageImpl soapMessage = (SOAPMessageImpl)
- MessageContextAssociation.peekMessageContext().getMessage();
- soapMessage.setXOPMessage(true);
- }
-
- return soapContentElement;
- }
-
- 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);
- }
-}
Added: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/common/CommonClient.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/common/CommonClient.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/common/CommonClient.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -0,0 +1,405 @@
+/*
+ * 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.common;
+
+// $Id:CommonClient.java 660 2006-08-01 16:29:43Z thomas.diesler at jboss.com $
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.rmi.RemoteException;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+import javax.xml.rpc.ParameterMode;
+import javax.xml.rpc.soap.SOAPFaultException;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.ws.BindingProvider;
+import javax.xml.ws.addressing.AddressingProperties;
+import javax.xml.ws.addressing.JAXWSAConstants;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.Constants;
+import org.jboss.ws.WSException;
+import org.jboss.ws.addressing.AddressingConstantsImpl;
+import org.jboss.ws.binding.EndpointInvocation;
+import org.jboss.ws.binding.UnboundHeader;
+import org.jboss.ws.jaxrpc.ParameterWrapping;
+import org.jboss.ws.jaxrpc.Style;
+import org.jboss.ws.jaxws.core.BindingImpl;
+import org.jboss.ws.jaxws.core.BindingProviderImpl;
+import org.jboss.ws.metadata.ClientEndpointMetaData;
+import org.jboss.ws.metadata.EndpointMetaData;
+import org.jboss.ws.metadata.OperationMetaData;
+import org.jboss.ws.metadata.ParameterMetaData;
+import org.jboss.ws.metadata.ServiceMetaData;
+import org.jboss.ws.metadata.UnifiedMetaData;
+import org.jboss.ws.metadata.EndpointMetaData.Type;
+import org.jboss.ws.metadata.HandlerMetaData.HandlerType;
+import org.jboss.ws.soap.EndpointInfo;
+import org.jboss.ws.soap.MessageContextAssociation;
+import org.jboss.ws.soap.SOAPBodyImpl;
+import org.jboss.ws.soap.SOAPConnectionImpl;
+import org.jboss.ws.utils.HolderUtils;
+import org.jboss.ws.utils.JavaUtils;
+
+/**
+ * Provides support for the dynamic invocation of a service endpoint.
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 10-Oct-2004
+ */
+public abstract class CommonClient
+{
+ // provide logging
+ private static Logger log = Logger.getLogger(CommonClient.class);
+
+ // The endpoint together with the operationName uniquely identify the call operation
+ protected EndpointMetaData epMetaData;
+ // The current operation name
+ protected QName operationName;
+ // Output parameters
+ protected EndpointInvocation epInv;
+
+ // The binding provider
+ private BindingProvider bindingProvider;
+
+ /** Create a call that needs to be configured manually
+ */
+ protected CommonClient(ServiceMetaData serviceMetaData)
+ {
+ // If the WSDLService has only one endpoint, use it
+ if (serviceMetaData != null && serviceMetaData.getEndpoints().size() == 1)
+ {
+ this.epMetaData = serviceMetaData.getEndpoints().get(0);
+ }
+ }
+
+ /** Create a call for a known WSDL endpoint.
+ */
+ protected CommonClient(EndpointMetaData epMetaData)
+ {
+ this.epMetaData = epMetaData;
+ }
+
+ /** Create a call for a known WSDL endpoint.
+ */
+ protected CommonClient(ServiceMetaData serviceMetaData, QName portName, QName opName)
+ {
+ if (serviceMetaData != null)
+ {
+ EndpointMetaData epMetaData = null;
+ if (serviceMetaData.getEndpoints().size() > 0)
+ {
+ epMetaData = serviceMetaData.getEndpoint(portName);
+ if (epMetaData == null)
+ throw new WSException("Cannot find endpoint for name: " + portName);
+ }
+
+ if (epMetaData != null)
+ {
+ this.epMetaData = epMetaData;
+ }
+ }
+
+ if (opName != null)
+ {
+ setOperationName(opName);
+ }
+ }
+
+ /** Gets the address of a target service endpoint.
+ */
+ public abstract String getTargetEndpointAddress();
+
+ /** Sets the address of the target service endpoint.
+ */
+ public abstract void setTargetEndpointAddress(String address);
+
+ /** Gets the name of the operation to be invoked using this Call instance.
+ */
+ public QName getOperationName()
+ {
+ return this.operationName;
+ }
+
+ /** Sets the name of the operation to be invoked using this Call instance.
+ */
+ public void setOperationName(QName operationName)
+ {
+ this.operationName = operationName;
+ }
+
+ /** Get the OperationMetaData for the given operation name
+ * If it does not exist, it will be created
+ */
+ public OperationMetaData getOperationMetaData()
+ {
+ if (operationName == null)
+ throw new WSException("Operation name not set");
+
+ return getOperationMetaData(operationName);
+ }
+
+ /** Get the OperationMetaData for the given operation name
+ * If it does not exist, it will be created
+ */
+ public OperationMetaData getOperationMetaData(QName opName)
+ {
+ if (opName == null)
+ throw new IllegalArgumentException("Cannot get OperationMetaData for null");
+
+ EndpointMetaData epMetaData = getEndpointMetaData();
+ OperationMetaData opMetaData = epMetaData.getOperation(opName);
+ if (opMetaData == null && epMetaData.getServiceMetaData().getWsdlDefinitions() == null)
+ {
+ opMetaData = new OperationMetaData(epMetaData, opName, opName.getLocalPart());
+ epMetaData.addOperation(opMetaData);
+ }
+
+ if (opMetaData == null)
+ throw new WSException("Cannot obtain operation meta data for: " + opName);
+
+ return opMetaData;
+ }
+
+ // Get the EndpointMetaData for all OperationMetaData
+ public EndpointMetaData getEndpointMetaData()
+ {
+ if (epMetaData == null)
+ {
+ UnifiedMetaData wsMetaData = new UnifiedMetaData();
+ ServiceMetaData serviceMetaData = new ServiceMetaData(wsMetaData, new QName(Constants.NS_JBOSSWS_URI, "AnonymousService"));
+ wsMetaData.addService(serviceMetaData);
+
+ epMetaData = new ClientEndpointMetaData(serviceMetaData, new QName(Constants.NS_JBOSSWS_URI, "AnonymousPort"), Type.JAXRPC);
+ epMetaData.setStyle(Style.RPC);
+
+ serviceMetaData.addEndpoint(epMetaData);
+ }
+ return epMetaData;
+ }
+
+ protected abstract boolean callRequestHandlerChain(QName portName, HandlerType type);
+
+ protected abstract boolean callResponseHandlerChain(QName portName, HandlerType type);
+
+ protected abstract void setInboundContextProperties();
+
+ protected abstract void setOutboundContextProperties();
+
+ /** Call invokation goes as follows:
+ *
+ * 1) synchronize the operation name with the operation meta data
+ * 2) synchronize the input parameters with the operation meta data
+ * 3) generate the payload using a BindingProvider
+ * 4) get the Invoker from Remoting, based on the target endpoint address
+ * 5) do the invocation through the Remoting framework
+ * 6) unwrap the result using the BindingProvider
+ * 7) return the result
+ */
+ protected Object invoke(QName opName, Object[] inputParams, Map<QName, UnboundHeader> unboundHeaders, boolean oneway) throws RemoteException
+ {
+ if (opName.equals(operationName) == false)
+ setOperationName(opName);
+
+ OperationMetaData opMetaData = getOperationMetaData();
+
+ // Associate a message context with the current thread
+ CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
+ msgContext.setOperationMetaData(opMetaData);
+
+ // copy properties to the message context
+ for (String key : getRequestContext().keySet())
+ {
+ Object value = getRequestContext().get(key);
+ msgContext.setProperty(key, value);
+ }
+
+ try
+ {
+ // Get the binding from the provider
+ BindingImpl binding = (BindingImpl)getBindingProvider().getBinding();
+
+ // Create the invocation and sync the input parameters
+ epInv = new EndpointInvocation(opMetaData);
+ epInv.initInputParams(inputParams);
+
+ // Bind the request message
+ SOAPMessage reqMessage = (SOAPMessage)binding.bindRequestMessage(opMetaData, epInv, unboundHeaders);
+
+ setOutboundContextProperties();
+
+ // Call the request handlers
+ QName portName = epMetaData.getQName();
+ boolean handlerPass = callRequestHandlerChain(portName, HandlerType.PRE);
+ handlerPass = handlerPass && callRequestHandlerChain(portName, HandlerType.ENDPOINT);
+ handlerPass = handlerPass && callRequestHandlerChain(portName, HandlerType.POST);
+
+ if (handlerPass)
+ {
+ String targetAddress = getTargetEndpointAddress();
+
+ // Fall back to wsa:To
+ AddressingProperties addrProps = (AddressingProperties)msgContext.getProperty(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES_OUTBOUND);
+ if (targetAddress == null && addrProps != null && addrProps.getTo() != null)
+ {
+ AddressingConstantsImpl ADDR = new AddressingConstantsImpl();
+ String wsaTo = addrProps.getTo().getURI().toString();
+ if (wsaTo.equals(ADDR.getAnonymousURI()) == false)
+ {
+ try
+ {
+ URL wsaToURL = new URL(wsaTo);
+ log.debug("Sending request to addressing destination: " + wsaToURL);
+ targetAddress = wsaToURL.toExternalForm();
+ }
+ catch (MalformedURLException ex)
+ {
+ log.debug("Not a valid URL: " + wsaTo);
+ }
+ }
+ }
+
+ // The endpoint address must be known beyond this point
+ if (targetAddress == null)
+ throw new WSException("Target endpoint address not set");
+
+ EndpointInfo epInfo = new EndpointInfo(epMetaData, targetAddress, getRequestContext());
+
+ SOAPMessage resMessage;
+ if (oneway)
+ {
+ resMessage = new SOAPConnectionImpl().callOneWay(reqMessage, epInfo);
+ }
+ else
+ {
+ resMessage = new SOAPConnectionImpl().call(reqMessage, epInfo);
+ }
+
+ // Associate current message with message context
+ msgContext.setSOAPMessage(resMessage);
+ }
+
+ setInboundContextProperties();
+
+ // Get the return object
+ Object retObj = null;
+ if (oneway == false)
+ {
+ // Call the response handlers
+ handlerPass = callResponseHandlerChain(portName, HandlerType.POST);
+
+ // unbind the return values
+ if (handlerPass)
+ {
+ SOAPMessage resMessage = msgContext.getSOAPMessage();
+ binding.unbindResponseMessage(opMetaData, resMessage, epInv, unboundHeaders);
+ }
+
+ handlerPass = handlerPass && callResponseHandlerChain(portName, HandlerType.ENDPOINT);
+ handlerPass = handlerPass && callResponseHandlerChain(portName, HandlerType.PRE);
+
+ // Check if protocol handlers modified the payload
+ if (((SOAPBodyImpl)reqMessage.getSOAPBody()).isModifiedFromSource())
+ {
+ log.debug("Handler modified body payload, unbind message again");
+ SOAPMessage resMessage = msgContext.getSOAPMessage();
+ binding.unbindResponseMessage(opMetaData, resMessage, epInv, unboundHeaders);
+ }
+
+ retObj = syncOutputParams(inputParams, epInv);
+ }
+
+ return retObj;
+ }
+ catch (SOAPFaultException ex)
+ {
+ log.error("Call invocation failed", ex);
+ String faultCode = ex.getFaultCode().getLocalPart();
+ throw new RemoteException("Call invocation failed with code [" + faultCode + "] because of: " + ex.getFaultString(), ex);
+ }
+ catch (Exception ex)
+ {
+ throw new RemoteException("Call invocation failed", ex);
+ }
+ finally
+ {
+ getResponseContext().putAll(msgContext.getProperties());
+ }
+ }
+
+ public BindingProvider getBindingProvider()
+ {
+ if (bindingProvider == null)
+ {
+ bindingProvider = new BindingProviderImpl(getEndpointMetaData());
+ }
+ return bindingProvider;
+ }
+
+ protected abstract Map<String, Object> getRequestContext();
+
+ protected abstract Map<String, Object> getResponseContext();
+
+ /** Synchronize the operation paramters with the call output parameters.
+ */
+ private Object syncOutputParams(Object[] inParams, EndpointInvocation epInv) throws SOAPException
+ {
+ Object retValue = null;
+
+ // Assign the return value, if we have a return param
+ OperationMetaData opMetaData = getOperationMetaData();
+ ParameterMetaData retMetaData = opMetaData.getReturnParameter();
+ if (retMetaData != null)
+ {
+ retValue = epInv.getReturnValue();
+ if (opMetaData.isDocumentWrapped())
+ retValue = ParameterWrapping.unwrapResponseParameter(opMetaData, retValue);
+
+ if (JavaUtils.isPrimitive(retMetaData.getJavaType()))
+ retValue = JavaUtils.getPrimitiveValue(retValue);
+ }
+
+ // Set the holder values for INOUT parameters
+ int index = 0;
+ for (ParameterMetaData paramMetaData : opMetaData.getParameters())
+ {
+ ParameterMode paramMode = paramMetaData.getMode();
+
+ if (paramMode == ParameterMode.INOUT || paramMode == ParameterMode.OUT)
+ {
+ QName xmlName = paramMetaData.getXmlName();
+ Object value = epInv.getResponseParamValue(xmlName);
+ log.debug("holder [" + index + "] " + xmlName);
+ HolderUtils.setHolderValue(inParams[index], value);
+ }
+
+ if (index == 0 && opMetaData.isDocumentWrapped())
+ index = paramMetaData.getWrappedVariables().size() - 1;
+
+ index++;
+ }
+
+ return retValue;
+ }
+}
Property changes on: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/common/CommonClient.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/common/CommonMessageContext.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/common/CommonMessageContext.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/common/CommonMessageContext.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -0,0 +1,149 @@
+/*
+ * 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.common;
+
+// $Id$
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import javax.xml.soap.SOAPMessage;
+
+import org.jboss.ws.binding.SerializationContext;
+import org.jboss.ws.metadata.EndpointMetaData;
+import org.jboss.ws.metadata.OperationMetaData;
+import org.jboss.xb.binding.NamespaceRegistry;
+
+/**
+ * The common JAXRPC/JAXWS MessageContext
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 1-Sep-2006
+ */
+public abstract class CommonMessageContext
+{
+ // expandToDOM in the SOAPContentElement should not happen during normal operation
+ // This property should be set the message context when it is ok to do so.
+ public static String ALLOW_EXPAND_TO_DOM = "org.jboss.ws.allow.expand.dom";
+
+ // The operation for this message ctx
+ private EndpointMetaData epMetaData;
+ // The operation for this message ctx
+ private OperationMetaData opMetaData;
+ // The SOAPMessage in this message context
+ private SOAPMessage soapMessage;
+ // The map of the properties
+ protected Map<String, Object> props = new HashMap<String, Object>();
+
+ public EndpointMetaData getEndpointMetaData()
+ {
+ if (epMetaData == null && opMetaData != null)
+ epMetaData = opMetaData.getEndpointMetaData();
+
+ return epMetaData;
+ }
+
+ public void setEndpointMetaData(EndpointMetaData epMetaData)
+ {
+ this.epMetaData = epMetaData;
+ }
+
+ public OperationMetaData getOperationMetaData()
+ {
+ return opMetaData;
+ }
+
+ public void setOperationMetaData(OperationMetaData opMetaData)
+ {
+ this.opMetaData = opMetaData;
+ }
+
+ public SOAPMessage getSOAPMessage()
+ {
+ return soapMessage;
+ }
+
+ public void setSOAPMessage(SOAPMessage soapMessage)
+ {
+ this.soapMessage = soapMessage;
+ }
+
+ public abstract SerializationContext getSerializationContext();
+
+ /** Gets the namespace registry for this message context */
+ public NamespaceRegistry getNamespaceRegistry()
+ {
+ return getSerializationContext().getNamespaceRegistry();
+ }
+
+ public Map<String, Object> getProperties()
+ {
+ return props;
+ }
+
+ public void setProperties(Map<String, Object> props)
+ {
+ this.props = props;
+ }
+
+ /**
+ * Returns true if the MessageContext contains a property with the specified name.
+ */
+ public boolean containsProperty(String name)
+ {
+ return props.containsKey(name);
+ }
+
+ /**
+ * Gets the value of a specific property from the MessageContext
+ */
+ public Object getProperty(String name)
+ {
+ return props.get(name);
+ }
+
+ /**
+ * Returns an Iterator view of the names of the properties in this MessageContext
+ */
+ public Iterator getPropertyNames()
+ {
+ return props.keySet().iterator();
+ }
+
+ /**
+ * Removes a property (name-value pair) from the MessageContext
+ */
+ public void removeProperty(String name)
+ {
+ props.remove(name);
+ }
+
+ /**
+ * Sets the name and value of a property associated with the MessageContext.
+ * If the MessageContext contains a value of the same property, the old value is replaced.
+ */
+ public void setProperty(String name, Object value)
+ {
+ props.put(name, value);
+ }
+}
Property changes on: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/common/CommonMessageContext.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Deleted: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/deployment/AbstractMetaDataBuilder.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/deployment/AbstractMetaDataBuilder.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/deployment/AbstractMetaDataBuilder.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -1,324 +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.deployment;
-
-// $Id$
-
-import java.net.MalformedURLException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.io.IOException;
-
-import javax.management.ObjectName;
-import javax.wsdl.Definition;
-import javax.wsdl.Import;
-import javax.wsdl.Port;
-import javax.wsdl.Service;
-import javax.wsdl.extensions.soap.SOAPAddress;
-import javax.xml.namespace.QName;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.WSException;
-import org.jboss.ws.metadata.ServerEndpointMetaData;
-import org.jboss.ws.metadata.wsse.WSSecurityConfiguration;
-import org.jboss.ws.metadata.wsse.WSSecurityConfigurationFactory;
-import org.jboss.ws.metadata.j2ee.UnifiedApplicationMetaData;
-import org.jboss.ws.metadata.j2ee.UnifiedBeanMetaData;
-import org.jboss.ws.metadata.j2ee.UnifiedMessageDrivenMetaData;
-import org.jboss.ws.metadata.j2ee.UnifiedWebMetaData;
-import org.jboss.ws.metadata.wsdl.WSDLDefinitions;
-import org.jboss.ws.metadata.wsdl.WSDLEndpoint;
-import org.jboss.ws.metadata.wsdl.WSDLService;
-import org.jboss.ws.server.ServiceEndpointManager;
-import org.jboss.ws.server.ServiceEndpointManagerFactory;
-import org.jboss.ws.utils.ObjectNameFactory;
-
-/** An abstract meta data builder.
- *
- * @author Thomas.Diesler at jboss.org
- * @since 19-May-2005
- */
-public abstract class AbstractMetaDataBuilder
-{
- // provide logging
- private final static Logger log = Logger.getLogger(AbstractMetaDataBuilder.class);
-
- protected ClassLoader classLoader;
- protected URLClassLoader resourceLoader;
-
- public void setClassLoader(ClassLoader classLoader)
- {
- this.classLoader = classLoader;
- }
-
- public void setResourceLoader(URLClassLoader resourceLoader)
- {
- this.resourceLoader = resourceLoader;
- }
-
- protected ObjectName getServiceEndpointID(UnifiedDeploymentInfo udi, ServerEndpointMetaData sepMetaData)
- {
- String endpoint = sepMetaData.getLinkName();
- String context = sepMetaData.getContextRoot();
- if (context.startsWith("/"))
- context = context.substring(1);
-
- StringBuilder idstr = new StringBuilder(ServerEndpointMetaData.SEPID_DOMAIN + ":");
- idstr.append(ServerEndpointMetaData.SEPID_PROPERTY_CONTEXT + "=" + context);
- idstr.append("," + ServerEndpointMetaData.SEPID_PROPERTY_ENDPOINT + "=" + endpoint);
-
- // Add JMS destination JNDI name for MDB endpoints
- if (udi.metaData instanceof UnifiedApplicationMetaData)
- {
- String ejbName = sepMetaData.getLinkName();
- if (ejbName == null)
- throw new WSException("Cannot obtain ejb-link from port component");
-
- UnifiedApplicationMetaData applMetaData = (UnifiedApplicationMetaData)udi.metaData;
- UnifiedBeanMetaData beanMetaData = (UnifiedBeanMetaData)applMetaData.getBeanByEjbName(ejbName);
- if (beanMetaData == null)
- throw new WSException("Cannot obtain ejb meta data for: " + ejbName);
-
- if (beanMetaData instanceof UnifiedMessageDrivenMetaData)
- {
- UnifiedMessageDrivenMetaData mdMetaData = (UnifiedMessageDrivenMetaData)beanMetaData;
- String jndiName = mdMetaData.getDestinationJndiName();
- idstr.append(",jms=" + jndiName);
- }
- }
-
- return ObjectNameFactory.create(idstr.toString());
- }
-
- /** Get the web service address for a given path
- */
- public String getServiceEndpointAddress(String uriScheme, String servicePath)
- {
- if (servicePath == null || servicePath.length() == 0)
- throw new WSException("Service path cannot be null");
-
- if (servicePath.endsWith("/*"))
- servicePath = servicePath.substring(0, servicePath.length() - 2);
-
- if (uriScheme == null)
- uriScheme = "http";
-
- ServiceEndpointManagerFactory factory = ServiceEndpointManagerFactory.getInstance();
- ServiceEndpointManager epManager = factory.getServiceEndpointManager();
- String host = epManager.getWebServiceHost();
- int port = epManager.getWebServicePort();
- if ("https".equals(uriScheme))
- port = epManager.getWebServiceSecurePort();
-
- String urlStr = uriScheme + "://" + host + ":" + port + servicePath;
- try
- {
- return new URL(urlStr).toExternalForm();
- }
- catch (MalformedURLException e)
- {
- throw new WSException("Malformed URL: " + urlStr);
- }
- }
-
- /** Replace the address locations for a given port component.
- */
- protected void replaceAddressLocation(ServerEndpointMetaData epMetaData)
- {
- WSDLDefinitions wsdlDefinitions = epMetaData.getServiceMetaData().getWsdlDefinitions();
- QName portName = epMetaData.getName();
-
- boolean endpointFound = false;
- for (WSDLService wsdlService : wsdlDefinitions.getServices())
- {
- for (WSDLEndpoint wsdlEndpoint : wsdlService.getEndpoints())
- {
- QName wsdlPortName = wsdlEndpoint.getQName();
- if (wsdlPortName.equals(portName))
- {
- endpointFound = true;
-
- String orgAddress = wsdlEndpoint.getAddress();
- String uriScheme = getUriScheme(orgAddress);
-
- String transportGuarantee = epMetaData.getTransportGuarantee();
- if ("CONFIDENTIAL".equals(transportGuarantee))
- uriScheme = "https";
-
- String servicePath = epMetaData.getContextRoot() + epMetaData.getURLPattern();
- String serviceEndpointURL = getServiceEndpointAddress(uriScheme, servicePath);
-
- ServiceEndpointManagerFactory factory = ServiceEndpointManagerFactory.getInstance();
- ServiceEndpointManager epManager = factory.getServiceEndpointManager();
- boolean alwaysModify = epManager.isAlwaysModifySOAPAddress();
-
- if (alwaysModify || uriScheme == null || orgAddress.indexOf("REPLACE_WITH_ACTUAL_URL") >= 0)
- {
- log.debug("Replace service endpoint address '" + orgAddress + "' with '" + serviceEndpointURL + "'");
- wsdlEndpoint.setAddress(serviceEndpointURL);
- epMetaData.setEndpointAddress(serviceEndpointURL);
-
- // modify the wsdl-1.1 definition
- if (wsdlDefinitions.getWsdlOneOneDefinition() != null)
- replaceWSDL11SOAPAddress(wsdlDefinitions, portName, serviceEndpointURL);
- }
- else
- {
- log.debug("Don't replace service endpoint address '" + orgAddress + "'");
- try
- {
- epMetaData.setEndpointAddress(new URL(orgAddress).toExternalForm());
- }
- catch (MalformedURLException e)
- {
- throw new WSException("Malformed URL: " + orgAddress);
- }
- }
- }
- }
- }
-
- if (endpointFound == false)
- throw new WSException("Cannot find service endpoint '" + portName + "' in wsdl document");
- }
-
- private void replaceWSDL11SOAPAddress(WSDLDefinitions wsdlDefinitions, QName portQName, String serviceEndpointURL)
- {
- Definition wsdlOneOneDefinition = wsdlDefinitions.getWsdlOneOneDefinition();
- String tnsURI = wsdlOneOneDefinition.getTargetNamespace();
-
- // search for matching portElement and replace the address URI
- Port wsdlOneOnePort = modifyPortAddress(tnsURI, portQName, serviceEndpointURL, wsdlOneOneDefinition.getServices());
-
- // recursivly process imports if none can be found
- if (wsdlOneOnePort == null && !wsdlOneOneDefinition.getImports().isEmpty())
- {
-
- Iterator imports = wsdlOneOneDefinition.getImports().values().iterator();
- while (imports.hasNext())
- {
- List l = (List)imports.next();
- Iterator importsByNS = l.iterator();
- while (importsByNS.hasNext())
- {
- Import anImport = (Import)importsByNS.next();
-
- wsdlOneOnePort = modifyPortAddress(anImport.getNamespaceURI(), portQName, serviceEndpointURL, anImport.getDefinition().getServices());
- }
- }
- }
-
- // if it still doesn't exist something is wrong
- if (wsdlOneOnePort == null)
- throw new IllegalArgumentException("Cannot find port with name '" + portQName + "' in wsdl document");
- }
-
- private Port modifyPortAddress(String tnsURI, QName portQName, String serviceEndpointURL, Map services)
- {
-
- Port wsdlOneOnePort = null;
- Iterator itServices = services.values().iterator();
- while (itServices.hasNext())
- {
- Service wsdlOneOneService = (Service)itServices.next();
- Map wsdlOneOnePorts = wsdlOneOneService.getPorts();
- Iterator itPorts = wsdlOneOnePorts.keySet().iterator();
- while (itPorts.hasNext())
- {
- String portLocalName = (String)itPorts.next();
- if (portQName.equals(new QName(tnsURI, portLocalName)))
- {
- wsdlOneOnePort = (Port)wsdlOneOnePorts.get(portLocalName);
- Iterator itElements = wsdlOneOnePort.getExtensibilityElements().iterator();
- while (itElements.hasNext())
- {
- Object obj = itElements.next();
- if (obj instanceof SOAPAddress)
- {
- SOAPAddress address = (SOAPAddress)obj;
- address.setLocationURI(serviceEndpointURL);
- }
- }
- }
- }
- }
-
- return wsdlOneOnePort;
- }
-
- private String getUriScheme(String addrStr)
- {
- try
- {
- URI addrURI = new URI(addrStr);
- String scheme = addrURI.getScheme();
- return scheme;
- }
- catch (URISyntaxException e)
- {
- return null;
- }
- }
-
- protected WSSecurityConfiguration getWsSecurityConfiguration(UnifiedDeploymentInfo udi) throws IOException
- {
- WSSecurityConfiguration config = null;
-
- String resource = WSSecurityConfigurationFactory.SERVER_RESOURCE_NAME;
- if (udi.metaData instanceof UnifiedWebMetaData)
- {
- resource = "WEB-INF/" + resource;
- }
- else
- {
- resource = "META-INF/" + resource;
- }
-
- URL location = resourceLoader.getResource(resource);
- if (location != null)
- {
- config = WSSecurityConfigurationFactory.newInstance().parse(location);
-
- // Get and set deployment path to the keystore file
- if (config.getKeyStoreFile() != null)
- {
- location = resourceLoader.getResource(config.getKeyStoreFile());
- if (location != null)
- config.setKeyStoreURL(location);
- }
-
- if (config.getTrustStoreFile() != null)
- {
- location = resourceLoader.getResource(config.getTrustStoreFile());
- if (location != null)
- config.setTrustStoreURL(location);
- }
- }
-
- return config;
- }
-}
Added: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/deployment/AnnotationsMetaDataBuilder.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/deployment/AnnotationsMetaDataBuilder.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/deployment/AnnotationsMetaDataBuilder.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -0,0 +1,200 @@
+/*
+ * 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.deployment;
+
+// $Id:AnnotationsMetaDataBuilder.java 732 2006-08-12 18:40:21Z thomas.diesler at jboss.com $
+
+import java.io.File;
+import java.io.IOException;
+import java.io.Writer;
+
+import javax.xml.ws.BindingType;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.Constants;
+import org.jboss.ws.WSException;
+import org.jboss.ws.annotation.PortComponent;
+import org.jboss.ws.metadata.EndpointMetaData;
+import org.jboss.ws.metadata.ServerEndpointMetaData;
+import org.jboss.ws.metadata.ServiceMetaData;
+import org.jboss.ws.metadata.UnifiedMetaData;
+import org.jboss.ws.metadata.j2ee.UnifiedWebMetaData;
+import org.jboss.ws.metadata.wsdl.WSDLDefinitions;
+import org.jboss.ws.server.ServerConfig;
+import org.jboss.ws.server.ServerConfigFactory;
+import org.jboss.ws.tools.JavaToWSDL;
+import org.jboss.ws.utils.IOUtils;
+
+/** An abstract annotation meta data builder.
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 27-Jun-2005
+ */
+public abstract class AnnotationsMetaDataBuilder extends MetaDataBuilder
+{
+ // provide logging
+ private final Logger log = Logger.getLogger(AnnotationsMetaDataBuilder.class);
+
+ public AnnotationsMetaDataBuilder()
+ {
+ }
+
+ protected void processBindingType(EndpointMetaData epMetaData, Class wsClass)
+ {
+ BindingType anBindingType = (BindingType)wsClass.getAnnotation(BindingType.class);
+ String uri = anBindingType.value();
+ if (uri.length() > 0)
+ {
+ epMetaData.setBindingId(uri);
+ }
+ }
+
+ protected void processOrGenerateWSDL(Class wsClass, ServiceMetaData serviceMetaData, String wsdlLocation, EndpointMetaData endpointMetaData)
+ {
+ if (wsdlLocation.length() > 0)
+ {
+ serviceMetaData.setWsdlFile(wsdlLocation);
+ }
+ else
+ {
+ // Generate the wsdl
+ ClassLoader ctxLoader = Thread.currentThread().getContextClassLoader();
+ try
+ {
+ UnifiedMetaData wsMetaData = serviceMetaData.getUnifiedMetaData();
+ Thread.currentThread().setContextClassLoader(wsMetaData.getClassLoader());
+ String serviceName = serviceMetaData.getQName().getLocalPart();
+
+ JavaToWSDL javaToWSDL = new JavaToWSDL(Constants.NS_WSDL11);
+ javaToWSDL.setUnifiedMetaData(wsMetaData);
+ javaToWSDL.setQualifiedElements(true);
+ WSDLDefinitions wsdlDefinitions = javaToWSDL.generate(wsClass);
+
+ ServerConfigFactory factory = ServerConfigFactory.getInstance();
+ ServerConfig config = factory.getServerConfig();
+ File tmpdir = new File(config.getServerTempDir().getCanonicalPath() + "/jbossws");
+ tmpdir.mkdirs();
+
+ File wsdlTmpFile = File.createTempFile(serviceName, ".wsdl", tmpdir);
+ wsdlTmpFile.deleteOnExit();
+
+ Writer writer = IOUtils.getCharsetFileWriter(wsdlTmpFile, Constants.DEFAULT_XML_CHARSET);
+ wsdlDefinitions.write(writer, Constants.DEFAULT_XML_CHARSET);
+ writer.close();
+
+ serviceMetaData.setWsdlFile(wsdlTmpFile.toURL().toExternalForm());
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (IOException e)
+ {
+ throw new WSException("Cannot write generated wsdl", e);
+ }
+ finally
+ {
+ Thread.currentThread().setContextClassLoader(ctxLoader);
+ }
+ }
+ }
+
+ protected void processPortComponent(UnifiedDeploymentInfo udi, Class wsClass, String linkName, ServerEndpointMetaData epMetaData)
+ {
+ String contextRoot = null;
+
+ // init contextRoot from jboss-web.xml
+ if (udi.metaData instanceof UnifiedWebMetaData)
+ {
+ UnifiedWebMetaData webMetaData = (UnifiedWebMetaData)udi.metaData;
+ contextRoot = webMetaData.getContextRoot();
+ }
+
+ PortComponent anPortComponent = (PortComponent)wsClass.getAnnotation(PortComponent.class);
+ if (anPortComponent != null)
+ {
+ // setup config name
+ String configName = anPortComponent.configName();
+ if (configName.length() > 0)
+ epMetaData.setConfigName(configName);
+
+ // setup config file
+ String configFile = anPortComponent.configFile();
+ if (configFile.length() > 0)
+ epMetaData.setConfigFile(configFile);
+
+ // setup endpoint url
+ if (anPortComponent.contextRoot().length() > 0)
+ {
+ contextRoot = anPortComponent.contextRoot();
+ }
+ else
+ {
+ String shortName = udi.shortName;
+ contextRoot = "/" + shortName.substring(0, shortName.indexOf('.'));
+ }
+ epMetaData.setContextRoot(contextRoot);
+
+ String urlPattern;
+ if (anPortComponent.urlPattern().length() > 0)
+ {
+ urlPattern = anPortComponent.urlPattern();
+ }
+ else
+ {
+ urlPattern = "/" + linkName;
+ }
+ epMetaData.setURLPattern(urlPattern);
+
+ String servicePath = contextRoot + urlPattern;
+ epMetaData.setEndpointAddress(getServiceEndpointAddress(null, servicePath));
+
+ // setup authetication method
+ String authMethod = anPortComponent.authMethod();
+ if (authMethod.length() > 0)
+ epMetaData.setAuthMethod(authMethod);
+
+ // setup transport guarantee
+ String transportGuarantee = anPortComponent.transportGuarantee();
+ if (transportGuarantee.length() > 0)
+ epMetaData.setTransportGuarantee(transportGuarantee);
+ }
+ else
+ {
+ if (contextRoot == null)
+ {
+ String shortName = udi.shortName;
+ contextRoot = "/" + shortName.substring(0, shortName.indexOf('.'));
+ }
+ epMetaData.setContextRoot(contextRoot);
+
+ String urlPattern = "/" + linkName;
+ epMetaData.setURLPattern(urlPattern);
+
+ String servicePath = contextRoot + urlPattern;
+ epMetaData.setEndpointAddress(getServiceEndpointAddress(null, servicePath));
+ }
+
+ // replace the SOAP address
+ replaceAddressLocation(epMetaData);
+ }
+}
Property changes on: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/deployment/AnnotationsMetaDataBuilder.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/deployment/MetaDataBuilder.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/deployment/MetaDataBuilder.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/deployment/MetaDataBuilder.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -0,0 +1,440 @@
+/*
+ * 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.deployment;
+
+// $Id$
+
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.management.ObjectName;
+import javax.wsdl.Definition;
+import javax.wsdl.Import;
+import javax.wsdl.Port;
+import javax.wsdl.Service;
+import javax.wsdl.extensions.ExtensibilityElement;
+import javax.wsdl.extensions.UnknownExtensibilityElement;
+import javax.wsdl.extensions.soap.SOAPAddress;
+import javax.xml.namespace.QName;
+import javax.xml.ws.addressing.AddressingProperties;
+import javax.xml.ws.soap.SOAPBinding;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.Constants;
+import org.jboss.ws.WSException;
+import org.jboss.ws.addressing.AddressingPropertiesImpl;
+import org.jboss.ws.addressing.metadata.AddressingOpMetaExt;
+import org.jboss.ws.eventing.EventingConstants;
+import org.jboss.ws.eventing.deployment.EventingEndpoint;
+import org.jboss.ws.eventing.metadata.EventingEpMetaExt;
+import org.jboss.ws.jaxrpc.UnqualifiedFaultException;
+import org.jboss.ws.jaxrpc.Use;
+import org.jboss.ws.metadata.ClientEndpointMetaData;
+import org.jboss.ws.metadata.EndpointMetaData;
+import org.jboss.ws.metadata.FaultMetaData;
+import org.jboss.ws.metadata.OperationMetaData;
+import org.jboss.ws.metadata.ServerEndpointMetaData;
+import org.jboss.ws.metadata.TypesMetaData;
+import org.jboss.ws.metadata.j2ee.UnifiedApplicationMetaData;
+import org.jboss.ws.metadata.j2ee.UnifiedBeanMetaData;
+import org.jboss.ws.metadata.j2ee.UnifiedMessageDrivenMetaData;
+import org.jboss.ws.metadata.wsdl.NCName;
+import org.jboss.ws.metadata.wsdl.WSDLBinding;
+import org.jboss.ws.metadata.wsdl.WSDLBindingOperation;
+import org.jboss.ws.metadata.wsdl.WSDLDefinitions;
+import org.jboss.ws.metadata.wsdl.WSDLEndpoint;
+import org.jboss.ws.metadata.wsdl.WSDLInterface;
+import org.jboss.ws.metadata.wsdl.WSDLInterfaceFault;
+import org.jboss.ws.metadata.wsdl.WSDLInterfaceOperation;
+import org.jboss.ws.metadata.wsdl.WSDLInterfaceOperationOutfault;
+import org.jboss.ws.metadata.wsdl.WSDLProperty;
+import org.jboss.ws.metadata.wsdl.WSDLService;
+import org.jboss.ws.server.ServiceEndpointManager;
+import org.jboss.ws.server.ServiceEndpointManagerFactory;
+import org.jboss.ws.utils.ObjectNameFactory;
+import org.w3c.dom.Element;
+
+/** An abstract meta data builder.
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 19-May-2005
+ */
+public abstract class MetaDataBuilder
+{
+ // provide logging
+ private final static Logger log = Logger.getLogger(MetaDataBuilder.class);
+
+ protected ClassLoader classLoader;
+ protected URLClassLoader resourceLoader;
+
+ public void setClassLoader(ClassLoader classLoader)
+ {
+ this.classLoader = classLoader;
+ }
+
+ public void setResourceLoader(URLClassLoader resourceLoader)
+ {
+ this.resourceLoader = resourceLoader;
+ }
+
+ /** Inititialize the endpoint binding
+ */
+ protected void initEndpointBinding(WSDLEndpoint wsdlEndpoint, ClientEndpointMetaData epMetaData)
+ {
+ WSDLDefinitions wsdlDefinitions = wsdlEndpoint.getWsdlService().getWsdlDefinitions();
+ WSDLInterface wsdlInterface = wsdlEndpoint.getInterface();
+ WSDLBinding wsdlBinding = wsdlDefinitions.getBindingByInterfaceName(wsdlInterface.getQName());
+ String bindingType = wsdlBinding.getType();
+ if (Constants.NS_SOAP11.equals(bindingType))
+ epMetaData.setBindingId(SOAPBinding.SOAP11HTTP_BINDING);
+ else if (Constants.NS_SOAP12.equals(bindingType))
+ epMetaData.setBindingId(SOAPBinding.SOAP12HTTP_BINDING);
+ }
+
+ /** Initialize the endpoint encoding style from the binding operations
+ */
+ protected void initEndpointEncodingStyle(EndpointMetaData epMetaData)
+ {
+ WSDLDefinitions wsdlDefinitions = epMetaData.getServiceMetaData().getWsdlDefinitions();
+ for (WSDLService wsdlService : wsdlDefinitions.getServices())
+ {
+ for (WSDLEndpoint wsdlEndpoint : wsdlService.getEndpoints())
+ {
+ if (epMetaData.getQName().equals(wsdlEndpoint.getQName()))
+ {
+ QName bindQName = wsdlEndpoint.getBinding();
+ NCName ncName = new NCName(bindQName.getLocalPart());
+ WSDLBinding wsdlBinding = wsdlDefinitions.getBinding(ncName);
+ if (wsdlBinding == null)
+ throw new WSException("Cannot obtain binding: " + ncName);
+
+ for (WSDLBindingOperation wsdlBindingOperation : wsdlBinding.getOperations())
+ {
+ String encStyle = wsdlBindingOperation.getEncodingStyle();
+ epMetaData.setEncodingStyle(Use.valueOf(encStyle));
+ }
+ }
+ }
+ }
+ }
+
+ protected void processEndpointMetaDataExtensions(EndpointMetaData epMetaData, WSDLDefinitions wsdlDefinitions)
+ {
+ for (WSDLInterface wsdlInterface : wsdlDefinitions.getInterfaces())
+ {
+ WSDLProperty eventSourceProp = wsdlInterface.getProperty(Constants.WSDL_PROPERTY_EVENTSOURCE);
+ if (eventSourceProp != null && epMetaData instanceof ServerEndpointMetaData)
+ {
+ ServerEndpointMetaData sepMetaData = (ServerEndpointMetaData)epMetaData;
+ String eventSourceNS = wsdlInterface.getQName().getNamespaceURI() + "/" + wsdlInterface.getQName().getLocalPart();
+ Object notificationSchema = null; // todo: resolve schema from operation message
+
+ EventingEpMetaExt ext = new EventingEpMetaExt(EventingConstants.NS_EVENTING);
+ ext.setEventSourceNS(eventSourceNS);
+ ext.setNotificationSchema(notificationSchema);
+
+ sepMetaData.addExtension(ext);
+ sepMetaData.setManagedEndpointBean(EventingEndpoint.class.getName());
+ }
+ }
+ }
+
+ protected ObjectName getServiceEndpointID(UnifiedDeploymentInfo udi, ServerEndpointMetaData sepMetaData)
+ {
+ String endpoint = sepMetaData.getLinkName();
+ String context = sepMetaData.getContextRoot();
+ if (context.startsWith("/"))
+ context = context.substring(1);
+
+ StringBuilder idstr = new StringBuilder(ServerEndpointMetaData.SEPID_DOMAIN + ":");
+ idstr.append(ServerEndpointMetaData.SEPID_PROPERTY_CONTEXT + "=" + context);
+ idstr.append("," + ServerEndpointMetaData.SEPID_PROPERTY_ENDPOINT + "=" + endpoint);
+
+ // Add JMS destination JNDI name for MDB endpoints
+ if (udi.metaData instanceof UnifiedApplicationMetaData)
+ {
+ String ejbName = sepMetaData.getLinkName();
+ if (ejbName == null)
+ throw new WSException("Cannot obtain ejb-link from port component");
+
+ UnifiedApplicationMetaData applMetaData = (UnifiedApplicationMetaData)udi.metaData;
+ UnifiedBeanMetaData beanMetaData = (UnifiedBeanMetaData)applMetaData.getBeanByEjbName(ejbName);
+ if (beanMetaData == null)
+ throw new WSException("Cannot obtain ejb meta data for: " + ejbName);
+
+ if (beanMetaData instanceof UnifiedMessageDrivenMetaData)
+ {
+ UnifiedMessageDrivenMetaData mdMetaData = (UnifiedMessageDrivenMetaData)beanMetaData;
+ String jndiName = mdMetaData.getDestinationJndiName();
+ idstr.append(",jms=" + jndiName);
+ }
+ }
+
+ return ObjectNameFactory.create(idstr.toString());
+ }
+
+ protected void buildFaultMetaData(OperationMetaData opMetaData, WSDLInterfaceOperation wsdlOperation)
+ {
+ TypesMetaData typesMetaData = opMetaData.getEndpointMetaData().getServiceMetaData().getTypesMetaData();
+
+ WSDLInterface wsdlInterface = wsdlOperation.getWsdlInterface();
+ for (WSDLInterfaceOperationOutfault outFault : wsdlOperation.getOutfaults())
+ {
+ QName ref = outFault.getRef();
+
+ WSDLInterfaceFault wsdlFault = wsdlInterface.getFault(new NCName(ref.getLocalPart()));
+ QName xmlName = wsdlFault.getXmlName();
+ QName xmlType = wsdlFault.getXmlType();
+ String javaTypeName = null;
+
+ if (typesMetaData.getTypeMappingByXMLType(xmlType) != null)
+ javaTypeName = typesMetaData.getTypeMappingByXMLType(xmlType).getJavaTypeName();
+
+ if (javaTypeName == null)
+ {
+ log.warn("Cannot obtain java type mapping for: " + xmlType);
+ javaTypeName = new UnqualifiedFaultException(xmlType).getClass().getName();
+ }
+
+ FaultMetaData faultMetaData = new FaultMetaData(opMetaData, xmlName, xmlType, javaTypeName);
+ opMetaData.addFault(faultMetaData);
+ }
+ }
+
+ /** Process operation meta data extensions. */
+ protected void processOpMetaExtensions(OperationMetaData opMetaData, WSDLInterfaceOperation wsdlOperation)
+ {
+
+ String tns = wsdlOperation.getQName().getNamespaceURI();
+ String portTypeName = wsdlOperation.getQName().getLocalPart();
+
+ AddressingProperties ADDR = new AddressingPropertiesImpl();
+ AddressingOpMetaExt addrExt = new AddressingOpMetaExt(ADDR.getNamespaceURI());
+
+ // inbound action
+ WSDLProperty wsaInAction = wsdlOperation.getProperty(Constants.WSDL_PROPERTY_ACTION_IN);
+ if (wsaInAction != null)
+ {
+ addrExt.setInboundAction(wsaInAction.getValue());
+ }
+ else
+ {
+ WSDLProperty messageName = wsdlOperation.getProperty(Constants.WSDL_PROPERTY_MESSAGE_NAME_IN);
+ addrExt.setInboundAction(tns + "/" + portTypeName + "/" + messageName);
+ }
+
+ // outbound action
+ WSDLProperty wsaOutAction = wsdlOperation.getProperty(Constants.WSDL_PROPERTY_ACTION_OUT);
+ if (wsaOutAction != null)
+ {
+ addrExt.setOutboundAction(wsaOutAction.getValue());
+ }
+ else
+ {
+ WSDLProperty messageName = wsdlOperation.getProperty(Constants.WSDL_PROPERTY_MESSAGE_NAME_OUT);
+ addrExt.setOutboundAction(tns + "/" + portTypeName + "/" + messageName);
+ }
+
+ opMetaData.addExtension(addrExt);
+ }
+
+ /** Get the web service address for a given path
+ */
+ public String getServiceEndpointAddress(String uriScheme, String servicePath)
+ {
+ if (servicePath == null || servicePath.length() == 0)
+ throw new WSException("Service path cannot be null");
+
+ if (servicePath.endsWith("/*"))
+ servicePath = servicePath.substring(0, servicePath.length() - 2);
+
+ if (uriScheme == null)
+ uriScheme = "http";
+
+ ServiceEndpointManagerFactory factory = ServiceEndpointManagerFactory.getInstance();
+ ServiceEndpointManager epManager = factory.getServiceEndpointManager();
+ String host = epManager.getWebServiceHost();
+ int port = epManager.getWebServicePort();
+ if ("https".equals(uriScheme))
+ port = epManager.getWebServiceSecurePort();
+
+ String urlStr = uriScheme + "://" + host + ":" + port + servicePath;
+ try
+ {
+ return new URL(urlStr).toExternalForm();
+ }
+ catch (MalformedURLException e)
+ {
+ throw new WSException("Malformed URL: " + urlStr);
+ }
+ }
+
+ /** Replace the address locations for a given port component.
+ */
+ protected void replaceAddressLocation(ServerEndpointMetaData epMetaData)
+ {
+ WSDLDefinitions wsdlDefinitions = epMetaData.getServiceMetaData().getWsdlDefinitions();
+ QName portName = epMetaData.getQName();
+
+ boolean endpointFound = false;
+ for (WSDLService wsdlService : wsdlDefinitions.getServices())
+ {
+ for (WSDLEndpoint wsdlEndpoint : wsdlService.getEndpoints())
+ {
+ QName wsdlPortName = wsdlEndpoint.getQName();
+ if (wsdlPortName.equals(portName))
+ {
+ endpointFound = true;
+
+ String orgAddress = wsdlEndpoint.getAddress();
+ String uriScheme = getUriScheme(orgAddress);
+
+ String transportGuarantee = epMetaData.getTransportGuarantee();
+ if ("CONFIDENTIAL".equals(transportGuarantee))
+ uriScheme = "https";
+
+ String servicePath = epMetaData.getContextRoot() + epMetaData.getURLPattern();
+ String serviceEndpointURL = getServiceEndpointAddress(uriScheme, servicePath);
+
+ ServiceEndpointManagerFactory factory = ServiceEndpointManagerFactory.getInstance();
+ ServiceEndpointManager epManager = factory.getServiceEndpointManager();
+ boolean alwaysModify = epManager.isAlwaysModifySOAPAddress();
+
+ if (alwaysModify || uriScheme == null || orgAddress.indexOf("REPLACE_WITH_ACTUAL_URL") >= 0)
+ {
+ log.debug("Replace service endpoint address '" + orgAddress + "' with '" + serviceEndpointURL + "'");
+ wsdlEndpoint.setAddress(serviceEndpointURL);
+ epMetaData.setEndpointAddress(serviceEndpointURL);
+
+ // modify the wsdl-1.1 definition
+ if (wsdlDefinitions.getWsdlOneOneDefinition() != null)
+ replaceWSDL11SOAPAddress(wsdlDefinitions, portName, serviceEndpointURL);
+ }
+ else
+ {
+ log.debug("Don't replace service endpoint address '" + orgAddress + "'");
+ try
+ {
+ epMetaData.setEndpointAddress(new URL(orgAddress).toExternalForm());
+ }
+ catch (MalformedURLException e)
+ {
+ throw new WSException("Malformed URL: " + orgAddress);
+ }
+ }
+ }
+ }
+ }
+
+ if (endpointFound == false)
+ throw new WSException("Cannot find port in wsdl: " + portName);
+ }
+
+ private void replaceWSDL11SOAPAddress(WSDLDefinitions wsdlDefinitions, QName portQName, String serviceEndpointURL)
+ {
+ Definition wsdlOneOneDefinition = wsdlDefinitions.getWsdlOneOneDefinition();
+ String tnsURI = wsdlOneOneDefinition.getTargetNamespace();
+
+ // search for matching portElement and replace the address URI
+ Port wsdlOneOnePort = modifySOAPAddress(tnsURI, portQName, serviceEndpointURL, wsdlOneOneDefinition.getServices());
+
+ // recursivly process imports if none can be found
+ if (wsdlOneOnePort == null && !wsdlOneOneDefinition.getImports().isEmpty())
+ {
+
+ Iterator imports = wsdlOneOneDefinition.getImports().values().iterator();
+ while (imports.hasNext())
+ {
+ List l = (List)imports.next();
+ Iterator importsByNS = l.iterator();
+ while (importsByNS.hasNext())
+ {
+ Import anImport = (Import)importsByNS.next();
+ wsdlOneOnePort = modifySOAPAddress(anImport.getNamespaceURI(), portQName, serviceEndpointURL, anImport.getDefinition().getServices());
+ }
+ }
+ }
+
+ // if it still doesn't exist something is wrong
+ if (wsdlOneOnePort == null)
+ throw new IllegalArgumentException("Cannot find port with name '" + portQName + "' in wsdl document");
+ }
+
+ private Port modifySOAPAddress(String tnsURI, QName portQName, String serviceEndpointURL, Map services)
+ {
+ QName SOAP12_ADDRESS = new QName(Constants.NS_SOAP12, "address");
+
+ Port wsdlOneOnePort = null;
+ Iterator itServices = services.values().iterator();
+ while (itServices.hasNext())
+ {
+ Service wsdlOneOneService = (Service)itServices.next();
+ Map wsdlOneOnePorts = wsdlOneOneService.getPorts();
+ Iterator itPorts = wsdlOneOnePorts.keySet().iterator();
+ while (itPorts.hasNext())
+ {
+ String portLocalName = (String)itPorts.next();
+ if (portQName.equals(new QName(tnsURI, portLocalName)))
+ {
+ wsdlOneOnePort = (Port)wsdlOneOnePorts.get(portLocalName);
+ List<ExtensibilityElement> extElements = wsdlOneOnePort.getExtensibilityElements();
+ for (ExtensibilityElement extElement : extElements)
+ {
+ QName elementType = extElement.getElementType();
+ if (extElement instanceof SOAPAddress)
+ {
+ SOAPAddress address = (SOAPAddress)extElement;
+ address.setLocationURI(serviceEndpointURL);
+ }
+ else if (SOAP12_ADDRESS.equals(elementType))
+ {
+ Element domElement = ((UnknownExtensibilityElement)extElement).getElement();
+ domElement.setAttribute("location", serviceEndpointURL);
+ }
+ }
+ }
+ }
+ }
+
+ return wsdlOneOnePort;
+ }
+
+ private String getUriScheme(String addrStr)
+ {
+ try
+ {
+ URI addrURI = new URI(addrStr);
+ String scheme = addrURI.getScheme();
+ return scheme;
+ }
+ catch (URISyntaxException e)
+ {
+ return null;
+ }
+ }
+}
Property changes on: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/deployment/MetaDataBuilder.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Deleted: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/handler/ClientHandlerChain.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/handler/ClientHandlerChain.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/handler/ClientHandlerChain.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -1,50 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.ws.handler;
-
-// $Id$
-
-import java.util.List;
-import java.util.Set;
-
-import javax.xml.rpc.handler.MessageContext;
-
-/**
- * Represents a list of handlers. All elements in the
- * HandlerChain are of the type javax.xml.rpc.handler.Handler.
- *
- * @author Thomas.Diesler at jboss.org
- * @since 06-May-2004
- */
-public class ClientHandlerChain extends HandlerChainBaseImpl
-{
- public ClientHandlerChain(List infos, Set roles)
- {
- super(infos, roles);
- }
-
- public boolean handleResponse(MessageContext msgContext)
- {
- boolean doNext = super.handleResponse(msgContext);
- return doNext;
- }
-}
Deleted: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/handler/HandlerChainBaseImpl.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/handler/HandlerChainBaseImpl.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/handler/HandlerChainBaseImpl.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -1,660 +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.handler;
-
-// $Id$
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.Constants;
-import org.jboss.ws.metadata.EndpointMetaData;
-import org.jboss.ws.metadata.OperationMetaData;
-import org.jboss.ws.metadata.ParameterMetaData;
-import org.jboss.ws.soap.SAAJElementWriter;
-import org.jboss.ws.soap.SOAPEnvelopeImpl;
-import org.jboss.ws.soap.SOAPMessageContextImpl;
-import org.jboss.ws.soap.SOAPMessageImpl;
-import org.jboss.ws.xop.XOPContext;
-
-import javax.xml.namespace.QName;
-import javax.xml.rpc.JAXRPCException;
-import javax.xml.rpc.handler.Handler;
-import javax.xml.rpc.handler.HandlerChain;
-import javax.xml.rpc.handler.HandlerInfo;
-import javax.xml.rpc.handler.MessageContext;
-import javax.xml.rpc.soap.SOAPFaultException;
-import javax.xml.soap.*;
-import java.util.*;
-
-
-/**
- * Represents a list of handlers. All elements in the
- * HandlerChain are of the type javax.xml.rpc.handler.Handler.
- * <p/>
- * Abstracts the policy and mechanism for the invocation of the registered handlers.
- *
- * @author Thomas.Diesler at jboss.org
- * @since 06-May-2004
- */
-public abstract class HandlerChainBaseImpl implements HandlerChain
-{
- private static Logger log = Logger.getLogger(HandlerChainBaseImpl.class);
-
- public static final int STATE_DOES_NOT_EXIST = 0;
- public static final int STATE_CREATED = 1;
- public static final int STATE_READY = 2;
- public static final int STATE_DESTROYED = 3;
-
- // The List<Entry> objects
- protected List<HandlerEntry> handlers = new ArrayList<HandlerEntry>();
- // The roles associated with the handler chain
- protected Set<String> roles = new HashSet<String>();
- // The index of the first handler that returned false during processing
- protected int falseIndex = -1;
- // The state of this handler chain
- protected int state;
-
- /**
- * Constructs a handler chain with the given handlers infos
- */
- public HandlerChainBaseImpl(List infos, Set roles)
- {
- log.debug("Create a handler chain for roles: " + roles);
- addHandlersToChain(infos, roles);
- }
-
- /** Get the list of handler infos
- */
- public List<HandlerInfo> getHandlerInfos()
- {
- List<HandlerInfo> list = new ArrayList<HandlerInfo>();
- for (int i = 0; i < handlers.size(); i++)
- {
- HandlerEntry entry = (HandlerEntry)handlers.get(i);
- list.add(entry.info);
- }
- return list;
- }
-
- /**
- * Initialize the a handler chain with the given handlers infos
- *
- * @throws javax.xml.rpc.JAXRPCException If any error during initialization
- */
- private void addHandlersToChain(List infos, Set roleSet)
- {
- try
- {
- if (infos != null)
- {
- for (int i = 0; i < infos.size(); i++)
- {
- HandlerInfo info = (HandlerInfo)infos.get(i);
- HandlerWrapper handler = new HandlerWrapper((Handler)info.getHandlerClass().newInstance());
- handlers.add(new HandlerEntry(handler, info));
- }
- }
- if (roleSet != null)
- {
- roles.addAll(roleSet);
- }
- }
- catch (RuntimeException rte)
- {
- throw rte;
- }
- catch (Exception ex)
- {
- throw new JAXRPCException("Cannot initialize handler chain", ex);
- }
-
- // set state to created
- state = STATE_CREATED;
- }
-
- /**
- * Get the state of this handler chain
- */
- public int getState()
- {
- return state;
- }
-
- /**
- * Initializes the configuration for a HandlerChain.
- *
- * @param config Configuration for the initialization of this handler chain
- * @throws javax.xml.rpc.JAXRPCException If any error during initialization
- */
- public void init(Map config)
- {
- log.debug("init: [config=" + config + "]");
- for (int i = 0; i < handlers.size(); i++)
- {
- HandlerEntry entry = (HandlerEntry)handlers.get(i);
- entry.handler.init(entry.info);
- }
-
- // set state to ready
- state = STATE_READY;
- }
-
- /**
- * Indicates the end of lifecycle for a HandlerChain.
- *
- * @throws javax.xml.rpc.JAXRPCException If any error during destroy
- */
- public void destroy()
- {
- log.debug("destroy");
- for (int i = 0; i < handlers.size(); i++)
- {
- HandlerEntry entry = (HandlerEntry)handlers.get(i);
- entry.handler.destroy();
- }
- handlers.clear();
-
- // set state to destroyed
- state = STATE_DESTROYED;
- }
-
- /**
- * Gets SOAP actor roles registered for this HandlerChain at this SOAP node. The returned array includes the
- * special SOAP actor next.
- *
- * @return SOAP Actor roles as URIs
- */
- public String[] getRoles()
- {
- String[] arr = new String[roles.size()];
- roles.toArray(arr);
- return arr;
- }
-
- /**
- * Sets SOAP Actor roles for this HandlerChain. This specifies the set of roles in which this HandlerChain is to act
- * for the SOAP message processing at this SOAP node. These roles assumed by a HandlerChain must be invariant during
- * the processing of an individual SOAP message through the HandlerChain.
- * <p/>
- * A HandlerChain always acts in the role of the special SOAP actor next. Refer to the SOAP specification for the
- * URI name for this special SOAP actor. There is no need to set this special role using this method.
- *
- * @param soapActorNames URIs for SOAP actor name
- */
- public void setRoles(String[] soapActorNames)
- {
- List<String> newRoles = Arrays.asList(soapActorNames);
- log.debug("setRoles: " + newRoles);
-
- roles.clear();
- roles.addAll(newRoles);
- }
-
- /**
- * Initiates the request processing for this handler chain.
- *
- * @param msgContext MessageContext parameter provides access to the request SOAP message.
- * @return Returns true if all handlers in chain have been processed. Returns false if a handler in the chain returned false from its handleRequest method.
- * @throws javax.xml.rpc.JAXRPCException if any processing error happens
- */
- public boolean handleRequest(MessageContext msgContext)
- {
- boolean doNext = true;
-
- if (handlers.size() > 0)
- {
- log.debug("Enter: handleRequest");
-
- // Replace handlers that did not survive the previous call
- replaceDirtyHandlers();
-
- int handlerIndex = 0;
- Handler currHandler = null;
- try
- {
- for (; doNext && handlerIndex < handlers.size(); handlerIndex++)
- {
- String lastMessageTrace = null;
- if (log.isTraceEnabled())
- {
- SOAPMessageContextImpl msgCtx = (SOAPMessageContextImpl)msgContext;
- SOAPPart soapPart = msgCtx.getMessage().getSOAPPart();
- lastMessageTrace = traceSOAPPart(soapPart, lastMessageTrace);
- }
-
- currHandler = ((HandlerEntry)handlers.get(handlerIndex)).getHandler();
- log.debug("Handle request: " + currHandler);
- doNext = currHandler.handleRequest(msgContext);
-
- if (log.isTraceEnabled())
- {
- SOAPMessageContextImpl msgCtx = (SOAPMessageContextImpl)msgContext;
- SOAPPart soapPart = msgCtx.getMessage().getSOAPPart();
- lastMessageTrace = traceSOAPPart(soapPart, lastMessageTrace);
- }
- }
- }
- catch (RuntimeException e)
- {
- log.error("RuntimeException in request handler", e);
- doNext = false;
- throw e;
- }
- finally
- {
- // we start at this index in the response chain
- if (doNext == false)
- falseIndex = (handlerIndex - 1);
-
- log.debug("Exit: handleRequest with status: " + doNext);
- }
- }
-
- return doNext;
- }
-
- /**
- * Initiates the response processing for this handler chain.
- * <p/>
- * In this implementation, the response handler chain starts processing from the same Handler
- * instance (that returned false) and goes backward in the execution sequence.
- *
- * @return Returns true if all handlers in chain have been processed.
- * Returns false if a handler in the chain returned false from its handleResponse method.
- * @throws javax.xml.rpc.JAXRPCException if any processing error happens
- */
- public boolean handleResponse(MessageContext msgContext)
- {
- boolean doNext = true;
-
- if (handlers.size() > 0)
- {
- log.debug("Enter: handleResponse");
-
- int handlerIndex = handlers.size() - 1;
- if (falseIndex != -1)
- handlerIndex = falseIndex;
-
- Handler currHandler = null;
- try
- {
- for (; doNext && handlerIndex >= 0; handlerIndex--)
- {
- String lastMessageTrace = null;
- if (log.isTraceEnabled())
- {
- SOAPMessageContextImpl msgCtx = (SOAPMessageContextImpl)msgContext;
- SOAPPart soapPart = msgCtx.getMessage().getSOAPPart();
- lastMessageTrace = traceSOAPPart(soapPart, lastMessageTrace);
- }
-
- currHandler = ((HandlerEntry)handlers.get(handlerIndex)).getHandler();
- log.debug("Handle response: " + currHandler);
- doNext = currHandler.handleResponse(msgContext);
-
- if (log.isTraceEnabled())
- {
- SOAPMessageContextImpl msgCtx = (SOAPMessageContextImpl)msgContext;
- SOAPPart soapPart = msgCtx.getMessage().getSOAPPart();
- lastMessageTrace = traceSOAPPart(soapPart, lastMessageTrace);
- }
- }
- }
- catch (RuntimeException rte)
- {
- log.error("RuntimeException in response handler", rte);
- doNext = false;
- throw rte;
- }
- finally
- {
- // we start at this index in the fault chain
- if (doNext == false)
- falseIndex = (handlerIndex - 1);
-
- log.debug("Exit: handleResponse with status: " + doNext);
- }
- }
-
- return doNext;
- }
-
- /**
- * Initiates the SOAP fault processing for this handler chain.
- * <p/>
- * In this implementation, the fault handler chain starts processing from the same Handler
- * instance (that returned false) and goes backward in the execution sequence.
- *
- * @return Returns true if all handlers in chain have been processed.
- * Returns false if a handler in the chain returned false from its handleFault method.
- * @throws javax.xml.rpc.JAXRPCException if any processing error happens
- */
- public boolean handleFault(MessageContext msgContext)
- {
- boolean doNext = true;
-
- if (handlers.size() > 0)
- {
- log.debug("Enter: handleFault");
-
- try
- {
- int handlerIndex = handlers.size() - 1;
- if (falseIndex != -1)
- handlerIndex = falseIndex;
-
- Handler currHandler = null;
- for (; doNext && handlerIndex >= 0; handlerIndex--)
- {
- currHandler = ((HandlerEntry)handlers.get(handlerIndex)).getHandler();
- log.debug("Handle fault: " + currHandler);
- doNext = currHandler.handleFault(msgContext);
- }
- }
- finally
- {
- log.debug("Exit: handleFault with status: " + doNext);
- }
- }
-
- return doNext;
- }
-
- /**
- * Trace the SOAPPart, do nothing if the String representation is equal to the last one.
- */
- protected String traceSOAPPart(SOAPPart soapPart, String lastMessageTrace)
- {
- try
- {
- SOAPEnvelopeImpl soapEnv = (SOAPEnvelopeImpl)soapPart.getEnvelope();
- String envString = SAAJElementWriter.printSOAPElement(soapEnv, true);
- if (envString.equals(lastMessageTrace) == false)
- {
- log.debug(envString);
- lastMessageTrace = envString;
- }
- return lastMessageTrace;
- }
- catch (SOAPException e)
- {
- log.error("Cannot get SOAPEnvelope", e);
- return null;
- }
- }
-
- /**
- * Replace handlers that did not survive the previous call
- */
- protected void replaceDirtyHandlers()
- {
- for (int i = 0; i < handlers.size(); i++)
- {
- HandlerEntry entry = (HandlerEntry)handlers.get(i);
- if (entry.handler.getState() == HandlerWrapper.DOES_NOT_EXIST)
- {
- log.debug("Replacing dirty handler: " + entry.handler);
- try
- {
- HandlerWrapper handler = new HandlerWrapper((Handler)entry.info.getHandlerClass().newInstance());
- entry.handler = handler;
- handler.init(entry.info);
- }
- catch (RuntimeException rte)
- {
- throw rte;
- }
- catch (Exception ex)
- {
- log.error("Cannot create handler instance for: " + entry.info, ex);
- }
- }
- }
- }
-
- /**
- * Get the handler at the requested position
- */
- protected Handler getHandlerAt(int pos)
- {
- if (pos < 0 || handlers.size() <= pos)
- throw new IllegalArgumentException("No handler at position: " + pos);
-
- HandlerEntry entry = (HandlerEntry)handlers.get(pos);
- return entry.handler;
- }
-
- /**
- * R1027 A RECEIVER MUST generate a "soap:MustUnderstand" fault when a
- * message contains a mandatory header block (i.e., one that has a
- * soap:mustUnderstand attribute with the value "1") targeted at the
- * receiver (via soap:actor) that the receiver does not understand.
- */
- public static void checkMustUnderstand(SOAPMessageContextImpl msgContext, String[] roles)
- {
- SOAPHeaderElement mustUnderstandHeaderElement = null;
- List roleList = (roles != null ? Arrays.asList(roles) : new ArrayList());
- try
- {
- SOAPMessageImpl soapMessage = (SOAPMessageImpl)msgContext.getMessage();
-
- // A SOAPHeaderElement is possibly bound to the endpoint operation
- // in order to check that we need a the opMetaData
- OperationMetaData opMetaData = msgContext.getOperationMetaData();
- if (opMetaData == null)
- {
- // The security handler must have decrypted the incomming message
- // before the dispatch target operation can be known
- EndpointMetaData epMetaData = msgContext.getEndpointMetaData();
- opMetaData = soapMessage.getOperationMetaData(epMetaData);
- }
-
- SOAPEnvelope soapEnvelope = soapMessage.getSOAPPart().getEnvelope();
- if (soapEnvelope != null && soapEnvelope.getHeader() != null)
- {
- Iterator it = soapEnvelope.getHeader().examineAllHeaderElements();
- while (it.hasNext() && mustUnderstandHeaderElement == null)
- {
- SOAPHeaderElement soapHeaderElement = (SOAPHeaderElement)it.next();
- Name name = soapHeaderElement.getElementName();
- QName xmlName = new QName(name.getURI(), name.getLocalName());
-
- ParameterMetaData paramMetaData = (opMetaData != null ? opMetaData.getParameter(xmlName) : null);
- boolean isBoundHeader = (paramMetaData != null && paramMetaData.isInHeader());
-
- if (soapHeaderElement.getMustUnderstand() && isBoundHeader == false)
- {
- String actor = soapHeaderElement.getActor();
- boolean noActor = (actor == null || actor.length() == 0);
- boolean nextActor = Constants.URI_SOAP11_NEXT_ACTOR.equals(actor);
- if (noActor || nextActor || roleList.contains(actor))
- {
- mustUnderstandHeaderElement = soapHeaderElement;
- }
- }
- }
- }
- }
- catch (SOAPException ex)
- {
- log.error("Cannot check mustUnderstand for headers", ex);
- }
-
- if (mustUnderstandHeaderElement != null)
- {
- QName faultCode = Constants.SOAP11_FAULT_CODE_MUST_UNDERSTAND;
- String faultString = "Unprocessed 'mustUnderstand' header element: " + mustUnderstandHeaderElement.getElementName();
- throw new SOAPFaultException(faultCode, faultString, null, null);
- }
- }
-
- /**
- * An entry in the handler list
- */
- private class HandlerEntry
- {
- private HandlerWrapper handler;
- private HandlerInfo info;
-
- public HandlerEntry(HandlerWrapper handler, HandlerInfo info)
- {
- this.handler = handler;
- this.info = info;
- }
-
- public Handler getHandler()
- {
- return handler;
- }
-
- public HandlerInfo getInfo()
- {
- return info;
- }
- }
-
- // java.util.List interface ****************************************************************************************
-
- public boolean remove(Object o)
- {
- return handlers.remove(o);
- }
-
- public boolean containsAll(Collection c)
- {
- return handlers.containsAll(c);
- }
-
- public boolean removeAll(Collection c)
- {
- return handlers.removeAll(c);
- }
-
- public boolean retainAll(Collection c)
- {
- return handlers.retainAll(c);
- }
-
- public int hashCode()
- {
- return handlers.hashCode();
- }
-
- public boolean equals(Object o)
- {
- return handlers.equals(o);
- }
-
- public Iterator iterator()
- {
- return handlers.iterator();
- }
-
- public List subList(int fromIndex, int toIndex)
- {
- return handlers.subList(fromIndex, toIndex);
- }
-
- public ListIterator listIterator()
- {
- return handlers.listIterator();
- }
-
- public ListIterator listIterator(int index)
- {
- return handlers.listIterator(index);
- }
-
- public int size()
- {
- return handlers.size();
- }
-
- public void clear()
- {
- handlers.clear();
- }
-
- public boolean isEmpty()
- {
- return handlers.isEmpty();
- }
-
- public Object[] toArray()
- {
- return handlers.toArray();
- }
-
- public Object get(int index)
- {
- return handlers.get(index);
- }
-
- public Object remove(int index)
- {
- return handlers.remove(index);
- }
-
- public void add(int index, Object element)
- {
- handlers.add(index, (HandlerEntry)element);
- }
-
- public int indexOf(Object elem)
- {
- return handlers.indexOf(elem);
- }
-
- public int lastIndexOf(Object elem)
- {
- return handlers.lastIndexOf(elem);
- }
-
- public boolean add(Object o)
- {
- return handlers.add((HandlerEntry)o);
- }
-
- public boolean contains(Object elem)
- {
- return handlers.contains(elem);
- }
-
- public boolean addAll(int index, Collection c)
- {
- return handlers.addAll(index, c);
- }
-
- public boolean addAll(Collection c)
- {
- return handlers.addAll(c);
- }
-
- public Object set(int index, Object element)
- {
- return handlers.set(index, (HandlerEntry)element);
- }
-
- public Object[] toArray(Object[] a)
- {
- return handlers.toArray(a);
- }
-}
Deleted: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/handler/HandlerWrapper.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/handler/HandlerWrapper.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/handler/HandlerWrapper.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -1,201 +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.handler;
-
-// $Id$
-
-import javax.xml.namespace.QName;
-import javax.xml.rpc.JAXRPCException;
-import javax.xml.rpc.handler.Handler;
-import javax.xml.rpc.handler.HandlerInfo;
-import javax.xml.rpc.handler.MessageContext;
-import javax.xml.rpc.soap.SOAPFaultException;
-
-import org.jboss.logging.Logger;
-
-/**
- * A wrapper arround a {@link javax.xml.rpc.handler.Handler} that takes care of its lifecycle.
- *
- * @author thomas.diesler at jboss.org
- */
-public class HandlerWrapper implements Handler
-{
- private static Logger log = Logger.getLogger(HandlerWrapper.class);
-
- public final static int DOES_NOT_EXIST = 0;
- public final static int METHOD_READY = 1;
-
- // The states as string
- private static String[] stateNames = new String[]{"DOES_NOT_EXIST", "METHOD_READY"};
-
- // The handler to delegate to
- private Handler delegate;
- // The handler state
- private int state;
-
- /**
- * Delegate to the given handler
- */
- public HandlerWrapper(Handler handler)
- {
- delegate = handler;
- state = DOES_NOT_EXIST; // this is somewhat a lie ;-)
- }
-
- /**
- * Get the current state
- */
- public int getState()
- {
- return state;
- }
-
- /**
- * Get the current state as string
- */
- public String getStateAsString()
- {
- return stateNames[state];
- }
-
- /**
- * Gets the header blocks processed by this Handler instance.
- */
- public QName[] getHeaders()
- {
- return delegate.getHeaders();
- }
-
- /**
- * The init method enables the Handler instance to initialize itself.
- */
- public void init(HandlerInfo config) throws JAXRPCException
- {
- log.debug("init: " + delegate);
- delegate.init(config);
- state = METHOD_READY;
- }
-
- /**
- * The destroy method indicates the end of lifecycle for a Handler instance.
- */
- public void destroy() throws JAXRPCException
- {
- log.debug("destroy: " + delegate);
- state = DOES_NOT_EXIST;
- delegate.destroy();
- }
-
- /**
- * The handleRequest method processes the request message.
- */
- public boolean handleRequest(MessageContext msgContext) throws JAXRPCException, SOAPFaultException
- {
- if (state == DOES_NOT_EXIST)
- {
- log.warn("Handler is in state DOES_NOT_EXIST, skipping Handler.handleRequest for: " + delegate);
- return true;
- }
-
- try
- {
- return delegate.handleRequest(msgContext);
- }
- catch (RuntimeException e)
- {
- return handleRuntimeException(e);
- }
- }
-
- /**
- * The handleResponse method processes the response SOAP message.
- */
- public boolean handleResponse(MessageContext msgContext)
- {
- if (state == DOES_NOT_EXIST)
- {
- log.warn("Handler is in state DOES_NOT_EXIST, skipping Handler.handleResponse for: " + delegate);
- return true;
- }
-
- try
- {
- return delegate.handleResponse(msgContext);
- }
- catch (RuntimeException e)
- {
- return handleRuntimeException(e);
- }
- }
-
- /**
- * The handleFault method processes the SOAP faults based on the SOAP message processing model.
- */
- public boolean handleFault(MessageContext msgContext)
- {
- if (state == DOES_NOT_EXIST)
- {
- log.warn("Handler is in state DOES_NOT_EXIST, skipping Handler.handleFault for: " + delegate);
- return true;
- }
-
- try
- {
- return delegate.handleFault(msgContext);
- }
- catch (RuntimeException e)
- {
- return handleRuntimeException(e);
- }
- }
-
- /**
- * As defined by JAX-RPC, a RuntimeException(other than SOAPFaultException) thrown from any method of
- * the Handler results in the destroymethod being invoked and transition to the 'Does Not Exist' state.
- */
- private boolean handleRuntimeException(RuntimeException e)
- {
- if ((e instanceof SOAPFaultException) == false)
- {
- log.warn("RuntimeException in handler method, transition to DOES_NOT_EXIST");
- destroy();
- }
-
- throw e;
- }
-
- /**
- * Returns a hash code value for the object.
- */
- public int hashCode()
- {
- return delegate.hashCode();
- }
-
- /**
- * Returns a string representation of the object.
- */
- public String toString()
- {
- return "[state=" + getStateAsString() + ",handler=" + delegate + "]";
- }
-}
Deleted: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/handler/MessageContextImpl.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/handler/MessageContextImpl.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/handler/MessageContextImpl.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -1,109 +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.handler;
-
-// $Id$
-
-import java.util.HashMap;
-import java.util.Iterator;
-
-import javax.xml.rpc.handler.MessageContext;
-
-/**
- * The message context that is processed by a handler
- * in the handle method.
- * <p/>
- * Provides methods to manage a property set.
- * MessageContext properties enable handlers in a handler chain to share
- * processing related state.
- *
- * @author Thomas.Diesler at jboss.org
- * @since 06-May-2004
- */
-public class MessageContextImpl implements MessageContext
-{
- public static final String SERVLET_CONTEXT = "javax.xml.ws.servlet.context";
- public static final String SERVLET_REQUEST = "javax.xml.ws.servlet.request";
- public static final String SERVLET_RESPONSE = "javax.xml.ws.servlet.response";
- public static final String SERVLET_SESSION = "javax.xml.ws.servlet.session";
-
- // The map of the properties
- private HashMap<String, Object> props = new HashMap<String, Object>();
-
- /**
- * Returns true if the MessageContext contains a property with the specified name.
- *
- * @param name Name of the property whose presense is to be tested
- * @return Returns true if the MessageContext contains the property; otherwise false
- */
- public boolean containsProperty(String name)
- {
- return props.containsKey(name);
- }
-
- /**
- * Gets the value of a specific property from the MessageContext
- *
- * @param name Name of the property whose value is to be retrieved
- * @return Value of the property
- * @throws IllegalArgumentException if an illegal property name is specified
- */
- public Object getProperty(String name)
- {
- return props.get(name);
- }
-
- /**
- * Returns an Iterator view of the names of the properties in this MessageContext
- *
- * @return Iterator for the property names
- */
- public Iterator getPropertyNames()
- {
- return props.keySet().iterator();
- }
-
- /**
- * Removes a property (name-value pair) from the MessageContext
- *
- * @param name Name of the property to be removed
- * @throws IllegalArgumentException if an illegal property name is specified
- */
- public void removeProperty(String name)
- {
- props.remove(name);
- }
-
- /**
- * Sets the name and value of a property associated with the MessageContext.
- * If the MessageContext contains a value of the same property, the old value is replaced.
- *
- * @param name Name of the property associated with the MessageContext
- * @param value Value of the property
- * @throws IllegalArgumentException If some aspect of the property is prevents it from being stored in the context
- * @throws UnsupportedOperationException If this method is not supported.
- */
- public void setProperty(String name, Object value)
- {
- props.put(name, value);
- }
-}
Deleted: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/handler/ServerHandlerChain.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/handler/ServerHandlerChain.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/handler/ServerHandlerChain.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -1,62 +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.handler;
-
-// $Id$
-
-import java.util.List;
-import java.util.Set;
-
-import javax.xml.rpc.handler.MessageContext;
-
-import org.jboss.ws.metadata.j2ee.UnifiedHandlerMetaData.HandlerType;
-
-/**
- * Represents a list of handlers. All elements in the
- * HandlerChain are of the type javax.xml.rpc.handler.Handler.
- *
- * @author Thomas.Diesler at jboss.org
- * @since 06-May-2004
- */
-public class ServerHandlerChain extends HandlerChainBaseImpl
-{
- // The required type of the handler
- private HandlerType type;
-
- public ServerHandlerChain(List infos, Set roles, HandlerType type)
- {
- super(infos, roles);
- this.type = type;
- }
-
- public boolean handleRequest(MessageContext msgContext)
- {
- boolean doNext = super.handleRequest(msgContext);
- return doNext;
- }
-
- public boolean handleResponse(MessageContext msgContext)
- {
- boolean doNext = super.handleResponse(msgContext);
- return doNext;
- }
-}
Deleted: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/jboss/ServiceEndpointGenerator.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/jboss/ServiceEndpointGenerator.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/jboss/ServiceEndpointGenerator.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -1,274 +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.integration.jboss;
-
-//$Id: WebServiceDeployer.java 312 2006-05-11 10:49:22Z thomas.diesler at jboss.com $
-
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.jboss.deployment.DeploymentInfo;
-import org.jboss.logging.Logger;
-import org.jboss.system.server.ServerConfig;
-import org.jboss.system.server.ServerConfigLocator;
-import org.jboss.ws.utils.DOMUtils;
-import org.jboss.ws.utils.DOMWriter;
-import org.jboss.ws.WSException;
-import org.jboss.ws.metadata.EndpointMetaData;
-import org.jboss.ws.metadata.ServerEndpointMetaData;
-import org.jboss.ws.metadata.ServiceMetaData;
-import org.jboss.ws.metadata.UnifiedMetaData;
-import org.w3c.dom.Element;
-
-/**
- * Generate a web deployment for EJB endpoints
- *
- * @author Thomas.Diesler at jboss.org
- * @since 12-May-2006
- */
-public abstract class ServiceEndpointGenerator
-{
- // logging support
- protected Logger log = Logger.getLogger(ServiceEndpointGenerator.class);
-
- public URL generatWebDeployment(DeploymentInfo di, UnifiedMetaData wsMetaData) throws IOException
- {
- // Collect the list of PortComponentMetaData
- List<EndpointMetaData> epMetaDataList = new ArrayList<EndpointMetaData>();
- for (ServiceMetaData serviceMetaData : wsMetaData.getServices())
- {
- for (EndpointMetaData epMetaData : serviceMetaData.getEndpoints())
- {
- epMetaDataList.add(epMetaData);
- }
- }
-
- Element webDoc = createWebAppDescriptor(di, epMetaDataList);
- Element jbossDoc = createJBossWebAppDescriptor(di, epMetaDataList);
-
- File tmpWar = null;
- try
- {
- ServerConfig config = ServerConfigLocator.locate();
- File tmpdir = new File(config.getServerTempDir().getCanonicalPath() + "/deploy");
-
- String deploymentName = di.getCanonicalName().replace('/', '-') + "-ws";
- tmpWar = File.createTempFile(deploymentName, ".war", tmpdir);
- tmpWar.delete();
- File webInf = new File(tmpWar, "WEB-INF");
- webInf.mkdirs();
-
- File webXml = new File(webInf, "web.xml");
- FileWriter fw = new FileWriter(webXml);
- new DOMWriter(fw).setPrettyprint(true).print(webDoc);
- fw.close();
-
- File jbossWebXml = new File(webInf, "jboss-web.xml");
- fw = new FileWriter(jbossWebXml);
- new DOMWriter(fw).setPrettyprint(true).print(jbossDoc);
- fw.close();
- }
- catch (IOException e)
- {
- throw new WSException("Failed to create webservice.war", e);
- }
-
- return tmpWar.toURL();
- }
-
- private Element createWebAppDescriptor(DeploymentInfo di, List<EndpointMetaData> epMetaDataList)
- {
- Element webApp = DOMUtils.createElement("web-app");
-
- /*
- <servlet>
- <servlet-name>
- <servlet-class>
- </servlet>
- */
- for (EndpointMetaData epMetaData : epMetaDataList)
- {
- ServerEndpointMetaData sepMetaData = (ServerEndpointMetaData)epMetaData;
- String ejbName = sepMetaData.getLinkName();
- Element servlet = (Element)webApp.appendChild(DOMUtils.createElement("servlet"));
- Element servletName = (Element)servlet.appendChild(DOMUtils.createElement("servlet-name"));
- servletName.appendChild(DOMUtils.createTextNode(ejbName));
- Element servletClass = (Element)servlet.appendChild(DOMUtils.createElement("servlet-class"));
- String targetBean = sepMetaData.getServiceEndpointImplName();
- String seiName = sepMetaData.getServiceEndpointInterfaceName();
- String servletClassName = (targetBean != null ? targetBean : seiName);
- servletClass.appendChild(DOMUtils.createTextNode(servletClassName));
- }
-
- /*
- <servlet-mapping>
- <servlet-name>
- <url-pattern>
- </servlet-mapping>
- */
- ArrayList urlPatters = new ArrayList();
- for (EndpointMetaData epMetaData : epMetaDataList)
- {
- ServerEndpointMetaData sepMetaData = (ServerEndpointMetaData)epMetaData;
- String ejbName = sepMetaData.getLinkName();
- Element servletMapping = (Element)webApp.appendChild(DOMUtils.createElement("servlet-mapping"));
- Element servletName = (Element)servletMapping.appendChild(DOMUtils.createElement("servlet-name"));
- servletName.appendChild(DOMUtils.createTextNode(ejbName));
- Element urlPatternElement = (Element)servletMapping.appendChild(DOMUtils.createElement("url-pattern"));
-
- String urlPattern = "/*";
- if (sepMetaData.getURLPattern() != null)
- {
- urlPattern = sepMetaData.getURLPattern();
- }
-
- if (urlPatters.contains(urlPattern))
- throw new IllegalArgumentException("Cannot use the same url-pattern with different endpoints, " + "check your <port-component-uri> in jboss.xml");
-
- urlPatternElement.appendChild(DOMUtils.createTextNode(urlPattern));
- urlPatters.add(urlPattern);
- }
-
- String authMethod = null;
-
- // Add web-app/security-constraint for each port component
- for (EndpointMetaData epMetaData : epMetaDataList)
- {
- ServerEndpointMetaData sepMetaData = (ServerEndpointMetaData)epMetaData;
- String ejbName = sepMetaData.getLinkName();
- if (sepMetaData.getAuthMethod() != null || sepMetaData.getTransportGuarantee() != null)
- {
- /*
- <security-constraint>
- <web-resource-collection>
- <web-resource-name>TestUnAuthPort</web-resource-name>
- <url-pattern>/HSTestRoot/TestUnAuth/*</url-pattern>
- </web-resource-collection>
- <auth-constraint>
- <role-name>*</role-name>
- </auth-constraint>
- <user-data-constraint>
- <transport-guarantee>NONE</transport-guarantee>
- </user-data-constraint>
- </security-constraint>
- */
- Element securityConstraint = (Element)webApp.appendChild(DOMUtils.createElement("security-constraint"));
- Element wrc = (Element)securityConstraint.appendChild(DOMUtils.createElement("web-resource-collection"));
- Element wrName = (Element)wrc.appendChild(DOMUtils.createElement("web-resource-name"));
- wrName.appendChild(DOMUtils.createTextNode(ejbName));
- Element pattern = (Element)wrc.appendChild(DOMUtils.createElement("url-pattern"));
- String uri = sepMetaData.getURLPattern();
- pattern.appendChild(DOMUtils.createTextNode(uri));
- Element method = (Element)wrc.appendChild(DOMUtils.createElement("http-method"));
- method.appendChild(DOMUtils.createTextNode("GET"));
- method = (Element)wrc.appendChild(DOMUtils.createElement("http-method"));
- method.appendChild(DOMUtils.createTextNode("POST"));
-
- // Optional auth-constraint
- if (sepMetaData.getAuthMethod() != null)
- {
- // Only the first auth-method gives the war login-config/auth-method
- if (authMethod == null)
- authMethod = sepMetaData.getAuthMethod();
-
- Element authConstraint = (Element)securityConstraint.appendChild(DOMUtils.createElement("auth-constraint"));
- Element roleName = (Element)authConstraint.appendChild(DOMUtils.createElement("role-name"));
- roleName.appendChild(DOMUtils.createTextNode("*"));
- }
- // Optional user-data-constraint
- if (sepMetaData.getTransportGuarantee() != null)
- {
- Element userData = (Element)securityConstraint.appendChild(DOMUtils.createElement("user-data-constraint"));
- Element transport = (Element)userData.appendChild(DOMUtils.createElement("transport-guarantee"));
- transport.appendChild(DOMUtils.createTextNode(sepMetaData.getTransportGuarantee()));
- }
- }
- }
-
- // Optional login-config/auth-method
- if (authMethod != null)
- {
- Element loginConfig = (Element)webApp.appendChild(DOMUtils.createElement("login-config"));
- Element method = (Element)loginConfig.appendChild(DOMUtils.createElement("auth-method"));
- method.appendChild(DOMUtils.createTextNode(authMethod));
- Element realm = (Element)loginConfig.appendChild(DOMUtils.createElement("realm-name"));
- realm.appendChild(DOMUtils.createTextNode("EJBServiceEndpointServlet Realm"));
-
- addEJBSecurityRoles(di, webApp);
- }
-
- return webApp;
- }
-
- private Element createJBossWebAppDescriptor(DeploymentInfo di, List<EndpointMetaData> epMetaDataList)
- {
- /* Create a jboss-web
- <jboss-web>
- <security-domain>java:/jaas/cts</security-domain>
- <context-root>/ws/ejbN/</context-root>
- </jboss-web>
- */
- Element jbossWeb = DOMUtils.createElement("jboss-web");
-
- UnifiedMetaData wsMetaData = epMetaDataList.get(0).getServiceMetaData().getUnifiedMetaData();
- String securityDomain = wsMetaData.getSecurityDomain();
- if (securityDomain != null)
- {
- Element secDomain = (Element)jbossWeb.appendChild(DOMUtils.createElement("security-domain"));
- secDomain.appendChild(DOMUtils.createTextNode("java:/jaas/" + securityDomain));
- }
-
- // Get the context root for this deployment
- String contextRoot = null;
- for (EndpointMetaData epMetaData : epMetaDataList)
- {
- ServerEndpointMetaData sepMetaData = (ServerEndpointMetaData)epMetaData;
- String next = sepMetaData.getContextRoot();
- if (next != null)
- {
- if (contextRoot == null)
- {
- contextRoot = next;
- }
- else if (contextRoot.equals(next) == false)
- {
- throw new WSException("Multiple context root not supported");
- }
- }
- }
- if (contextRoot == null)
- throw new WSException("Cannot obtain context root");
-
- Element root = (Element)jbossWeb.appendChild(DOMUtils.createElement("context-root"));
- root.appendChild(DOMUtils.createTextNode(contextRoot));
-
- return jbossWeb;
- }
-
- /** Add the roles from ejb-jar.xml to the security roles
- */
- protected abstract void addEJBSecurityRoles(DeploymentInfo di, Element webApp);
-}
Added: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/jboss/ServiceEndpointGeneratorEJB.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/jboss/ServiceEndpointGeneratorEJB.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/jboss/ServiceEndpointGeneratorEJB.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -0,0 +1,274 @@
+/*
+ * 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.integration.jboss;
+
+//$Id$
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jboss.deployment.DeploymentInfo;
+import org.jboss.logging.Logger;
+import org.jboss.system.server.ServerConfig;
+import org.jboss.system.server.ServerConfigLocator;
+import org.jboss.ws.utils.DOMUtils;
+import org.jboss.ws.utils.DOMWriter;
+import org.jboss.ws.WSException;
+import org.jboss.ws.metadata.EndpointMetaData;
+import org.jboss.ws.metadata.ServerEndpointMetaData;
+import org.jboss.ws.metadata.ServiceMetaData;
+import org.jboss.ws.metadata.UnifiedMetaData;
+import org.w3c.dom.Element;
+
+/**
+ * Generate a web deployment for EJB endpoints
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 12-May-2006
+ */
+public abstract class ServiceEndpointGeneratorEJB
+{
+ // logging support
+ protected Logger log = Logger.getLogger(ServiceEndpointGeneratorEJB.class);
+
+ public URL generatWebDeployment(DeploymentInfo di, UnifiedMetaData wsMetaData) throws IOException
+ {
+ // Collect the list of PortComponentMetaData
+ List<EndpointMetaData> epMetaDataList = new ArrayList<EndpointMetaData>();
+ for (ServiceMetaData serviceMetaData : wsMetaData.getServices())
+ {
+ for (EndpointMetaData epMetaData : serviceMetaData.getEndpoints())
+ {
+ epMetaDataList.add(epMetaData);
+ }
+ }
+
+ Element webDoc = createWebAppDescriptor(di, epMetaDataList);
+ Element jbossDoc = createJBossWebAppDescriptor(di, epMetaDataList);
+
+ File tmpWar = null;
+ try
+ {
+ ServerConfig config = ServerConfigLocator.locate();
+ File tmpdir = new File(config.getServerTempDir().getCanonicalPath() + "/deploy");
+
+ String deploymentName = di.getCanonicalName().replace('/', '-') + "-ws";
+ tmpWar = File.createTempFile(deploymentName, ".war", tmpdir);
+ tmpWar.delete();
+ File webInf = new File(tmpWar, "WEB-INF");
+ webInf.mkdirs();
+
+ File webXml = new File(webInf, "web.xml");
+ FileWriter fw = new FileWriter(webXml);
+ new DOMWriter(fw).setPrettyprint(true).print(webDoc);
+ fw.close();
+
+ File jbossWebXml = new File(webInf, "jboss-web.xml");
+ fw = new FileWriter(jbossWebXml);
+ new DOMWriter(fw).setPrettyprint(true).print(jbossDoc);
+ fw.close();
+ }
+ catch (IOException e)
+ {
+ throw new WSException("Failed to create webservice.war", e);
+ }
+
+ return tmpWar.toURL();
+ }
+
+ private Element createWebAppDescriptor(DeploymentInfo di, List<EndpointMetaData> epMetaDataList)
+ {
+ Element webApp = DOMUtils.createElement("web-app");
+
+ /*
+ <servlet>
+ <servlet-name>
+ <servlet-class>
+ </servlet>
+ */
+ for (EndpointMetaData epMetaData : epMetaDataList)
+ {
+ ServerEndpointMetaData sepMetaData = (ServerEndpointMetaData)epMetaData;
+ String ejbName = sepMetaData.getLinkName();
+ Element servlet = (Element)webApp.appendChild(DOMUtils.createElement("servlet"));
+ Element servletName = (Element)servlet.appendChild(DOMUtils.createElement("servlet-name"));
+ servletName.appendChild(DOMUtils.createTextNode(ejbName));
+ Element servletClass = (Element)servlet.appendChild(DOMUtils.createElement("servlet-class"));
+ String targetBean = sepMetaData.getServiceEndpointImplName();
+ String seiName = sepMetaData.getServiceEndpointInterfaceName();
+ String servletClassName = (targetBean != null ? targetBean : seiName);
+ servletClass.appendChild(DOMUtils.createTextNode(servletClassName));
+ }
+
+ /*
+ <servlet-mapping>
+ <servlet-name>
+ <url-pattern>
+ </servlet-mapping>
+ */
+ ArrayList urlPatters = new ArrayList();
+ for (EndpointMetaData epMetaData : epMetaDataList)
+ {
+ ServerEndpointMetaData sepMetaData = (ServerEndpointMetaData)epMetaData;
+ String ejbName = sepMetaData.getLinkName();
+ Element servletMapping = (Element)webApp.appendChild(DOMUtils.createElement("servlet-mapping"));
+ Element servletName = (Element)servletMapping.appendChild(DOMUtils.createElement("servlet-name"));
+ servletName.appendChild(DOMUtils.createTextNode(ejbName));
+ Element urlPatternElement = (Element)servletMapping.appendChild(DOMUtils.createElement("url-pattern"));
+
+ String urlPattern = "/*";
+ if (sepMetaData.getURLPattern() != null)
+ {
+ urlPattern = sepMetaData.getURLPattern();
+ }
+
+ if (urlPatters.contains(urlPattern))
+ throw new IllegalArgumentException("Cannot use the same url-pattern with different endpoints, " + "check your <port-component-uri> in jboss.xml");
+
+ urlPatternElement.appendChild(DOMUtils.createTextNode(urlPattern));
+ urlPatters.add(urlPattern);
+ }
+
+ String authMethod = null;
+
+ // Add web-app/security-constraint for each port component
+ for (EndpointMetaData epMetaData : epMetaDataList)
+ {
+ ServerEndpointMetaData sepMetaData = (ServerEndpointMetaData)epMetaData;
+ String ejbName = sepMetaData.getLinkName();
+ if (sepMetaData.getAuthMethod() != null || sepMetaData.getTransportGuarantee() != null)
+ {
+ /*
+ <security-constraint>
+ <web-resource-collection>
+ <web-resource-name>TestUnAuthPort</web-resource-name>
+ <url-pattern>/HSTestRoot/TestUnAuth/*</url-pattern>
+ </web-resource-collection>
+ <auth-constraint>
+ <role-name>*</role-name>
+ </auth-constraint>
+ <user-data-constraint>
+ <transport-guarantee>NONE</transport-guarantee>
+ </user-data-constraint>
+ </security-constraint>
+ */
+ Element securityConstraint = (Element)webApp.appendChild(DOMUtils.createElement("security-constraint"));
+ Element wrc = (Element)securityConstraint.appendChild(DOMUtils.createElement("web-resource-collection"));
+ Element wrName = (Element)wrc.appendChild(DOMUtils.createElement("web-resource-name"));
+ wrName.appendChild(DOMUtils.createTextNode(ejbName));
+ Element pattern = (Element)wrc.appendChild(DOMUtils.createElement("url-pattern"));
+ String uri = sepMetaData.getURLPattern();
+ pattern.appendChild(DOMUtils.createTextNode(uri));
+ Element method = (Element)wrc.appendChild(DOMUtils.createElement("http-method"));
+ method.appendChild(DOMUtils.createTextNode("GET"));
+ method = (Element)wrc.appendChild(DOMUtils.createElement("http-method"));
+ method.appendChild(DOMUtils.createTextNode("POST"));
+
+ // Optional auth-constraint
+ if (sepMetaData.getAuthMethod() != null)
+ {
+ // Only the first auth-method gives the war login-config/auth-method
+ if (authMethod == null)
+ authMethod = sepMetaData.getAuthMethod();
+
+ Element authConstraint = (Element)securityConstraint.appendChild(DOMUtils.createElement("auth-constraint"));
+ Element roleName = (Element)authConstraint.appendChild(DOMUtils.createElement("role-name"));
+ roleName.appendChild(DOMUtils.createTextNode("*"));
+ }
+ // Optional user-data-constraint
+ if (sepMetaData.getTransportGuarantee() != null)
+ {
+ Element userData = (Element)securityConstraint.appendChild(DOMUtils.createElement("user-data-constraint"));
+ Element transport = (Element)userData.appendChild(DOMUtils.createElement("transport-guarantee"));
+ transport.appendChild(DOMUtils.createTextNode(sepMetaData.getTransportGuarantee()));
+ }
+ }
+ }
+
+ // Optional login-config/auth-method
+ if (authMethod != null)
+ {
+ Element loginConfig = (Element)webApp.appendChild(DOMUtils.createElement("login-config"));
+ Element method = (Element)loginConfig.appendChild(DOMUtils.createElement("auth-method"));
+ method.appendChild(DOMUtils.createTextNode(authMethod));
+ Element realm = (Element)loginConfig.appendChild(DOMUtils.createElement("realm-name"));
+ realm.appendChild(DOMUtils.createTextNode("EJBServiceEndpointServlet Realm"));
+
+ addEJBSecurityRoles(di, webApp);
+ }
+
+ return webApp;
+ }
+
+ private Element createJBossWebAppDescriptor(DeploymentInfo di, List<EndpointMetaData> epMetaDataList)
+ {
+ /* Create a jboss-web
+ <jboss-web>
+ <security-domain>java:/jaas/cts</security-domain>
+ <context-root>/ws/ejbN/</context-root>
+ </jboss-web>
+ */
+ Element jbossWeb = DOMUtils.createElement("jboss-web");
+
+ UnifiedMetaData wsMetaData = epMetaDataList.get(0).getServiceMetaData().getUnifiedMetaData();
+ String securityDomain = wsMetaData.getSecurityDomain();
+ if (securityDomain != null)
+ {
+ Element secDomain = (Element)jbossWeb.appendChild(DOMUtils.createElement("security-domain"));
+ secDomain.appendChild(DOMUtils.createTextNode("java:/jaas/" + securityDomain));
+ }
+
+ // Get the context root for this deployment
+ String contextRoot = null;
+ for (EndpointMetaData epMetaData : epMetaDataList)
+ {
+ ServerEndpointMetaData sepMetaData = (ServerEndpointMetaData)epMetaData;
+ String next = sepMetaData.getContextRoot();
+ if (next != null)
+ {
+ if (contextRoot == null)
+ {
+ contextRoot = next;
+ }
+ else if (contextRoot.equals(next) == false)
+ {
+ throw new WSException("Multiple context root not supported");
+ }
+ }
+ }
+ if (contextRoot == null)
+ throw new WSException("Cannot obtain context root");
+
+ Element root = (Element)jbossWeb.appendChild(DOMUtils.createElement("context-root"));
+ root.appendChild(DOMUtils.createTextNode(contextRoot));
+
+ return jbossWeb;
+ }
+
+ /** Add the roles from ejb-jar.xml to the security roles
+ */
+ protected abstract void addEJBSecurityRoles(DeploymentInfo di, Element webApp);
+}
Property changes on: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/jboss/ServiceEndpointGeneratorEJB.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/jboss/jms/JMSMessageDispatcher.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/jboss/jms/JMSMessageDispatcher.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/jboss/jms/JMSMessageDispatcher.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -0,0 +1,115 @@
+/*
+ * 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.integration.jboss.jms;
+
+// $Id$
+
+import java.io.InputStream;
+import java.rmi.RemoteException;
+
+import javax.management.ObjectName;
+import javax.xml.soap.SOAPMessage;
+
+import org.jboss.logging.Logger;
+import org.jboss.util.NotImplementedException;
+import org.jboss.ws.WSException;
+import org.jboss.ws.binding.BindingException;
+import org.jboss.ws.common.CommonMessageContext;
+import org.jboss.ws.integration.jboss.ServiceEndpointInvokerMDB;
+import org.jboss.ws.metadata.ServerEndpointMetaData;
+import org.jboss.ws.server.ServiceEndpoint;
+import org.jboss.ws.server.ServiceEndpointInvoker;
+import org.jboss.ws.server.ServiceEndpointManager;
+import org.jboss.ws.server.ServiceEndpointManagerFactory;
+import org.jboss.ws.soap.MessageContextAssociation;
+
+/**
+ * A dispatcher for SOAPMessages
+ *
+ * @author Thomas.Diesler at jboss.org
+ */
+public class JMSMessageDispatcher implements MessageDispatcher
+{
+ // logging support
+ protected Logger log = Logger.getLogger(JMSMessageDispatcher.class);
+
+ /** Dispatch the message to the underlying SOAP engine
+ */
+ public SOAPMessage dipatchMessage(String fromName, Object targetBean, InputStream reqMessage) throws RemoteException
+ {
+ try
+ {
+ ServiceEndpointManagerFactory factory = ServiceEndpointManagerFactory.getInstance();
+ ServiceEndpointManager epManager = factory.getServiceEndpointManager();
+ ObjectName sepID = getServiceEndpointForDestination(epManager, fromName);
+
+ if (sepID == null)
+ throw new WSException("Cannot find serviceID for: " + fromName);
+
+ log.debug("dipatchMessage: " + sepID);
+
+ // Setup the MDB invoker
+ ServiceEndpoint sep = epManager.getServiceEndpointByID(sepID);
+ ServerEndpointMetaData sepMetaData = sep.getServiceEndpointInfo().getServerEndpointMetaData();
+
+ ServiceEndpointInvoker invoker = sep.getServiceEndpointInfo().getInvoker();
+ if (invoker instanceof ServiceEndpointInvokerMDB)
+ {
+ ServiceEndpointInvokerMDB mdbInvoker = (ServiceEndpointInvokerMDB)invoker;
+ mdbInvoker.setTargetBeanObject(targetBean);
+ }
+
+ // Associate a message context with the current thread
+ CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
+ msgContext.setEndpointMetaData(sepMetaData);
+
+ return sep.handleRequest(null, null, reqMessage);
+ }
+ catch (BindingException ex)
+ {
+ throw new WSException("Cannot bind incomming soap message", ex);
+ }
+ }
+
+ /** Dispatch the message to the underlying SOAP engine
+ */
+ public SOAPMessage delegateMessage(String serviceID, InputStream soapMessage) throws RemoteException
+ {
+ throw new NotImplementedException();
+ }
+
+ // The destination jndiName is encoded in the service object name under key 'jms'
+ private ObjectName getServiceEndpointForDestination(ServiceEndpointManager epManager, String fromName)
+ {
+ ObjectName sepID = null;
+ for (ObjectName aux : epManager.getServiceEndpoints())
+ {
+ String jmsProp = aux.getKeyProperty("jms");
+ if (jmsProp != null && jmsProp.equals(fromName))
+ {
+ sepID = aux;
+ break;
+ }
+ }
+ return sepID;
+ }
+}
Property changes on: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/jboss/jms/JMSMessageDispatcher.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/jboss/jms/JMSTransportSupport.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/jboss/jms/JMSTransportSupport.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/jboss/jms/JMSTransportSupport.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -0,0 +1,255 @@
+/*
+ * 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.integration.jboss.jms;
+
+// $Id$
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.rmi.RemoteException;
+
+import javax.ejb.EJBException;
+import javax.ejb.MessageDrivenBean;
+import javax.ejb.MessageDrivenContext;
+import javax.jms.BytesMessage;
+import javax.jms.Destination;
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.MessageListener;
+import javax.jms.Queue;
+import javax.jms.QueueConnection;
+import javax.jms.QueueConnectionFactory;
+import javax.jms.QueueSender;
+import javax.jms.QueueSession;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import javax.jms.Topic;
+import javax.naming.InitialContext;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPMessage;
+
+import org.jboss.logging.Logger;
+import org.jboss.util.NestedRuntimeException;
+import org.jboss.ws.common.CommonMessageContext;
+import org.jboss.ws.jaxrpc.handler.SOAPMessageContextJAXRPC;
+import org.jboss.ws.soap.MessageContextAssociation;
+
+/**
+ * The abstract base class for MDBs that want to act as web service endpoints.
+ * A subclass should only need to implement the service endpoint interface.
+ *
+ * @author Thomas.Diesler at jboss.org
+ */
+public abstract class JMSTransportSupport implements MessageDrivenBean, MessageListener
+{
+ // logging support
+ protected Logger log = Logger.getLogger(JMSTransportSupport.class);
+
+ //private MessageDrivenContext mdbCtx;
+ private QueueConnectionFactory queueFactory;
+
+ /**
+ * All messages come in here, if it is a BytesMessage we pass it on for further processing.
+ */
+ public void onMessage(Message message)
+ {
+ try
+ {
+ String msgStr = null;
+ if (message instanceof BytesMessage)
+ {
+ msgStr = getMessageStr((BytesMessage)message);
+ }
+ else if (message instanceof TextMessage)
+ {
+ msgStr = ((TextMessage)message).getText();
+ }
+ else
+ {
+ log.warn("Invalid message type: " + message);
+ return;
+ }
+
+ log.debug("Incomming SOAP message: " + msgStr);
+
+ String fromName = null;
+ Destination destination = message.getJMSDestination();
+ if (destination instanceof Queue)
+ fromName = "queue/" + ((Queue)destination).getQueueName();
+ if (destination instanceof Topic)
+ fromName = "topic/" + ((Topic)destination).getTopicName();
+
+ // Associate a message context with the current thread
+ CommonMessageContext msgContext = new SOAPMessageContextJAXRPC();
+ MessageContextAssociation.pushMessageContext(msgContext);
+ try
+ {
+
+ InputStream reqMessage = new ByteArrayInputStream(msgStr.getBytes());
+ SOAPMessage resMessage = processSOAPMessage(fromName, reqMessage);
+
+ if (resMessage != null)
+ {
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ resMessage.writeTo(baos);
+
+ msgStr = new String(baos.toByteArray());
+ log.debug("Outgoing SOAP message: " + msgStr);
+
+ Queue replyQueue = getReplyQueue(message);
+ if (replyQueue != null)
+ {
+ sendResponse(replyQueue, msgStr);
+ }
+ else
+ {
+ log.warn("No reply queue, ignore response message");
+ }
+ }
+ else
+ {
+ log.debug("SOAP response message is null");
+ }
+ }
+ finally
+ {
+ MessageContextAssociation.popMessageContext();
+ }
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (Exception e)
+ {
+ throw new EJBException(e);
+ }
+ }
+
+ protected SOAPMessage processSOAPMessage(String fromName, InputStream reqMessage) throws SOAPException, IOException, RemoteException
+ {
+ MessageDispatcher msgDispatcher = new JMSMessageDispatcher();
+ SOAPMessage resMessage = msgDispatcher.dipatchMessage(fromName, this, reqMessage);
+ return resMessage;
+ }
+
+ private String getMessageStr(BytesMessage message) throws Exception
+ {
+ byte[] buffer = new byte[8 * 1024];
+ ByteArrayOutputStream out = new ByteArrayOutputStream(buffer.length);
+ int read = message.readBytes(buffer);
+ while (read != -1)
+ {
+ out.write(buffer, 0, read);
+ read = message.readBytes(buffer);
+ }
+
+ byte[] msgBytes = out.toByteArray();
+ return new String(msgBytes);
+ }
+
+ /**
+ * Get the reply queue.
+ */
+ protected Queue getReplyQueue(Message message) throws JMSException
+ {
+ Queue replyQueue = (Queue)message.getJMSReplyTo();
+ return replyQueue;
+ }
+
+ /**
+ * Respond to the call by sending a message to the reply queue
+ */
+ protected void sendResponse(Queue replyQueue, String msgStr) throws SOAPException, IOException, JMSException
+ {
+ QueueConnection qc = queueFactory.createQueueConnection();
+ QueueSession session = qc.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
+ QueueSender sender = null;
+ try
+ {
+ sender = session.createSender(replyQueue);
+ TextMessage responseMessage = session.createTextMessage(msgStr);
+ sender.send(responseMessage);
+ log.info("Sent response");
+ }
+ finally
+ {
+ try
+ {
+ sender.close();
+ }
+ catch (JMSException ignored)
+ {
+ }
+ try
+ {
+ session.close();
+ }
+ catch (JMSException ignored)
+ {
+ }
+ try
+ {
+ qc.close();
+ }
+ catch (JMSException ignored)
+ {
+ }
+ }
+ }
+
+ // MDB lifecycle methods ********************************************************************************************
+
+ public void ejbCreate()
+ {
+ try
+ {
+ InitialContext ctx = new InitialContext();
+ queueFactory = (QueueConnectionFactory)ctx.lookup("java:/ConnectionFactory");
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (Exception e)
+ {
+ throw new NestedRuntimeException(e);
+ }
+ }
+
+ /**
+ * A container invokes this method before it ends the life of the message-driven object.
+ */
+ public void ejbRemove() throws EJBException
+ {
+ }
+
+ /**
+ * Set the associated message-driven context.
+ */
+ public void setMessageDrivenContext(MessageDrivenContext ctx) throws EJBException
+ {
+ //this.mdbCtx = ctx;
+ }
+}
Property changes on: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/jboss/jms/JMSTransportSupport.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/jboss/jms/MessageDispatcher.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/jboss/jms/MessageDispatcher.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/jboss/jms/MessageDispatcher.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -0,0 +1,46 @@
+/*
+ * 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.integration.jboss.jms;
+
+// $Id:MessageDispatcher.java 898 2006-09-05 08:23:03Z thomas.diesler at jboss.com $
+
+import java.io.InputStream;
+import java.rmi.RemoteException;
+
+import javax.xml.soap.SOAPMessage;
+
+/**
+ * A dispatcher for SOAPMessages
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 19-Feb-2006
+ */
+public interface MessageDispatcher
+{
+ /** Dispatch the message to the underlying SOAP engine
+ */
+ SOAPMessage dipatchMessage(String fromName, Object targetImplBean, InputStream reqMessage) throws RemoteException;
+
+ /** Dispatch the message to the underlying SOAP engine
+ */
+ SOAPMessage delegateMessage(String serviceID, InputStream reqMessage) throws RemoteException;
+}
\ No newline at end of file
Property changes on: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/jboss/jms/MessageDispatcher.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Deleted: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/other/ContextServlet.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/other/ContextServlet.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/other/ContextServlet.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -1,110 +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.integration.other;
-
-// $Id: ContextServlet.java 293 2006-05-08 16:31:50Z thomas.diesler at jboss.com $
-
-import java.io.File;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.net.URL;
-
-import javax.servlet.ServletConfig;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.WSException;
-import org.jboss.ws.server.ServiceEndpointManager;
-import org.jboss.ws.server.ServiceEndpointManagerFactory;
-
-/**
- * The servlet that that is associated with context /jbossws
- *
- * @author Thomas.Diesler at jboss.org
- * @since 21-Mar-2005
- */
-public class ContextServlet extends HttpServlet
-{
- // provide logging
- protected final Logger log = Logger.getLogger(ContextServlet.class);
-
- protected ServiceEndpointManager epManager;
-
- public void init(ServletConfig config) throws ServletException
- {
- super.init(config);
- initServiceEndpointManager();
- }
-
- private void initServiceEndpointManager()
- {
- try
- {
- URL beansXML = new File(getServletContext().getRealPath("/META-INF/jboss-beans.xml")).toURL();
- if (beansXML == null)
- throw new IllegalStateException("Invalid null kernel deployment");
-
- new KernelBootstrap().bootstrap(beansXML);
- }
- catch (RuntimeException rte)
- {
- throw rte;
- }
- catch (Exception ex)
- {
- throw new WSException("Cannot bootstrap kernel", ex);
- }
-
- // Initialize the ServiceEndpointManager
- ServiceEndpointManagerFactory factory = ServiceEndpointManagerFactory.getInstance();
- epManager = factory.getServiceEndpointManager();
- }
-
- /** Process GET requests.
- */
- public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
- {
- PrintWriter writer = res.getWriter();
- res.setContentType("text/html");
-
- writer.print("<html>");
- setupHTMLResponseHeader(writer);
-
- writer.print("<body>");
- writer.print(epManager.showServiceEndpointTable());
- writer.print("</body>");
- writer.print("</html>");
- writer.close();
- }
-
- private void setupHTMLResponseHeader(PrintWriter writer)
- {
- writer.println("<head>");
- writer.println("<meta http-equiv='Content-Type content='text/html; charset=iso-8859-1'>");
- writer.println("<title>JBossWS</title>");
- writer.println("<link rel='stylesheet' href='./styles.css'>");
- writer.println("</head>");
- }
-}
Deleted: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/other/CrossContextLoader.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/other/CrossContextLoader.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/other/CrossContextLoader.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -1,96 +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.integration.other;
-
-// $Id: ContextServlet.java 293 2006-05-08 16:31:50Z thomas.diesler at jboss.com $
-
-import java.io.File;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.net.URLClassLoader;
-
-import javax.servlet.ServletContext;
-
-/**
- * A URLClassLoader that provides access to the webapp base dir
- *
- * @author Thomas.Diesler at jboss.org
- * @since 16-May-2006
- */
-public class CrossContextLoader extends URLClassLoader
-{
- public CrossContextLoader(URL[] urls, ClassLoader parent)
- {
- super(urls, parent);
- }
-
- public static CrossContextLoader newInstance(ServletContext context)
- {
- ClassLoader parent = Thread.currentThread().getContextClassLoader();
- if (parent instanceof CrossContextLoader)
- throw new IllegalStateException("Circular classloader parent association");
-
- CrossContextLoader loader = new CrossContextLoader(new URL[] {}, parent);
-
- String path = context.getRealPath("/");
- File contextDir = new File(path);
- if (contextDir.exists() == false || contextDir.isDirectory() == false)
- throw new IllegalStateException("Cannot find expanded dir: " + contextDir);
-
- // Add URL to context root
- loader.addURL(toURL(contextDir));
-
- File jbosswsDir = new File(path + "../jbossws");
- if (jbosswsDir.exists() == false || jbosswsDir.isDirectory() == false)
- throw new IllegalStateException("Cannot find expanded dir: " + jbosswsDir);
-
- // Add URL to jbossws context root
- loader.addURL(toURL(jbosswsDir));
-
- // Add jars in jbossws/WEB-INF/lib
- File libDir = new File(path + "../jbossws/WEB-INF/lib");
- if (libDir.exists() && libDir.isDirectory())
- {
- File[] files = libDir.listFiles();
- for (int i=0; i < files.length; i++)
- {
- File file = files[i];
- loader.addURL(toURL(file));
- }
- }
-
- return loader;
- }
-
- private static URL toURL(File file)
- {
- try
- {
- return file.toURL();
- }
- catch (MalformedURLException e)
- {
- // ignore
- return null;
- }
- }
-}
Deleted: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/other/DeploymentInfoAdaptor.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/other/DeploymentInfoAdaptor.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/other/DeploymentInfoAdaptor.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -1,165 +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.integration.other;
-
-// $Id: WebServiceDeploymentAdaptor.java 317 2006-05-14 17:16:59Z thomas.diesler at jboss.com $
-
-import java.io.File;
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-import javax.servlet.ServletContext;
-
-import org.jboss.ws.utils.DOMUtils;
-import org.jboss.ws.WSException;
-import org.jboss.ws.deployment.UnifiedDeploymentInfo;
-import org.jboss.ws.deployment.ServiceEndpointPublisher;
-import org.jboss.ws.metadata.j2ee.UnifiedWebMetaData;
-import org.w3c.dom.Element;
-
-/**
- * Build container independent deployment info.
- *
- * @author Thomas.Diesler at jboss.org
- * @since 05-May-2006
- */
-public class DeploymentInfoAdaptor
-{
- public static UnifiedDeploymentInfo buildDeploymentInfo(UnifiedDeploymentInfo udi, URLClassLoader loader, ServletContext ctx)
- {
- URL warURL = null;
- try
- {
- warURL = new File(ctx.getRealPath("/")).toURL();
- }
- catch (MalformedURLException e)
- {
- // ignore
- }
-
- String shortName = getContextRoot(warURL);
- shortName = shortName.substring(1) + ".war";
-
- udi.shortName = shortName;
- udi.localUrl = warURL;
- udi.url = warURL;
- udi.metaData = buildWebMetaData(udi, ctx);
- udi.annotationsCl = loader.getParent();
- udi.localCl = loader;
- udi.ucl = loader.getParent();
- udi.deployedObject = null;
-
- return udi;
- }
-
- private static UnifiedWebMetaData buildWebMetaData(UnifiedDeploymentInfo udi, ServletContext ctx)
- {
- Element webXML = getWebXMLDocument(ctx);
-
- UnifiedWebMetaData wmd = new UnifiedWebMetaData();
- wmd.setServletMappings(getServetMappings(webXML));
- wmd.setServletClassMap(getServetClassMap(webXML));
- wmd.setContextRoot(getContextRoot(udi.url));
- wmd.setConfigName(ctx.getInitParameter("jbossws-config-name"));
- wmd.setConfigFile(ctx.getInitParameter("jbossws-config-file"));
- wmd.setContextLoader(udi.ucl);
-
- return wmd;
- }
-
- private static String getContextRoot(URL warURL)
- {
- String contextRoot = warURL.toExternalForm();
- if (contextRoot.endsWith("/"))
- {
- contextRoot = contextRoot.substring(0, contextRoot.length() - 1);
- }
- contextRoot = contextRoot.substring(contextRoot.lastIndexOf("/"));
- if (contextRoot.endsWith(".war"))
- {
- contextRoot = contextRoot.substring(0, contextRoot.length() - 4);
- }
- return contextRoot;
- }
-
- private static Map<String, String> getServetMappings(Element root)
- {
- Map<String, String> servletMappings = new HashMap<String, String>();
-
- Iterator itMapping = DOMUtils.getChildElements(root, "servlet-mapping");
- while (itMapping.hasNext())
- {
- Element smel = (Element)itMapping.next();
- String servletName = DOMUtils.getTextContent(DOMUtils.getFirstChildElement(smel, "servlet-name"));
- String urlPattern = DOMUtils.getTextContent(DOMUtils.getFirstChildElement(smel, "url-pattern"));
- servletMappings.put(servletName, urlPattern);
- }
-
- return servletMappings;
- }
-
- private static Map<String, String> getServetClassMap(Element root)
- {
- Map<String, String> servletClassMap = new HashMap<String, String>();
-
- Iterator itServlet = DOMUtils.getChildElements(root, "servlet");
- while (itServlet.hasNext())
- {
- Element sel = (Element)itServlet.next();
- String servletName = DOMUtils.getTextContent(DOMUtils.getFirstChildElement(sel, "servlet-name"));
-
- Iterator itParams = DOMUtils.getChildElements(sel, "init-param");
- while (itParams.hasNext())
- {
- Element ipel = (Element)itParams.next();
- String paramName = DOMUtils.getTextContent(DOMUtils.getFirstChildElement(ipel, "param-name"));
- String paramValue = DOMUtils.getTextContent(DOMUtils.getFirstChildElement(ipel, "param-value"));
- if (ServiceEndpointPublisher.INIT_PARAM_SERVICE_ENDPOINT_IMPL.equals(paramName))
- {
- servletClassMap.put(servletName, paramValue);
- }
- }
- }
-
- return servletClassMap;
- }
-
- private static Element getWebXMLDocument(ServletContext ctx)
- {
- URL webXML = null;
- try
- {
- webXML = new File(ctx.getRealPath("/WEB-INF/web.xml")).toURL();
- return DOMUtils.parse(webXML.openStream());
- }
- catch (IOException e)
- {
- throw new WSException("Cannot parse: " + webXML);
- }
- }
-
-}
Deleted: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/other/GenericServiceEndpointPublisher.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/other/GenericServiceEndpointPublisher.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/other/GenericServiceEndpointPublisher.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -1,202 +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.integration.other;
-
-// $Id: WebServiceDeployer.java 312 2006-05-11 10:49:22Z thomas.diesler at jboss.com $
-
-import java.io.File;
-import java.net.URL;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.jboss.logging.Logger;
-import org.jboss.util.NotImplementedException;
-import org.jboss.ws.deployment.ServiceEndpointPublisher;
-import org.jboss.ws.deployment.UnifiedDeploymentInfo;
-
-/**
- * Publish the HTTP service endpoint to Tomcat
- *
- * @author Thomas.Diesler at jboss.org
- * @since 12-May-2006
- */
-public class GenericServiceEndpointPublisher extends ServiceEndpointPublisher
-{
- // logging support
- private static Logger log = Logger.getLogger(GenericServiceEndpointPublisher.class);
-
- private boolean isRunning;
- private File targetDir;
- private File deployDir;
- private long interval;
-
- private Set<File> deployedFiles = new HashSet<File>();
-
- public void setDeployDir(String dirName)
- {
- this.deployDir = new File(dirName);
- if (deployDir.exists() == false)
- {
- System.out.println("create directory: " + deployDir);
- deployDir.mkdirs();
- }
- }
-
- public void setTargetDir(String dirName)
- {
- this.targetDir = new File(dirName);
- if (targetDir.isDirectory() == false)
- throw new IllegalArgumentException ("Target dir does not exist: " + targetDir);
- }
-
- public void setInterval(long interval)
- {
- this.interval = interval;
- }
-
- public String publishServiceEndpoint(URL warURL) throws Exception
- {
- new wspublish().process(warURL, targetDir, servletName);
- return "OK";
- }
-
- public String destroyServiceEndpoint(URL warURL) throws Exception
- {
- File targetFile = new File(targetDir.getAbsolutePath() + "/" + new File(warURL.getFile()).getName());
- if (targetFile.delete())
- return "OK";
- else
- return "NOT FOUND";
- }
-
- public String publishServiceEndpoint(UnifiedDeploymentInfo udi) throws Exception
- {
- throw new NotImplementedException();
- }
-
- public String destroyServiceEndpoint(UnifiedDeploymentInfo udi) throws Exception
- {
- throw new NotImplementedException();
- }
-
- private void scanDeployDir()
- {
- List<File> fileList = Arrays.asList(deployDir.listFiles());
-
- // deploy new files
- for (File file : fileList)
- {
- if (deployedFiles.contains(file) == false)
- {
- deployFile(file);
- deployedFiles.add(file);
- }
- }
-
- // undeploy files
- for (File file : deployedFiles)
- {
- if (fileList.contains(file) == false)
- {
- undeployFile(file);
- deployedFiles.remove(file);
- }
- }
- }
-
- private void deployFile(File file)
- {
- try
- {
- if (new File(targetDir.getAbsolutePath() + "/" + file.getName()).exists() == false)
- {
- System.out.println("Deploy file: " + file);
- publishServiceEndpoint(file.toURL());
- }
- else
- {
- System.out.println("Ignore file: " + file);
- }
- }
- catch (Exception ex)
- {
- log.error("Cannot deploy file: " + file, ex);
- }
- }
-
- private void undeployFile(File file)
- {
- try
- {
- if (new File(targetDir.getAbsolutePath() + "/" + file.getName()).exists())
- {
- System.out.println("Undeploy file: " + file);
- destroyServiceEndpoint(file.toURL());
- }
- else
- {
- System.out.println("Ignore file: " + file);
- }
- }
- catch (Exception ex)
- {
- log.error("Cannot undeploy file: " + file, ex);
- }
- }
-
- // bean lifecycle start
- public void start()
- {
- System.out.println("Start scanning: " + deployDir);
- Scanner s = new Scanner();
- new Thread(s).start();
- }
-
- // bean lifecycle stop
- public void stop()
- {
- System.out.println("Stop scanning: " + deployDir);
- isRunning = false;
- }
-
- class Scanner implements Runnable
- {
- public void run()
- {
- isRunning = true;
- try
- {
- while (isRunning)
- {
- scanDeployDir();
- Thread.sleep(Math.max(100, interval));
- }
- }
- catch (InterruptedException ex)
- {
- // ignore
- }
- }
- }
-}
Deleted: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/other/GenericServiceEndpointServlet.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/other/GenericServiceEndpointServlet.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/other/GenericServiceEndpointServlet.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -1,200 +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.integration.other;
-
-// $Id: ServiceEndpointServlet.java 296 2006-05-08 19:45:49Z thomas.diesler at jboss.com $
-
-import java.io.IOException;
-import java.net.URL;
-import java.net.URLClassLoader;
-
-import javax.servlet.ServletConfig;
-import javax.servlet.ServletContext;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.jboss.kernel.spi.registry.KernelRegistry;
-import org.jboss.kernel.spi.registry.KernelRegistryEntry;
-import org.jboss.logging.Logger;
-import org.jboss.ws.WSException;
-import org.jboss.ws.deployment.JSR109Deployment;
-import org.jboss.ws.deployment.JSR181Deployment;
-import org.jboss.ws.deployment.ServiceEndpointDeployer;
-import org.jboss.ws.deployment.UnifiedDeploymentInfo;
-import org.jboss.ws.server.KernelLocator;
-import org.jboss.ws.server.StandardEndpointServlet;
-
-/**
- * A servlet that is installed for every web service endpoint.
- *
- * @author Thomas.Diesler at jboss.org
- * @since 16-May-2006
- */
-public class GenericServiceEndpointServlet extends StandardEndpointServlet
-{
- // provide logging
- private static final Logger log = Logger.getLogger(GenericServiceEndpointServlet.class);
-
- public void init(ServletConfig config) throws ServletException
- {
- ClassLoader ctxLoader = Thread.currentThread().getContextClassLoader();
- try
- {
- CrossContextLoader jbwsLoader = CrossContextLoader.newInstance(config.getServletContext());
- Thread.currentThread().setContextClassLoader(jbwsLoader);
-
- super.init(config);
- deployServiceEndpoints(getServletContext());
- }
- catch (Exception e)
- {
- Thread.currentThread().setContextClassLoader(ctxLoader);
- }
- }
-
- public void destroy()
- {
- undeployServiceEndpoints(getServletContext());
- super.destroy();
- }
-
- public void service(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
- {
- ClassLoader ctxLoader = Thread.currentThread().getContextClassLoader();
- try
- {
- if ((ctxLoader instanceof CrossContextLoader) == false)
- {
- CrossContextLoader jbwsLoader = CrossContextLoader.newInstance(getServletContext());
- Thread.currentThread().setContextClassLoader(jbwsLoader);
- }
- super.service(req, res);
- }
- finally
- {
- Thread.currentThread().setContextClassLoader(ctxLoader);
- }
- }
-
- /**
- * Bootstrap the Microkernel and initialize the
- * ServiceEndpointManager
- */
- protected void initServiceEndpointManager()
- {
- // bootstrap the microkernel
- URLClassLoader ctxLoader = (URLClassLoader)Thread.currentThread().getContextClassLoader();
- URL beansXML = ctxLoader.findResource("META-INF/jboss-beans.xml");
- if (beansXML == null)
- throw new IllegalStateException("Invalid null kernel deployment");
-
- try
- {
- new KernelBootstrap().bootstrap(beansXML);
- }
- catch (RuntimeException rte)
- {
- throw rte;
- }
- catch (Exception ex)
- {
- throw new WSException("Cannot bootstrap kernel", ex);
- }
-
- // init the service endpoint manager
- super.initServiceEndpointManager();
- }
-
- private void deployServiceEndpoints(ServletContext servletContext)
- {
- UnifiedDeploymentInfo udi = (UnifiedDeploymentInfo)servletContext.getAttribute(UnifiedDeploymentInfo.class.getName());
- if (udi == null)
- {
- ServiceEndpointDeployer deployer = getServiceEndpointDeployer();
- try
- {
- udi = createDeploymentInfo(servletContext);
- servletContext.setAttribute(UnifiedDeploymentInfo.class.getName(), udi);
-
- deployer.create(udi);
- deployer.start(udi);
- }
- catch (RuntimeException rte)
- {
- throw rte;
- }
- catch (Throwable th)
- {
- throw new WSException("Cannot deploy service endpoint", th);
- }
- }
- }
-
- private UnifiedDeploymentInfo createDeploymentInfo(ServletContext servletContext) throws Exception
- {
- UnifiedDeploymentInfo udi;
-
- URLClassLoader ctxLoader = (URLClassLoader)Thread.currentThread().getContextClassLoader();
- URL webservices109URL = ctxLoader.findResource("WEB-INF/webservices.xml");
- if (webservices109URL != null)
- {
- udi = new JSR109Deployment(UnifiedDeploymentInfo.Type.JSR109_JSE, webservices109URL);
- }
- else
- {
- udi = new JSR181Deployment(UnifiedDeploymentInfo.Type.JSR181_JSE);
- }
-
- DeploymentInfoAdaptor.buildDeploymentInfo(udi, ctxLoader, servletContext);
- return udi;
- }
-
- private void undeployServiceEndpoints(ServletContext servletContext)
- {
- UnifiedDeploymentInfo udi = (UnifiedDeploymentInfo)servletContext.getAttribute(UnifiedDeploymentInfo.class.getName());
- if (udi != null)
- {
- ServiceEndpointDeployer deployer = getServiceEndpointDeployer();
- try
- {
- deployer.stop(udi);
- deployer.destroy(udi);
- }
- catch (RuntimeException rte)
- {
- throw rte;
- }
- catch (Throwable th)
- {
- throw new WSException("Cannot deploy service endpoint", th);
- }
- }
- }
-
- private ServiceEndpointDeployer getServiceEndpointDeployer()
- {
- KernelRegistry registry = KernelLocator.getKernel().getRegistry();
- KernelRegistryEntry entry = registry.getEntry(ServiceEndpointDeployer.BEAN_NAME);
- return (ServiceEndpointDeployer)entry.getTarget();
- }
-}
Deleted: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/other/KernelBootstrap.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/other/KernelBootstrap.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/other/KernelBootstrap.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -1,121 +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.integration.other;
-
-// $Id: ContextServlet.java 293 2006-05-08 16:31:50Z thomas.diesler at jboss.com $
-
-import java.net.URL;
-
-import org.jboss.kernel.plugins.bootstrap.basic.BasicBootstrap;
-import org.jboss.kernel.plugins.deployment.xml.BeanXMLDeployer;
-import org.jboss.logging.Logger;
-import org.jboss.ws.server.KernelLocator;
-
-/**
- * Bootstrap the microkernel in Tomcat
- *
- * @author Thomas.Diesler at jboss.org
- * @since 15-May-2006
- */
-public class KernelBootstrap extends BasicBootstrap
-{
- // FIXME: remove ctor that throws exception
- public KernelBootstrap() throws Exception
- {
- super();
- }
-
- // provide logging
- protected final Logger log = Logger.getLogger(KernelBootstrap.class);
-
- protected BeanXMLDeployer deployer;
-
- public void bootstrap(URL beansXML)
- {
- // synchronize bootstrap access
- synchronized (KernelBootstrap.class)
- {
- // only bootstrap if the kernel is not there yet
- if (KernelLocator.getKernel() == null)
- {
- try
- {
- super.bootstrap();
-
- deployer = new BeanXMLDeployer(getKernel());
-
- Runtime.getRuntime().addShutdownHook(new Shutdown());
-
- deploy(beansXML);
-
- // Validate that everything is ok
- deployer.validate();
- }
- catch (RuntimeException rte)
- {
- throw rte;
- }
- catch (Throwable th)
- {
- throw new IllegalStateException("Cannot bootstrap microkernel", th);
- }
- }
- }
- }
-
- /**
- * Deploy a url
- *
- * @param url the deployment url
- * @throws Throwable for any error
- */
- protected void deploy(URL url) throws Throwable
- {
- deployer.deploy(url);
- }
-
- /**
- * Undeploy a url
- *
- * @param url the deployment url
- */
- protected void undeploy(URL url)
- {
- try
- {
- //deployer.undeploy(url);
- }
- catch (Throwable t)
- {
- log.warn("Error during undeployment: " + url, t);
- }
- }
-
- protected class Shutdown extends Thread
- {
- public void run()
- {
- log.info("Shutting down");
- //deployer.shutdown();
- }
- }
-}
Deleted: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/other/ServerConfigImpl.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/other/ServerConfigImpl.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/other/ServerConfigImpl.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -1,64 +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.integration.other;
-
-//$Id: ServiceEndpointManagerFactoryImpl.java 294 2006-05-08 16:33:42Z thomas.diesler at jboss.com $
-
-import java.io.File;
-import java.io.IOException;
-
-import org.jboss.ws.server.ServerConfig;
-
-/**
- * Tomcat specific implementation of a ServerConfig
- *
- * @author Thomas.Diesler at jboss.org
- * @since 08-May-2006
- */
-public class ServerConfigImpl implements ServerConfig
-{
- public File getServerTempDir()
- {
- try
- {
- File tmpdir = File.createTempFile("jbossws", null).getParentFile();
- return tmpdir;
- }
- catch (IOException e)
- {
- return null;
- }
- }
-
- public File getServerDataDir()
- {
- try
- {
- File tmpdir = File.createTempFile("jbossws", null).getParentFile();
- return tmpdir;
- }
- catch (IOException e)
- {
- return null;
- }
- }
-}
Deleted: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/other/wspublish.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/other/wspublish.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/other/wspublish.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -1,142 +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.integration.other;
-
-// $Id: ContextServlet.java 293 2006-05-08 16:31:50Z thomas.diesler at jboss.com $
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.MalformedURLException;
-import java.net.URL;
-
-import org.jboss.logging.Logger;
-import org.jboss.util.file.JarUtils;
-
-/**
- * Publish a standard portable J2EE web service endpoint
- * to standalone Tomcat
- *
- * @author Thomas.Diesler at jboss.org
- * @since 15-May-2006
- */
-public class wspublish
-{
- // provide logging
- protected final Logger log = Logger.getLogger(wspublish.class);
-
- public static final String DEFAULT_TOMCAT_SERVICE_ENDPOINT_SERVLET = "org.jboss.ws.integration.other.GenericServiceEndpointServlet";
-
- public URL process(URL warURL, File destDir, String servletName) throws IOException
- {
- if (warURL == null)
- throw new IllegalArgumentException("Invalid war URL: " + warURL);
-
- if (destDir == null || destDir.isDirectory() == false)
- throw new IllegalArgumentException("Invalid destintion dir: " + destDir);
-
- if (servletName == null)
- servletName = DEFAULT_TOMCAT_SERVICE_ENDPOINT_SERVLET;
-
- InputStream in = warURL.openStream();
- String warName = new File(warURL.getFile()).getName();
- File tmpDir = new File("./wspublish/" + warName);
- tmpDir.mkdirs();
-
- log.debug("Extracting war to: " + tmpDir);
- JarUtils.unjar(in, tmpDir);
- in.close();
-
- GenericServiceEndpointPublisher publisher = new GenericServiceEndpointPublisher();
- publisher.setServiceEndpointServlet(servletName);
- publisher.rewriteWebXML(tmpDir.toURL());
-
- File outFile = new File(destDir.getCanonicalPath() + "/" + warName);
- outFile.getParentFile().mkdirs();
-
- log.info("Writing war to: " + outFile.toURL());
- FileOutputStream fos = new FileOutputStream(outFile);
- JarUtils.jar(fos, tmpDir.listFiles());
- fos.close();
-
- return outFile.toURL();
- }
-
- public static void main(String[] args) throws Exception
- {
- URL warURL = null;
- File destDir = null;
- String servletName = null;
-
- for (int i = 0; i < args.length; i++)
- {
- String arg = args[i];
- if ("-url".equals(arg))
- {
- warURL = getURL(args[i + 1]);
- i++;
- }
- else if ("-dest".equals(arg))
- {
- destDir = new File(args[i + 1]);
- i++;
- }
- else if ("-servlet".equals(arg))
- {
- servletName = args[i + 1];
- i++;
- }
- }
-
- if (warURL == null || destDir == null)
- {
- System.out.println("Usage: wspublish -url warURL -dest webappsDir [-servlet servletName]");
- System.exit(1);
- }
-
- // process the args
- new wspublish().process(warURL, destDir, servletName);
- }
-
- private static URL getURL(String urlStr)
- {
- URL warURL = null;
- try
- {
- warURL = new URL(urlStr);
- }
- catch (MalformedURLException ex)
- {
- // ignore
- }
- try
- {
- warURL = new File(urlStr).toURL();
- }
- catch (MalformedURLException ex)
- {
- // ignore
- }
- return warURL;
- }
-}
Added: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/tomcat/ContextServlet.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/tomcat/ContextServlet.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/tomcat/ContextServlet.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -0,0 +1,110 @@
+/*
+ * 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.integration.tomcat;
+
+// $Id$
+
+import java.io.File;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.net.URL;
+
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.WSException;
+import org.jboss.ws.server.ServiceEndpointManager;
+import org.jboss.ws.server.ServiceEndpointManagerFactory;
+
+/**
+ * The servlet that that is associated with context /jbossws
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 21-Mar-2005
+ */
+public class ContextServlet extends HttpServlet
+{
+ // provide logging
+ protected final Logger log = Logger.getLogger(ContextServlet.class);
+
+ protected ServiceEndpointManager epManager;
+
+ public void init(ServletConfig config) throws ServletException
+ {
+ super.init(config);
+ initServiceEndpointManager();
+ }
+
+ private void initServiceEndpointManager()
+ {
+ try
+ {
+ URL beansXML = new File(getServletContext().getRealPath("/META-INF/jboss-beans.xml")).toURL();
+ if (beansXML == null)
+ throw new IllegalStateException("Invalid null kernel deployment");
+
+ new KernelBootstrap().bootstrap(beansXML);
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (Exception ex)
+ {
+ throw new WSException("Cannot bootstrap kernel", ex);
+ }
+
+ // Initialize the ServiceEndpointManager
+ ServiceEndpointManagerFactory factory = ServiceEndpointManagerFactory.getInstance();
+ epManager = factory.getServiceEndpointManager();
+ }
+
+ /** Process GET requests.
+ */
+ public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
+ {
+ PrintWriter writer = res.getWriter();
+ res.setContentType("text/html");
+
+ writer.print("<html>");
+ setupHTMLResponseHeader(writer);
+
+ writer.print("<body>");
+ writer.print(epManager.showServiceEndpointTable());
+ writer.print("</body>");
+ writer.print("</html>");
+ writer.close();
+ }
+
+ private void setupHTMLResponseHeader(PrintWriter writer)
+ {
+ writer.println("<head>");
+ writer.println("<meta http-equiv='Content-Type content='text/html; charset=iso-8859-1'>");
+ writer.println("<title>JBossWS</title>");
+ writer.println("<link rel='stylesheet' href='./styles.css'>");
+ writer.println("</head>");
+ }
+}
Property changes on: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/tomcat/ContextServlet.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/tomcat/CrossContextLoader.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/tomcat/CrossContextLoader.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/tomcat/CrossContextLoader.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -0,0 +1,96 @@
+/*
+ * 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.integration.tomcat;
+
+// $Id$
+
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLClassLoader;
+
+import javax.servlet.ServletContext;
+
+/**
+ * A URLClassLoader that provides access to the webapp base dir
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 16-May-2006
+ */
+public class CrossContextLoader extends URLClassLoader
+{
+ public CrossContextLoader(URL[] urls, ClassLoader parent)
+ {
+ super(urls, parent);
+ }
+
+ public static CrossContextLoader newInstance(ServletContext context)
+ {
+ ClassLoader parent = Thread.currentThread().getContextClassLoader();
+ if (parent instanceof CrossContextLoader)
+ throw new IllegalStateException("Circular classloader parent association");
+
+ CrossContextLoader loader = new CrossContextLoader(new URL[] {}, parent);
+
+ String path = context.getRealPath("/");
+ File contextDir = new File(path);
+ if (contextDir.exists() == false || contextDir.isDirectory() == false)
+ throw new IllegalStateException("Cannot find expanded dir: " + contextDir);
+
+ // Add URL to context root
+ loader.addURL(toURL(contextDir));
+
+ File jbosswsDir = new File(path + "../jbossws");
+ if (jbosswsDir.exists() == false || jbosswsDir.isDirectory() == false)
+ throw new IllegalStateException("Cannot find expanded dir: " + jbosswsDir);
+
+ // Add URL to jbossws context root
+ loader.addURL(toURL(jbosswsDir));
+
+ // Add jars in jbossws/WEB-INF/lib
+ File libDir = new File(path + "../jbossws/WEB-INF/lib");
+ if (libDir.exists() && libDir.isDirectory())
+ {
+ File[] files = libDir.listFiles();
+ for (int i=0; i < files.length; i++)
+ {
+ File file = files[i];
+ loader.addURL(toURL(file));
+ }
+ }
+
+ return loader;
+ }
+
+ private static URL toURL(File file)
+ {
+ try
+ {
+ return file.toURL();
+ }
+ catch (MalformedURLException e)
+ {
+ // ignore
+ return null;
+ }
+ }
+}
Property changes on: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/tomcat/CrossContextLoader.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/tomcat/DeploymentInfoAdaptor.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/tomcat/DeploymentInfoAdaptor.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/tomcat/DeploymentInfoAdaptor.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -0,0 +1,165 @@
+/*
+ * 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.integration.tomcat;
+
+// $Id$
+
+import java.io.File;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import javax.servlet.ServletContext;
+
+import org.jboss.ws.utils.DOMUtils;
+import org.jboss.ws.WSException;
+import org.jboss.ws.deployment.UnifiedDeploymentInfo;
+import org.jboss.ws.deployment.ServiceEndpointPublisher;
+import org.jboss.ws.metadata.j2ee.UnifiedWebMetaData;
+import org.w3c.dom.Element;
+
+/**
+ * Build container independent deployment info.
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 05-May-2006
+ */
+public class DeploymentInfoAdaptor
+{
+ public static UnifiedDeploymentInfo buildDeploymentInfo(UnifiedDeploymentInfo udi, URLClassLoader loader, ServletContext ctx)
+ {
+ URL warURL = null;
+ try
+ {
+ warURL = new File(ctx.getRealPath("/")).toURL();
+ }
+ catch (MalformedURLException e)
+ {
+ // ignore
+ }
+
+ String shortName = getContextRoot(warURL);
+ shortName = shortName.substring(1) + ".war";
+
+ udi.shortName = shortName;
+ udi.localUrl = warURL;
+ udi.url = warURL;
+ udi.metaData = buildWebMetaData(udi, ctx);
+ udi.annotationsCl = loader.getParent();
+ udi.localCl = loader;
+ udi.ucl = loader.getParent();
+ udi.deployedObject = null;
+
+ return udi;
+ }
+
+ private static UnifiedWebMetaData buildWebMetaData(UnifiedDeploymentInfo udi, ServletContext ctx)
+ {
+ Element webXML = getWebXMLDocument(ctx);
+
+ UnifiedWebMetaData wmd = new UnifiedWebMetaData();
+ wmd.setServletMappings(getServetMappings(webXML));
+ wmd.setServletClassMap(getServetClassMap(webXML));
+ wmd.setContextRoot(getContextRoot(udi.url));
+ wmd.setConfigName(ctx.getInitParameter("jbossws-config-name"));
+ wmd.setConfigFile(ctx.getInitParameter("jbossws-config-file"));
+ wmd.setContextLoader(udi.ucl);
+
+ return wmd;
+ }
+
+ private static String getContextRoot(URL warURL)
+ {
+ String contextRoot = warURL.toExternalForm();
+ if (contextRoot.endsWith("/"))
+ {
+ contextRoot = contextRoot.substring(0, contextRoot.length() - 1);
+ }
+ contextRoot = contextRoot.substring(contextRoot.lastIndexOf("/"));
+ if (contextRoot.endsWith(".war"))
+ {
+ contextRoot = contextRoot.substring(0, contextRoot.length() - 4);
+ }
+ return contextRoot;
+ }
+
+ private static Map<String, String> getServetMappings(Element root)
+ {
+ Map<String, String> servletMappings = new HashMap<String, String>();
+
+ Iterator itMapping = DOMUtils.getChildElements(root, "servlet-mapping");
+ while (itMapping.hasNext())
+ {
+ Element smel = (Element)itMapping.next();
+ String servletName = DOMUtils.getTextContent(DOMUtils.getFirstChildElement(smel, "servlet-name"));
+ String urlPattern = DOMUtils.getTextContent(DOMUtils.getFirstChildElement(smel, "url-pattern"));
+ servletMappings.put(servletName, urlPattern);
+ }
+
+ return servletMappings;
+ }
+
+ private static Map<String, String> getServetClassMap(Element root)
+ {
+ Map<String, String> servletClassMap = new HashMap<String, String>();
+
+ Iterator itServlet = DOMUtils.getChildElements(root, "servlet");
+ while (itServlet.hasNext())
+ {
+ Element sel = (Element)itServlet.next();
+ String servletName = DOMUtils.getTextContent(DOMUtils.getFirstChildElement(sel, "servlet-name"));
+
+ Iterator itParams = DOMUtils.getChildElements(sel, "init-param");
+ while (itParams.hasNext())
+ {
+ Element ipel = (Element)itParams.next();
+ String paramName = DOMUtils.getTextContent(DOMUtils.getFirstChildElement(ipel, "param-name"));
+ String paramValue = DOMUtils.getTextContent(DOMUtils.getFirstChildElement(ipel, "param-value"));
+ if (ServiceEndpointPublisher.INIT_PARAM_SERVICE_ENDPOINT_IMPL.equals(paramName))
+ {
+ servletClassMap.put(servletName, paramValue);
+ }
+ }
+ }
+
+ return servletClassMap;
+ }
+
+ private static Element getWebXMLDocument(ServletContext ctx)
+ {
+ URL webXML = null;
+ try
+ {
+ webXML = new File(ctx.getRealPath("/WEB-INF/web.xml")).toURL();
+ return DOMUtils.parse(webXML.openStream());
+ }
+ catch (IOException e)
+ {
+ throw new WSException("Cannot parse: " + webXML);
+ }
+ }
+
+}
Property changes on: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/tomcat/DeploymentInfoAdaptor.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/tomcat/KernelBootstrap.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/tomcat/KernelBootstrap.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/tomcat/KernelBootstrap.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -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.integration.tomcat;
+
+// $Id$
+
+import java.net.URL;
+
+import org.jboss.kernel.plugins.bootstrap.basic.BasicBootstrap;
+import org.jboss.kernel.plugins.deployment.xml.BeanXMLDeployer;
+import org.jboss.logging.Logger;
+import org.jboss.ws.server.KernelLocator;
+
+/**
+ * Bootstrap the microkernel in Tomcat
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 15-May-2006
+ */
+public class KernelBootstrap extends BasicBootstrap
+{
+ // FIXME: remove ctor that throws exception
+ public KernelBootstrap() throws Exception
+ {
+ super();
+ }
+
+ // provide logging
+ protected final Logger log = Logger.getLogger(KernelBootstrap.class);
+
+ protected BeanXMLDeployer deployer;
+
+ public void bootstrap(URL beansXML)
+ {
+ // synchronize bootstrap access
+ synchronized (KernelBootstrap.class)
+ {
+ // only bootstrap if the kernel is not there yet
+ if (KernelLocator.getKernel() == null)
+ {
+ try
+ {
+ super.bootstrap();
+
+ deployer = new BeanXMLDeployer(getKernel());
+
+ Runtime.getRuntime().addShutdownHook(new Shutdown());
+
+ deploy(beansXML);
+
+ // Validate that everything is ok
+ deployer.validate();
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (Throwable th)
+ {
+ throw new IllegalStateException("Cannot bootstrap microkernel", th);
+ }
+ }
+ }
+ }
+
+ /**
+ * Deploy a url
+ *
+ * @param url the deployment url
+ * @throws Throwable for any error
+ */
+ protected void deploy(URL url) throws Throwable
+ {
+ deployer.deploy(url);
+ }
+
+ /**
+ * Undeploy a url
+ *
+ * @param url the deployment url
+ */
+ protected void undeploy(URL url)
+ {
+ try
+ {
+ //deployer.undeploy(url);
+ }
+ catch (Throwable t)
+ {
+ log.warn("Error during undeployment: " + url, t);
+ }
+ }
+
+ protected class Shutdown extends Thread
+ {
+ public void run()
+ {
+ log.info("Shutting down");
+ //deployer.shutdown();
+ }
+ }
+}
Property changes on: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/tomcat/KernelBootstrap.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/tomcat/ServerConfigImpl.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/tomcat/ServerConfigImpl.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/tomcat/ServerConfigImpl.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -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.integration.tomcat;
+
+//$Id$
+
+import java.io.File;
+import java.io.IOException;
+
+import org.jboss.ws.server.ServerConfig;
+
+/**
+ * Tomcat specific implementation of a ServerConfig
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 08-May-2006
+ */
+public class ServerConfigImpl implements ServerConfig
+{
+ public File getServerTempDir()
+ {
+ try
+ {
+ File tmpdir = File.createTempFile("jbossws", null).getParentFile();
+ return tmpdir;
+ }
+ catch (IOException e)
+ {
+ return null;
+ }
+ }
+
+ public File getServerDataDir()
+ {
+ try
+ {
+ File tmpdir = File.createTempFile("jbossws", null).getParentFile();
+ return tmpdir;
+ }
+ catch (IOException e)
+ {
+ return null;
+ }
+ }
+}
Property changes on: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/tomcat/ServerConfigImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/tomcat/TomcatServiceEndpointPublisher.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/tomcat/TomcatServiceEndpointPublisher.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/tomcat/TomcatServiceEndpointPublisher.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -0,0 +1,202 @@
+/*
+ * 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.integration.tomcat;
+
+// $Id$
+
+import java.io.File;
+import java.net.URL;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.jboss.logging.Logger;
+import org.jboss.util.NotImplementedException;
+import org.jboss.ws.deployment.ServiceEndpointPublisher;
+import org.jboss.ws.deployment.UnifiedDeploymentInfo;
+
+/**
+ * Publish the HTTP service endpoint to Tomcat
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 12-May-2006
+ */
+public class TomcatServiceEndpointPublisher extends ServiceEndpointPublisher
+{
+ // logging support
+ private static Logger log = Logger.getLogger(TomcatServiceEndpointPublisher.class);
+
+ private boolean isRunning;
+ private File targetDir;
+ private File deployDir;
+ private long interval;
+
+ private Set<File> deployedFiles = new HashSet<File>();
+
+ public void setDeployDir(String dirName)
+ {
+ this.deployDir = new File(dirName);
+ if (deployDir.exists() == false)
+ {
+ System.out.println("create directory: " + deployDir);
+ deployDir.mkdirs();
+ }
+ }
+
+ public void setTargetDir(String dirName)
+ {
+ this.targetDir = new File(dirName);
+ if (targetDir.isDirectory() == false)
+ throw new IllegalArgumentException ("Target dir does not exist: " + targetDir);
+ }
+
+ public void setInterval(long interval)
+ {
+ this.interval = interval;
+ }
+
+ public String publishServiceEndpoint(URL warURL) throws Exception
+ {
+ new wspublish().process(warURL, targetDir, servletName);
+ return "OK";
+ }
+
+ public String destroyServiceEndpoint(URL warURL) throws Exception
+ {
+ File targetFile = new File(targetDir.getAbsolutePath() + "/" + new File(warURL.getFile()).getName());
+ if (targetFile.delete())
+ return "OK";
+ else
+ return "NOT FOUND";
+ }
+
+ public String publishServiceEndpoint(UnifiedDeploymentInfo udi) throws Exception
+ {
+ throw new NotImplementedException();
+ }
+
+ public String destroyServiceEndpoint(UnifiedDeploymentInfo udi) throws Exception
+ {
+ throw new NotImplementedException();
+ }
+
+ private void scanDeployDir()
+ {
+ List<File> fileList = Arrays.asList(deployDir.listFiles());
+
+ // deploy new files
+ for (File file : fileList)
+ {
+ if (deployedFiles.contains(file) == false)
+ {
+ deployFile(file);
+ deployedFiles.add(file);
+ }
+ }
+
+ // undeploy files
+ for (File file : deployedFiles)
+ {
+ if (fileList.contains(file) == false)
+ {
+ undeployFile(file);
+ deployedFiles.remove(file);
+ }
+ }
+ }
+
+ private void deployFile(File file)
+ {
+ try
+ {
+ if (new File(targetDir.getAbsolutePath() + "/" + file.getName()).exists() == false)
+ {
+ System.out.println("Deploy file: " + file);
+ publishServiceEndpoint(file.toURL());
+ }
+ else
+ {
+ System.out.println("Ignore file: " + file);
+ }
+ }
+ catch (Exception ex)
+ {
+ log.error("Cannot deploy file: " + file, ex);
+ }
+ }
+
+ private void undeployFile(File file)
+ {
+ try
+ {
+ if (new File(targetDir.getAbsolutePath() + "/" + file.getName()).exists())
+ {
+ System.out.println("Undeploy file: " + file);
+ destroyServiceEndpoint(file.toURL());
+ }
+ else
+ {
+ System.out.println("Ignore file: " + file);
+ }
+ }
+ catch (Exception ex)
+ {
+ log.error("Cannot undeploy file: " + file, ex);
+ }
+ }
+
+ // bean lifecycle start
+ public void start()
+ {
+ System.out.println("Start scanning: " + deployDir);
+ Scanner s = new Scanner();
+ new Thread(s).start();
+ }
+
+ // bean lifecycle stop
+ public void stop()
+ {
+ System.out.println("Stop scanning: " + deployDir);
+ isRunning = false;
+ }
+
+ class Scanner implements Runnable
+ {
+ public void run()
+ {
+ isRunning = true;
+ try
+ {
+ while (isRunning)
+ {
+ scanDeployDir();
+ Thread.sleep(Math.max(100, interval));
+ }
+ }
+ catch (InterruptedException ex)
+ {
+ // ignore
+ }
+ }
+ }
+}
Property changes on: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/tomcat/TomcatServiceEndpointPublisher.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/tomcat/TomcatServiceEndpointServlet.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/tomcat/TomcatServiceEndpointServlet.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/tomcat/TomcatServiceEndpointServlet.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -0,0 +1,200 @@
+/*
+ * 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.integration.tomcat;
+
+// $Id$
+
+import java.io.IOException;
+import java.net.URL;
+import java.net.URLClassLoader;
+
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.jboss.kernel.spi.registry.KernelRegistry;
+import org.jboss.kernel.spi.registry.KernelRegistryEntry;
+import org.jboss.logging.Logger;
+import org.jboss.ws.WSException;
+import org.jboss.ws.deployment.JSR109Deployment;
+import org.jboss.ws.deployment.JSR181Deployment;
+import org.jboss.ws.deployment.ServiceEndpointDeployer;
+import org.jboss.ws.deployment.UnifiedDeploymentInfo;
+import org.jboss.ws.server.KernelLocator;
+import org.jboss.ws.server.StandardEndpointServlet;
+
+/**
+ * A servlet that is installed for every web service endpoint.
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 16-May-2006
+ */
+public class TomcatServiceEndpointServlet extends StandardEndpointServlet
+{
+ // provide logging
+ private static final Logger log = Logger.getLogger(TomcatServiceEndpointServlet.class);
+
+ public void init(ServletConfig config) throws ServletException
+ {
+ ClassLoader ctxLoader = Thread.currentThread().getContextClassLoader();
+ try
+ {
+ CrossContextLoader jbwsLoader = CrossContextLoader.newInstance(config.getServletContext());
+ Thread.currentThread().setContextClassLoader(jbwsLoader);
+
+ super.init(config);
+ deployServiceEndpoints(getServletContext());
+ }
+ catch (Exception e)
+ {
+ Thread.currentThread().setContextClassLoader(ctxLoader);
+ }
+ }
+
+ public void destroy()
+ {
+ undeployServiceEndpoints(getServletContext());
+ super.destroy();
+ }
+
+ public void service(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
+ {
+ ClassLoader ctxLoader = Thread.currentThread().getContextClassLoader();
+ try
+ {
+ if ((ctxLoader instanceof CrossContextLoader) == false)
+ {
+ CrossContextLoader jbwsLoader = CrossContextLoader.newInstance(getServletContext());
+ Thread.currentThread().setContextClassLoader(jbwsLoader);
+ }
+ super.service(req, res);
+ }
+ finally
+ {
+ Thread.currentThread().setContextClassLoader(ctxLoader);
+ }
+ }
+
+ /**
+ * Bootstrap the Microkernel and initialize the
+ * ServiceEndpointManager
+ */
+ protected void initServiceEndpointManager()
+ {
+ // bootstrap the microkernel
+ URLClassLoader ctxLoader = (URLClassLoader)Thread.currentThread().getContextClassLoader();
+ URL beansXML = ctxLoader.findResource("META-INF/jboss-beans.xml");
+ if (beansXML == null)
+ throw new IllegalStateException("Invalid null kernel deployment");
+
+ try
+ {
+ new KernelBootstrap().bootstrap(beansXML);
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (Exception ex)
+ {
+ throw new WSException("Cannot bootstrap kernel", ex);
+ }
+
+ // init the service endpoint manager
+ super.initServiceEndpointManager();
+ }
+
+ private void deployServiceEndpoints(ServletContext servletContext)
+ {
+ UnifiedDeploymentInfo udi = (UnifiedDeploymentInfo)servletContext.getAttribute(UnifiedDeploymentInfo.class.getName());
+ if (udi == null)
+ {
+ ServiceEndpointDeployer deployer = getServiceEndpointDeployer();
+ try
+ {
+ udi = createDeploymentInfo(servletContext);
+ servletContext.setAttribute(UnifiedDeploymentInfo.class.getName(), udi);
+
+ deployer.create(udi);
+ deployer.start(udi);
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (Throwable th)
+ {
+ throw new WSException("Cannot deploy service endpoint", th);
+ }
+ }
+ }
+
+ private UnifiedDeploymentInfo createDeploymentInfo(ServletContext servletContext) throws Exception
+ {
+ UnifiedDeploymentInfo udi;
+
+ URLClassLoader ctxLoader = (URLClassLoader)Thread.currentThread().getContextClassLoader();
+ URL webservices109URL = ctxLoader.findResource("WEB-INF/webservices.xml");
+ if (webservices109URL != null)
+ {
+ udi = new JSR109Deployment(UnifiedDeploymentInfo.DeploymentType.JSR109_JSE, webservices109URL);
+ }
+ else
+ {
+ udi = new JSR181Deployment(UnifiedDeploymentInfo.DeploymentType.JSR181_JSE);
+ }
+
+ DeploymentInfoAdaptor.buildDeploymentInfo(udi, ctxLoader, servletContext);
+ return udi;
+ }
+
+ private void undeployServiceEndpoints(ServletContext servletContext)
+ {
+ UnifiedDeploymentInfo udi = (UnifiedDeploymentInfo)servletContext.getAttribute(UnifiedDeploymentInfo.class.getName());
+ if (udi != null)
+ {
+ ServiceEndpointDeployer deployer = getServiceEndpointDeployer();
+ try
+ {
+ deployer.stop(udi);
+ deployer.destroy(udi);
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (Throwable th)
+ {
+ throw new WSException("Cannot deploy service endpoint", th);
+ }
+ }
+ }
+
+ private ServiceEndpointDeployer getServiceEndpointDeployer()
+ {
+ KernelRegistry registry = KernelLocator.getKernel().getRegistry();
+ KernelRegistryEntry entry = registry.getEntry(ServiceEndpointDeployer.BEAN_NAME);
+ return (ServiceEndpointDeployer)entry.getTarget();
+ }
+}
Property changes on: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/tomcat/TomcatServiceEndpointServlet.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/tomcat/wspublish.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/tomcat/wspublish.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/tomcat/wspublish.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -0,0 +1,142 @@
+/*
+ * 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.integration.tomcat;
+
+// $Id$
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import org.jboss.logging.Logger;
+import org.jboss.util.file.JarUtils;
+
+/**
+ * Publish a standard portable J2EE web service endpoint
+ * to standalone Tomcat
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 15-May-2006
+ */
+public class wspublish
+{
+ // provide logging
+ protected final Logger log = Logger.getLogger(wspublish.class);
+
+ public static final String DEFAULT_TOMCAT_SERVICE_ENDPOINT_SERVLET = "org.jboss.ws.integration.other.GenericServiceEndpointServlet";
+
+ public URL process(URL warURL, File destDir, String servletName) throws IOException
+ {
+ if (warURL == null)
+ throw new IllegalArgumentException("Invalid war URL: " + warURL);
+
+ if (destDir == null || destDir.isDirectory() == false)
+ throw new IllegalArgumentException("Invalid destintion dir: " + destDir);
+
+ if (servletName == null)
+ servletName = DEFAULT_TOMCAT_SERVICE_ENDPOINT_SERVLET;
+
+ InputStream in = warURL.openStream();
+ String warName = new File(warURL.getFile()).getName();
+ File tmpDir = new File("./wspublish/" + warName);
+ tmpDir.mkdirs();
+
+ log.debug("Extracting war to: " + tmpDir);
+ JarUtils.unjar(in, tmpDir);
+ in.close();
+
+ TomcatServiceEndpointPublisher publisher = new TomcatServiceEndpointPublisher();
+ publisher.setServiceEndpointServlet(servletName);
+ publisher.rewriteWebXML(tmpDir.toURL());
+
+ File outFile = new File(destDir.getCanonicalPath() + "/" + warName);
+ outFile.getParentFile().mkdirs();
+
+ log.info("Writing war to: " + outFile.toURL());
+ FileOutputStream fos = new FileOutputStream(outFile);
+ JarUtils.jar(fos, tmpDir.listFiles());
+ fos.close();
+
+ return outFile.toURL();
+ }
+
+ public static void main(String[] args) throws Exception
+ {
+ URL warURL = null;
+ File destDir = null;
+ String servletName = null;
+
+ for (int i = 0; i < args.length; i++)
+ {
+ String arg = args[i];
+ if ("-url".equals(arg))
+ {
+ warURL = getURL(args[i + 1]);
+ i++;
+ }
+ else if ("-dest".equals(arg))
+ {
+ destDir = new File(args[i + 1]);
+ i++;
+ }
+ else if ("-servlet".equals(arg))
+ {
+ servletName = args[i + 1];
+ i++;
+ }
+ }
+
+ if (warURL == null || destDir == null)
+ {
+ System.out.println("Usage: wspublish -url warURL -dest webappsDir [-servlet servletName]");
+ System.exit(1);
+ }
+
+ // process the args
+ new wspublish().process(warURL, destDir, servletName);
+ }
+
+ private static URL getURL(String urlStr)
+ {
+ URL warURL = null;
+ try
+ {
+ warURL = new URL(urlStr);
+ }
+ catch (MalformedURLException ex)
+ {
+ // ignore
+ }
+ try
+ {
+ warURL = new File(urlStr).toURL();
+ }
+ catch (MalformedURLException ex)
+ {
+ // ignore
+ }
+ return warURL;
+ }
+}
Property changes on: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/tomcat/wspublish.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Deleted: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxb/JAXBConstants.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxb/JAXBConstants.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxb/JAXBConstants.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -1,44 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.ws.jaxb;
-
-
-// $Id$
-
-/** JBoss JAXB Constants
- *
- * @author Thomas.Diesler at jboss.org
- * @since 18-Oct-2004
- */
-public interface JAXBConstants
-{
- /** Set this property with a Reader to the xsdSchema */
- String JAXB_SCHEMA_READER = "org.jboss.jaxb.xsd.reader";
- /** Set this property with a the QName of the root element */
- String JAXB_ROOT_QNAME = "org.jboss.jaxb.root.qname";
- /** Set this property with a the QName of the root type */
- String JAXB_TYPE_QNAME = "org.jboss.jaxb.type.qname";
- /** Set this property with an instance of JavaWsdlMapping */
- String JAXB_JAVA_MAPPING = "org.jboss.jaxb.java.mapping";
- /** Set this property to the XSModel to pull schema info from */
- String JAXB_XS_MODEL = "org.jboss.jaxb.xsd.xsmodel";
-}
Deleted: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxb/JAXBMarshaller.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxb/JAXBMarshaller.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxb/JAXBMarshaller.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -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.jaxb;
-
-import org.xml.sax.ContentHandler;
-import org.w3c.dom.Node;
-
-import java.io.Writer;
-import java.io.OutputStream;
-
-/**
- * @author Heiko Braun <heiko.braun at jboss.com>
- * @version $Id$
- * @since Jul 5, 2006
- */
-public interface JAXBMarshaller {
-
- void marshal(Object obj, Writer writer) throws MarshalException;
-
- void marshal(Object obj, ContentHandler handler);
-
- void marshal(Object obj, Node node);
-
- void marshal(Object obj, OutputStream os) throws MarshalException;
-
- Object getProperty(String name);
-
- void setProperty(String name, Object value);
-}
Deleted: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxb/JAXBUnmarshaller.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxb/JAXBUnmarshaller.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxb/JAXBUnmarshaller.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -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.jaxb;
-
-import java.io.InputStream;
-
-/**
- * @author Heiko Braun <heiko.braun at jboss.com>
- * @version $Id$
- * @since Jul 5, 2006
- */
-public interface JAXBUnmarshaller {
- Object unmarshal(InputStream is) throws UnmarshalException;
-
- Object getProperty(String name);
-
- void setProperty(String name, Object value);
-}
Deleted: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxb/JBossXBMarshallerImpl.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxb/JBossXBMarshallerImpl.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxb/JBossXBMarshallerImpl.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -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.jaxb;
-
-// $Id$
-
-import org.jboss.logging.Logger;
-import org.jboss.util.NotImplementedException;
-import org.jboss.ws.WSException;
-import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping;
-import org.jboss.ws.metadata.jaxrpcmapping.JavaXmlTypeMapping;
-import org.jboss.ws.metadata.jaxrpcmapping.VariableMapping;
-import org.jboss.ws.utils.JavaUtils;
-import org.jboss.ws.xop.XOPMarshallerImpl;
-import org.jboss.xb.binding.Constants;
-import org.jboss.xb.binding.introspection.ClassInfos;
-import org.jboss.xb.binding.sunday.marshalling.MarshallerImpl;
-import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding;
-import org.w3c.dom.Node;
-import org.xml.sax.ContentHandler;
-
-import javax.xml.namespace.QName;
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-import java.io.Writer;
-import java.util.HashMap;
-
-/**
- * An implementation of a JAXB Marshaller that uses the JBossXB schema binding marshaller.
- *
- * @author Thomas.Diesler at jboss.org
- * @author Heiko.Braun at jboss.org
- * @since 05-Jul-2006
- */
-public class JBossXBMarshallerImpl implements JAXBMarshaller {
-
- // provide logging
- private static final Logger log = Logger.getLogger(JBossXBMarshallerImpl.class);
-
- // The marshaller properties
- private HashMap properties = new HashMap();
-
- private MarshallerImpl delegate;
-
- public JBossXBMarshallerImpl()
- {
-
- //ClassInfos.disableCache();
-
- delegate = new MarshallerImpl();
- delegate.setProperty(org.jboss.xb.binding.Marshaller.PROP_OUTPUT_XML_VERSION, "false");
- delegate.setProperty(org.jboss.xb.binding.Marshaller.PROP_OUTPUT_INDENTATION, "false");
- delegate.declareNamespace("xsi", Constants.NS_XML_SCHEMA_INSTANCE);
- delegate.setSupportNil(true);
- }
-
- /**
- * Marshal the content tree rooted at obj into a Writer.
- */
- public void marshal(Object obj, Writer writer) throws MarshalException
- {
- assertRequiredProperties();
-
- try
- {
- QName xmlName = (QName)getProperty(JAXBConstants.JAXB_ROOT_QNAME);
- delegate.addRootElement(xmlName);
-
- QName xmlType = (QName)getProperty(JAXBConstants.JAXB_TYPE_QNAME);
- 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(JAXBConstants.JAXB_JAVA_MAPPING);
- if (wsdlMapping != null)
- {
- JavaXmlTypeMapping[] javaXmlMappings = wsdlMapping.getJavaXmlTypeMappings();
- if (javaXmlMappings != null)
- {
- for (int i = 0; i < javaXmlMappings.length; ++i)
- {
- JavaXmlTypeMapping javaXmlMapping = javaXmlMappings[i];
- VariableMapping[] variableMappings = javaXmlMapping.getVariableMappings();
-
- if (variableMappings != null)
- {
- String clsName = javaXmlMapping.getJavaType();
- Class cls = JavaUtils.loadJavaType(clsName, Thread.currentThread().getContextClassLoader());
- QName clsQName = javaXmlMapping.getRootTypeQName();
-
- 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(JAXBConstants.JAXB_SCHEMA_READER) == null && getProperty(JAXBConstants.JAXB_XS_MODEL) == null)
- throw new WSException("Cannot find required property: " + JAXBConstants.JAXB_XS_MODEL);
-
- if (getProperty(JAXBConstants.JAXB_JAVA_MAPPING) == null)
- throw new WSException("Cannot find required property: " + JAXBConstants.JAXB_JAVA_MAPPING);
-
- QName xmlName = (QName)getProperty(JAXBConstants.JAXB_ROOT_QNAME);
- if (xmlName == null)
- throw new WSException("Cannot find required property: " + JAXBConstants.JAXB_ROOT_QNAME);
-
- if (xmlName.getNamespaceURI().length() > 0 && xmlName.getPrefix().length() == 0)
- throw new IllegalArgumentException("The given root element name must be prefix qualified: " + xmlName);
- }
-}
Deleted: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxb/JBossXBSupport.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxb/JBossXBSupport.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxb/JBossXBSupport.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -1,107 +0,0 @@
-package org.jboss.ws.jaxb;
-
-import java.util.Map;
-
-import javax.xml.namespace.QName;
-
-import org.jboss.util.xml.JBossEntityResolver;
-import org.jboss.ws.metadata.EndpointMetaData;
-import org.jboss.ws.metadata.OperationMetaData;
-import org.jboss.ws.metadata.ServiceMetaData;
-import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping;
-import org.jboss.ws.metadata.wsdl.xmlschema.JBossXSModel;
-import org.jboss.ws.soap.MessageContextAssociation;
-import org.jboss.ws.soap.SOAPMessageContextImpl;
-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 at 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 JAXBConstants#JAXB_ROOT_QNAME
- * @see JAXBConstants#JAXB_TYPE_QNAME
- */
- public static SchemaBinding getOrCreateSchemaBinding(Map properties)
- {
- SchemaBinding schemaBinding = null;
- SchemaBindingBuilder bindingBuilder = new SchemaBindingBuilder();
-
- QName xmlName = (QName)properties.get(JAXBConstants.JAXB_ROOT_QNAME);
- QName xmlType = (QName)properties.get(JAXBConstants.JAXB_TYPE_QNAME);
-
- // Get the eagerly initialized SchameBinding from the ServiceMetaData
- SOAPMessageContextImpl 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(JAXBConstants.JAXB_XS_MODEL);
- JavaWsdlMapping wsdlMapping = (JavaWsdlMapping)properties.get(JAXBConstants.JAXB_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/jbossws-1.0/src/main/java/org/jboss/ws/jaxb/JBossXBUnmarshallerImpl.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxb/JBossXBUnmarshallerImpl.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxb/JBossXBUnmarshallerImpl.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -1,108 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.ws.jaxb;
-
-// $Id$
-
-import java.io.InputStream;
-import java.util.HashMap;
-
-import org.jboss.ws.WSException;
-import org.jboss.ws.xop.XOPUnmarshallerImpl;
-import org.jboss.xb.binding.JBossXBException;
-import org.jboss.xb.binding.UnmarshallerFactory;
-import org.jboss.xb.binding.introspection.ClassInfos;
-import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding;
-
-/**
- * An implementation of a JAXB Unmarshaller.
- *
- * @author Thomas.Diesler at jboss.org
- * @author Alexey.Loubyansky at jboss.org
- * @since 18-Oct-2004
- */
-public class JBossXBUnmarshallerImpl implements JAXBUnmarshaller {
-
- // The marshaller properties
- private HashMap<String, Object> properties = new HashMap<String, Object>();
-
- /**
- * Unmarshal XML data from the specified InputStream and return the resulting content tree.
- */
- public Object unmarshal(InputStream is) throws UnmarshalException
- {
-
- //ClassInfos.disableCache();
-
- assertRequiredProperties();
-
- org.jboss.xb.binding.Unmarshaller unm = UnmarshallerFactory.newInstance().newUnmarshaller();
- SchemaBinding schemaBinding = JBossXBSupport.getOrCreateSchemaBinding(properties);
- schemaBinding.setXopUnmarshaller(new XOPUnmarshallerImpl());
- try
- {
- return unm.unmarshal(is, schemaBinding);
- }
- catch (JBossXBException e)
- {
- throw new UnmarshalException(e.getMessage(), e);
- }
- }
-
- /**
- * Get the particular property in the underlying implementation of Unmarshaller.
- */
- public Object getProperty(String name)
- {
- if (name == null)
- throw new IllegalArgumentException("name parameter is null");
-
- return properties.get(name);
- }
-
- /**
- * Set the particular property in the underlying implementation of Unmarshaller.
- */
- public void setProperty(String name, Object value)
- {
- if (name == null)
- throw new IllegalArgumentException("name parameter is null");
-
- properties.put(name, value);
- }
-
-
- /** Assert the required properties
- */
- private void assertRequiredProperties()
- {
- if (getProperty(JAXBConstants.JAXB_XS_MODEL) == null)
- {
- throw new WSException("Cannot find required property: " + JAXBConstants.JAXB_XS_MODEL);
- }
-
- if (getProperty(JAXBConstants.JAXB_JAVA_MAPPING) == null)
- {
- throw new WSException("Cannot find required property: " + JAXBConstants.JAXB_JAVA_MAPPING);
- }
- }
-}
Deleted: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxb/MarshalException.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxb/MarshalException.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxb/MarshalException.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -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.jaxb;
-
-/**
- * A marshal exception.
- *
- * @author Thomas.Diesler at 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/jbossws-1.0/src/main/java/org/jboss/ws/jaxb/SchemaBindingBuilder.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxb/SchemaBindingBuilder.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxb/SchemaBindingBuilder.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -1,644 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.ws.jaxb;
-
-// $Id$
-
-import java.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.metadata.jaxrpcmapping.ExceptionMapping;
-import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping;
-import org.jboss.ws.metadata.jaxrpcmapping.JavaXmlTypeMapping;
-import org.jboss.ws.metadata.jaxrpcmapping.PackageMapping;
-import org.jboss.ws.metadata.jaxrpcmapping.VariableMapping;
-import org.jboss.ws.Constants;
-import org.jboss.ws.WSException;
-import org.jboss.ws.utils.JBossWSEntityResolver;
-import org.jboss.ws.xop.XOPValueAdapter;
-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 at jboss.org
- * @author Alexey.Loubyansky at 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);
- }
-
- 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());
- }
- // XOP elements that derive from xmlmime namespace
- // need to be declared 'simple' in order for XB to
- // treat them as simple base64Binaries.
- QName elementType = element.getType().getQName();
- if(elementType!=null)
- {
- String elementTypeNS = elementType.getNamespaceURI() != null ? elementType.getNamespaceURI() : "";
- String elementTypeName = elementType.getLocalPart() != null ? elementType.getLocalPart() : "";
- if(elementTypeNS.equals(Constants.NS_XML_MIME) && elementTypeName.equals("base64Binary"))
- {
- element.getType().setSimple(true);
- element.getType().setValueAdapter(new XOPValueAdapter());
- }
- }
- }
-
- 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/jbossws-1.0/src/main/java/org/jboss/ws/jaxb/UnmarshalException.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxb/UnmarshalException.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxb/UnmarshalException.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -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.jaxb;
-
-/**
- * A marshal exception.
- *
- * @author Thomas.Diesler at 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/jbossws-1.0/src/main/java/org/jboss/ws/jaxb/XercesXSMarshallerImpl.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxb/XercesXSMarshallerImpl.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxb/XercesXSMarshallerImpl.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -1,250 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.ws.jaxb;
-
-// $Id$
-
-import org.apache.xerces.xs.XSModel;
-import org.jboss.logging.Logger;
-import org.jboss.util.NotImplementedException;
-import org.jboss.ws.WSException;
-import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping;
-import org.jboss.ws.metadata.jaxrpcmapping.JavaXmlTypeMapping;
-import org.jboss.ws.metadata.jaxrpcmapping.VariableMapping;
-import org.jboss.ws.utils.JavaUtils;
-import org.jboss.xb.binding.Constants;
-import org.jboss.xb.binding.MappingObjectModelProvider;
-import org.jboss.xb.binding.XercesXsMarshaller;
-import org.w3c.dom.Node;
-import org.xml.sax.ContentHandler;
-
-import javax.xml.namespace.QName;
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-import java.io.Writer;
-import java.util.HashMap;
-
-/**
- * An implementation of a JAXB Marshaller that user XercesXSMarshaller impl.
- *
- * @author Thomas.Diesler at jboss.org
- * @since 18-Oct-2004
- */
-public class XercesXSMarshallerImpl implements JAXBMarshaller
-{
-
- // 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(JAXBConstants.JAXB_ROOT_QNAME);
- delegate.addRootElement(xmlName);
-
- QName xmlType = (QName)getProperty(JAXBConstants.JAXB_TYPE_QNAME);
- if (xmlType != null)
- {
- delegate.setRootTypeQName(xmlType);
- }
-
- if (xmlName.getNamespaceURI().length() > 0)
- {
- String prefix = xmlName.getPrefix();
- String nsURI = xmlName.getNamespaceURI();
- delegate.declareNamespace(prefix, nsURI);
- }
-
- MappingObjectModelProvider provider = new MappingObjectModelProvider();
- provider.setIgnoreLowLine(false);
- provider.setIgnoreNotFoundField(false);
-
- // todo complete wsdl mapping merge
- JavaWsdlMapping wsdlMapping = (JavaWsdlMapping)getProperty(JAXBConstants.JAXB_JAVA_MAPPING);
- if (wsdlMapping != null)
- {
- JavaXmlTypeMapping[] javaXmlMappings = wsdlMapping.getJavaXmlTypeMappings();
- if (javaXmlMappings != null)
- {
- for (int i = 0; i < javaXmlMappings.length; ++i)
- {
- JavaXmlTypeMapping javaXmlMapping = javaXmlMappings[i];
- VariableMapping[] variableMappings = javaXmlMapping.getVariableMappings();
- if (variableMappings != null)
- {
- String clsName = javaXmlMapping.getJavaType();
- Class cls = JavaUtils.loadJavaType(clsName, Thread.currentThread().getContextClassLoader());
- QName clsQName = javaXmlMapping.getRootTypeQName();
-
- 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(JAXBConstants.JAXB_XS_MODEL) != null)
- {
- XSModel model = (XSModel)getProperty(JAXBConstants.JAXB_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(JAXBConstants.JAXB_SCHEMA_READER) == null && getProperty(JAXBConstants.JAXB_XS_MODEL) == null)
- throw new WSException("Cannot find required property: " + JAXBConstants.JAXB_XS_MODEL);
-
- if (getProperty(JAXBConstants.JAXB_JAVA_MAPPING) == null)
- throw new WSException("Cannot find required property: " + JAXBConstants.JAXB_JAVA_MAPPING);
-
- QName xmlName = (QName)getProperty(JAXBConstants.JAXB_ROOT_QNAME);
- if (xmlName == null)
- throw new WSException("Cannot find required property: " + JAXBConstants.JAXB_ROOT_QNAME);
-
- if (xmlName.getNamespaceURI().length() > 0 && xmlName.getPrefix().length() == 0)
- throw new IllegalArgumentException("The given root element name must be prefix qualified: " + xmlName);
- }
-}
Added: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxrpc/SerializationContextJAXRPC.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxrpc/SerializationContextJAXRPC.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxrpc/SerializationContextJAXRPC.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -0,0 +1,127 @@
+/*
+ * 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.jaxrpc;
+
+// $Id$
+
+import javax.xml.namespace.QName;
+
+import org.apache.xerces.xs.XSModel;
+import org.jboss.logging.Logger;
+import org.jboss.ws.Constants;
+import org.jboss.ws.WSException;
+import org.jboss.ws.binding.SerializationContext;
+import org.jboss.ws.jaxrpc.handler.SOAPMessageContextJAXRPC;
+import org.jboss.ws.metadata.OperationMetaData;
+import org.jboss.ws.metadata.ServiceMetaData;
+import org.jboss.ws.metadata.TypesMetaData;
+import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping;
+import org.jboss.ws.metadata.jaxrpcmapping.JavaXmlTypeMapping;
+import org.jboss.ws.metadata.jaxrpcmapping.PackageMapping;
+import org.jboss.ws.soap.MessageContextAssociation;
+import org.jboss.ws.utils.JavaUtils;
+
+/**
+ * The serialization context for JAXRPC endpoints/clients
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 04-Dec-2004
+ */
+public class SerializationContextJAXRPC extends SerializationContext
+{
+ // provide logging
+ private static final Logger log = Logger.getLogger(SerializationContextJAXRPC.class);
+
+ // XML mapping from jaxrpc-mapping.xml
+ private JavaWsdlMapping jaxrpcMapping;
+
+ public JavaWsdlMapping getJavaWsdlMapping()
+ {
+ if (jaxrpcMapping == null)
+ {
+ log.debug("Generate jaxrpcMapping from typeMapping");
+
+ jaxrpcMapping = new JavaWsdlMapping();
+ for (QName xmlType : getTypeMapping().getRegisteredXmlTypes())
+ {
+ String nsURI = xmlType.getNamespaceURI();
+ if (!Constants.NS_SCHEMA_XSD.equals(nsURI) && !Constants.NS_ATTACHMENT_MIME_TYPE.equals(nsURI))
+ {
+ Class javaType = getTypeMapping().getJavaType(xmlType);
+ String javaTypeName = javaType.getName();
+
+ Class componentType = javaType;
+ while (componentType.isArray())
+ componentType = componentType.getComponentType();
+
+ if (JavaUtils.isPrimitive(componentType))
+ componentType = JavaUtils.getWrapperType(componentType);
+
+ Package packageObject = componentType.getPackage();
+ String packageName = (packageObject != null) ? packageObject.getName() : "";
+ String packageType = jaxrpcMapping.getPackageNameForNamespaceURI(nsURI);
+ if (packageName.equals(packageType) == false)
+ {
+ PackageMapping packageMapping = new PackageMapping(jaxrpcMapping);
+ packageMapping.setNamespaceURI(nsURI);
+ packageMapping.setPackageType(packageName);
+ jaxrpcMapping.addPackageMapping(packageMapping);
+ log.debug("Add package mapping: " + packageMapping);
+ }
+
+ // Do not add mappings for array types
+ if (javaType.isArray())
+ continue;
+
+ JavaXmlTypeMapping xmlTypeMapping = jaxrpcMapping.getTypeMappingForQName(xmlType);
+ if (xmlTypeMapping == null)
+ {
+ xmlTypeMapping = new JavaXmlTypeMapping(jaxrpcMapping);
+ xmlTypeMapping.setQNameScope("complexType");
+ xmlTypeMapping.setJavaType(javaTypeName);
+ xmlTypeMapping.setRootTypeQName(xmlType);
+ jaxrpcMapping.addJavaXmlTypeMappings(xmlTypeMapping);
+ log.debug("Add type mapping: " + xmlTypeMapping);
+ }
+ }
+ }
+ }
+ return jaxrpcMapping;
+ }
+
+ public void setJavaWsdlMapping(JavaWsdlMapping jaxrpcMapping)
+ {
+ this.jaxrpcMapping = jaxrpcMapping;
+ }
+
+ public XSModel getXsModel()
+ {
+ SOAPMessageContextJAXRPC msgContext = (SOAPMessageContextJAXRPC)MessageContextAssociation.peekMessageContext();
+ if (msgContext == null)
+ throw new WSException("MessageContext not available");
+
+ OperationMetaData opMetaData = msgContext.getOperationMetaData();
+ ServiceMetaData serviceMetaData = opMetaData.getEndpointMetaData().getServiceMetaData();
+ TypesMetaData typesMetaData = serviceMetaData.getTypesMetaData();
+ return typesMetaData.getSchemaModel();
+ }
+}
Property changes on: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxrpc/SerializationContextJAXRPC.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxrpc/ServletEndpointContextImpl.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxrpc/ServletEndpointContextImpl.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxrpc/ServletEndpointContextImpl.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -0,0 +1,94 @@
+/*
+ * 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.jaxrpc;
+
+// $Id$
+
+import java.security.Principal;
+
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+import javax.xml.rpc.handler.MessageContext;
+import javax.xml.rpc.server.ServletEndpointContext;
+
+import org.jboss.ws.server.EndpointContext;
+import org.jboss.ws.soap.MessageContextAssociation;
+
+/**
+ * Implementation of <code>ServletEndpointContext</code>
+ *
+ * @author <a href="mailto:jason at stacksmash.com">Jason T. Greene</a>
+ */
+public class ServletEndpointContextImpl implements ServletEndpointContext
+{
+ private ServletContext context;
+ private HttpServletRequest request;
+ private HttpServletResponse response;
+
+ public ServletEndpointContextImpl(EndpointContext context)
+ {
+ this.context = context.getServletContext();
+ this.request = context.getHttpServletRequest();
+ this.response = context.getHttpServletResponse();
+ }
+
+ public HttpSession getHttpSession()
+ {
+ return request.getSession();
+ }
+
+ public MessageContext getMessageContext()
+ {
+ return (MessageContext)MessageContextAssociation.peekMessageContext();
+ }
+
+ public ServletContext getServletContext()
+ {
+ return context;
+ }
+
+ public Principal getUserPrincipal()
+ {
+ return request.getUserPrincipal();
+ }
+
+ public boolean isUserInRole(String role)
+ {
+ return request.isUserInRole(role);
+ }
+
+ // BEGIN non-standard access methods
+
+ public HttpServletRequest getHttpServletRequest()
+ {
+ return request;
+ }
+
+ public HttpServletResponse getHttpServletResponse()
+ {
+ return response;
+ }
+
+ // END non-standard access methods
+}
\ No newline at end of file
Property changes on: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxrpc/ServletEndpointContextImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Deleted: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxrpc/encoding/DeserializerSupport.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxrpc/encoding/DeserializerSupport.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxrpc/encoding/DeserializerSupport.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -1,94 +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.jaxrpc.encoding;
-
-// $Id$
-
-import javax.xml.namespace.QName;
-import javax.xml.rpc.encoding.Deserializer;
-
-import org.jboss.util.NotImplementedException;
-import org.jboss.ws.binding.BindingException;
-import org.jboss.ws.utils.XMLPredefinedEntityReferenceResolver;
-
-/** The base class for all Deserializers.
- *
- * @author Thomas.Diesler at 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, SerializationContextImpl 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();
- }
-}
Deleted: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxrpc/encoding/JAXBDeserializer.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxrpc/encoding/JAXBDeserializer.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxrpc/encoding/JAXBDeserializer.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -1,107 +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.jaxrpc.encoding;
-
-// $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.binding.BindingException;
-import org.jboss.ws.jaxb.JAXBConstants;
-import org.jboss.ws.jaxb.JBossXBUnmarshallerImpl;
-import org.jboss.ws.jaxb.JAXBUnmarshaller;
-import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping;
-
-/**
- * A Deserializer that can handle complex types by delegating to JAXB.
- *
- * @author Thomas.Diesler at jboss.org
- * @since 04-Dec-2004
- */
-public class JAXBDeserializer extends DeserializerSupport
-{
- // provide logging
- private static final Logger log = Logger.getLogger(JAXBDeserializer.class);
-
- private JAXBUnmarshaller unmarshaller;
-
- public JAXBDeserializer() 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, SerializationContextImpl serContext) throws BindingException
- {
- log.debug("deserialize: [xmlName=" + xmlName + ",xmlType=" + xmlType + "]");
-
- Object value = null;
- String typeName = xmlType.getLocalPart();
-
- try
- {
- // Get the parsed model
- XSModel model = serContext.getXsModel();
-
- // Get the jaxrpc-mapping.xml meta data
- JavaWsdlMapping jaxrpcMapping = serContext.getJavaWsdlMapping();
-
- unmarshaller.setProperty(JAXBConstants.JAXB_XS_MODEL, model);
- unmarshaller.setProperty(JAXBConstants.JAXB_ROOT_QNAME, xmlName);
- unmarshaller.setProperty(JAXBConstants.JAXB_TYPE_QNAME, xmlType);
- unmarshaller.setProperty(JAXBConstants.JAXB_JAVA_MAPPING, jaxrpcMapping);
-
- ByteArrayInputStream ins = new ByteArrayInputStream(val.getBytes("UTF-8"));
- value = unmarshaller.unmarshal(ins);
- }
- catch (RuntimeException e)
- {
- throw e;
- }
- catch (Exception e)
- {
- throw new BindingException(e);
- }
-
- log.debug("deserialized: " + (value != null ? value.getClass().getName() : null));
- return value;
-
- }
-}
Deleted: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxrpc/encoding/JAXBDeserializerFactory.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxrpc/encoding/JAXBDeserializerFactory.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxrpc/encoding/JAXBDeserializerFactory.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -1,41 +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.jaxrpc.encoding;
-
-import org.jboss.ws.binding.BindingException;
-
-// $Id$
-
-/**
- * A factory for a Deserializer that can handle complex types
- * by delegating to JAXB.
- *
- * @author Thomas.Diesler at jboss.org
- * @since 04-Dec-2004
- */
-public class JAXBDeserializerFactory extends DeserializerFactoryBase
-{
- public DeserializerSupport getDeserializer() throws BindingException
- {
- return new JAXBDeserializer();
- }
-}
Deleted: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxrpc/encoding/JAXBSerializer.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxrpc/encoding/JAXBSerializer.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxrpc/encoding/JAXBSerializer.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -1,123 +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.jaxrpc.encoding;
-
-// $Id$
-
-import org.apache.xerces.xs.XSModel;
-import org.jboss.logging.Logger;
-import org.jboss.ws.binding.BindingException;
-import org.jboss.ws.jaxb.JAXBConstants;
-import org.jboss.ws.jaxb.JAXBMarshaller;
-import org.jboss.ws.jaxb.JBossXBMarshallerImpl;
-import org.jboss.ws.jaxb.XercesXSMarshallerImpl;
-import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping;
-import org.w3c.dom.NamedNodeMap;
-
-import javax.xml.namespace.QName;
-import java.io.StringWriter;
-
-/**
- * A Serializer that can handle complex types by delegating to JAXB.
- *
- * @author Thomas.Diesler at jboss.org
- * @since 04-Dec-2004
- */
-public class JAXBSerializer extends SerializerSupport
-{
- // provide logging
- private static final Logger log = Logger.getLogger(JAXBSerializer.class);
-
- private JAXBMarshaller marshaller;
-
- public JAXBSerializer() 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, SerializationContextImpl serContext, NamedNodeMap attributes) throws BindingException
- {
- log.debug("serialize: [xmlName=" + xmlName + ",xmlType=" + xmlType + "]");
- try
- {
-
- String xmlFragment = null;
-
- // Get the parsed model
- XSModel model = serContext.getXsModel();
-
- // Get the jaxrpc-mapping.xml object graph
- JavaWsdlMapping jaxrpcMapping = serContext.getJavaWsdlMapping();
-
- StringWriter strwr = new StringWriter();
-
- // schemabinding marshaller is the default delegate
- JAXBMarshaller 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(JAXBConstants.JAXB_XS_MODEL, model);
- delegate.setProperty(JAXBConstants.JAXB_TYPE_QNAME, xmlType);
- delegate.setProperty(JAXBConstants.JAXB_ROOT_QNAME, xmlName);
- delegate.setProperty(JAXBConstants.JAXB_JAVA_MAPPING, jaxrpcMapping);
-
- // marshall
- delegate.marshal(value, strwr);
- xmlFragment = strwr.toString();
-
- log.debug("serialized: " + xmlFragment);
-
- return xmlFragment;
- }
- catch (RuntimeException e)
- {
- throw e;
- }
- catch (Exception e)
- {
- throw new BindingException(e);
- }
- }
-}
Deleted: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxrpc/encoding/JAXBSerializerFactory.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxrpc/encoding/JAXBSerializerFactory.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxrpc/encoding/JAXBSerializerFactory.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -1,42 +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.jaxrpc.encoding;
-
-import org.jboss.ws.binding.BindingException;
-
-// $Id$
-
-
-/**
- * A factory for a Serializer that can handle complex types
- * by delegating to JAXB.
- *
- * @author Thomas.Diesler at jboss.org
- * @since 04-Dec-2004
- */
-public class JAXBSerializerFactory extends SerializerFactoryBase
-{
- public SerializerSupport getSerializer() throws BindingException
- {
- return new JAXBSerializer();
- }
-}
Deleted: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxrpc/encoding/SerializationContextImpl.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxrpc/encoding/SerializationContextImpl.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxrpc/encoding/SerializationContextImpl.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -1,168 +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.jaxrpc.encoding;
-
-// $Id$
-
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.xml.namespace.QName;
-import javax.xml.rpc.encoding.SerializationContext;
-
-import org.apache.xerces.xs.XSModel;
-import org.jboss.logging.Logger;
-import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping;
-import org.jboss.ws.metadata.jaxrpcmapping.JavaXmlTypeMapping;
-import org.jboss.ws.metadata.jaxrpcmapping.PackageMapping;
-import org.jboss.ws.Constants;
-import org.jboss.ws.WSException;
-import org.jboss.ws.jaxrpc.TypeMappingImpl;
-import org.jboss.ws.metadata.OperationMetaData;
-import org.jboss.ws.metadata.ServiceMetaData;
-import org.jboss.ws.metadata.TypesMetaData;
-import org.jboss.ws.soap.MessageContextAssociation;
-import org.jboss.ws.soap.SOAPMessageContextImpl;
-import org.jboss.ws.utils.JavaUtils;
-import org.jboss.xb.binding.NamespaceRegistry;
-
-/**
- * @author Thomas.Diesler at jboss.org
- * @since 04-Dec-2004
- */
-public class SerializationContextImpl implements SerializationContext
-{
- // provide logging
- private static final Logger log = Logger.getLogger(SerializationContextImpl.class);
-
- public static final String PROPERTY_PARAMETER_META_DATA = "org.jboss.ws.metadata.ParameterMetaData";
-
- // 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;
- // XML mapping from jaxrpc-mapping.xml
- private JavaWsdlMapping jaxrpcMapping;
- // An arbitrary property bag
- private Map<Object, Object> properties = new HashMap<Object,Object>();
-
- public Object getProperty(Object key)
- {
- return properties.get(key);
- }
-
- public void setProperty(Object key, Object value)
- {
- properties.put(key, value);
- }
-
- public TypeMappingImpl getTypeMapping()
- {
- return typeMapping;
- }
-
- public void setTypeMapping(TypeMappingImpl typeMapping)
- {
- this.typeMapping = typeMapping;
- }
-
- public NamespaceRegistry getNamespaceRegistry()
- {
- return namespaceRegistry;
- }
-
- public void setNamespaceRegistry(NamespaceRegistry namespaceRegistry)
- {
- this.namespaceRegistry = namespaceRegistry;
- }
-
- public JavaWsdlMapping getJavaWsdlMapping()
- {
- if (jaxrpcMapping == null)
- {
- log.debug("Generate jaxrpcMapping from typeMapping");
-
- jaxrpcMapping = new JavaWsdlMapping();
- for (QName xmlType : typeMapping.getRegisteredXmlTypes())
- {
- String nsURI = xmlType.getNamespaceURI();
- if (!Constants.NS_SCHEMA_XSD.equals(nsURI) && !Constants.NS_ATTACHMENT_MIME_TYPE.equals(nsURI))
- {
- Class javaType = typeMapping.getJavaType(xmlType);
- String javaTypeName = javaType.getName();
-
- Class componentType = javaType;
- while (componentType.isArray())
- componentType = componentType.getComponentType();
-
- if (JavaUtils.isPrimitive(componentType))
- componentType = JavaUtils.getWrapperType(componentType);
-
- Package packageObject = componentType.getPackage();
- String packageName = (packageObject != null) ? packageObject.getName() : "";
- String packageType = jaxrpcMapping.getPackageNameForNamespaceURI(nsURI);
- if (packageName.equals(packageType) == false)
- {
- PackageMapping packageMapping = new PackageMapping(jaxrpcMapping);
- packageMapping.setNamespaceURI(nsURI);
- packageMapping.setPackageType(packageName);
- jaxrpcMapping.addPackageMapping(packageMapping);
- log.debug("Add package mapping: " + packageMapping);
- }
-
- // Do not add mappings for array types
- if (javaType.isArray())
- continue;
-
- JavaXmlTypeMapping xmlTypeMapping = jaxrpcMapping.getTypeMappingForQName(xmlType);
- if (xmlTypeMapping == null)
- {
- xmlTypeMapping = new JavaXmlTypeMapping(jaxrpcMapping);
- xmlTypeMapping.setQNameScope("complexType");
- xmlTypeMapping.setJavaType(javaTypeName);
- xmlTypeMapping.setRootTypeQName(xmlType);
- jaxrpcMapping.addJavaXmlTypeMappings(xmlTypeMapping);
- log.debug("Add type mapping: " + xmlTypeMapping);
- }
- }
- }
- }
- return jaxrpcMapping;
- }
-
- public void setJavaWsdlMapping(JavaWsdlMapping jaxrpcMapping)
- {
- this.jaxrpcMapping = jaxrpcMapping;
- }
-
- public XSModel getXsModel()
- {
- SOAPMessageContextImpl msgContext = MessageContextAssociation.peekMessageContext();
- if (msgContext == null)
- throw new WSException("MessageContext not available");
-
- OperationMetaData opMetaData = msgContext.getOperationMetaData();
- ServiceMetaData serviceMetaData = opMetaData.getEndpointMetaData().getServiceMetaData();
- TypesMetaData typesMetaData = serviceMetaData.getTypesMetaData();
- return typesMetaData.getSchemaModel();
- }
-}
Deleted: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxrpc/encoding/SerializerSupport.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxrpc/encoding/SerializerSupport.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxrpc/encoding/SerializerSupport.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -1,162 +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.jaxrpc.encoding;
-
-// $Id$
-
-import javax.xml.namespace.QName;
-import javax.xml.rpc.encoding.Serializer;
-
-import org.jboss.util.NotImplementedException;
-import org.jboss.ws.binding.BindingException;
-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 at jboss.org
- * @author <a href="mailto:jason.greene at 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, SerializationContextImpl 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)
- {
- 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)
- {
- xmlFragment = "<" + elName + nsAttr + " xsi:nil='1'/>";
- }
- else
- {
- 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
Deleted: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxrpc/encoding/XOPDeserializer.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxrpc/encoding/XOPDeserializer.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxrpc/encoding/XOPDeserializer.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -1,74 +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.jaxrpc.encoding;
-
-// $Id: XOPDeserializer.java 275 2006-05-04 21:36:29Z jason.greene at jboss.com $
-
-import java.io.IOException;
-
-import javax.activation.DataHandler;
-import javax.xml.namespace.QName;
-import javax.xml.soap.AttachmentPart;
-import javax.xml.soap.SOAPException;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.binding.BindingException;
-import org.jboss.ws.soap.MessageContextAssociation;
-import org.jboss.ws.soap.SOAPMessageContextImpl;
-import org.jboss.ws.soap.SOAPMessageImpl;
-
-/**
- * Deserializer for XOP
- *
- * @author Thomas.Diesler at jboss.org
- * @since 18-Jan-2006
- */
-public class XOPDeserializer extends DeserializerSupport
-{
- // provide logging
- private static final Logger log = Logger.getLogger(XOPDeserializer.class);
-
- public Object deserialize(QName xmlName, QName xmlType, String cid, SerializationContextImpl serContext) throws BindingException
- {
- log.debug("deserialize: [xmlName=" + xmlName + ",xmlType=" + xmlType + "]");
-
- try
- {
- SOAPMessageContextImpl msgContext = MessageContextAssociation.peekMessageContext();
- SOAPMessageImpl soapMessage = (SOAPMessageImpl)msgContext.getMessage();
- AttachmentPart part = soapMessage.getAttachmentByContentId(cid);
- if (part == null)
- throw new BindingException("Cannot find attachment part for: " + cid);
-
- DataHandler dataHandler = part.getDataHandler();
- return dataHandler.getContent();
- }
- catch (SOAPException ex)
- {
- throw new BindingException(ex);
- }
- catch (IOException ex)
- {
- throw new BindingException(ex);
- }
- }
-}
Deleted: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxrpc/encoding/XOPSerializer.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxrpc/encoding/XOPSerializer.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxrpc/encoding/XOPSerializer.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -1,97 +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.jaxrpc.encoding;
-
-// $Id: XOPSerializer.java 275 2006-05-04 21:36:29Z jason.greene at jboss.com $
-
-import javax.activation.DataHandler;
-import javax.xml.namespace.QName;
-import javax.xml.soap.AttachmentPart;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.Constants;
-import org.jboss.ws.WSException;
-import org.jboss.ws.binding.BindingException;
-import org.jboss.ws.soap.MessageContextAssociation;
-import org.jboss.ws.soap.SOAPMessageContextImpl;
-import org.jboss.ws.soap.SOAPMessageImpl;
-import org.jboss.ws.soap.attachment.MimeConstants;
-import org.jboss.xb.binding.NamespaceRegistry;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-
-/**
- * Serializer for XOP values.
- *
- * @author Thomas.Diesler at jboss.org
- * @since 17-Jan-2006
- */
-public class XOPSerializer extends SerializerSupport
-{
- // provide logging
- private static final Logger log = Logger.getLogger(XOPSerializer.class);
-
- /**
- * Serializes an XOP object into an xop:Include
- */
- public String serialize(QName xmlName, QName xmlType, Object value, SerializationContextImpl serContext, NamedNodeMap attributes) throws BindingException
- {
- log.debug("serialize: [xmlName=" + xmlName + ",xmlType=" + xmlType + "]");
-
- NamespaceRegistry nsRegistry = serContext.getNamespaceRegistry();
-
- // Add the xop:Include element
- StringBuilder xopInclude = new StringBuilder("<" + Constants.PREFIX_XOP + ":Include ");
- xopInclude.append("xmlns:" + Constants.PREFIX_XOP + "='" + Constants.NS_XOP + "' ");
-
- SOAPMessageContextImpl msgContext = MessageContextAssociation.peekMessageContext();
- SOAPMessageImpl soapMessage = (SOAPMessageImpl)msgContext.getMessage();
-
- String cid = soapMessage.getCidGenerator().generateFromName(xmlName.getLocalPart());
- xopInclude.append("href='" + cid + "'/>");
-
- Node attr = attributes.getNamedItemNS(Constants.NS_XML_MIME, "contentType");
- if (attr == null)
- throw new WSException("Cannot obtain xmime:contentType");
-
- String contentType = attr.getNodeValue();
-
- AttachmentPart xopPart;
- if (value instanceof DataHandler)
- {
- DataHandler dataHandler = (DataHandler)value;
- xopPart = soapMessage.createAttachmentPart(dataHandler);
- if (contentType.equals(dataHandler.getContentType()) == false)
- log.warn("ContentType missmatch " + contentType + "!=" + dataHandler.getContentType());
- }
- else
- {
- xopPart = soapMessage.createAttachmentPart(value, contentType);
- }
-
- xopPart.addMimeHeader(MimeConstants.CONTENT_ID, cid);
- soapMessage.addAttachmentPart(xopPart);
-
- String xmlFragment = wrapValueStr(xmlName, xopInclude.toString(), nsRegistry, attributes);
- return xmlFragment;
- }
-}
Added: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxrpc/handler/ClientHandlerChain.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxrpc/handler/ClientHandlerChain.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxrpc/handler/ClientHandlerChain.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -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.jaxrpc.handler;
+
+// $Id$
+
+import java.util.List;
+import java.util.Set;
+
+
+/**
+ * Represents a list of handlers. All elements in the
+ * HandlerChain are of the type javax.xml.rpc.handler.Handler.
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 06-May-2004
+ */
+public class ClientHandlerChain extends HandlerChainBaseImpl
+{
+ public ClientHandlerChain(List infos, Set roles)
+ {
+ super(infos, roles);
+ }
+}
Property changes on: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxrpc/handler/ClientHandlerChain.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxrpc/handler/HandlerChainBaseImpl.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxrpc/handler/HandlerChainBaseImpl.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxrpc/handler/HandlerChainBaseImpl.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -0,0 +1,730 @@
+/*
+ * 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.jaxrpc.handler;
+
+// $Id$
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.Map;
+import java.util.Set;
+
+import javax.xml.namespace.QName;
+import javax.xml.rpc.JAXRPCException;
+import javax.xml.rpc.handler.Handler;
+import javax.xml.rpc.handler.HandlerChain;
+import javax.xml.rpc.handler.HandlerInfo;
+import javax.xml.rpc.handler.MessageContext;
+import javax.xml.rpc.soap.SOAPFaultException;
+import javax.xml.soap.Name;
+import javax.xml.soap.SOAPEnvelope;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPHeaderElement;
+import javax.xml.soap.SOAPPart;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.Constants;
+import org.jboss.ws.common.CommonMessageContext;
+import org.jboss.ws.metadata.EndpointMetaData;
+import org.jboss.ws.metadata.OperationMetaData;
+import org.jboss.ws.metadata.ParameterMetaData;
+import org.jboss.ws.metadata.HandlerMetaData.HandlerType;
+import org.jboss.ws.soap.SOAPElementImpl;
+import org.jboss.ws.soap.SOAPElementWriter;
+import org.jboss.ws.soap.SOAPEnvelopeImpl;
+import org.jboss.ws.soap.SOAPMessageImpl;
+
+/**
+ * Represents a list of handlers. All elements in the
+ * HandlerChain are of the type javax.xml.rpc.handler.Handler.
+ * <p/>
+ * Abstracts the policy and mechanism for the invocation of the registered handlers.
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 06-May-2004
+ */
+public abstract class HandlerChainBaseImpl implements HandlerChain
+{
+ private static Logger log = Logger.getLogger(HandlerChainBaseImpl.class);
+
+ public static final int STATE_DOES_NOT_EXIST = 0;
+ public static final int STATE_CREATED = 1;
+ public static final int STATE_READY = 2;
+ public static final int STATE_DESTROYED = 3;
+
+ // The List<Entry> objects
+ protected List<HandlerEntry> handlers = new ArrayList<HandlerEntry>();
+ // The roles associated with the handler chain
+ protected Set<String> roles = new HashSet<String>();
+ // The index of the first handler that returned false during processing
+ protected int falseIndex = -1;
+ // The state of this handler chain
+ protected int state;
+
+ /**
+ * Constructs a handler chain with the given handlers infos
+ */
+ public HandlerChainBaseImpl(List<HandlerInfo> infos, Set<String> roles)
+ {
+ log.debug("Create a handler chain for roles: " + roles);
+ addHandlersToChain(infos, roles);
+ }
+
+ /** Get the list of handler infos
+ */
+ public List<HandlerInfo> getHandlerInfos()
+ {
+ List<HandlerInfo> list = new ArrayList<HandlerInfo>();
+ for (int i = 0; i < handlers.size(); i++)
+ {
+ HandlerEntry entry = (HandlerEntry)handlers.get(i);
+ list.add(entry.info);
+ }
+ return list;
+ }
+
+ /**
+ * Initialize the a handler chain with the given handlers infos
+ *
+ * @throws javax.xml.rpc.JAXRPCException If any error during initialization
+ */
+ private void addHandlersToChain(List<HandlerInfo> infos, Set<String> roleSet)
+ {
+ try
+ {
+ if (infos != null)
+ {
+ for (HandlerInfo info : infos)
+ {
+ HandlerWrapper handler = new HandlerWrapper((Handler)info.getHandlerClass().newInstance());
+ HandlerType type = (HandlerType)info.getHandlerConfig().get(HandlerType.class.getName());
+ handlers.add(new HandlerEntry(handler, info, type));
+ }
+ }
+ if (roleSet != null)
+ {
+ roles.addAll(roleSet);
+ }
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (Exception ex)
+ {
+ throw new JAXRPCException("Cannot initialize handler chain", ex);
+ }
+
+ // set state to created
+ state = STATE_CREATED;
+ }
+
+ /**
+ * Get the state of this handler chain
+ */
+ public int getState()
+ {
+ return state;
+ }
+
+ /**
+ * Initializes the configuration for a HandlerChain.
+ *
+ * @param config Configuration for the initialization of this handler chain
+ * @throws javax.xml.rpc.JAXRPCException If any error during initialization
+ */
+ public void init(Map config)
+ {
+ log.debug("init: [config=" + config + "]");
+ for (int i = 0; i < handlers.size(); i++)
+ {
+ HandlerEntry entry = (HandlerEntry)handlers.get(i);
+ entry.handler.init(entry.info);
+ }
+
+ // set state to ready
+ state = STATE_READY;
+ }
+
+ /**
+ * Indicates the end of lifecycle for a HandlerChain.
+ *
+ * @throws javax.xml.rpc.JAXRPCException If any error during destroy
+ */
+ public void destroy()
+ {
+ log.debug("destroy");
+ for (int i = 0; i < handlers.size(); i++)
+ {
+ HandlerEntry entry = (HandlerEntry)handlers.get(i);
+ entry.handler.destroy();
+ }
+ handlers.clear();
+
+ // set state to destroyed
+ state = STATE_DESTROYED;
+ }
+
+ /**
+ * Gets SOAP actor roles registered for this HandlerChain at this SOAP node. The returned array includes the
+ * special SOAP actor next.
+ *
+ * @return SOAP Actor roles as URIs
+ */
+ public String[] getRoles()
+ {
+ Set<String> auxlist = new HashSet<String>(roles);
+ auxlist.add(Constants.URI_SOAP11_NEXT_ACTOR);
+ String[] roleArr = new String[auxlist.size()];
+ auxlist.toArray(roleArr);
+ return roleArr;
+ }
+
+ /**
+ * Sets SOAP Actor roles for this HandlerChain. This specifies the set of roles in which this HandlerChain is to act
+ * for the SOAP message processing at this SOAP node. These roles assumed by a HandlerChain must be invariant during
+ * the processing of an individual SOAP message through the HandlerChain.
+ * <p/>
+ * A HandlerChain always acts in the role of the special SOAP actor next. Refer to the SOAP specification for the
+ * URI name for this special SOAP actor. There is no need to set this special role using this method.
+ *
+ * @param soapActorNames URIs for SOAP actor name
+ */
+ public void setRoles(String[] soapActorNames)
+ {
+ List<String> newRoles = Arrays.asList(soapActorNames);
+ log.debug("setRoles: " + newRoles);
+
+ roles.clear();
+ roles.addAll(newRoles);
+ }
+
+ /**
+ * Initiates the request processing for this handler chain.
+ *
+ * @param msgContext MessageContext parameter provides access to the request SOAP message.
+ * @return Returns true if all handlers in chain have been processed. Returns false if a handler in the chain returned false from its handleRequest method.
+ * @throws javax.xml.rpc.JAXRPCException if any processing error happens
+ */
+ public boolean handleRequest(MessageContext msgContext)
+ {
+ return handleRequestInternal(msgContext, HandlerType.ALL);
+ }
+
+ public boolean handleRequest(MessageContext msgContext, HandlerType type)
+ {
+ return handleRequestInternal(msgContext, type);
+ }
+
+ private boolean handleRequestInternal(MessageContext msgContext, HandlerType type)
+ {
+ boolean doNext = true;
+
+ if (handlers.size() > 0)
+ {
+ log.debug("Enter: handleRequest");
+
+ SOAPMessageContextJAXRPC jaxrpcContext = (SOAPMessageContextJAXRPC)msgContext;
+ jaxrpcContext.setProperty(CommonMessageContext.ALLOW_EXPAND_TO_DOM, Boolean.TRUE);
+
+ // Replace handlers that did not survive the previous call
+ replaceDirtyHandlers();
+
+ int handlerIndex = 0;
+ Handler currHandler = null;
+ try
+ {
+ String lastMessageTrace = null;
+ for (; doNext && handlerIndex < handlers.size(); handlerIndex++)
+ {
+ HandlerEntry handlerEntry = (HandlerEntry)handlers.get(handlerIndex);
+ if (type == HandlerType.ALL || type == handlerEntry.getType())
+ {
+ currHandler = handlerEntry.getHandler();
+
+ if (log.isTraceEnabled())
+ {
+ SOAPPart soapPart = jaxrpcContext.getMessage().getSOAPPart();
+ lastMessageTrace = traceSOAPPart("BEFORE handleRequest - " + currHandler, soapPart, lastMessageTrace);
+ }
+
+ doNext = currHandler.handleRequest(msgContext);
+
+ if (log.isTraceEnabled())
+ {
+ SOAPPart soapPart = jaxrpcContext.getMessage().getSOAPPart();
+ lastMessageTrace = traceSOAPPart("AFTER handleRequest - " + currHandler, soapPart, lastMessageTrace);
+ }
+ }
+ }
+ }
+ catch (RuntimeException e)
+ {
+ log.error("RuntimeException in request handler", e);
+ doNext = false;
+ throw e;
+ }
+ finally
+ {
+ // we start at this index in the response chain
+ if (doNext == false)
+ falseIndex = (handlerIndex - 1);
+
+ jaxrpcContext.removeProperty(CommonMessageContext.ALLOW_EXPAND_TO_DOM);
+ log.debug("Exit: handleRequest with status: " + doNext);
+ }
+ }
+
+ return doNext;
+ }
+
+ /**
+ * Initiates the response processing for this handler chain.
+ * <p/>
+ * In this implementation, the response handler chain starts processing from the same Handler
+ * instance (that returned false) and goes backward in the execution sequence.
+ *
+ * @return Returns true if all handlers in chain have been processed.
+ * Returns false if a handler in the chain returned false from its handleResponse method.
+ * @throws javax.xml.rpc.JAXRPCException if any processing error happens
+ */
+ public boolean handleResponse(MessageContext msgContext)
+ {
+ return handleResponseInternal(msgContext, HandlerType.ALL);
+ }
+
+ public boolean handleResponse(MessageContext msgContext, HandlerType type)
+ {
+ return handleResponseInternal(msgContext, type);
+ }
+
+ private boolean handleResponseInternal(MessageContext msgContext, HandlerType type)
+ {
+ boolean doNext = true;
+
+ if (handlers.size() > 0)
+ {
+ log.debug("Enter: handleResponse");
+
+ SOAPMessageContextJAXRPC jaxrpcContext = (SOAPMessageContextJAXRPC)msgContext;
+ jaxrpcContext.setProperty(CommonMessageContext.ALLOW_EXPAND_TO_DOM, Boolean.TRUE);
+
+ int handlerIndex = handlers.size() - 1;
+ if (falseIndex != -1)
+ handlerIndex = falseIndex;
+
+ Handler currHandler = null;
+ try
+ {
+ String lastMessageTrace = null;
+ for (; doNext && handlerIndex >= 0; handlerIndex--)
+ {
+ HandlerEntry handlerEntry = (HandlerEntry)handlers.get(handlerIndex);
+ if (type == HandlerType.ALL || type == handlerEntry.getType())
+ {
+ currHandler = handlerEntry.getHandler();
+
+ if (log.isTraceEnabled())
+ {
+ SOAPPart soapPart = jaxrpcContext.getMessage().getSOAPPart();
+ lastMessageTrace = traceSOAPPart("BEFORE handleResponse - " + currHandler, soapPart, lastMessageTrace);
+ }
+
+ doNext = currHandler.handleResponse(msgContext);
+
+ if (log.isTraceEnabled())
+ {
+ SOAPPart soapPart = jaxrpcContext.getMessage().getSOAPPart();
+ lastMessageTrace = traceSOAPPart("AFTER handleResponse - " + currHandler, soapPart, lastMessageTrace);
+ }
+ }
+ }
+ }
+ catch (RuntimeException rte)
+ {
+ log.error("RuntimeException in response handler", rte);
+ doNext = false;
+ throw rte;
+ }
+ finally
+ {
+ // we start at this index in the fault chain
+ if (doNext == false)
+ falseIndex = (handlerIndex - 1);
+
+ jaxrpcContext.removeProperty(CommonMessageContext.ALLOW_EXPAND_TO_DOM);
+ log.debug("Exit: handleResponse with status: " + doNext);
+ }
+ }
+
+ return doNext;
+ }
+
+ /**
+ * Initiates the SOAP fault processing for this handler chain.
+ * <p/>
+ * In this implementation, the fault handler chain starts processing from the same Handler
+ * instance (that returned false) and goes backward in the execution sequence.
+ *
+ * @return Returns true if all handlers in chain have been processed.
+ * Returns false if a handler in the chain returned false from its handleFault method.
+ * @throws javax.xml.rpc.JAXRPCException if any processing error happens
+ */
+ public boolean handleFault(MessageContext msgContext)
+ {
+ boolean doNext = true;
+
+ if (handlers.size() > 0)
+ {
+ log.debug("Enter: handleFault");
+
+ SOAPMessageContextJAXRPC jaxrpcContext = (SOAPMessageContextJAXRPC)msgContext;
+ jaxrpcContext.setProperty(CommonMessageContext.ALLOW_EXPAND_TO_DOM, Boolean.TRUE);
+
+ try
+ {
+ int handlerIndex = handlers.size() - 1;
+ if (falseIndex != -1)
+ handlerIndex = falseIndex;
+
+ Handler currHandler = null;
+ for (; doNext && handlerIndex >= 0; handlerIndex--)
+ {
+ currHandler = ((HandlerEntry)handlers.get(handlerIndex)).getHandler();
+ log.debug("Handle fault: " + currHandler);
+ doNext = currHandler.handleFault(msgContext);
+ }
+ }
+ finally
+ {
+ jaxrpcContext.removeProperty(CommonMessageContext.ALLOW_EXPAND_TO_DOM);
+ log.debug("Exit: handleFault with status: " + doNext);
+ }
+ }
+
+ return doNext;
+ }
+
+ /** Trace the SOAPPart, do nothing if the String representation is equal to the last one.
+ */
+ protected String traceSOAPPart(String logMsg, SOAPPart soapPart, String lastMessageTrace)
+ {
+ try
+ {
+ SOAPEnvelopeImpl soapEnv = (SOAPEnvelopeImpl)soapPart.getEnvelope();
+ String envStr = SOAPElementWriter.writeElement((SOAPElementImpl)soapEnv, true);
+ if (envStr.equals(lastMessageTrace))
+ {
+ log.trace(logMsg + ": unchanged");
+ }
+ else
+ {
+ log.trace(logMsg + "\n" + envStr);
+ lastMessageTrace = envStr;
+ }
+ return lastMessageTrace;
+ }
+ catch (Exception ex)
+ {
+ log.error("Cannot trace SOAP message", ex);
+ return null;
+ }
+ }
+
+ /**
+ * Replace handlers that did not survive the previous call
+ */
+ protected void replaceDirtyHandlers()
+ {
+ for (int i = 0; i < handlers.size(); i++)
+ {
+ HandlerEntry entry = (HandlerEntry)handlers.get(i);
+ if (entry.handler.getState() == HandlerWrapper.DOES_NOT_EXIST)
+ {
+ log.debug("Replacing dirty handler: " + entry.handler);
+ try
+ {
+ HandlerWrapper handler = new HandlerWrapper((Handler)entry.info.getHandlerClass().newInstance());
+ entry.handler = handler;
+ handler.init(entry.info);
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (Exception ex)
+ {
+ log.error("Cannot create handler instance for: " + entry.info, ex);
+ }
+ }
+ }
+ }
+
+ /**
+ * Get the handler at the requested position
+ */
+ protected Handler getHandlerAt(int pos)
+ {
+ if (pos < 0 || handlers.size() <= pos)
+ throw new IllegalArgumentException("No handler at position: " + pos);
+
+ HandlerEntry entry = (HandlerEntry)handlers.get(pos);
+ return entry.handler;
+ }
+
+ /**
+ * R1027 A RECEIVER MUST generate a "soap:MustUnderstand" fault when a
+ * message contains a mandatory header block (i.e., one that has a
+ * soap:mustUnderstand attribute with the value "1") targeted at the
+ * receiver (via soap:actor) that the receiver does not understand.
+ */
+ public static void checkMustUnderstand(SOAPMessageContextJAXRPC msgContext, String[] roles)
+ {
+ SOAPHeaderElement mustUnderstandHeaderElement = null;
+ List roleList = (roles != null ? Arrays.asList(roles) : new ArrayList());
+ try
+ {
+ SOAPMessageImpl soapMessage = (SOAPMessageImpl)msgContext.getMessage();
+
+ // A SOAPHeaderElement is possibly bound to the endpoint operation
+ // in order to check that we need a the opMetaData
+ OperationMetaData opMetaData = msgContext.getOperationMetaData();
+ if (opMetaData == null)
+ {
+ // The security handler must have decrypted the incomming message
+ // before the dispatch target operation can be known
+ EndpointMetaData epMetaData = msgContext.getEndpointMetaData();
+ opMetaData = soapMessage.getOperationMetaData(epMetaData);
+ }
+
+ SOAPEnvelope soapEnvelope = soapMessage.getSOAPPart().getEnvelope();
+ if (soapEnvelope != null && soapEnvelope.getHeader() != null)
+ {
+ Iterator it = soapEnvelope.getHeader().examineAllHeaderElements();
+ while (it.hasNext() && mustUnderstandHeaderElement == null)
+ {
+ SOAPHeaderElement soapHeaderElement = (SOAPHeaderElement)it.next();
+ Name name = soapHeaderElement.getElementName();
+ QName xmlName = new QName(name.getURI(), name.getLocalName());
+
+ ParameterMetaData paramMetaData = (opMetaData != null ? opMetaData.getParameter(xmlName) : null);
+ boolean isBoundHeader = (paramMetaData != null && paramMetaData.isInHeader());
+
+ if (soapHeaderElement.getMustUnderstand() && isBoundHeader == false)
+ {
+ String actor = soapHeaderElement.getActor();
+ boolean noActor = (actor == null || actor.length() == 0);
+ boolean nextActor = Constants.URI_SOAP11_NEXT_ACTOR.equals(actor);
+ if (noActor || nextActor || roleList.contains(actor))
+ {
+ mustUnderstandHeaderElement = soapHeaderElement;
+ }
+ }
+ }
+ }
+ }
+ catch (SOAPException ex)
+ {
+ log.error("Cannot check mustUnderstand for headers", ex);
+ }
+
+ if (mustUnderstandHeaderElement != null)
+ {
+ QName faultCode = Constants.SOAP11_FAULT_CODE_MUST_UNDERSTAND;
+ String faultString = "Unprocessed 'mustUnderstand' header element: " + mustUnderstandHeaderElement.getElementName();
+ throw new SOAPFaultException(faultCode, faultString, null, null);
+ }
+ }
+
+ /**
+ * An entry in the handler list
+ */
+ private class HandlerEntry
+ {
+ private HandlerWrapper handler;
+ private HandlerInfo info;
+ private HandlerType type;
+
+ public HandlerEntry(HandlerWrapper handler, HandlerInfo info, HandlerType type)
+ {
+ if (handler == null || info == null)
+ throw new IllegalStateException("Invalid handler entry");
+
+ if (type == null)
+ {
+ log.debug("Using handler type default: " + HandlerType.ENDPOINT);
+ type = HandlerType.ENDPOINT;
+ }
+
+ this.handler = handler;
+ this.info = info;
+ this.type = type;
+ }
+
+ public Handler getHandler()
+ {
+ return handler;
+ }
+
+ public HandlerInfo getInfo()
+ {
+ return info;
+ }
+
+ public HandlerType getType()
+ {
+ return type;
+ }
+ }
+
+ // java.util.List interface ****************************************************************************************
+
+ public boolean remove(Object o)
+ {
+ return handlers.remove(o);
+ }
+
+ public boolean containsAll(Collection c)
+ {
+ return handlers.containsAll(c);
+ }
+
+ public boolean removeAll(Collection c)
+ {
+ return handlers.removeAll(c);
+ }
+
+ public boolean retainAll(Collection c)
+ {
+ return handlers.retainAll(c);
+ }
+
+ public int hashCode()
+ {
+ return handlers.hashCode();
+ }
+
+ public boolean equals(Object o)
+ {
+ return handlers.equals(o);
+ }
+
+ public Iterator iterator()
+ {
+ return handlers.iterator();
+ }
+
+ public List subList(int fromIndex, int toIndex)
+ {
+ return handlers.subList(fromIndex, toIndex);
+ }
+
+ public ListIterator listIterator()
+ {
+ return handlers.listIterator();
+ }
+
+ public ListIterator listIterator(int index)
+ {
+ return handlers.listIterator(index);
+ }
+
+ public int size()
+ {
+ return handlers.size();
+ }
+
+ public void clear()
+ {
+ handlers.clear();
+ }
+
+ public boolean isEmpty()
+ {
+ return handlers.isEmpty();
+ }
+
+ public Object[] toArray()
+ {
+ return handlers.toArray();
+ }
+
+ public Object get(int index)
+ {
+ return handlers.get(index);
+ }
+
+ public Object remove(int index)
+ {
+ return handlers.remove(index);
+ }
+
+ public void add(int index, Object element)
+ {
+ handlers.add(index, (HandlerEntry)element);
+ }
+
+ public int indexOf(Object elem)
+ {
+ return handlers.indexOf(elem);
+ }
+
+ public int lastIndexOf(Object elem)
+ {
+ return handlers.lastIndexOf(elem);
+ }
+
+ public boolean add(Object o)
+ {
+ return handlers.add((HandlerEntry)o);
+ }
+
+ public boolean contains(Object elem)
+ {
+ return handlers.contains(elem);
+ }
+
+ public boolean addAll(int index, Collection c)
+ {
+ return handlers.addAll(index, c);
+ }
+
+ public boolean addAll(Collection c)
+ {
+ return handlers.addAll(c);
+ }
+
+ public Object set(int index, Object element)
+ {
+ return handlers.set(index, (HandlerEntry)element);
+ }
+
+ public Object[] toArray(Object[] a)
+ {
+ return handlers.toArray(a);
+ }
+}
Property changes on: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxrpc/handler/HandlerChainBaseImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxrpc/handler/HandlerDelegateJAXRPC.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxrpc/handler/HandlerDelegateJAXRPC.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxrpc/handler/HandlerDelegateJAXRPC.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -0,0 +1,202 @@
+/*
+ * 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.jaxrpc.handler;
+
+// $Id$
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import javax.xml.namespace.QName;
+import javax.xml.rpc.handler.HandlerChain;
+import javax.xml.rpc.handler.HandlerInfo;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.WSException;
+import org.jboss.ws.metadata.HandlerMetaData;
+import org.jboss.ws.metadata.HandlerMetaDataJAXRPC;
+import org.jboss.ws.metadata.ServerEndpointMetaData;
+import org.jboss.ws.metadata.HandlerMetaData.HandlerType;
+import org.jboss.ws.metadata.HandlerMetaData.HandlerInitParam;
+import org.jboss.ws.server.HandlerDelegate;
+import org.jboss.ws.server.ServiceEndpointInfo;
+import org.jboss.ws.soap.MessageContextAssociation;
+
+/** Delegates to JAXRPC handlers
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 19-Jan-2005
+ */
+public class HandlerDelegateJAXRPC implements HandlerDelegate
+{
+ // provide logging
+ private static Logger log = Logger.getLogger(HandlerDelegateJAXRPC.class);
+
+ // This endpoints handler chain
+ private ServerHandlerChain preHandlerChain;
+ // This endpoints handler chain
+ private ServerHandlerChain jaxrpcHandlerChain;
+ // This endpoints handler chain
+ private ServerHandlerChain postHandlerChain;
+
+ public HandlerDelegateJAXRPC()
+ {
+ }
+
+ public boolean callRequestHandlerChain(ServiceEndpointInfo seInfo, HandlerType type)
+ {
+ SOAPMessageContextJAXRPC msgContext = (SOAPMessageContextJAXRPC)MessageContextAssociation.peekMessageContext();
+ ServerEndpointMetaData sepMetaData = seInfo.getServerEndpointMetaData();
+
+ // Initialize the handler chain
+ if (sepMetaData.isHandlersInitialized() == false)
+ {
+ initHandlerChain(seInfo, HandlerType.PRE);
+ initHandlerChain(seInfo, HandlerType.ENDPOINT);
+ initHandlerChain(seInfo, HandlerType.POST);
+ sepMetaData.setHandlersInitialized(true);
+ }
+
+ boolean status = true;
+ String[] roles = null;
+
+ HandlerChain handlerChain = null;
+ if (type == HandlerType.PRE)
+ handlerChain = preHandlerChain;
+ else if (type == HandlerType.ENDPOINT)
+ handlerChain = jaxrpcHandlerChain;
+ else if (type == HandlerType.POST)
+ handlerChain = postHandlerChain;
+
+ if (handlerChain != null)
+ {
+ roles = handlerChain.getRoles();
+ status = handlerChain.handleRequest(msgContext);
+ }
+
+ // BP-1.0 R1027
+ if (type == HandlerType.POST)
+ HandlerChainBaseImpl.checkMustUnderstand(msgContext, roles);
+
+ return status;
+ }
+
+ public boolean callResponseHandlerChain(ServiceEndpointInfo seInfo, HandlerType type)
+ {
+ SOAPMessageContextJAXRPC msgContext = (SOAPMessageContextJAXRPC)MessageContextAssociation.peekMessageContext();
+
+ HandlerChain handlerChain = null;
+ if (type == HandlerType.PRE)
+ handlerChain = preHandlerChain;
+ else if (type == HandlerType.ENDPOINT)
+ handlerChain = jaxrpcHandlerChain;
+ else if (type == HandlerType.POST)
+ handlerChain = postHandlerChain;
+
+ return (handlerChain != null ? handlerChain.handleResponse(msgContext) : true);
+ }
+
+ public boolean callFaultHandlerChain(ServiceEndpointInfo seInfo, HandlerType type, Exception ex)
+ {
+ SOAPMessageContextJAXRPC msgContext = (SOAPMessageContextJAXRPC)MessageContextAssociation.peekMessageContext();
+
+ HandlerChain handlerChain = null;
+ if (type == HandlerType.PRE)
+ handlerChain = preHandlerChain;
+ else if (type == HandlerType.ENDPOINT)
+ handlerChain = jaxrpcHandlerChain;
+ else if (type == HandlerType.POST)
+ handlerChain = postHandlerChain;
+
+ return (handlerChain != null ? handlerChain.handleFault(msgContext) : true);
+ }
+
+ /**
+ * Init the handler chain
+ */
+ private void initHandlerChain(ServiceEndpointInfo seInfo, HandlerType type)
+ {
+ Set<String> handlerRoles = new HashSet<String>();
+ List<HandlerInfo> hInfos = new ArrayList<HandlerInfo>();
+
+ ServerEndpointMetaData sepMetaData = seInfo.getServerEndpointMetaData();
+ for (HandlerMetaData handlerMetaData : sepMetaData.getHandlers(type))
+ {
+ HandlerMetaDataJAXRPC jaxrpcMetaData = (HandlerMetaDataJAXRPC)handlerMetaData;
+ handlerRoles.addAll(jaxrpcMetaData.getSoapRoles());
+
+ Class hClass;
+ String handlerClass = jaxrpcMetaData.getHandlerClass();
+ try
+ {
+ // Load the handler class using the deployments top level CL
+ ClassLoader classLoader = sepMetaData.getClassLoader();
+ hClass = classLoader.loadClass(handlerClass);
+ }
+ catch (ClassNotFoundException e)
+ {
+ throw new WSException("Cannot load handler class: " + handlerClass);
+ }
+
+ HashMap<String, Object> hConfig = new HashMap<String, Object>();
+ for (HandlerInitParam param : jaxrpcMetaData.getInitParams())
+ {
+ hConfig.put(param.getParamName(), param.getParamValue());
+ }
+
+ Set<QName> headers = jaxrpcMetaData.getSoapHeaders();
+ QName[] headerArr = new QName[headers.size()];
+ headers.toArray(headerArr);
+
+ hConfig.put(HandlerType.class.getName(), jaxrpcMetaData.getHandlerType());
+ HandlerInfo info = new HandlerInfo(hClass, hConfig, headerArr);
+
+ log.debug("Adding server side handler to service '" + sepMetaData.getQName() + "': " + info);
+ hInfos.add(info);
+ }
+
+ initHandlerChain(seInfo, hInfos, handlerRoles, type);
+ }
+
+ private void initHandlerChain(ServiceEndpointInfo seInfo, List<HandlerInfo> hInfos, Set<String> handlerRoles, HandlerType type)
+ {
+ log.debug("Init handler chain with [" + hInfos.size() + "] handlers");
+
+ ServerHandlerChain handlerChain = new ServerHandlerChain(hInfos, handlerRoles, type);
+ if (type == HandlerType.PRE)
+ preHandlerChain = handlerChain;
+ else if (type == HandlerType.ENDPOINT)
+ jaxrpcHandlerChain = handlerChain;
+ else if (type == HandlerType.POST)
+ postHandlerChain = handlerChain;
+
+ if (handlerChain.getState() == ServerHandlerChain.STATE_CREATED)
+ {
+ // what is the config for a handler chain?
+ handlerChain.init(null);
+ }
+ }
+
+}
Property changes on: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxrpc/handler/HandlerDelegateJAXRPC.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxrpc/handler/HandlerWrapper.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxrpc/handler/HandlerWrapper.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxrpc/handler/HandlerWrapper.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -0,0 +1,201 @@
+/*
+* 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.jaxrpc.handler;
+
+// $Id$
+
+import javax.xml.namespace.QName;
+import javax.xml.rpc.JAXRPCException;
+import javax.xml.rpc.handler.Handler;
+import javax.xml.rpc.handler.HandlerInfo;
+import javax.xml.rpc.handler.MessageContext;
+import javax.xml.rpc.soap.SOAPFaultException;
+
+import org.jboss.logging.Logger;
+
+/**
+ * A wrapper arround a {@link javax.xml.rpc.handler.Handler} that takes care of its lifecycle.
+ *
+ * @author thomas.diesler at jboss.org
+ */
+public class HandlerWrapper implements Handler
+{
+ private static Logger log = Logger.getLogger(HandlerWrapper.class);
+
+ public final static int DOES_NOT_EXIST = 0;
+ public final static int METHOD_READY = 1;
+
+ // The states as string
+ private static String[] stateNames = new String[]{"DOES_NOT_EXIST", "METHOD_READY"};
+
+ // The handler to delegate to
+ private Handler delegate;
+ // The handler state
+ private int state;
+
+ /**
+ * Delegate to the given handler
+ */
+ public HandlerWrapper(Handler handler)
+ {
+ delegate = handler;
+ state = DOES_NOT_EXIST; // this is somewhat a lie ;-)
+ }
+
+ /**
+ * Get the current state
+ */
+ public int getState()
+ {
+ return state;
+ }
+
+ /**
+ * Get the current state as string
+ */
+ public String getStateAsString()
+ {
+ return stateNames[state];
+ }
+
+ /**
+ * Gets the header blocks processed by this Handler instance.
+ */
+ public QName[] getHeaders()
+ {
+ return delegate.getHeaders();
+ }
+
+ /**
+ * The init method enables the Handler instance to initialize itself.
+ */
+ public void init(HandlerInfo config) throws JAXRPCException
+ {
+ log.debug("init: " + delegate);
+ delegate.init(config);
+ state = METHOD_READY;
+ }
+
+ /**
+ * The destroy method indicates the end of lifecycle for a Handler instance.
+ */
+ public void destroy() throws JAXRPCException
+ {
+ log.debug("destroy: " + delegate);
+ state = DOES_NOT_EXIST;
+ delegate.destroy();
+ }
+
+ /**
+ * The handleRequest method processes the request message.
+ */
+ public boolean handleRequest(MessageContext msgContext) throws JAXRPCException, SOAPFaultException
+ {
+ if (state == DOES_NOT_EXIST)
+ {
+ log.warn("Handler is in state DOES_NOT_EXIST, skipping Handler.handleRequest for: " + delegate);
+ return true;
+ }
+
+ try
+ {
+ return delegate.handleRequest(msgContext);
+ }
+ catch (RuntimeException e)
+ {
+ return handleRuntimeException(e);
+ }
+ }
+
+ /**
+ * The handleResponse method processes the response SOAP message.
+ */
+ public boolean handleResponse(MessageContext msgContext)
+ {
+ if (state == DOES_NOT_EXIST)
+ {
+ log.warn("Handler is in state DOES_NOT_EXIST, skipping Handler.handleResponse for: " + delegate);
+ return true;
+ }
+
+ try
+ {
+ return delegate.handleResponse(msgContext);
+ }
+ catch (RuntimeException e)
+ {
+ return handleRuntimeException(e);
+ }
+ }
+
+ /**
+ * The handleFault method processes the SOAP faults based on the SOAP message processing model.
+ */
+ public boolean handleFault(MessageContext msgContext)
+ {
+ if (state == DOES_NOT_EXIST)
+ {
+ log.warn("Handler is in state DOES_NOT_EXIST, skipping Handler.handleFault for: " + delegate);
+ return true;
+ }
+
+ try
+ {
+ return delegate.handleFault(msgContext);
+ }
+ catch (RuntimeException e)
+ {
+ return handleRuntimeException(e);
+ }
+ }
+
+ /**
+ * As defined by JAX-RPC, a RuntimeException(other than SOAPFaultException) thrown from any method of
+ * the Handler results in the destroymethod being invoked and transition to the �Does Not Exist� state.
+ */
+ private boolean handleRuntimeException(RuntimeException e)
+ {
+ if ((e instanceof SOAPFaultException) == false)
+ {
+ log.warn("RuntimeException in handler method, transition to DOES_NOT_EXIST");
+ destroy();
+ }
+
+ throw e;
+ }
+
+ /**
+ * Returns a hash code value for the object.
+ */
+ public int hashCode()
+ {
+ return delegate.hashCode();
+ }
+
+ /**
+ * Returns a string representation of the object.
+ */
+ public String toString()
+ {
+ return "[state=" + getStateAsString() + ",handler=" + delegate + "]";
+ }
+}
Property changes on: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxrpc/handler/HandlerWrapper.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxrpc/handler/MessageContextJAXRPC.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxrpc/handler/MessageContextJAXRPC.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxrpc/handler/MessageContextJAXRPC.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -0,0 +1,91 @@
+/*
+ * 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.jaxrpc.handler;
+
+// $Id$
+
+import javax.xml.rpc.handler.MessageContext;
+import javax.xml.soap.SOAPMessage;
+
+import org.jboss.ws.binding.SerializationContext;
+import org.jboss.ws.common.CommonMessageContext;
+import org.jboss.ws.jaxrpc.SerializationContextJAXRPC;
+import org.jboss.ws.metadata.EndpointMetaData;
+import org.jboss.ws.metadata.ServiceMetaData;
+import org.jboss.xb.binding.NamespaceRegistry;
+
+/**
+ * The message context that is processed by a handler
+ * in the handle method.
+ * <p/>
+ * Provides methods to manage a property set.
+ * MessageContext properties enable handlers in a handler chain to share
+ * processing related state.
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 06-May-2004
+ */
+public class MessageContextJAXRPC extends CommonMessageContext implements MessageContext
+{
+ public static final String SERVLET_CONTEXT = "javax.xml.ws.servlet.context";
+ public static final String SERVLET_REQUEST = "javax.xml.ws.servlet.request";
+ public static final String SERVLET_RESPONSE = "javax.xml.ws.servlet.response";
+ public static final String SERVLET_SESSION = "javax.xml.ws.servlet.session";
+
+ // The SOAP message
+ private SOAPMessage message;
+ // The serialization context for this message ctx
+ private SerializationContext serContext;
+
+ public SOAPMessage getMessage()
+ {
+ return message;
+ }
+
+ public void setMessage(SOAPMessage message)
+ {
+ this.message = message;
+ }
+
+ /** Get or create the serialization context
+ */
+ public SerializationContext getSerializationContext()
+ {
+ if (serContext == null)
+ {
+ EndpointMetaData epMetaData = getEndpointMetaData();
+ ServiceMetaData serviceMetaData = epMetaData.getServiceMetaData();
+
+ SerializationContextJAXRPC jaxrpcContext = new SerializationContextJAXRPC();
+ jaxrpcContext.setTypeMapping(serviceMetaData.getTypeMapping());
+ jaxrpcContext.setJavaWsdlMapping(serviceMetaData.getJavaWsdlMapping());
+ serContext = jaxrpcContext;
+ }
+ return serContext;
+ }
+
+ /** Gets the namespace registry for this message context */
+ public NamespaceRegistry getNamespaceRegistry()
+ {
+ return getSerializationContext().getNamespaceRegistry();
+ }
+}
Property changes on: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxrpc/handler/MessageContextJAXRPC.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxrpc/handler/SOAPMessageContextJAXRPC.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxrpc/handler/SOAPMessageContextJAXRPC.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxrpc/handler/SOAPMessageContextJAXRPC.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -0,0 +1,75 @@
+/*
+ * 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.jaxrpc.handler;
+
+// $Id$
+
+import javax.xml.rpc.handler.soap.SOAPMessageContext;
+import javax.xml.soap.SOAPMessage;
+
+/**
+ * Provides access to the SOAP message for either RPC request or response.
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 14-Dec-2004
+ */
+public class SOAPMessageContextJAXRPC extends MessageContextJAXRPC implements SOAPMessageContext
+{
+ /** Default constuctor
+ */
+ public SOAPMessageContextJAXRPC()
+ {
+ }
+
+ /** Gets the SOAPMessage from this message context
+ *
+ * @return Returns the SOAPMessage; returns null if no SOAPMessage is present in this message context
+ */
+ public SOAPMessage getMessage()
+ {
+ return getSOAPMessage();
+ }
+
+ /** Sets the SOAPMessage in this message context
+ *
+ * @param message SOAP message
+ * @throws javax.xml.rpc.JAXRPCException If any error during the setting of the SOAPMessage in this message context
+ * @throws UnsupportedOperationException - If this operation is not supported
+ */
+ public void setMessage(SOAPMessage message)
+ {
+ setSOAPMessage(message);
+ }
+
+ /**
+ * Gets the SOAP actor roles associated with an execution of the HandlerChain and its contained Handler instances.
+ * Note that SOAP actor roles apply to the SOAP node and are managed using HandlerChain.setRoles and HandlerChain.getRoles.
+ * Handler instances in the HandlerChain use this information about the SOAP actor roles to process the SOAP header blocks.
+ * Note that the SOAP actor roles are invariant during the processing of SOAP message through the HandlerChain.
+ *
+ * @return Array of URIs for SOAP actor roles
+ */
+ public String[] getRoles()
+ {
+ return new String[0];
+ }
+}
Property changes on: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxrpc/handler/SOAPMessageContextJAXRPC.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxrpc/handler/ServerHandlerChain.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxrpc/handler/ServerHandlerChain.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxrpc/handler/ServerHandlerChain.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -0,0 +1,62 @@
+/*
+* 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.jaxrpc.handler;
+
+// $Id$
+
+import java.util.List;
+import java.util.Set;
+
+import javax.xml.rpc.handler.MessageContext;
+
+import org.jboss.ws.metadata.HandlerMetaData.HandlerType;
+
+/**
+ * Represents a list of handlers. All elements in the
+ * HandlerChain are of the type javax.xml.rpc.handler.Handler.
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 06-May-2004
+ */
+public class ServerHandlerChain extends HandlerChainBaseImpl
+{
+ // The required type of the handler
+ private HandlerType type;
+
+ public ServerHandlerChain(List infos, Set roles, HandlerType type)
+ {
+ super(infos, roles);
+ this.type = type;
+ }
+
+ public boolean handleRequest(MessageContext msgContext)
+ {
+ boolean doNext = super.handleRequest(msgContext);
+ return doNext;
+ }
+
+ public boolean handleResponse(MessageContext msgContext)
+ {
+ boolean doNext = super.handleResponse(msgContext);
+ return doNext;
+ }
+}
Property changes on: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxrpc/handler/ServerHandlerChain.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxws/core/BindingImpl.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxws/core/BindingImpl.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxws/core/BindingImpl.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -0,0 +1,97 @@
+/*
+ * 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.jaxws.core;
+
+// $Id$
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.Binding;
+import javax.xml.ws.handler.Handler;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.binding.BindingException;
+import org.jboss.ws.binding.EndpointInvocation;
+import org.jboss.ws.binding.UnboundHeader;
+import org.jboss.ws.metadata.OperationMetaData;
+import org.jboss.ws.metadata.HandlerMetaData.HandlerType;
+
+/**
+ * The Binding interface is the base interface for JAX-WS protocol bindings.
+ *
+ * @author Thomas.Diesler at jboss.com
+ * @since 04-Jul-2006
+ */
+public abstract class BindingImpl implements Binding
+{
+ // provide logging
+ private static Logger log = Logger.getLogger(BindingImpl.class);
+
+ private List<Handler> preHandlerChain = new ArrayList<Handler>();
+ private List<Handler> jaxwsHandlerChain = new ArrayList<Handler>();
+ private List<Handler> postHandlerChain = new ArrayList<Handler>();
+
+ /** On the client side, generate the Object from IN parameters. */
+ public abstract 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 */
+ public abstract EndpointInvocation unbindRequestMessage(OperationMetaData opMetaData, Object reqMessage) throws BindingException;
+
+ /** On the server side, generate the Object from OUT parameters in the Invocation object. */
+ public abstract 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. */
+ public abstract void unbindResponseMessage(OperationMetaData opMetaData, Object resMessage, EndpointInvocation epInv, Map<QName, UnboundHeader> unboundHeaders)
+ throws BindingException;
+
+ public List<Handler> getHandlerChain(HandlerType handlerType)
+ {
+ List<Handler> handlerChain = new ArrayList<Handler>();
+
+ if (handlerType == HandlerType.PRE || handlerType == HandlerType.ALL)
+ handlerChain.addAll(preHandlerChain);
+
+ if (handlerType == HandlerType.ENDPOINT || handlerType == HandlerType.ALL)
+ handlerChain.addAll(jaxwsHandlerChain);
+
+ if (handlerType == HandlerType.POST || handlerType == HandlerType.ALL)
+ handlerChain.addAll(postHandlerChain);
+
+ return Collections.unmodifiableList(handlerChain);
+ }
+
+ public List<Handler> getHandlerChain()
+ {
+ log.debug("getHandlerChain: " + jaxwsHandlerChain);
+ return jaxwsHandlerChain;
+ }
+
+ public void setHandlerChain(List<Handler> handlerChain)
+ {
+ log.debug("setHandlerChain: " + handlerChain);
+ this.jaxwsHandlerChain = handlerChain;
+ }
+}
Property changes on: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxws/core/BindingImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxws/core/BindingProviderImpl.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxws/core/BindingProviderImpl.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxws/core/BindingProviderImpl.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -0,0 +1,89 @@
+/*
+ * 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.jaxws.core;
+
+// $Id$
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.xml.ws.Binding;
+import javax.xml.ws.BindingProvider;
+import javax.xml.ws.WebServiceException;
+import javax.xml.ws.soap.SOAPBinding;
+
+import org.jboss.ws.metadata.EndpointMetaData;
+
+/**
+ * The BindingProvider interface provides access to the protocol binding and associated context objects
+ * for request and response message processing.
+ *
+ * @author Thomas.Diesler at jboss.com
+ * @since 04-Jul-2006
+ */
+public class BindingProviderImpl implements BindingProvider
+{
+ private BindingImpl binding;
+ private Map<String, Object> requestContext = new HashMap<String, Object>();
+ private Map<String, Object> responseContext = new HashMap<String, Object>();
+
+ public BindingProviderImpl(EndpointMetaData epMetaData)
+ {
+ initBinding(epMetaData.getBindingId());
+ }
+
+ public BindingProviderImpl(String bindingId)
+ {
+ initBinding(bindingId);
+ }
+
+ private void initBinding(String bindingId)
+ {
+ if (SOAPBinding.SOAP11HTTP_BINDING.equals(bindingId))
+ {
+ binding = new SOAP11BindingImpl();
+ }
+ else if (SOAPBinding.SOAP12HTTP_BINDING.equals(bindingId))
+ {
+ binding = new SOAP12BindingImpl();
+ }
+ else
+ {
+ throw new WebServiceException("Unsupported binding: " + bindingId);
+ }
+ }
+
+ public Map<String, Object> getRequestContext()
+ {
+ return requestContext;
+ }
+
+ public Map<String, Object> getResponseContext()
+ {
+ return responseContext;
+ }
+
+ public Binding getBinding()
+ {
+ return binding;
+ }
+}
Property changes on: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxws/core/BindingProviderImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxws/core/HTTPBindingImpl.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxws/core/HTTPBindingImpl.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxws/core/HTTPBindingImpl.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -0,0 +1,69 @@
+/*
+ * 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.jaxws.core;
+
+// $Id$
+
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.http.HTTPBinding;
+
+import org.jboss.util.NotImplementedException;
+import org.jboss.ws.binding.BindingException;
+import org.jboss.ws.binding.EndpointInvocation;
+import org.jboss.ws.binding.UnboundHeader;
+import org.jboss.ws.metadata.OperationMetaData;
+
+/**
+ * The HTTPBinding interface is an abstraction for the XML/HTTP binding.
+ *
+ * @author Thomas.Diesler at jboss.com
+ * @since 04-Jul-2006
+ */
+public class HTTPBindingImpl extends BindingImpl implements HTTPBinding
+{
+
+ @Override
+ public Object bindRequestMessage(OperationMetaData opMetaData, EndpointInvocation epInv, Map<QName, UnboundHeader> unboundHeaders) throws BindingException
+ {
+ throw new NotImplementedException();
+ }
+
+ @Override
+ public Object bindResponseMessage(OperationMetaData opMetaData, EndpointInvocation epInv) throws BindingException
+ {
+ throw new NotImplementedException();
+ }
+
+ @Override
+ public EndpointInvocation unbindRequestMessage(OperationMetaData opMetaData, Object reqMessage) throws BindingException
+ {
+ throw new NotImplementedException();
+ }
+
+ @Override
+ public void unbindResponseMessage(OperationMetaData opMetaData, Object resMessage, EndpointInvocation epInv, Map<QName, UnboundHeader> unboundHeaders) throws BindingException
+ {
+ throw new NotImplementedException();
+ }
+}
Property changes on: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxws/core/HTTPBindingImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxws/core/SOAP11BindingImpl.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxws/core/SOAP11BindingImpl.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxws/core/SOAP11BindingImpl.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -0,0 +1,104 @@
+/*
+ * 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.jaxws.core;
+
+// $Id$
+
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+import javax.xml.rpc.Call;
+import javax.xml.soap.MimeHeaders;
+import javax.xml.soap.SOAPEnvelope;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPMessage;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.Constants;
+import org.jboss.ws.binding.BindingException;
+import org.jboss.ws.binding.EndpointInvocation;
+import org.jboss.ws.binding.UnboundHeader;
+import org.jboss.ws.common.CommonMessageContext;
+import org.jboss.ws.jaxrpc.Use;
+import org.jboss.ws.metadata.OperationMetaData;
+import org.jboss.ws.soap.MessageContextAssociation;
+import org.jboss.ws.soap.MessageFactoryImpl;
+
+/**
+ * The SOAP11Binding
+ *
+ * @author Thomas.Diesler at jboss.com
+ * @since 04-Jul-2006
+ */
+public class SOAP11BindingImpl extends SOAPBindingImpl
+{
+ // provide logging
+ private static Logger log = Logger.getLogger(SOAPBindingImpl.class);
+
+ /** 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;
+ }
+
+ /** On the client side, generate the payload from IN parameters. */
+ public Object bindRequestMessage(OperationMetaData opMetaData, EndpointInvocation epInv, Map<QName, UnboundHeader> unboundHeaders) throws BindingException
+ {
+ SOAPMessage reqMessage = (SOAPMessage) super.bindRequestMessage(opMetaData, epInv, unboundHeaders);
+
+ // Set the SOAPAction
+ MimeHeaders mimeHeaders = reqMessage.getMimeHeaders();
+ String soapAction = opMetaData.getSOAPAction();
+
+ // R2744 A HTTP request MESSAGE MUST contain a SOAPAction HTTP header field
+ // with a quoted value equal to the value of the soapAction attribute of
+ // soapbind:operation, if present in the corresponding WSDL description.
+
+ // R2745 A HTTP request MESSAGE MUST contain a SOAPAction HTTP header field
+ // with a quoted empty string value, if in the corresponding WSDL description,
+ // the soapAction attribute of soapbind:operation is either not present, or
+ // present with an empty string as its value.
+
+ CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
+ if (msgContext.getProperty(Call.SOAPACTION_USE_PROPERTY) != null)
+ log.info("Ignore Call.SOAPACTION_USE_PROPERTY because of BP-1.0 R2745, R2745");
+
+ String soapActionProperty = (String)msgContext.getProperty(Call.SOAPACTION_URI_PROPERTY);
+ if (soapActionProperty != null)
+ soapAction = soapActionProperty;
+
+ mimeHeaders.addHeader("SOAPAction", soapAction != null ? soapAction : "");
+
+ return reqMessage;
+ }
+}
Property changes on: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxws/core/SOAP11BindingImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxws/core/SOAP12BindingImpl.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxws/core/SOAP12BindingImpl.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxws/core/SOAP12BindingImpl.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -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.jaxws.core;
+
+// $Id$
+
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPMessage;
+
+import org.jboss.ws.Constants;
+import org.jboss.ws.metadata.OperationMetaData;
+import org.jboss.ws.soap.MessageFactoryImpl;
+
+/**
+ * The SOAP11Binding
+ *
+ * @author Thomas.Diesler at jboss.com
+ * @since 04-Jul-2006
+ */
+public class SOAP12BindingImpl extends SOAPBindingImpl
+{
+ /** 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();
+ }
+}
Property changes on: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxws/core/SOAP12BindingImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxws/core/SOAPBindingImpl.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxws/core/SOAPBindingImpl.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxws/core/SOAPBindingImpl.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -0,0 +1,887 @@
+/*
+ * 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.jaxws.core;
+
+// $Id$
+
+import java.net.URI;
+import java.util.HashMap;
+import java.util.HashSet;
+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.JAXRPCException;
+import javax.xml.rpc.ParameterMode;
+import javax.xml.rpc.soap.SOAPFaultException;
+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 javax.xml.ws.soap.SOAPBinding;
+
+import org.apache.xerces.xs.XSElementDeclaration;
+import org.apache.xerces.xs.XSTypeDefinition;
+import org.jboss.logging.Logger;
+import org.jboss.ws.utils.DOMUtils;
+import org.jboss.ws.Constants;
+import org.jboss.ws.WSException;
+import org.jboss.ws.binding.BindingException;
+import org.jboss.ws.binding.EndpointInvocation;
+import org.jboss.ws.binding.UnboundHeader;
+import org.jboss.ws.common.CommonMessageContext;
+import org.jboss.ws.jaxrpc.ParameterWrapping;
+import org.jboss.ws.jaxrpc.SOAPFaultExceptionHelper;
+import org.jboss.ws.jaxrpc.Style;
+import org.jboss.ws.metadata.OperationMetaData;
+import org.jboss.ws.metadata.ParameterMetaData;
+import org.jboss.ws.metadata.TypesMetaData;
+import org.jboss.ws.soap.MessageContextAssociation;
+import org.jboss.ws.soap.MessageFactoryImpl;
+import org.jboss.ws.soap.NameImpl;
+import org.jboss.ws.soap.SOAPBodyElementDoc;
+import org.jboss.ws.soap.SOAPBodyElementRpc;
+import org.jboss.ws.soap.SOAPContentElement;
+import org.jboss.ws.soap.SOAPElementImpl;
+import org.jboss.ws.soap.SOAPFactoryImpl;
+import org.jboss.ws.soap.SOAPFaultImpl;
+import org.jboss.ws.soap.SOAPHeaderElementImpl;
+import org.jboss.ws.soap.SOAPMessageImpl;
+import org.jboss.ws.soap.attachment.AttachmentPartImpl;
+import org.jboss.ws.soap.attachment.CIDGenerator;
+import org.jboss.ws.utils.JavaUtils;
+import org.jboss.ws.utils.MimeUtils;
+import org.jboss.xb.binding.NamespaceRegistry;
+import org.w3c.dom.Element;
+
+/**
+ * The SOAPBinding interface is an abstraction for the SOAP binding.
+ *
+ * @author Thomas.Diesler at jboss.com
+ * @since 04-Jul-2006
+ */
+public abstract class SOAPBindingImpl extends BindingImpl implements SOAPBinding
+{
+ // provide logging
+ private static Logger log = Logger.getLogger(SOAPBindingImpl.class);
+
+ private boolean mtomEnabled;
+ private Set<URI> roles = new HashSet<URI>();
+
+ public MessageFactory getMessageFactory()
+ {
+ return new MessageFactoryImpl();
+ }
+
+ public Set<URI> getRoles()
+ {
+ return roles;
+ }
+
+ public void setRoles(Set<URI> roles)
+ {
+ this.roles = roles;
+ }
+
+ 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");
+
+ // 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);
+ }
+ }
+ }
+
+ return reqMessage;
+ }
+ catch (Exception e)
+ {
+ handleException(e);
+ return null;
+ }
+ }
+
+ /** 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");
+
+ // 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");
+
+ // 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.isOneWayOperation())
+ {
+ 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.wrapResponseParameter(opMetaData, value);
+
+ 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.isOneWayOperation() == 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");
+
+ 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)
+ {
+ SOAPFaultImpl soapFault = (SOAPFaultImpl)soapBodyElement;
+ SOAPFaultException faultEx = SOAPFaultExceptionHelper.getSOAPFaultException(soapFault);
+ throw faultEx;
+ }
+
+ // 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);
+ }
+ }
+
+ private void verifySOAPVersion(OperationMetaData opMetaData, SOAPEnvelope soapEnvelope)
+ {
+ String envNS = soapEnvelope.getNamespaceURI();
+ String bindingId = opMetaData.getEndpointMetaData().getBindingId();
+ if (SOAPBinding.SOAP11HTTP_BINDING.equals(bindingId) && Constants.NS_SOAP11_ENV.equals(envNS) == false)
+ log.warn("Expected SOAP-1.1 envelope, but got: " + envNS);
+
+ if (SOAPBinding.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);
+ }
+
+ // The object value needs to be set after xmime:contentType
+ if (paramMetaData.isXOP())
+ {
+ 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());
+ Name soapArrayName = new NameImpl("Array", Constants.PREFIX_SOAP11_ENC, Constants.URI_SOAP11_ENC);
+
+ 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 (soapArrayName.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 JAXRPCException("Cannot find child element: " + xmlName);
+
+ if (paramMetaData.isXOP())
+ {
+ SOAPMessageImpl soapMessage = (SOAPMessageImpl)MessageContextAssociation.peekMessageContext().getSOAPMessage();
+ soapMessage.setXOPMessage(true);
+ }
+ return soapContentElement;
+ }
+
+ 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);
+ }
+}
Property changes on: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxws/core/SOAPBindingImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jbossxb/JBossXBConstants.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jbossxb/JBossXBConstants.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jbossxb/JBossXBConstants.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -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.jbossxb;
+
+// $Id$
+
+/** JBossXB Constants
+ *
+ * @author Thomas.Diesler at 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";
+}
Property changes on: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jbossxb/JBossXBConstants.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jbossxb/JBossXBDeserializer.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jbossxb/JBossXBDeserializer.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jbossxb/JBossXBDeserializer.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -0,0 +1,110 @@
+/*
+ * 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.jbossxb;
+
+// $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.binding.BindingException;
+import org.jboss.ws.binding.ComplexTypeDeserializer;
+import org.jboss.ws.binding.SerializationContext;
+import org.jboss.ws.jaxrpc.SerializationContextJAXRPC;
+import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping;
+
+/**
+ * A Deserializer that can handle complex types by delegating to JAXB.
+ *
+ * @author Thomas.Diesler at 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;
+
+ }
+}
Property changes on: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jbossxb/JBossXBDeserializer.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jbossxb/JBossXBDeserializerFactory.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jbossxb/JBossXBDeserializerFactory.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jbossxb/JBossXBDeserializerFactory.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -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.jbossxb;
+
+import org.jboss.ws.binding.BindingException;
+import org.jboss.ws.binding.DeserializerSupport;
+import org.jboss.ws.jaxrpc.encoding.DeserializerFactoryBase;
+
+// $Id$
+
+/**
+ * A factory for a Deserializer that can handle complex types
+ * by delegating to JAXB.
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 04-Dec-2004
+ */
+public class JBossXBDeserializerFactory extends DeserializerFactoryBase
+{
+ public DeserializerSupport getDeserializer() throws BindingException
+ {
+ return new JBossXBDeserializer();
+ }
+}
Property changes on: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jbossxb/JBossXBDeserializerFactory.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jbossxb/JBossXBMarshaller.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jbossxb/JBossXBMarshaller.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jbossxb/JBossXBMarshaller.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -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.jbossxb;
+
+import org.xml.sax.ContentHandler;
+import org.w3c.dom.Node;
+
+import java.io.Writer;
+import java.io.OutputStream;
+
+/**
+ * @author Heiko Braun <heiko.braun at 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);
+}
Property changes on: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jbossxb/JBossXBMarshaller.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jbossxb/JBossXBMarshallerImpl.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jbossxb/JBossXBMarshallerImpl.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jbossxb/JBossXBMarshallerImpl.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -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.jbossxb;
+
+// $Id$
+
+import org.jboss.logging.Logger;
+import org.jboss.util.NotImplementedException;
+import org.jboss.ws.WSException;
+import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping;
+import org.jboss.ws.metadata.jaxrpcmapping.JavaXmlTypeMapping;
+import org.jboss.ws.metadata.jaxrpcmapping.VariableMapping;
+import org.jboss.ws.utils.JavaUtils;
+import org.jboss.ws.xop.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;
+
+import javax.xml.namespace.QName;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.Writer;
+import java.util.HashMap;
+
+/**
+ * An implementation of a JAXB Marshaller that uses the JBossXB schema binding marshaller.
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @author Heiko.Braun at 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);
+ }
+}
Property changes on: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jbossxb/JBossXBMarshallerImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jbossxb/JBossXBSerializer.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jbossxb/JBossXBSerializer.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jbossxb/JBossXBSerializer.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -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.jbossxb;
+
+// $Id$
+
+import org.apache.xerces.xs.XSModel;
+import org.jboss.logging.Logger;
+import org.jboss.ws.binding.BindingException;
+import org.jboss.ws.binding.ComplexTypeSerializer;
+import org.jboss.ws.binding.SerializationContext;
+import org.jboss.ws.jaxrpc.SerializationContextJAXRPC;
+import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping;
+import org.w3c.dom.NamedNodeMap;
+
+import javax.xml.namespace.QName;
+import java.io.StringWriter;
+
+/**
+ * A Serializer that can handle complex types by delegating to JAXB.
+ *
+ * @author Thomas.Diesler at 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);
+ }
+ }
+}
Property changes on: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jbossxb/JBossXBSerializer.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jbossxb/JBossXBSerializerFactory.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jbossxb/JBossXBSerializerFactory.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jbossxb/JBossXBSerializerFactory.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -0,0 +1,44 @@
+/*
+* 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.jbossxb;
+
+import org.jboss.ws.binding.BindingException;
+import org.jboss.ws.binding.SerializerSupport;
+import org.jboss.ws.jaxrpc.encoding.SerializerFactoryBase;
+
+// $Id$
+
+
+/**
+ * A factory for a Serializer that can handle complex types
+ * by delegating to JAXB.
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 04-Dec-2004
+ */
+public class JBossXBSerializerFactory extends SerializerFactoryBase
+{
+ public SerializerSupport getSerializer() throws BindingException
+ {
+ return new JBossXBSerializer();
+ }
+}
Property changes on: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jbossxb/JBossXBSerializerFactory.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jbossxb/JBossXBSupport.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jbossxb/JBossXBSupport.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jbossxb/JBossXBSupport.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -0,0 +1,106 @@
+package org.jboss.ws.jbossxb;
+
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.ws.common.CommonMessageContext;
+import org.jboss.ws.metadata.EndpointMetaData;
+import org.jboss.ws.metadata.OperationMetaData;
+import org.jboss.ws.metadata.ServiceMetaData;
+import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping;
+import org.jboss.ws.metadata.wsdl.xmlschema.JBossXSModel;
+import org.jboss.ws.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 at 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 SchameBinding 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());
+ }
+ }
+ };
+ }
+}
Property changes on: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jbossxb/JBossXBSupport.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jbossxb/JBossXBUnmarshaller.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jbossxb/JBossXBUnmarshaller.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jbossxb/JBossXBUnmarshaller.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -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.jbossxb;
+
+import java.io.InputStream;
+
+/**
+ * @author Heiko Braun <heiko.braun at 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);
+}
Property changes on: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jbossxb/JBossXBUnmarshaller.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jbossxb/JBossXBUnmarshallerImpl.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jbossxb/JBossXBUnmarshallerImpl.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jbossxb/JBossXBUnmarshallerImpl.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -0,0 +1,104 @@
+/*
+ * 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.jbossxb;
+
+// $Id$
+
+import java.io.InputStream;
+import java.util.HashMap;
+
+import org.jboss.ws.WSException;
+import org.jboss.ws.xop.XOPUnmarshallerImpl;
+import org.jboss.xb.binding.JBossXBException;
+import org.jboss.xb.binding.UnmarshallerFactory;
+import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding;
+
+/**
+ * An implementation of a JAXB Unmarshaller.
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @author Alexey.Loubyansky at 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);
+ schemaBinding.setXopUnmarshaller(new XOPUnmarshallerImpl());
+ try
+ {
+ return unm.unmarshal(is, schemaBinding);
+ }
+ catch (JBossXBException e)
+ {
+ throw new UnmarshalException(e.getMessage(), e);
+ }
+ }
+
+ /**
+ * Get the particular property in the underlying implementation of Unmarshaller.
+ */
+ public Object getProperty(String name)
+ {
+ if (name == null)
+ throw new IllegalArgumentException("name parameter is null");
+
+ return properties.get(name);
+ }
+
+ /**
+ * Set the particular property in the underlying implementation of Unmarshaller.
+ */
+ public void setProperty(String name, Object value)
+ {
+ if (name == null)
+ throw new IllegalArgumentException("name parameter is null");
+
+ properties.put(name, value);
+ }
+
+
+ /** Assert the required properties
+ */
+ private void assertRequiredProperties()
+ {
+ if (getProperty(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);
+ }
+ }
+}
Property changes on: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jbossxb/JBossXBUnmarshallerImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jbossxb/MarshalException.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jbossxb/MarshalException.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jbossxb/MarshalException.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -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.jbossxb;
+
+/**
+ * A marshal exception.
+ *
+ * @author Thomas.Diesler at 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);
+ }
+}
Property changes on: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jbossxb/MarshalException.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jbossxb/SchemaBindingBuilder.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jbossxb/SchemaBindingBuilder.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jbossxb/SchemaBindingBuilder.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -0,0 +1,629 @@
+/*
+ * 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.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.ws.metadata.jaxrpcmapping.ExceptionMapping;
+import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping;
+import org.jboss.ws.metadata.jaxrpcmapping.JavaXmlTypeMapping;
+import org.jboss.ws.metadata.jaxrpcmapping.PackageMapping;
+import org.jboss.ws.metadata.jaxrpcmapping.VariableMapping;
+import org.jboss.ws.utils.JBossWSEntityResolver;
+import org.jboss.ws.Constants;
+import org.jboss.ws.WSException;
+import org.jboss.ws.xop.XOPValueAdapter;
+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.*;
+import org.jboss.xb.binding.sunday.unmarshalling.impl.runtime.RtElementHandler;
+import org.jboss.util.xml.JBossEntityResolver;
+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 at jboss.org
+ * @author Alexey.Loubyansky at 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);
+ }
+
+ 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());
+ }
+ // XOP elements that derive from xmlmime namespace
+ // need to be declared 'simple' in order for XB to
+ // treat them as simple base64Binaries.
+ QName elementType = element.getType().getQName();
+ if(elementType!=null)
+ {
+ String elementTypeNS = elementType.getNamespaceURI() != null ? elementType.getNamespaceURI() : "";
+ String elementTypeName = elementType.getLocalPart() != null ? elementType.getLocalPart() : "";
+ if(elementTypeNS.equals(Constants.NS_XML_MIME) && elementTypeName.equals("base64Binary"))
+ {
+ element.getType().setSimple(true);
+ element.getType().setValueAdapter(new XOPValueAdapter());
+ }
+ }
+ }
+
+ 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;
+ }
+ }
+}
Property changes on: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jbossxb/SchemaBindingBuilder.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jbossxb/UnmarshalException.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jbossxb/UnmarshalException.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jbossxb/UnmarshalException.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -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.jbossxb;
+
+/**
+ * A marshal exception.
+ *
+ * @author Thomas.Diesler at 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);
+ }
+}
Property changes on: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jbossxb/UnmarshalException.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jbossxb/XercesXSMarshallerImpl.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jbossxb/XercesXSMarshallerImpl.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jbossxb/XercesXSMarshallerImpl.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -0,0 +1,250 @@
+/*
+ * 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.jbossxb;
+
+// $Id$
+
+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.metadata.jaxrpcmapping.JavaWsdlMapping;
+import org.jboss.ws.metadata.jaxrpcmapping.JavaXmlTypeMapping;
+import org.jboss.ws.metadata.jaxrpcmapping.VariableMapping;
+import org.jboss.ws.utils.JavaUtils;
+import org.jboss.xb.binding.Constants;
+import org.jboss.xb.binding.MappingObjectModelProvider;
+import org.jboss.xb.binding.XercesXsMarshaller;
+import org.w3c.dom.Node;
+import org.xml.sax.ContentHandler;
+
+import javax.xml.namespace.QName;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.Writer;
+import java.util.HashMap;
+
+/**
+ * An implementation of a JAXB Marshaller that user XercesXSMarshaller impl.
+ *
+ * @author Thomas.Diesler at 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);
+ }
+}
Property changes on: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jbossxb/XercesXSMarshallerImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/HandlerMetaData.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/HandlerMetaData.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/HandlerMetaData.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -0,0 +1,154 @@
+/*
+ * 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.metadata;
+
+// $Id$
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import javax.xml.namespace.QName;
+
+/**
+ * The common metdata data for a handler element
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 05-May-2006
+ */
+public abstract class HandlerMetaData implements Serializable
+{
+ public enum HandlerType
+ {
+ PRE, ENDPOINT, POST, ALL
+ };
+
+ private transient EndpointMetaData endpointMetaData;
+
+ // The required <handler-name> element
+ private String handlerName;
+ // The required <handler-class> element
+ private String handlerClass;
+ // The required handler type
+ private HandlerType handlerType;
+ // The optional <soap-header> elements
+ private Set<QName> soapHeaders = new HashSet<QName>();
+ // The optional <init-param> elements
+ private List<HandlerInitParam> initParams = new ArrayList<HandlerInitParam>();
+
+ public HandlerMetaData(EndpointMetaData endpointMetaData, HandlerType type)
+ {
+ this.endpointMetaData = endpointMetaData;
+ this.handlerType = type;
+ }
+
+ public void setEndpointMetaData(EndpointMetaData endpointMetaData)
+ {
+ this.endpointMetaData = endpointMetaData;
+ }
+
+ public EndpointMetaData getEndpointMetaData()
+ {
+ return endpointMetaData;
+ }
+
+ public void setHandlerName(String value)
+ {
+ this.handlerName = value;
+ }
+
+ public String getHandlerName()
+ {
+ return handlerName;
+ }
+
+ public void setHandlerClass(String handlerClass)
+ {
+ this.handlerClass = handlerClass;
+ }
+
+ public String getHandlerClass()
+ {
+ return handlerClass;
+ }
+
+ public HandlerType getHandlerType()
+ {
+ return handlerType;
+ }
+
+ public void setSoapHeaders(Set<QName> soapHeaders)
+ {
+ this.soapHeaders = soapHeaders;
+ }
+
+ public Set<QName> getSoapHeaders()
+ {
+ return soapHeaders;
+ }
+
+ public void seiInitParams(List<HandlerInitParam> initParams)
+ {
+ this.initParams = initParams;
+ }
+
+ public List<HandlerInitParam> getInitParams()
+ {
+ return initParams;
+ }
+
+ public static class HandlerInitParam
+ {
+ // The required <handler-name> element
+ private String paramName;
+ // The required <handler-class> element
+ private String paramValue;
+
+ public String getParamName()
+ {
+ return paramName;
+ }
+
+ public void setParamName(String paramName)
+ {
+ this.paramName = paramName;
+ }
+
+
+ public String getParamValue()
+ {
+ return paramValue;
+ }
+
+ public void setParamValue(String paramValue)
+ {
+ this.paramValue = paramValue;
+ }
+
+ public String toString()
+ {
+ return "[name=" + paramName + ",value=" + paramValue + "]";
+ }
+ }
+}
Property changes on: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/HandlerMetaData.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/HandlerMetaDataJAXRPC.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/HandlerMetaDataJAXRPC.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/HandlerMetaDataJAXRPC.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -0,0 +1,83 @@
+/*
+ * 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.metadata;
+
+//$Id$
+
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.xml.namespace.QName;
+
+/**
+ * The JAXRPC metdata data for a handler element
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 05-May-2006
+ */
+public class HandlerMetaDataJAXRPC extends HandlerMetaData
+{
+ private static final long serialVersionUID = -5232305815202943509L;
+
+ // The optional <soap-role> elements
+ private Set<String> soapRoles = new HashSet<String>();
+ // The optional <port-name> elements
+ private Set<String> portNames = new HashSet<String>();
+
+ public HandlerMetaDataJAXRPC(EndpointMetaData epMetaData, HandlerType type)
+ {
+ super(epMetaData, type);
+ }
+
+ public void setSoapRoles(Set<String> soapRoles)
+ {
+ this.soapRoles = soapRoles;
+ }
+
+ public Set<String> getSoapRoles()
+ {
+ return soapRoles;
+ }
+
+ public void setPortNames(Set<String> portNames)
+ {
+ this.portNames = portNames;
+ }
+
+ public Set<String> getPortNames()
+ {
+ return portNames;
+ }
+
+ public String toString()
+ {
+ StringBuffer buffer = new StringBuffer("\nHandlerMetaDataJAXRPC:");
+ buffer.append("\n type=" + getHandlerType());
+ buffer.append("\n name=" + getHandlerName());
+ buffer.append("\n class=" + getHandlerClass());
+ buffer.append("\n params=" + getInitParams());
+ buffer.append("\n headers=" + getSoapHeaders());
+ buffer.append("\n roles=" + getSoapRoles());
+ buffer.append("\n ports=" + getPortNames());
+ return buffer.toString();
+ }
+}
Property changes on: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/HandlerMetaDataJAXRPC.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Deleted: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/config/WSClientConfig.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/config/WSClientConfig.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/config/WSClientConfig.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -1,34 +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.metadata.config;
-
-// $Id$
-
-/**
- * A JBossWS client configuration
- *
- * @author Thomas.Diesler at jboss.org
- * @since 18-Dec-2005
- */
-public class WSClientConfig extends WSCommonConfig
-{
-}
Deleted: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/config/WSConfig.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/config/WSConfig.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/config/WSConfig.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -1,93 +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.metadata.config;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * A JBossWS configuration
- *
- * @author Thomas.Diesler at jboss.org
- * @since 18-Dec-2005
- */
-public class WSConfig
-{
- private List<WSClientConfig> clientConfigList = new ArrayList<WSClientConfig>();
- private List<WSEndpointConfig> endpointConfigList = new ArrayList<WSEndpointConfig>();
-
- public List<WSClientConfig> getClientConfig()
- {
- return clientConfigList;
- }
-
- public void setClientConfig(List<WSClientConfig> clientConfig)
- {
- this.clientConfigList = clientConfig;
- }
-
- public List<WSEndpointConfig> getEndpointConfig()
- {
- return endpointConfigList;
- }
-
- public void setEndpointConfig(List<WSEndpointConfig> endpointConfig)
- {
- this.endpointConfigList = endpointConfig;
- }
-
- public WSClientConfig getClientConfigByName(String configName)
- {
- WSClientConfig config = null;
- for(WSClientConfig aux : clientConfigList)
- {
- if (aux.getConfigName().equals(configName))
- {
- config = aux;
- break;
- }
- }
-
- if (config == null && clientConfigList.size() == 1)
- config = clientConfigList.get(0);
-
- return config;
- }
-
- public WSEndpointConfig getEndpointConfigByName(String configName)
- {
- WSEndpointConfig config = null;
- for(WSEndpointConfig aux : endpointConfigList)
- {
- if (aux.getConfigName().equals(configName))
- {
- config = aux;
- break;
- }
- }
-
- if (config == null && endpointConfigList.size() == 1)
- config = endpointConfigList.get(0);
-
- return config;
- }
-}
Deleted: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/config/WSEndpointConfig.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/config/WSEndpointConfig.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/config/WSEndpointConfig.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -1,34 +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.metadata.config;
-
-// $Id$
-
-/**
- * A JBossWS endpoint configuration
- *
- * @author Thomas.Diesler at jboss.org
- * @since 18-Dec-2005
- */
-public class WSEndpointConfig extends WSCommonConfig
-{
-}
Deleted: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/config/WSHandlerChainConfig.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/config/WSHandlerChainConfig.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/config/WSHandlerChainConfig.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -1,60 +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.metadata.config;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.jboss.ws.metadata.j2ee.UnifiedHandlerMetaData;
-
-
-/**
- * A JBossWS handler chain configuration
- *
- * @author Thomas.Diesler at jboss.org
- * @since 18-Dec-2005
- */
-public class WSHandlerChainConfig
-{
- private String handlerChainName;
- private List<UnifiedHandlerMetaData> handlers = new ArrayList<UnifiedHandlerMetaData>();
-
- public String getHandlerChainName()
- {
- return handlerChainName;
- }
-
- public void setHandlerChainName(String handlerChainName)
- {
- this.handlerChainName = handlerChainName;
- }
-
- public List<UnifiedHandlerMetaData> getHandlers()
- {
- return handlers;
- }
-
- public void setHandlers(List<UnifiedHandlerMetaData> handlers)
- {
- this.handlers = handlers;
- }
-}
Added: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/config/jaxrpc/WSClientConfigJAXRPC.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/config/jaxrpc/WSClientConfigJAXRPC.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/config/jaxrpc/WSClientConfigJAXRPC.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -0,0 +1,35 @@
+/*
+ * 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.metadata.config.jaxrpc;
+
+
+// $Id$
+
+/**
+ * A JBossWS client configuration
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 18-Dec-2005
+ */
+public class WSClientConfigJAXRPC extends WSCommonConfigJAXRPC
+{
+}
Property changes on: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/config/jaxrpc/WSClientConfigJAXRPC.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/config/jaxrpc/WSCommonConfigJAXRPC.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/config/jaxrpc/WSCommonConfigJAXRPC.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/config/jaxrpc/WSCommonConfigJAXRPC.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -0,0 +1,91 @@
+/*
+ * 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.metadata.config.jaxrpc;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jboss.ws.metadata.EndpointMetaData;
+import org.jboss.ws.metadata.HandlerMetaData;
+import org.jboss.ws.metadata.HandlerMetaData.HandlerType;
+import org.jboss.ws.metadata.config.WSCommonConfig;
+import org.jboss.ws.metadata.j2ee.UnifiedHandlerMetaData;
+import org.jboss.ws.metadata.jsr181.HandlerChainMetaData;
+
+
+// $Id$
+
+/**
+ * A JBossWS client configuration
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 18-Dec-2005
+ */
+public abstract class WSCommonConfigJAXRPC extends WSCommonConfig
+{
+ private HandlerChainMetaData preHandlerChain;
+ private HandlerChainMetaData postHandlerChain;
+
+ public HandlerChainMetaData getPostHandlerChain()
+ {
+ return postHandlerChain;
+ }
+
+ public void setPostHandlerChain(HandlerChainMetaData postHandlerChain)
+ {
+ this.postHandlerChain = postHandlerChain;
+ }
+
+ public HandlerChainMetaData getPreHandlerChain()
+ {
+ return preHandlerChain;
+ }
+
+ public void setPreHandlerChain(HandlerChainMetaData preHandlerChain)
+ {
+ this.preHandlerChain = preHandlerChain;
+ }
+
+ @Override
+ public List<HandlerMetaData> getHandlers(EndpointMetaData epMetaData, HandlerType type)
+ {
+ List<HandlerMetaData> handlers = new ArrayList<HandlerMetaData>();
+
+ HandlerChainMetaData handlerChain;
+ if (type == HandlerType.PRE)
+ handlerChain = getPreHandlerChain();
+ else if (type == HandlerType.POST)
+ handlerChain = getPostHandlerChain();
+ else
+ throw new IllegalArgumentException("Invalid handler type: " + type);
+
+ if (handlerChain != null)
+ {
+ for (UnifiedHandlerMetaData uhmd : handlerChain.getHandlers())
+ {
+ handlers.add(uhmd.getHandlerMetaDataJAXRPC(epMetaData, type));
+ }
+ }
+
+ return handlers;
+ }
+}
Property changes on: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/config/jaxrpc/WSCommonConfigJAXRPC.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/config/jaxrpc/WSConfigFactoryJAXRPC.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/config/jaxrpc/WSConfigFactoryJAXRPC.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/config/jaxrpc/WSConfigFactoryJAXRPC.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -0,0 +1,160 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ws.metadata.config.jaxrpc;
+
+//$Id$
+
+import java.util.List;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.metadata.HandlerMetaData.HandlerType;
+import org.jboss.ws.metadata.HandlerMetaData.HandlerInitParam;
+import org.jboss.ws.metadata.j2ee.UnifiedHandlerMetaData;
+import org.jboss.ws.metadata.jsr181.HandlerChainMetaData;
+import org.jboss.xb.binding.ObjectModelFactory;
+import org.jboss.xb.binding.UnmarshallingContext;
+import org.xml.sax.Attributes;
+
+/**
+ * A factory for the JBossWS endpoint/client configuration
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 18-Dec-2005
+ */
+public class WSConfigFactoryJAXRPC implements ObjectModelFactory
+{
+ // provide logging
+ private final Logger log = Logger.getLogger(WSConfigFactoryJAXRPC.class);
+
+ public Object newRoot(Object root, UnmarshallingContext ctx, String namespaceURI, String localName, Attributes attrs)
+ {
+ return new WSConfigRootJAXRPC();
+ }
+
+ public Object completeRoot(Object root, UnmarshallingContext ctx, String namespaceURI, String localName)
+ {
+ return root;
+ }
+
+ /**
+ * Called when parsing of a new element started.
+ */
+ public Object newChild(WSConfigRootJAXRPC wsConfig, UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs)
+ {
+ log.trace("WSConfig newChild: " + localName);
+ if ("endpoint-config".equals(localName))
+ {
+ WSEndpointConfigJAXRPC wsEndpointConfig = new WSEndpointConfigJAXRPC();
+ wsConfig.getEndpointConfig().add(wsEndpointConfig);
+ return wsEndpointConfig;
+ }
+ if ("client-config".equals(localName))
+ {
+ WSClientConfigJAXRPC wsClientConfig = new WSClientConfigJAXRPC();
+ wsConfig.getClientConfig().add(wsClientConfig);
+ return wsClientConfig;
+ }
+ return null;
+ }
+
+ /**
+ * Called when a new simple child element with text value was read from the XML content.
+ */
+ public void setValue(WSCommonConfigJAXRPC wsCommonConfig, UnmarshallingContext navigator, String namespaceURI, String localName, String value)
+ {
+ if (log.isTraceEnabled())
+ log.trace("WSCommonConfig setValue: nuri=" + namespaceURI + " localName=" + localName + " value=" + value);
+
+ if (localName.equals("config-name"))
+ wsCommonConfig.setConfigName(value);
+ }
+
+ /**
+ * Called when parsing of a new element started.
+ */
+ public Object newChild(WSCommonConfigJAXRPC wsCommonConfig, UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs)
+ {
+ log.trace("WSCommonConfig newChild: " + localName);
+
+ if ("pre-handler-chain".equals(localName))
+ {
+ HandlerChainMetaData preHandlerChain = new HandlerChainMetaData(null);
+ wsCommonConfig.setPreHandlerChain(preHandlerChain);
+ return preHandlerChain;
+ }
+ if ("post-handler-chain".equals(localName))
+ {
+ HandlerChainMetaData postHandlerChain = new HandlerChainMetaData(null);
+ wsCommonConfig.setPostHandlerChain(postHandlerChain);
+ return postHandlerChain;
+ }
+ return null;
+ }
+
+ /**
+ * Called when parsing of a new element started.
+ */
+ public Object newChild(HandlerChainMetaData handlerChainMetaData, UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs)
+ {
+ log.trace("WSHandlerChainConfig newChild: " + localName);
+ if ("handler".equals(localName))
+ {
+ UnifiedHandlerMetaData handler = new UnifiedHandlerMetaData(handlerChainMetaData);
+ List<UnifiedHandlerMetaData> handlers = handlerChainMetaData.getHandlers();
+ handlers.add(handler);
+ return handler;
+ }
+ return null;
+ }
+
+ /**
+ * Called when a new simple child element with text value was read from the XML content.
+ */
+ public void setValue(UnifiedHandlerMetaData handler, UnmarshallingContext navigator, String namespaceURI, String localName, String value)
+ {
+ if (log.isTraceEnabled())
+ log.trace("UnifiedHandlerMetaData setValue: nuri=" + namespaceURI + " localName=" + localName + " value=" + value);
+
+ if (localName.equals("handler-name"))
+ handler.setHandlerName(value);
+ else if (localName.equals("handler-class"))
+ handler.setHandlerClass(value);
+ else if (localName.equals("soap-header"))
+ handler.addSoapHeader(navigator.resolveQName(value));
+ else if (localName.equals("soap-role"))
+ handler.addSoapRole(value);
+ }
+
+ /**
+ * Called when a new simple child element with text value was read from the XML content.
+ */
+ public void setValue(HandlerInitParam param, UnmarshallingContext navigator, String namespaceURI, String localName, String value)
+ {
+ if (log.isTraceEnabled())
+ log.trace("UnifiedInitParamMetaData setValue: nuri=" + namespaceURI + " localName=" + localName + " value=" + value);
+
+ if (localName.equals("param-name"))
+ param.setParamName(value);
+ else if (localName.equals("param-value"))
+ param.setParamValue(value);
+ }
+}
Property changes on: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/config/jaxrpc/WSConfigFactoryJAXRPC.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/config/jaxrpc/WSConfigRootJAXRPC.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/config/jaxrpc/WSConfigRootJAXRPC.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/config/jaxrpc/WSConfigRootJAXRPC.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -0,0 +1,94 @@
+/*
+ * 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.metadata.config.jaxrpc;
+
+import java.util.ArrayList;
+import java.util.List;
+
+
+/**
+ * A JBossWS configuration
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 18-Dec-2005
+ */
+public class WSConfigRootJAXRPC
+{
+ private List<WSClientConfigJAXRPC> clientConfigList = new ArrayList<WSClientConfigJAXRPC>();
+ private List<WSEndpointConfigJAXRPC> endpointConfigList = new ArrayList<WSEndpointConfigJAXRPC>();
+
+ public List<WSClientConfigJAXRPC> getClientConfig()
+ {
+ return clientConfigList;
+ }
+
+ public void setClientConfig(List<WSClientConfigJAXRPC> clientConfig)
+ {
+ this.clientConfigList = clientConfig;
+ }
+
+ public List<WSEndpointConfigJAXRPC> getEndpointConfig()
+ {
+ return endpointConfigList;
+ }
+
+ public void setEndpointConfig(List<WSEndpointConfigJAXRPC> endpointConfig)
+ {
+ this.endpointConfigList = endpointConfig;
+ }
+
+ public WSClientConfigJAXRPC getClientConfigByName(String configName)
+ {
+ WSClientConfigJAXRPC config = null;
+ for(WSClientConfigJAXRPC aux : clientConfigList)
+ {
+ if (aux.getConfigName().equals(configName))
+ {
+ config = aux;
+ break;
+ }
+ }
+
+ if (config == null && clientConfigList.size() == 1)
+ config = clientConfigList.get(0);
+
+ return config;
+ }
+
+ public WSEndpointConfigJAXRPC getEndpointConfigByName(String configName)
+ {
+ WSEndpointConfigJAXRPC config = null;
+ for(WSEndpointConfigJAXRPC aux : endpointConfigList)
+ {
+ if (aux.getConfigName().equals(configName))
+ {
+ config = aux;
+ break;
+ }
+ }
+
+ if (config == null && endpointConfigList.size() == 1)
+ config = endpointConfigList.get(0);
+
+ return config;
+ }
+}
Property changes on: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/config/jaxrpc/WSConfigRootJAXRPC.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/config/jaxrpc/WSEndpointConfigJAXRPC.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/config/jaxrpc/WSEndpointConfigJAXRPC.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/config/jaxrpc/WSEndpointConfigJAXRPC.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -0,0 +1,44 @@
+/*
+ * 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.metadata.config.jaxrpc;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jboss.ws.metadata.EndpointMetaData;
+import org.jboss.ws.metadata.HandlerMetaData;
+import org.jboss.ws.metadata.HandlerMetaData.HandlerType;
+import org.jboss.ws.metadata.j2ee.UnifiedHandlerMetaData;
+import org.jboss.ws.metadata.jsr181.HandlerChainMetaData;
+
+
+// $Id$
+
+/**
+ * A JBossWS endpoint configuration
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 18-Dec-2005
+ */
+public class WSEndpointConfigJAXRPC extends WSCommonConfigJAXRPC
+{
+}
Property changes on: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/config/jaxrpc/WSEndpointConfigJAXRPC.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Deleted: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/j2ee/UnifiedInitParamMetaData.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/j2ee/UnifiedInitParamMetaData.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/j2ee/UnifiedInitParamMetaData.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -1,67 +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.metadata.j2ee;
-
-import java.io.Serializable;
-
-//$Id: UnifiedInitParamMetaData.java 314 2006-05-11 10:57:59Z thomas.diesler at jboss.com $
-
-/**
- * The container independent metdata data from handler init params
- *
- * @author Thomas.Diesler at jboss.org
- * @since 05-May-2006
- */
-public class UnifiedInitParamMetaData implements Serializable
-{
- private static final long serialVersionUID = 6170636868961963764L;
-
- // The required <handler-name> element
- private String paramName;
- // The required <handler-class> element
- private String paramValue;
-
- public String getParamName()
- {
- return paramName;
- }
-
- public void setParamName(String paramName)
- {
- this.paramName = paramName;
- }
-
- public String getParamValue()
- {
- return paramValue;
- }
-
- public void setParamValue(String paramValue)
- {
- this.paramValue = paramValue;
- }
-
- public String toString()
- {
- return "[name=" + paramName + ",value=" + paramValue + "]";
- }
-}
Added: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/jsr181/HandlerChainFactory.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/jsr181/HandlerChainFactory.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/jsr181/HandlerChainFactory.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -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.metadata.jsr181;
+
+// $Id$
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.metadata.HandlerMetaData.HandlerType;
+import org.jboss.ws.metadata.HandlerMetaData.HandlerInitParam;
+import org.jboss.ws.metadata.j2ee.UnifiedHandlerMetaData;
+import org.jboss.xb.binding.ObjectModelFactory;
+import org.jboss.xb.binding.UnmarshallingContext;
+import org.xml.sax.Attributes;
+
+/**
+ * A JBossXB factory for jsr181 the HandlerChain annotation
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 15-Oct-2005
+ */
+public class HandlerChainFactory implements ObjectModelFactory
+{
+ // provide logging
+ private static final Logger log = Logger.getLogger(HandlerChainFactory.class);
+
+ public HandlerChainFactory()
+ {
+ }
+
+ /**
+ * This method is called on the factory by the object model builder when the parsing starts.
+ *
+ * @return the root of the object model.
+ */
+ public Object newRoot(Object root, UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs)
+ {
+ HandlerChainsMetaData handlerConfigMetaData = new HandlerChainsMetaData(HandlerType.ENDPOINT);
+ return handlerConfigMetaData;
+ }
+
+ public Object completeRoot(Object root, UnmarshallingContext ctx, String uri, String name)
+ {
+ return root;
+ }
+
+ /**
+ * Called when parsing of a new element started.
+ */
+ public Object newChild(HandlerChainsMetaData handlerConfig, UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs)
+ {
+ if ("handler-chain".equals(localName))
+ return new HandlerChainMetaData(handlerConfig);
+ else
+ return null;
+ }
+
+ /**
+ * Called when parsing character is complete.
+ */
+ public void addChild(HandlerChainsMetaData handlerConfig, HandlerChainMetaData handlerChain, UnmarshallingContext navigator, String namespaceURI, String localName)
+ {
+ handlerConfig.addHandlerChain(handlerChain);
+ }
+
+ /**
+ * Called when parsing of a new element started.
+ */
+ public Object newChild(HandlerChainMetaData chainConfig, UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs)
+ {
+ if ("handler".equals(localName))
+ return new UnifiedHandlerMetaData(chainConfig);
+ else
+ return null;
+ }
+
+ /**
+ * Called when parsing character is complete.
+ */
+ public void addChild(HandlerChainMetaData handlerConfig, UnifiedHandlerMetaData handler, UnmarshallingContext navigator, String namespaceURI, String localName)
+ {
+ handlerConfig.addHandler(handler);
+ }
+
+ /**
+ * Called when parsing of a new element started.
+ */
+ public Object newChild(UnifiedHandlerMetaData handler, UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs)
+ {
+ if ("init-param".equals(localName))
+ return new HandlerInitParam();
+ else return null;
+ }
+
+ /**
+ * Called when parsing character is complete.
+ */
+ public void addChild(UnifiedHandlerMetaData handler, HandlerInitParam param, UnmarshallingContext navigator, String namespaceURI, String localName)
+ {
+ handler.addInitParam(param);
+ }
+
+ /**
+ * Called when a new simple child element with text value was read from the XML content.
+ */
+ public void setValue(HandlerChainMetaData handlerChain, UnmarshallingContext navigator, String namespaceURI, String localName, String value)
+ {
+ if (log.isTraceEnabled())
+ log.trace("HandlerChainMetaData setValue: nuri=" + namespaceURI + " localName=" + localName + " value=" + value);
+
+ if (localName.equals("protocol-bindings"))
+ handlerChain.setProtocolBindings(value);
+ else if (localName.equals("service-name-pattern"))
+ handlerChain.setServiceNamePattern(navigator.resolveQName(value));
+ else if (localName.equals("port-name-pattern"))
+ handlerChain.setPortNamePattern(navigator.resolveQName(value));
+ }
+
+ /**
+ * Called when a new simple child element with text value was read from the XML content.
+ */
+ public void setValue(UnifiedHandlerMetaData handler, UnmarshallingContext navigator, String namespaceURI, String localName, String value)
+ {
+ if (log.isTraceEnabled())
+ log.trace("UnifiedHandlerMetaData setValue: nuri=" + namespaceURI + " localName=" + localName + " value=" + value);
+
+ if (localName.equals("handler-name"))
+ handler.setHandlerName(value);
+ else if (localName.equals("handler-class"))
+ handler.setHandlerClass(value);
+ }
+
+ /**
+ * Called when a new simple child element with text value was read from the XML content.
+ */
+ public void setValue(HandlerInitParam param, UnmarshallingContext navigator, String namespaceURI, String localName, String value)
+ {
+ if (log.isTraceEnabled())
+ log.trace("UnifiedInitParamMetaData setValue: nuri=" + namespaceURI + " localName=" + localName + " value=" + value);
+
+ if (localName.equals("param-name"))
+ param.setParamName(value);
+ else if (localName.equals("param-value"))
+ param.setParamValue(value);
+ }
+}
Property changes on: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/jsr181/HandlerChainFactory.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/jsr181/HandlerChainsMetaData.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/jsr181/HandlerChainsMetaData.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/jsr181/HandlerChainsMetaData.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -0,0 +1,66 @@
+/*
+* 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.
+*/
+// $Id$
+package org.jboss.ws.metadata.jsr181;
+
+//$Id$
+
+import java.util.ArrayList;
+
+import org.jboss.ws.metadata.HandlerMetaData.HandlerType;
+
+/**
+ * XML Binding root element for JSR-181 HandlerChain
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 15-Oct-2005
+ */
+public class HandlerChainsMetaData
+{
+ // The required handler type
+ private HandlerType handlerType;
+ // The required <handler-chain> elements
+ private ArrayList<HandlerChainMetaData> handlerChains = new ArrayList<HandlerChainMetaData>();
+
+ public HandlerChainsMetaData(HandlerType handlerType)
+ {
+ this.handlerType = handlerType;
+ }
+
+ public HandlerType getHandlerType()
+ {
+ return handlerType;
+ }
+
+
+ public void addHandlerChain(HandlerChainMetaData handlerChain)
+ {
+ handlerChains.add(handlerChain);
+ }
+
+ public HandlerChainMetaData[] getHandlerChains()
+ {
+ HandlerChainMetaData[] array = new HandlerChainMetaData[handlerChains.size()];
+ handlerChains.toArray(array);
+ return array;
+ }
+}
Property changes on: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/jsr181/HandlerChainsMetaData.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Deleted: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/jsr181/HandlerConfigFactory.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/jsr181/HandlerConfigFactory.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/jsr181/HandlerConfigFactory.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -1,171 +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.metadata.jsr181;
-
-// $Id$
-
-import java.net.URL;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.metadata.j2ee.UnifiedHandlerMetaData;
-import org.jboss.ws.metadata.j2ee.UnifiedInitParamMetaData;
-import org.jboss.xb.binding.ObjectModelFactory;
-import org.jboss.xb.binding.UnmarshallingContext;
-import org.xml.sax.Attributes;
-
-/**
- * A JBossXB factory for {@link HandlerConfigMetaData}
- *
- * @author Thomas.Diesler at jboss.org
- * @since 15-Oct-2005
- */
-public class HandlerConfigFactory implements ObjectModelFactory
-{
- // provide logging
- private static final Logger log = Logger.getLogger(HandlerConfigFactory.class);
-
- // The URL to the handler-config.xml descriptor
- private URL fileURL;
-
- public HandlerConfigFactory(URL fileURL)
- {
- this.fileURL = fileURL;
- }
-
- /**
- * This method is called on the factory by the object model builder when the parsing starts.
- *
- * @return the root of the object model.
- */
- public Object newRoot(Object root, UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs)
- {
- HandlerConfigMetaData handlerConfigMetaData = new HandlerConfigMetaData(fileURL);
- return handlerConfigMetaData;
- }
-
- public Object completeRoot(Object root, UnmarshallingContext ctx, String uri, String name)
- {
- return root;
- }
-
- /**
- * Called when parsing of a new element started.
- */
- public Object newChild(HandlerConfigMetaData handlerConfig, UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs)
- {
- if ("handler-chain".equals(localName))
- return new HandlerChainMetaData(handlerConfig);
- else
- return null;
- }
-
- /**
- * Called when parsing character is complete.
- */
- public void addChild(HandlerConfigMetaData handlerConfig, HandlerChainMetaData handlerChain, UnmarshallingContext navigator, String namespaceURI, String localName)
- {
- handlerConfig.addHandlerChain(handlerChain);
- }
-
- /**
- * Called when parsing of a new element started.
- */
- public Object newChild(HandlerChainMetaData handlerConfig, UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs)
- {
- if ("handler".equals(localName))
- return new UnifiedHandlerMetaData();
- else
- return null;
- }
-
- /**
- * Called when parsing character is complete.
- */
- public void addChild(HandlerChainMetaData handlerConfig, UnifiedHandlerMetaData handler, UnmarshallingContext navigator, String namespaceURI, String localName)
- {
- handlerConfig.addHandler(handler);
- }
-
- /**
- * Called when parsing of a new element started.
- */
- public Object newChild(UnifiedHandlerMetaData handler, UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs)
- {
- if ("init-param".equals(localName))
- return new UnifiedInitParamMetaData();
- else return null;
- }
-
- /**
- * Called when parsing character is complete.
- */
- public void addChild(UnifiedHandlerMetaData handler, UnifiedInitParamMetaData param, UnmarshallingContext navigator, String namespaceURI, String localName)
- {
- handler.addInitParam(param);
- }
-
- /**
- * Called when a new simple child element with text value was read from the XML content.
- */
- public void setValue(HandlerChainMetaData handlerChain, UnmarshallingContext navigator, String namespaceURI, String localName, String value)
- {
- if (log.isTraceEnabled())
- log.trace("HandlerChainMetaData setValue: nuri=" + namespaceURI + " localName=" + localName + " value=" + value);
-
- if (localName.equals("handler-chain-name"))
- handlerChain.setHandlerChainName(value);
- }
-
- /**
- * Called when a new simple child element with text value was read from the XML content.
- */
- public void setValue(UnifiedHandlerMetaData handler, UnmarshallingContext navigator, String namespaceURI, String localName, String value)
- {
- if (log.isTraceEnabled())
- log.trace("UnifiedHandlerMetaData setValue: nuri=" + namespaceURI + " localName=" + localName + " value=" + value);
-
- if (localName.equals("handler-name"))
- handler.setHandlerName(value);
- else if (localName.equals("handler-class"))
- handler.setHandlerClass(value);
- else if (localName.equals("soap-header"))
- handler.addSoapHeader(navigator.resolveQName(value));
- else if (localName.equals("soap-role"))
- handler.addSoapRole(value);
- else if (localName.equals("port-name"))
- handler.addPortName(value);
- }
-
- /**
- * Called when a new simple child element with text value was read from the XML content.
- */
- public void setValue(UnifiedInitParamMetaData param, UnmarshallingContext navigator, String namespaceURI, String localName, String value)
- {
- if (log.isTraceEnabled())
- log.trace("UnifiedInitParamMetaData setValue: nuri=" + namespaceURI + " localName=" + localName + " value=" + value);
-
- if (localName.equals("param-name"))
- param.setParamName(value);
- else if (localName.equals("param-value"))
- param.setParamValue(value);
- }
-}
Deleted: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/jsr181/HandlerConfigMetaData.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/jsr181/HandlerConfigMetaData.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/jsr181/HandlerConfigMetaData.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -1,65 +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.
-*/
-// $Id$
-package org.jboss.ws.metadata.jsr181;
-
-//$Id$
-
-import java.net.URL;
-import java.util.ArrayList;
-
-/**
- * XML Binding root element for JSR-181 HandlerChain
- *
- * @author Thomas.Diesler at jboss.org
- * @since 15-Oct-2005
- */
-public class HandlerConfigMetaData
-{
- // The required <handler-chain> elements
- private ArrayList<HandlerChainMetaData> handlerChains = new ArrayList<HandlerChainMetaData>();
-
- // The URL to the webservices.xml descriptor
- private URL fileURL;
-
- public HandlerConfigMetaData(URL fileURL)
- {
- this.fileURL = fileURL;
- }
-
- public URL getDescriptorURL()
- {
- return fileURL;
- }
-
- public void addHandlerChain(HandlerChainMetaData handlerChain)
- {
- handlerChains.add(handlerChain);
- }
-
- public HandlerChainMetaData[] getHandlerChains()
- {
- HandlerChainMetaData[] array = new HandlerChainMetaData[handlerChains.size()];
- handlerChains.toArray(array);
- return array;
- }
-}
Added: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/wsdl/DOMTypes.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/wsdl/DOMTypes.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/wsdl/DOMTypes.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -0,0 +1,56 @@
+/*
+* 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.metadata.wsdl;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.util.NotImplementedException;
+import org.jboss.ws.utils.DOMWriter;
+import org.w3c.dom.Element;
+
+/**
+ * A DOM Element based schema representation. Care should be taken to ensure
+ * thread safety.
+ *
+ * @author <a href="mailto:jason.greene at jboss.com">Jason T. Greene</a>
+ * @version $Revision$
+ */
+public class DOMTypes extends WSDLTypes
+{
+ private Element element;
+
+ public DOMTypes(Element element)
+ {
+ this.element = element;
+ }
+
+ public String toString()
+ {
+ return DOMWriter.printNode(element, true);
+ }
+
+ @Override
+ public QName getXMLType(QName name)
+ {
+ throw new NotImplementedException();
+ }
+}
Property changes on: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/wsdl/DOMTypes.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/wsdl/XSModelTypes.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/wsdl/XSModelTypes.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/wsdl/XSModelTypes.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -0,0 +1,110 @@
+/*
+* 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.metadata.wsdl;
+
+import javax.xml.namespace.QName;
+
+import org.apache.xerces.xs.XSElementDeclaration;
+import org.apache.xerces.xs.XSTypeDefinition;
+import org.jboss.logging.Logger;
+import org.jboss.ws.WSException;
+import org.jboss.ws.metadata.wsdl.xmlschema.JBossXSModel;
+
+/**
+ * A JBossXSModel based type definition.
+ *
+ * @author <a href="mailto:jason.greene at jboss.com">Jason T. Greene</a>
+ * @version $Revision$
+ */
+public class XSModelTypes extends WSDLTypes
+{
+ private static final Logger log = Logger.getLogger(XSModelTypes.class);
+
+ private JBossXSModel schemaModel;
+
+ public XSModelTypes()
+ {
+ this.schemaModel = new JBossXSModel();
+ }
+
+ /**
+ * Add a schema model for a given namespaceURI
+ * @param nsURI the namespaceURI under which the model has been generated
+ * @param schema the Schema Model that needs to be added to existing schema
+ * model in WSDLTypes
+ * <dt>Warning:</dd>
+ * <p>Passing a null nsURI will replace the internal schema model
+ * held by WSDLTypes by the model passed as an argument.</p>
+ */
+ public void addSchemaModel(String nsURI, JBossXSModel schema)
+ {
+ if(nsURI == null)
+ {
+ log.trace("nsURI passed to addSchemaModel is null. Replacing Schema Model");
+ schemaModel = schema;
+ }
+ else
+ schemaModel.merge(schema);
+ }
+
+ /**
+ * Return the global Schema Model
+ * @return
+ */
+ public JBossXSModel getSchemaModel()
+ {
+ return schemaModel;
+ }
+
+ /** Get the xmlType from a given element xmlName
+ */
+ public QName getXMLType(QName xmlName)
+ {
+ QName xmlType = null;
+ String nsURI = xmlName.getNamespaceURI();
+ String localPart = xmlName.getLocalPart();
+ XSElementDeclaration xsel = schemaModel.getElementDeclaration(localPart, nsURI);
+ if (xsel != null)
+ {
+ XSTypeDefinition xstype = xsel.getTypeDefinition();
+ if (xstype == null)
+ throw new WSException("Cannot obtain XSTypeDefinition for: " + xmlName);
+
+ if (xstype.getAnonymous() == false)
+ {
+ xmlType = new QName(xstype.getNamespace(), xstype.getName());
+ }
+ else
+ {
+ xmlType = new QName(xstype.getNamespace(), ">" + localPart);
+ }
+ }
+ return xmlType;
+ }
+
+ public String toString()
+ {
+ StringBuilder buffer = new StringBuilder("WSDLTypes:\n");
+ buffer.append(schemaModel != null ? schemaModel.serialize() : "<schema/>");
+ return buffer.toString();
+ }
+}
Property changes on: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/wsdl/XSModelTypes.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/server/AbstractServiceEndpointInvoker.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/server/AbstractServiceEndpointInvoker.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/server/AbstractServiceEndpointInvoker.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -0,0 +1,307 @@
+/*
+ * 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.server;
+
+// $Id$
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
+import javax.management.MBeanException;
+import javax.xml.namespace.QName;
+import javax.xml.rpc.soap.SOAPFaultException;
+import javax.xml.soap.Name;
+import javax.xml.soap.SOAPBody;
+import javax.xml.soap.SOAPBodyElement;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPHeader;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.ws.BindingProvider;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.Constants;
+import org.jboss.ws.binding.EndpointInvocation;
+import org.jboss.ws.common.CommonMessageContext;
+import org.jboss.ws.jaxrpc.SOAPFaultExceptionHelper;
+import org.jboss.ws.jaxrpc.handler.HandlerDelegateJAXRPC;
+import org.jboss.ws.jaxws.core.BindingImpl;
+import org.jboss.ws.jaxws.core.BindingProviderImpl;
+import org.jboss.ws.metadata.EndpointMetaData;
+import org.jboss.ws.metadata.OperationMetaData;
+import org.jboss.ws.metadata.ServerEndpointMetaData;
+import org.jboss.ws.metadata.HandlerMetaData.HandlerType;
+import org.jboss.ws.soap.MessageContextAssociation;
+import org.jboss.ws.soap.SOAPBodyImpl;
+import org.jboss.ws.soap.SOAPMessageImpl;
+import org.jboss.ws.utils.JavaUtils;
+
+/** An implementation handles invocations on the endpoint
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 19-Jan-2005
+ */
+public abstract class AbstractServiceEndpointInvoker implements ServiceEndpointInvoker, HandlerDelegate
+{
+ // provide logging
+ private static Logger log = Logger.getLogger(AbstractServiceEndpointInvoker.class);
+
+ protected BindingProvider bindingProvider;
+ protected HandlerDelegate handlerDelegate;
+
+ /** Initialize the service endpoint */
+ public void initServiceEndpoint(ServiceEndpointInfo seInfo)
+ {
+ ServerEndpointMetaData sepMetaData = seInfo.getServerEndpointMetaData();
+ bindingProvider = new BindingProviderImpl(sepMetaData);
+ handlerDelegate = new HandlerDelegateJAXRPC();
+ }
+
+ /** Load the SEI implementation bean if necessary */
+ protected abstract Class loadServiceEndpoint(ServiceEndpointInfo seInfo) throws ClassNotFoundException;
+
+ /** Create the instance of the SEI implementation bean if necessary */
+ protected abstract Object createServiceEndpoint(ServiceEndpointInfo seInfo, Object context, Class seiImplClass) throws IllegalAccessException,
+ InstantiationException;
+
+ /** Invoke the instance of the SEI implementation bean */
+ protected abstract void invokeServiceEndpoint(ServiceEndpointInfo seInfo, Object seiImpl, EndpointInvocation epInv);
+
+ /** Destroy the instance of the SEI implementation bean if necessary */
+ protected abstract void destroyServiceEndpoint(ServiceEndpointInfo seInfo, Object seiImpl);
+
+ public boolean callRequestHandlerChain(ServiceEndpointInfo seInfo, HandlerType type)
+ {
+ return handlerDelegate.callRequestHandlerChain(seInfo, type);
+ }
+
+ public boolean callResponseHandlerChain(ServiceEndpointInfo seInfo, HandlerType type)
+ {
+ return handlerDelegate.callResponseHandlerChain(seInfo, type);
+ }
+
+ public boolean callFaultHandlerChain(ServiceEndpointInfo seInfo, HandlerType type, Exception ex)
+ {
+ return handlerDelegate.callFaultHandlerChain(seInfo, type, ex);
+ }
+
+ /** Invoke the the service endpoint */
+ public SOAPMessage invoke(ServiceEndpointInfo seInfo, Object context) throws Exception
+ {
+ CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
+ EndpointMetaData epMetaData = msgContext.getEndpointMetaData();
+ SOAPMessageImpl reqMessage = (SOAPMessageImpl)msgContext.getSOAPMessage();
+
+ // Load the endpoint implementation bean
+ Class seImpl = loadServiceEndpoint(seInfo);
+
+ // Create an instance of the endpoint implementation bean
+ Object seInstance = createServiceEndpoint(seInfo, context, seImpl);
+
+ try
+ {
+ boolean oneway = false;
+ BindingImpl binding = null;
+ EndpointInvocation epInv = null;
+ OperationMetaData opMetaData = null;
+
+ // call the handler chain
+ boolean handlersPass = callRequestHandlerChain(seInfo, HandlerType.PRE);
+
+ // Unbind the request message
+ if (handlersPass)
+ {
+ // Get the binding from the provideer
+ binding = (BindingImpl)bindingProvider.getBinding();
+
+ // Get the operation meta data from the SOAP message
+ opMetaData = getDispatchDestination(epMetaData, reqMessage);
+ msgContext.setOperationMetaData(opMetaData);
+ oneway = opMetaData.isOneWayOperation();
+
+ // Unbind the request message
+ epInv = binding.unbindRequestMessage(opMetaData, reqMessage);
+ }
+
+ handlersPass = handlersPass && callRequestHandlerChain(seInfo, HandlerType.ENDPOINT);
+ handlersPass = handlersPass && callRequestHandlerChain(seInfo, HandlerType.POST);
+
+ // Check if protocol handlers modified the payload
+ if (((SOAPBodyImpl)reqMessage.getSOAPBody()).isModifiedFromSource())
+ {
+ log.debug("Handler modified body payload, unbind message again");
+ epInv = binding.unbindRequestMessage(opMetaData, reqMessage);
+ }
+
+ if (handlersPass)
+ {
+ // Invoke the service endpoint
+ msgContext.setProperty(CommonMessageContext.ALLOW_EXPAND_TO_DOM, Boolean.TRUE);
+ try
+ {
+ invokeServiceEndpoint(seInfo, seInstance, epInv);
+ }
+ finally
+ {
+ msgContext.removeProperty(CommonMessageContext.ALLOW_EXPAND_TO_DOM);
+ }
+
+ // Bind the response message
+ SOAPMessage resMessage = (SOAPMessage)binding.bindResponseMessage(opMetaData, epInv);
+ msgContext.setSOAPMessage(resMessage);
+ }
+
+ // call the handler chain
+ if (oneway == false)
+ {
+ handlersPass = callResponseHandlerChain(seInfo, HandlerType.POST);
+ handlersPass = handlersPass && callResponseHandlerChain(seInfo, HandlerType.ENDPOINT);
+ handlersPass = handlersPass && callResponseHandlerChain(seInfo, HandlerType.PRE);
+ }
+
+ SOAPMessage resMessage = msgContext.getSOAPMessage();
+ return resMessage;
+ }
+ catch (Exception ex)
+ {
+ try
+ {
+ SOAPMessage faultMessage = SOAPFaultExceptionHelper.exceptionToFaultMessage(ex);
+ msgContext.setSOAPMessage(faultMessage);
+
+ // call the handler chain
+ boolean handlersPass = handlerDelegate.callFaultHandlerChain(seInfo, HandlerType.POST, ex);
+ handlersPass = handlersPass && handlerDelegate.callFaultHandlerChain(seInfo, HandlerType.ENDPOINT, ex);
+ handlersPass = handlersPass && handlerDelegate.callFaultHandlerChain(seInfo, HandlerType.PRE, ex);
+ }
+ catch (Exception subEx)
+ {
+ log.warn("Cannot process handlerChain.handleFault, ignoring: ", subEx);
+ }
+ throw ex;
+ }
+ finally
+ {
+ destroyServiceEndpoint(seInfo, seInstance);
+ }
+ }
+
+ private OperationMetaData getDispatchDestination(EndpointMetaData epMetaData, SOAPMessageImpl reqMessage) throws SOAPException
+ {
+ OperationMetaData opMetaData = reqMessage.getOperationMetaData(epMetaData);
+ SOAPHeader soapHeader = reqMessage.getSOAPHeader();
+
+ // Report a MustUnderstand fault
+ if (opMetaData == null)
+ {
+ String faultString;
+ SOAPBody soapBody = reqMessage.getSOAPBody();
+ if (soapBody.getChildElements().hasNext())
+ {
+ SOAPBodyElement soapBodyElement = (SOAPBodyElement)soapBody.getChildElements().next();
+ Name soapName = soapBodyElement.getElementName();
+ faultString = "Endpoint " + epMetaData.getQName() + " does not contain operation meta data for: " + soapName;
+ }
+ else
+ {
+ faultString = "Endpoint " + epMetaData.getQName() + " does not contain operation meta data for empty soap body";
+ }
+
+ // R2724 If an INSTANCE receives a message that is inconsistent with its WSDL description, it SHOULD generate a soap:Fault
+ // with a faultcode of "Client", unless a "MustUnderstand" or "VersionMismatch" fault is generated.
+ if (soapHeader != null && soapHeader.examineMustUnderstandHeaderElements(Constants.URI_SOAP11_NEXT_ACTOR).hasNext())
+ {
+ QName faultCode = Constants.SOAP11_FAULT_CODE_MUST_UNDERSTAND;
+ throw new SOAPFaultException(faultCode, faultString, null, null);
+ }
+ else
+ {
+ QName faultCode = Constants.SOAP11_FAULT_CODE_CLIENT;
+ throw new SOAPFaultException(faultCode, faultString, null, null);
+ }
+ }
+ return opMetaData;
+ }
+
+ protected Method getImplMethod(Class implClass, Method seiMethod) throws ClassNotFoundException, NoSuchMethodException
+ {
+ String methodName = seiMethod.getName();
+ Class[] paramTypes = seiMethod.getParameterTypes();
+ for (int i = 0; i < paramTypes.length; i++)
+ {
+ Class paramType = paramTypes[i];
+ if (JavaUtils.isPrimitive(paramType) == false)
+ {
+ String paramTypeName = paramType.getName();
+ paramType = JavaUtils.loadJavaType(paramTypeName);
+ paramTypes[i] = paramType;
+ }
+ }
+
+ Method implMethod = implClass.getMethod(methodName, paramTypes);
+ return implMethod;
+ }
+
+ /** handle invokation exceptions */
+ public void handleInvocationException(Throwable th) throws SOAPFaultException
+ {
+ if (th instanceof RuntimeException)
+ throw (RuntimeException)th;
+
+ if (th instanceof InvocationTargetException)
+ {
+ InvocationTargetException targetException = (InvocationTargetException)th;
+ Throwable targetEx = targetException.getTargetException();
+ if (targetEx instanceof SOAPFaultException)
+ {
+ throw (SOAPFaultException)targetEx;
+ }
+ else
+ {
+ String faultString = targetEx.toString();
+ SOAPFaultException soapFaultEx = new SOAPFaultException(Constants.SOAP11_FAULT_CODE_CLIENT, faultString, null, null);
+ soapFaultEx.initCause(targetEx);
+ throw soapFaultEx;
+ }
+ }
+
+ if (th instanceof MBeanException)
+ {
+ Exception targetEx = ((MBeanException)th).getTargetException();
+ if (targetEx instanceof SOAPFaultException)
+ {
+ throw (SOAPFaultException)targetEx;
+ }
+ else
+ {
+ String faultString = targetEx.toString();
+ SOAPFaultException soapFaultEx = new SOAPFaultException(Constants.SOAP11_FAULT_CODE_CLIENT, faultString, null, null);
+ soapFaultEx.initCause(targetEx);
+ throw soapFaultEx;
+ }
+ }
+
+ String faultString = th.toString();
+ SOAPFaultException soapFaultEx = new SOAPFaultException(Constants.SOAP11_FAULT_CODE_CLIENT, faultString, null, null);
+ soapFaultEx.initCause(th);
+ throw soapFaultEx;
+ }
+}
Property changes on: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/server/AbstractServiceEndpointInvoker.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/server/EndpointContext.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/server/EndpointContext.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/server/EndpointContext.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -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.server;
+
+// $Id$
+
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+import javax.xml.rpc.handler.MessageContext;
+
+import org.jboss.ws.soap.MessageContextAssociation;
+
+/**
+ * Implementation of ServletEndpointContext
+ *
+ * @author Thomas.Diesler at jboss.org
+ */
+public class EndpointContext
+{
+ private ServletContext context;
+ private HttpServletRequest request;
+ private HttpServletResponse response;
+
+ public EndpointContext(ServletContext context, HttpServletRequest request, HttpServletResponse response)
+ {
+ this.context = context;
+ this.request = request;
+ this.response = response;
+ }
+
+ public HttpSession getHttpSession()
+ {
+ return request.getSession();
+ }
+
+ public MessageContext getMessageContext()
+ {
+ return (MessageContext)MessageContextAssociation.peekMessageContext();
+ }
+
+ public ServletContext getServletContext()
+ {
+ return context;
+ }
+
+ public HttpServletRequest getHttpServletRequest()
+ {
+ return request;
+ }
+
+ public HttpServletResponse getHttpServletResponse()
+ {
+ return response;
+ }
+}
\ No newline at end of file
Property changes on: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/server/EndpointContext.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/server/HandlerDelegate.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/server/HandlerDelegate.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/server/HandlerDelegate.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -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.server;
+
+// $Id$
+
+import org.jboss.ws.metadata.HandlerMetaData.HandlerType;
+
+/** An implementation of handles invocations on the endpoint
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 19-Jan-2005
+ */
+public interface HandlerDelegate
+{
+ public boolean callRequestHandlerChain(ServiceEndpointInfo seInfo, HandlerType type);
+
+ public boolean callResponseHandlerChain(ServiceEndpointInfo seInfo, HandlerType type);
+
+ public boolean callFaultHandlerChain(ServiceEndpointInfo seInfo, HandlerType type, Exception ex);
+}
Property changes on: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/server/HandlerDelegate.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Deleted: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/server/ServiceEndpointInterceptor.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/server/ServiceEndpointInterceptor.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/server/ServiceEndpointInterceptor.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -1,41 +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.server;
-
-// $Id: ServiceEndpointInterceptor.java 275 2006-05-04 21:36:29Z jason.greene at jboss.com $
-
-import org.jboss.ejb.plugins.AbstractInterceptor;
-import org.jboss.invocation.Invocation;
-
-/**
- * Retained for backward compatibility with jboss-4.0.4.GA
- *
- * @author Thomas.Diesler at jboss.org
- * @since 21-Sep-2005
- */
-public class ServiceEndpointInterceptor extends AbstractInterceptor
-{
- public Object invoke(final Invocation mi) throws Exception
- {
- return getNext().invoke(mi);
- }
-}
Deleted: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/server/ServletEndpointContextImpl.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/server/ServletEndpointContextImpl.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/server/ServletEndpointContextImpl.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -1,93 +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.server;
-
-// $Id$
-
-import java.security.Principal;
-
-import javax.servlet.ServletContext;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.http.HttpSession;
-import javax.xml.rpc.handler.MessageContext;
-import javax.xml.rpc.server.ServletEndpointContext;
-
-import org.jboss.ws.soap.MessageContextAssociation;
-
-/**
- * Implementation of <code>ServletEndpointContext</code>
- *
- * @author <a href="mailto:jason at stacksmash.com">Jason T. Greene</a>
- */
-public class ServletEndpointContextImpl implements ServletEndpointContext
-{
- private ServletContext context;
- private HttpServletRequest request;
- private HttpServletResponse response;
-
- public ServletEndpointContextImpl(ServletContext context, HttpServletRequest request, HttpServletResponse response)
- {
- this.context = context;
- this.request = request;
- this.response = response;
- }
-
- public HttpSession getHttpSession()
- {
- return request.getSession();
- }
-
- public MessageContext getMessageContext()
- {
- return MessageContextAssociation.peekMessageContext();
- }
-
- public ServletContext getServletContext()
- {
- return context;
- }
-
- public Principal getUserPrincipal()
- {
- return request.getUserPrincipal();
- }
-
- public boolean isUserInRole(String role)
- {
- return request.isUserInRole(role);
- }
-
- // BEGIN non-standard access methods
-
- public HttpServletRequest getHttpServletRequest()
- {
- return request;
- }
-
- public HttpServletResponse getHttpServletResponse()
- {
- return response;
- }
-
- // END non-standard access methods
-}
\ No newline at end of file
Deleted: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/soap/DOMEnvelopeBuilder.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/soap/DOMEnvelopeBuilder.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/soap/DOMEnvelopeBuilder.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -1,285 +0,0 @@
-package org.jboss.ws.soap;
-
-import org.w3c.dom.*;
-import org.w3c.dom.Node;
-import org.jboss.ws.utils.DOMUtils;
-import org.jboss.ws.utils.DOMWriter;
-import org.jboss.xb.binding.NamespaceRegistry;
-import org.jboss.ws.jaxrpc.Style;
-import org.jboss.ws.WSException;
-
-import javax.xml.soap.*;
-import javax.xml.namespace.QName;
-import java.io.InputStream;
-import java.io.IOException;
-import java.util.Iterator;
-
-/**
- * @author Heiko Braun, <heiko.braun at jboss.com>
- * @since 19-Apr-2006
- */
-public class DOMEnvelopeBuilder implements SAAJEnvelopeBuilder {
-
- private SOAPMessage soapMessage;
- private boolean ignoreParseException = false;
- private Style style = Style.DOCUMENT;
-
- public void setSOAPMessage(SOAPMessage soapMessage) {
- this.soapMessage = soapMessage;
- }
-
- public void setIgnoreParseException(boolean ignoreParseException) {
- this.ignoreParseException = ignoreParseException;
- }
-
- public void setStyle(Style style) {
- this.style = style;
- }
-
- public SOAPEnvelope build(InputStream ins) throws IOException, SOAPException {
- // Parse the XML input stream
- Element domEnv = null;
- try
- {
- domEnv = DOMUtils.parse(ins);
- }
- catch (IOException ex)
- {
- if (ignoreParseException)
- {
- return null;
- }
- throw ex;
- }
-
- String envNS = domEnv.getNamespaceURI();
- String envPrefix = domEnv.getPrefix();
-
- // Construct the envelope
- SOAPFactoryImpl soapFactory = new SOAPFactoryImpl();
- SOAPPartImpl soapPart = (SOAPPartImpl)soapMessage.getSOAPPart();
- SOAPEnvelopeImpl soapEnv = new SOAPEnvelopeImpl(soapPart, soapFactory.createElement(domEnv, false));
- NamespaceRegistry namespaceRegistry = soapEnv.getNamespaceRegistry();
-
- DOMUtils.copyAttributes(soapEnv, domEnv);
- registerNamespaces(namespaceRegistry, soapEnv);
-
- // Add the header elements
- Element domHeader = DOMUtils.getFirstChildElement(domEnv, new QName(envNS, "Header"));
- if (domHeader != null)
- {
- SOAPHeader soapHeader = soapEnv.getHeader();
-
- DOMUtils.copyAttributes(soapHeader, domHeader);
- registerNamespaces(namespaceRegistry, soapHeader);
-
- Iterator it = DOMUtils.getChildElements(domHeader);
- while (it.hasNext())
- {
- Element srcElement = (Element)it.next();
- //registerNamespacesLocally(srcElement);
- String xmlFragment = DOMWriter.printNode(srcElement, false);
-
- Name name = new NameImpl(srcElement.getLocalName(), srcElement.getPrefix(), srcElement.getNamespaceURI());
- SOAPContentElement destElement = new SOAPHeaderElementImpl(name);
- soapHeader.addChildElement(destElement);
-
- //DOMUtils.copyAttributes(destElement, srcElement);
- destElement.setXMLFragment(xmlFragment);
- }
- }
-
- // Add the body elements
- Element domBody = DOMUtils.getFirstChildElement(domEnv, new QName(envNS, "Body"));
- SOAPBody soapBody = soapEnv.getBody();
-
- DOMUtils.copyAttributes(soapBody, domBody);
- registerNamespaces(namespaceRegistry, soapBody);
-
- Iterator itBody = DOMUtils.getChildElements(domBody);
- if (itBody.hasNext())
- {
- Element domBodyElement = (Element)itBody.next();
-
- String localName = domBodyElement.getLocalName();
- String prefix = domBodyElement.getPrefix();
- String nsURI = domBodyElement.getNamespaceURI();
- Name beName = new NameImpl(localName, prefix, nsURI);
-
- // Process a <env:Fault> message
- if (beName.equals(new NameImpl("Fault", envPrefix, envNS)))
- {
- SOAPFaultImpl soapFault = new SOAPFaultImpl(envNS);
- soapBody.addChildElement(soapFault);
-
- DOMUtils.copyAttributes(soapFault, domBodyElement);
-
- Element domFaultCode = DOMUtils.getFirstChildElement(domBodyElement, new QName("faultcode"));
- if (domFaultCode == null)
- throw new SOAPException("SOAPFault does not contain a <faultcode> element");
-
- Element domFaultString = DOMUtils.getFirstChildElement(domBodyElement, new QName("faultstring"));
- if (domFaultString == null)
- throw new SOAPException("SOAPFault does not contain a <faultstring> element");
-
- String faultCode = DOMUtils.getTextContent(domFaultCode);
- soapFault.setFaultCode(faultCode);
-
- String faultString = DOMUtils.getTextContent(domFaultString);
- soapFault.setFaultString(faultString);
-
- Element domFaultActor = DOMUtils.getFirstChildElement(domBodyElement, new QName("faultactor"));
- if (domFaultActor != null)
- {
- String faultActor = DOMUtils.getTextContent(domFaultActor);
- soapFault.setFaultActor(faultActor);
- }
-
- // Add the fault detail
- Element domFaultDetail = DOMUtils.getFirstChildElement(domBodyElement, "detail");
- if (domFaultDetail != null)
- {
- Detail detail = soapFault.addDetail();
- Iterator it = DOMUtils.getChildElements(domFaultDetail);
- while (it.hasNext())
- {
- Element domElement = (Element)it.next();
- SOAPElement detailEntry = new DetailEntryImpl(soapFactory.createElement(domElement, true));
- detailEntry = detail.addChildElement(detailEntry);
- }
- }
- }
-
- // Process and RPC or DOCUMENT style message
- else
- {
-
- if (style == Style.RPC)
- {
- SOAPBodyElementRpc soapBodyElement = new SOAPBodyElementRpc(beName);
- soapBodyElement = (SOAPBodyElementRpc)soapBody.addChildElement(soapBodyElement);
-
- DOMUtils.copyAttributes(soapBodyElement, domBodyElement);
-
- Iterator itBodyElement = DOMUtils.getChildElements(domBodyElement);
- while (itBodyElement.hasNext())
- {
- Element srcElement = (Element)itBodyElement.next();
- registerNamespacesLocally(srcElement);
-
- Name name = new NameImpl(srcElement.getLocalName(), srcElement.getPrefix(), srcElement.getNamespaceURI());
- SOAPContentElement destElement = new SOAPContentElement(name);
- soapBodyElement.addChildElement(destElement);
- // handle SOAPEncoding namespaces
- /*NamedNodeMap attribs = srcElement.getAttributes();
- for (int i = 0; i < attribs.getLength(); i++)
- {
- Attr attr = (Attr)attribs.item(i);
- if(attr.getNamespaceURI()!=null &&
- attr.getNamespaceURI().equals(Constants.URI_SOAP11_ENC) &&
- attr.getValue().indexOf(':') != -1
- ) // nested soap11-enc namespaces
- {
- String nestedPrefix = attr.getValue().substring(0, attr.getValue().indexOf(':'));
- String nestedNS = soapBodyElement.getNamespaceURI(nestedPrefix);
- if(nestedNS!=null)
- soapBodyElement.addNamespaceDeclaration(nestedPrefix, nestedNS);
- }
- } */
-
- String xmlFragment = DOMWriter.printNode(srcElement, false);
- destElement.setXMLFragment(xmlFragment);
- }
- }
- else if (style == Style.DOCUMENT)
- {
- Element srcElement = (Element)domBodyElement;
- registerNamespacesLocally(srcElement);
-
- SOAPBodyElementDoc destElement = new SOAPBodyElementDoc(beName);
- destElement = (SOAPBodyElementDoc)soapBody.addChildElement(destElement);
-
- String xmlFragment = DOMWriter.printNode(srcElement, false);
- destElement.setXMLFragment(xmlFragment);
- }
- else if (style == null)
- {
- SOAPBodyElementMessage soapBodyElement = new SOAPBodyElementMessage(beName);
- soapBodyElement = (SOAPBodyElementMessage)soapBody.addChildElement(soapBodyElement);
-
- DOMUtils.copyAttributes(soapBodyElement, domBodyElement);
-
- NodeList nlist = domBodyElement.getChildNodes();
- for (int i = 0; i < nlist.getLength(); i++)
- {
- org.w3c.dom.Node child = nlist.item(i);
- short childType = child.getNodeType();
- if (childType == org.w3c.dom.Node.ELEMENT_NODE)
- {
- SOAPElement soapElement = soapFactory.createElement((Element)child, true);
- soapBodyElement.addChildElement(soapElement);
- }
- else if (childType == org.w3c.dom.Node.TEXT_NODE)
- {
- String nodeValue = child.getNodeValue();
- soapBodyElement.addTextNode(nodeValue);
- }
- else if (childType == org.w3c.dom.Node.CDATA_SECTION_NODE)
- {
- String nodeValue = child.getNodeValue();
- soapBodyElement.addTextNode(nodeValue);
- }
- else
- {
- System.out.println("Ignore child type: " + childType);
- }
- }
- }
- else
- {
- throw new WSException("Unsupported message style: " + style);
- }
- }
- }
-
- return soapEnv;
- }
-
- /**
- * Register globally available namespaces on element level.
- * This is necessary to ensure that each xml fragment is valid.
- */
- private static void registerNamespacesLocally(Element element) {
-
- redeclareNamespace(element);
-
- NodeList nlist = element.getChildNodes();
- for (int i = 0; i < nlist.getLength(); i++)
- {
- Node childNode = nlist.item(i);
- if (childNode.getNodeType() == Node.ELEMENT_NODE)
- {
- registerNamespacesLocally((Element)childNode);
- }
- }
- }
-
- private static void redeclareNamespace(Element element)
- {
- if(element.getPrefix()== null)
- element.setAttribute("xmlns", element.getNamespaceURI());
- else
- element.setAttribute("xmlns:"+element.getPrefix(), element.getNamespaceURI());
- }
-
- private void registerNamespaces(NamespaceRegistry namespaceRegistry, SOAPElement soapEl)
- {
- Iterator itNSPrefixes = soapEl.getNamespacePrefixes();
- while (itNSPrefixes.hasNext())
- {
- String prefix = (String)itNSPrefixes.next();
- String nsURI = soapEl.getNamespaceURI(prefix);
- namespaceRegistry.registerURI(nsURI, prefix);
- }
- }
-}
Added: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/soap/PayloadBuilder.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/soap/PayloadBuilder.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/soap/PayloadBuilder.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -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.soap;
+
+// $Id$
+
+import java.io.IOException;
+import java.io.InputStream;
+
+import javax.xml.soap.SOAPException;
+
+/**
+ * @author Heiko Braun, <heiko.braun at jboss.com>
+ * @author Thomas.Diesler at jboss.com
+ * @since 19-Apr-2006
+ */
+public interface PayloadBuilder
+{
+ void build(SOAPMessageImpl soapMessage, InputStream in, boolean ignoreParseError) throws IOException, SOAPException;
+}
Property changes on: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/soap/PayloadBuilder.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Deleted: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/soap/SAAJElementWriter.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/soap/SAAJElementWriter.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/soap/SAAJElementWriter.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -1,193 +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.soap;
-
-import javax.xml.soap.SOAPElement;
-import java.io.*;
-import java.util.Iterator;
-
-/**
- * Writes a SAAJ elements to an output stream.
- *
- * @see SOAPElementImpl
- *
- * @author Heiko Braun <heiko.braun at jboss.com>
- * @version $Id$
- * @since Aug 4, 2006
- */
-public class SAAJElementWriter {
-
- // Print writer
- private PrintWriter out;
- // True, if canonical output
- private boolean canonical;
- // True, if pretty printing should be used
- private boolean prettyprint;
- // True, if the XML declaration should be written
- private boolean writeXMLDeclaration;
- // Explicit character set encoding
- private String charsetName;
- // True, if the XML declaration has been written
- private boolean wroteXMLDeclaration;
-
- public SAAJElementWriter(Writer w)
- {
- this.out = new PrintWriter(w);
- }
-
- public SAAJElementWriter(OutputStream stream)
- {
- try
- {
- this.out = new PrintWriter(new OutputStreamWriter(stream, "UTF-8"));
- }
- catch (UnsupportedEncodingException e)
- {
- // ignore, UTF-8 should be available
- }
- }
-
- public SAAJElementWriter(OutputStream stream, String charsetName)
- {
- try
- {
- this.out = new PrintWriter(new OutputStreamWriter(stream, charsetName));
- this.charsetName = charsetName;
- this.writeXMLDeclaration = true;
- }
- catch (UnsupportedEncodingException e)
- {
- throw new IllegalArgumentException("Unsupported encoding: " + charsetName);
- }
- }
-
- /**
- * Print a node with explicit prettyprinting.
- * The defaults for all other DOMWriter properties apply.
- *
- */
- public static String printSOAPElement(SOAPElementImpl element, boolean prettyprint)
- {
- StringWriter strw = new StringWriter();
- new SAAJElementWriter(strw).setPrettyprint(prettyprint).print(element);
- return strw.toString();
- }
-
- public boolean isCanonical()
- {
- return canonical;
- }
-
- /**
- * Set wheter entities should appear in their canonical form.
- * The default is false.
- */
- public SAAJElementWriter setCanonical(boolean canonical)
- {
- this.canonical = canonical;
- return this;
- }
-
- public boolean isPrettyprint()
- {
- return prettyprint;
- }
-
- /**
- * Set wheter element should be indented.
- * The default is false.
- */
- public SAAJElementWriter setPrettyprint(boolean prettyprint)
- {
- this.prettyprint = prettyprint;
- return this;
- }
-
- public boolean isWriteXMLDeclaration()
- {
- return writeXMLDeclaration;
- }
-
- /**
- * Set wheter the XML declaration should be written.
- * The default is false.
- */
- public SAAJElementWriter setWriteXMLDeclaration(boolean writeXMLDeclaration)
- {
- this.writeXMLDeclaration = writeXMLDeclaration;
- return this;
- }
-
- public void print(SOAPElementImpl element)
- {
- printInternal(element);
- }
-
- private void printInternal(SOAPElementImpl element)
- {
- // is there anything to do?
- if (element == null)
- {
- return;
- }
-
- if (wroteXMLDeclaration == false && writeXMLDeclaration == true && canonical == false)
- {
- out.print("<?xml version='1.0'");
- if (charsetName != null)
- out.print(" encoding='" + charsetName + "'");
-
- out.println("?>");
- wroteXMLDeclaration = true;
- }
-
- writeElement(element, out, prettyprint);
-
- out.flush();
- }
-
- private static void writeElement(SOAPElementImpl element, PrintWriter out, boolean pretty) {
-
- // the element itself
- String endTag = element.write(out, pretty);
-
- // skip SOAPContentElements
- if(! (element instanceof SOAPContentElement))
- {
- // and it's children
- Iterator it = element.getChildElements();
- while(it.hasNext())
- {
- Object child = it.next();
- if(child instanceof SOAPElement)
- {
- SOAPElementImpl childElement = (SOAPElementImpl)child;
- writeElement(childElement, out, pretty);
- }
- }
-
- }
- if(endTag!=null)
- out.write(endTag);
- }
-
-}
Deleted: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/soap/SAAJEnvelopeBuilder.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/soap/SAAJEnvelopeBuilder.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/soap/SAAJEnvelopeBuilder.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -1,20 +0,0 @@
-package org.jboss.ws.soap;
-
-import org.jboss.ws.jaxrpc.Style;
-
-import javax.xml.soap.SOAPEnvelope;
-import javax.xml.soap.SOAPMessage;
-import javax.xml.soap.SOAPException;
-import java.io.InputStream;
-import java.io.IOException;
-
-/**
- * @author Heiko Braun, <heiko.braun at jboss.com>
- * @since 19-Apr-2006
- */
-public interface SAAJEnvelopeBuilder {
- void setSOAPMessage(SOAPMessage soapMessage);
- void setStyle(Style style);
- SOAPEnvelope build(InputStream in) throws IOException, SOAPException;
- void setIgnoreParseException(boolean b);
-}
Deleted: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/soap/SAAJEnvelopeBuilderFactory.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/soap/SAAJEnvelopeBuilderFactory.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/soap/SAAJEnvelopeBuilderFactory.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -1,39 +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.soap;
-
-/**
- * @author Heiko Braun <heiko.braun at jboss.com>
- * @version $Id$
- * @since Aug 18, 2006
- */
-public class SAAJEnvelopeBuilderFactory {
-
- public static SAAJEnvelopeBuilderFactory newInstance() {
- return new SAAJEnvelopeBuilderFactory();
- }
-
- public SAAJEnvelopeBuilder createSAAJEnvelopeBuilder()
- {
- return new DOMEnvelopeBuilder();
- }
-}
Added: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/soap/SAAJPayloadBuilderDOM.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/soap/SAAJPayloadBuilderDOM.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/soap/SAAJPayloadBuilderDOM.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -0,0 +1,269 @@
+/*
+ * 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.soap;
+
+//$Id$
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Iterator;
+
+import javax.xml.namespace.QName;
+import javax.xml.soap.Detail;
+import javax.xml.soap.Name;
+import javax.xml.soap.SOAPBody;
+import javax.xml.soap.SOAPElement;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPHeader;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.utils.DOMUtils;
+import org.jboss.ws.WSException;
+import org.jboss.ws.jaxrpc.Style;
+import org.jboss.ws.jaxws.core.SOAPBindingImpl;
+import org.jboss.ws.utils.DOMWriter;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+/**
+ * A SOAPEnvelope builder for JAXRPC based on DOM
+ *
+ * @author Heiko Braun, <heiko.braun at jboss.com>
+ * @author Thomas.Diesler at jboss.com
+ * @since 19-Apr-2006
+ */
+public class SAAJPayloadBuilderDOM implements PayloadBuilder
+{
+ // provide logging
+ private static Logger log = Logger.getLogger(SOAPBindingImpl.class);
+
+ private Style style = Style.DOCUMENT;
+
+ public SAAJPayloadBuilderDOM(Style style)
+ {
+ this.style = style;
+ }
+
+ public void build(SOAPMessageImpl soapMessage, InputStream ins, boolean ignoreParseError) throws IOException, SOAPException
+ {
+ // Parse the XML input stream
+ Element domEnv = null;
+ try
+ {
+ domEnv = DOMUtils.parse(ins);
+ }
+ catch (IOException ex)
+ {
+ if (ignoreParseError)
+ {
+ return;
+ }
+ throw ex;
+ }
+
+ String envNS = domEnv.getNamespaceURI();
+ String envPrefix = domEnv.getPrefix();
+
+ // Construct the envelope
+ SOAPFactoryImpl soapFactory = new SOAPFactoryImpl();
+ SOAPPartImpl soapPart = (SOAPPartImpl)soapMessage.getSOAPPart();
+ SOAPEnvelopeImpl soapEnv = new SOAPEnvelopeImpl(soapPart, soapFactory.createElement(domEnv, false));
+
+ DOMUtils.copyAttributes(soapEnv, domEnv);
+
+ // Add the header elements
+ Element domHeader = DOMUtils.getFirstChildElement(domEnv, new QName(envNS, "Header"));
+ if (domHeader != null)
+ {
+ SOAPHeader soapHeader = soapEnv.getHeader();
+
+ DOMUtils.copyAttributes(soapHeader, domHeader);
+
+ Iterator it = DOMUtils.getChildElements(domHeader);
+ while (it.hasNext())
+ {
+ Element srcElement = (Element)it.next();
+ //registerNamespacesLocally(srcElement);
+ String xmlFragment = DOMWriter.printNode(srcElement, false);
+
+ Name name = new NameImpl(srcElement.getLocalName(), srcElement.getPrefix(), srcElement.getNamespaceURI());
+ SOAPContentElement destElement = new SOAPHeaderElementImpl(name);
+ soapHeader.addChildElement(destElement);
+
+ DOMUtils.copyAttributes(destElement, srcElement);
+ destElement.setXMLFragment(xmlFragment);
+ }
+ }
+
+ // Add the body elements
+ Element domBody = DOMUtils.getFirstChildElement(domEnv, new QName(envNS, "Body"));
+ SOAPBody soapBody = soapEnv.getBody();
+
+ DOMUtils.copyAttributes(soapBody, domBody);
+
+ Iterator itBody = DOMUtils.getChildElements(domBody);
+ if (itBody.hasNext())
+ {
+ Element domBodyElement = (Element)itBody.next();
+
+ String localName = domBodyElement.getLocalName();
+ String prefix = domBodyElement.getPrefix();
+ String nsURI = domBodyElement.getNamespaceURI();
+ Name beName = new NameImpl(localName, prefix, nsURI);
+
+ // Process a <env:Fault> message
+ if (beName.equals(new NameImpl("Fault", envPrefix, envNS)))
+ {
+ SOAPFaultImpl soapFault = new SOAPFaultImpl(envNS);
+ soapBody.addChildElement(soapFault);
+
+ DOMUtils.copyAttributes(soapFault, domBodyElement);
+
+ Element domFaultCode = DOMUtils.getFirstChildElement(domBodyElement, new QName("faultcode"));
+ if (domFaultCode == null)
+ throw new SOAPException("SOAPFault does not contain a <faultcode> element");
+
+ Element domFaultString = DOMUtils.getFirstChildElement(domBodyElement, new QName("faultstring"));
+ if (domFaultString == null)
+ throw new SOAPException("SOAPFault does not contain a <faultstring> element");
+
+ String faultCode = DOMUtils.getTextContent(domFaultCode);
+ soapFault.setFaultCode(faultCode);
+
+ String faultString = DOMUtils.getTextContent(domFaultString);
+ soapFault.setFaultString(faultString);
+
+ Element domFaultActor = DOMUtils.getFirstChildElement(domBodyElement, new QName("faultactor"));
+ if (domFaultActor != null)
+ {
+ String faultActor = DOMUtils.getTextContent(domFaultActor);
+ soapFault.setFaultActor(faultActor);
+ }
+
+ // Add the fault detail
+ Element domFaultDetail = DOMUtils.getFirstChildElement(domBodyElement, "detail");
+ if (domFaultDetail != null)
+ {
+ Detail detail = soapFault.addDetail();
+ Iterator it = DOMUtils.getChildElements(domFaultDetail);
+ while (it.hasNext())
+ {
+ Element domElement = (Element)it.next();
+ SOAPElement detailEntry = new DetailEntryImpl(soapFactory.createElement(domElement, true));
+ detailEntry = detail.addChildElement(detailEntry);
+ }
+ }
+ }
+
+ // Process and RPC or DOCUMENT style message
+ else
+ {
+
+ if (style == Style.RPC)
+ {
+ SOAPBodyElementRpc soapBodyElement = new SOAPBodyElementRpc(beName);
+ soapBodyElement = (SOAPBodyElementRpc)soapBody.addChildElement(soapBodyElement);
+
+ DOMUtils.copyAttributes(soapBodyElement, domBodyElement);
+
+ Iterator itBodyElement = DOMUtils.getChildElements(domBodyElement);
+ while (itBodyElement.hasNext())
+ {
+ Element srcElement = (Element)itBodyElement.next();
+ registerNamespacesLocally(srcElement);
+
+ Name name = new NameImpl(srcElement.getLocalName(), srcElement.getPrefix(), srcElement.getNamespaceURI());
+ SOAPContentElement destElement = new SOAPContentElement(name);
+ destElement = (SOAPContentElement)soapBodyElement.addChildElement(destElement);
+
+ DOMUtils.copyAttributes(destElement, srcElement);
+
+ String xmlFragment = DOMWriter.printNode(srcElement, false);
+ destElement.setXMLFragment(xmlFragment);
+ }
+ }
+ else if (style == Style.DOCUMENT)
+ {
+ Element srcElement = (Element)domBodyElement;
+ registerNamespacesLocally(srcElement);
+ SOAPContentElement destElement = new SOAPBodyElementDoc(beName);
+ destElement = (SOAPContentElement)soapBody.addChildElement(destElement);
+
+ DOMUtils.copyAttributes(destElement, srcElement);
+
+ String xmlFragment = DOMWriter.printNode(srcElement, false);
+ destElement.setXMLFragment(xmlFragment);
+ }
+ else if (style == null)
+ {
+ SOAPBodyElementMessage soapBodyElement = new SOAPBodyElementMessage(beName);
+ soapBodyElement = (SOAPBodyElementMessage)soapBody.addChildElement(soapBodyElement);
+
+ DOMUtils.copyAttributes(soapBodyElement, domBodyElement);
+
+ NodeList nlist = domBodyElement.getChildNodes();
+ for (int i = 0; i < nlist.getLength(); i++)
+ {
+ org.w3c.dom.Node child = nlist.item(i);
+ short childType = child.getNodeType();
+ if (childType == org.w3c.dom.Node.ELEMENT_NODE)
+ {
+ SOAPElement soapElement = soapFactory.createElement((Element)child, true);
+ soapBodyElement.addChildElement(soapElement);
+ }
+ else if (childType == org.w3c.dom.Node.TEXT_NODE)
+ {
+ String nodeValue = child.getNodeValue();
+ soapBodyElement.addTextNode(nodeValue);
+ }
+ else if (childType == org.w3c.dom.Node.CDATA_SECTION_NODE)
+ {
+ String nodeValue = child.getNodeValue();
+ soapBodyElement.addTextNode(nodeValue);
+ }
+ else
+ {
+ log.warn("Ignore child type: " + childType);
+ }
+ }
+ }
+ else
+ {
+ throw new WSException("Unsupported message style: " + style);
+ }
+ }
+ }
+ }
+
+ /**
+ * Register globally available namespaces on element level.
+ * This is necessary to ensure that each xml fragment is valid.
+ */
+ private void registerNamespacesLocally(Element srcElement) {
+ if(srcElement.getPrefix()== null)
+ {
+ srcElement.setAttribute("xmlns", srcElement.getNamespaceURI());
+ }
+ else
+ {
+ srcElement.setAttribute("xmlns:"+srcElement.getPrefix(), srcElement.getNamespaceURI());
+ }
+ }
+}
Property changes on: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/soap/SAAJPayloadBuilderDOM.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/soap/SAAJPayloadBuilderStax.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/soap/SAAJPayloadBuilderStax.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/soap/SAAJPayloadBuilderStax.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -0,0 +1,467 @@
+/*
+ * 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.soap;
+
+// $Id$
+
+import java.io.IOException;
+import java.io.InputStream;
+
+import javax.xml.namespace.QName;
+import javax.xml.soap.Name;
+import javax.xml.soap.SOAPBody;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPFault;
+import javax.xml.soap.SOAPHeader;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import org.w3c.dom.Element;
+
+import com.ctc.wstx.stax.WstxInputFactory;
+
+/**
+ * A SOAPEnvelope builder for JAXRPC based on Stax
+ *
+ * @author Heiko Braun, <heiko.braun at jboss.com>
+ * @author Thomas.Diesler at jboss.com
+ * @since 15-Apr-2006
+ */
+public class SAAJPayloadBuilderStax implements PayloadBuilder
+{
+ private static final String END_ELEMENT_BRACKET = "</";
+ private static final String EMPTY_STRING = "";
+ private static final String CLOSING_BRACKET = ">";
+ private static final String START_ELEMENT_BRACKET = "<";
+ private static final String HEADER_ELEMENT_NAME = "Header";
+ private static final String BODY_ELEMENT_NAME = "Body";
+ private static final String FAULT_ELEMENT_NAME = "Fault";
+
+ private static enum Part
+ {
+ ENVELOPE, HEADER, BODY, FAULT, RPC_PAYLOAD, DOC_PAYLOAD, BARE_PAYLOAD
+ }
+
+ private Part currentPart = Part.ENVELOPE;
+ private Part previousPart = null;
+
+ // saaj
+ private SOAPPartImpl soapPart;
+ private SOAPEnvelopeImpl soapEnv;
+
+ private StringBuffer fragmentBuffer;
+ private QName fragmentRootCursor = null;
+ private QName currentRootElement = null;
+ private XMLStreamReader reader;
+
+ private static XMLInputFactory factory;
+
+ public SAAJPayloadBuilderStax()
+ {
+ resetFragmentBuffer();
+ }
+
+ private void resetFragmentBuffer()
+ {
+ this.fragmentBuffer = new StringBuffer();
+ this.fragmentBuffer.ensureCapacity(2048);
+ }
+
+ public void build(SOAPMessageImpl soapMessage, InputStream in, boolean ignoreParseError) throws IOException, SOAPException
+ {
+ try
+ {
+ reader = getFactoryInstance().createXMLStreamReader(in);
+ }
+ catch (XMLStreamException e)
+ {
+ throw new IOException("Failed to create stream reader:" + e.getMessage());
+ }
+
+ try
+ {
+ soapPart = (SOAPPartImpl)soapMessage.getSOAPPart();
+
+ while (reader.hasNext())
+ {
+
+ if (reader.isStartElement())
+ {
+ processStartElement();
+ }
+ else if (reader.isCharacters())
+ {
+ processCharacters();
+ }
+ else if (reader.isEndElement())
+ {
+ processEndElement();
+ }
+
+ reader.next();
+ }
+
+ }
+ catch (XMLStreamException e)
+ {
+ if (!ignoreParseError)
+ throw new IOException("Failed to parse stream: " + e.getMessage());
+ }
+ catch (SOAPException e)
+ {
+ e.printStackTrace();
+ throw e;
+ }
+ finally
+ {
+ try
+ {
+ if (reader != null)
+ reader.close();
+ }
+ catch (XMLStreamException e)
+ {
+ // ignore
+ }
+ }
+ }
+
+ private static synchronized XMLInputFactory getFactoryInstance()
+ {
+ if (null == factory)
+ {
+ System.setProperty("javax.xml.stream.XMLInputFactory", "com.ctc.wstx.stax.WstxInputFactory");
+ //System.setProperty("javax.xml.stream.XMLInputFactory", "com.sun.xml.stream.ZephyrParserFactory");
+ factory = XMLInputFactory.newInstance();
+ factory.setProperty(XMLInputFactory.IS_VALIDATING, Boolean.FALSE);
+ ((WstxInputFactory)factory).configureForSpeed();
+ }
+ return factory;
+
+ }
+
+ private void processCharacters() throws SOAPException
+ {
+ if (fragmentRootCursor != null)
+ consumeCharacters();
+ }
+
+ private void consumeCharacters() throws SOAPException
+ {
+
+ String text = normalize(reader.getText());
+
+ if (!atPartMargin() && !reader.isWhiteSpace())
+ {
+
+ fragmentBuffer.append(text);
+
+ if (Part.FAULT == currentPart)
+ {
+ String localName = currentRootElement.getLocalPart();
+ SOAPFault fault = soapEnv.getBody().getFault();
+ if ("faultcode".equalsIgnoreCase(localName))
+ fault.setFaultCode(text);
+ else if ("faultactor".equalsIgnoreCase(localName))
+ fault.setFaultActor(text);
+ else if ("faultstring".equalsIgnoreCase(localName))
+ fault.setFaultString(text);
+ }
+ }
+ }
+
+ private void processEndElement() throws SOAPException
+ {
+ if (fragmentRootCursor != null)
+ consumeEndElement();
+ }
+
+ private void consumeEndElement() throws SOAPException
+ {
+
+ QName qName = reader.getName();
+
+ fragmentBuffer.append(END_ELEMENT_BRACKET);
+ fragmentBuffer.append(getFQElementName(qName));
+ fragmentBuffer.append(CLOSING_BRACKET);
+
+ if (fragmentRootCursor != null && fragmentRootCursor.equals(qName))
+ {
+ flushBuffer();
+ fragmentRootCursor = null;
+ }
+ }
+
+ private void flushBuffer() throws SOAPException
+ {
+ if (Part.HEADER == currentPart)
+ {
+ SOAPHeader soapHeader = soapEnv.getHeader();
+ SOAPContentElement lastHeaderElement = (SOAPContentElement)soapHeader.getChildNodes().item(soapHeader.getChildNodes().getLength() - 1);
+
+ lastHeaderElement.setXMLFragment(fragmentBuffer.toString());
+ }
+ else if (Part.BODY == currentPart)
+ {
+ SOAPBody soapBody = soapEnv.getBody();
+ SOAPContentElement lastBodyElement = (SOAPContentElement)soapBody.getChildNodes().item(soapBody.getChildNodes().getLength() - 1);
+ lastBodyElement.setXMLFragment(fragmentBuffer.toString());
+ }
+ else if (Part.FAULT == currentPart)
+ {
+ SOAPBody soapBody = soapEnv.getBody();
+ SOAPContentElement faultElement = (SOAPContentElement)soapBody.getFault();
+ faultElement.setXMLFragment(fragmentBuffer.toString());
+ }
+
+ resetFragmentBuffer();
+ }
+
+ private void processStartElement() throws SOAPException
+ {
+
+ QName qName = reader.getName();
+ currentRootElement = qName;
+
+ // identify current envelope part
+ togglePartMargin(qName);
+
+ // toggle current element
+ Element destElement = null;
+ if (Part.ENVELOPE == currentPart)
+ {
+ // setup envelope impl
+ soapEnv = new SOAPEnvelopeImpl(soapPart, qName.getNamespaceURI());
+ destElement = soapEnv; // soapEnv becomes current
+ }
+ else if (Part.HEADER == currentPart)
+ {
+ if (atPartMargin())
+ {
+ // the env:Header element itself
+ SOAPHeader soapHeader = soapEnv.getHeader();
+ destElement = soapHeader; // header becomes current
+ previousPart = Part.HEADER;
+ }
+ else
+ {
+ // child element of env:Header
+ if (fragmentRootCursor == null)
+ {
+ Name name = new NameImpl(qName.getLocalPart(), qName.getPrefix(), qName.getNamespaceURI());
+ SOAPContentElement headerElement = new SOAPHeaderElementImpl(name);
+ soapEnv.getHeader().addChildElement(headerElement);
+
+ destElement = headerElement; // headerElement becomes current
+ fragmentRootCursor = qName;
+ }
+
+ consumeStartElement();
+ }
+ }
+ else if (Part.BODY == currentPart)
+ {
+
+ SOAPBody soapBody = soapEnv.getBody();
+
+ if (atPartMargin())
+ {
+ // the env:Body element
+ destElement = soapBody;
+ previousPart = Part.BODY;
+ }
+ else
+ {
+ // payload not fault
+ Name bodyElementName = new NameImpl(qName.getLocalPart(), qName.getPrefix(), qName.getNamespaceURI());
+
+ if (fragmentRootCursor == null)
+ {
+ SOAPBodyElementDoc docBodyElement = new SOAPBodyElementDoc(bodyElementName);
+ docBodyElement = (SOAPBodyElementDoc)soapBody.addChildElement(docBodyElement);
+
+ destElement = docBodyElement;
+ fragmentRootCursor = qName;
+ }
+
+ consumeStartElement();
+ }
+ }
+ else if (Part.FAULT == currentPart)
+ {
+ // payload is fault
+ if (atPartMargin())
+ {
+ SOAPBody soapBody = soapEnv.getBody();
+ SOAPFaultImpl soapFault = new SOAPFaultImpl(soapEnv.getNamespaceURI());
+ soapBody.addChildElement(soapFault);
+ destElement = soapFault;
+ previousPart = Part.FAULT;
+ }
+
+ if (fragmentRootCursor == null)
+ {
+ fragmentRootCursor = qName;
+ }
+
+ consumeStartElement();
+ }
+
+ if (fragmentRootCursor == null) // constructing soap elements
+ {
+ copyAttributes(destElement);
+ }
+ }
+
+ private void togglePartMargin(QName qName)
+ {
+ // identify the current part
+ if (qName.getLocalPart().equalsIgnoreCase(HEADER_ELEMENT_NAME))
+ {
+ previousPart = currentPart;
+ currentPart = Part.HEADER;
+ }
+ else if (qName.getLocalPart().equalsIgnoreCase(BODY_ELEMENT_NAME))
+ {
+ previousPart = currentPart;
+ currentPart = Part.BODY;
+ }
+ else if (qName.getLocalPart().equalsIgnoreCase(FAULT_ELEMENT_NAME))
+ {
+ previousPart = currentPart;
+ currentPart = Part.FAULT;
+ }
+ }
+
+ private void consumeStartElement()
+ {
+
+ QName qName = reader.getName();
+
+ // element
+ fragmentBuffer.append(START_ELEMENT_BRACKET);
+ fragmentBuffer.append(getFQElementName(qName));
+
+ // local namespaces
+ for (int x = 0; x < reader.getNamespaceCount(); x++)
+ {
+ if (reader.getNamespacePrefix(x) != null)
+ {
+ fragmentBuffer.append(" xmlns:");
+ fragmentBuffer.append(reader.getNamespacePrefix(x)).append("='");
+ fragmentBuffer.append(reader.getNamespaceURI(x)).append("'");
+ }
+ else if (reader.getNamespaceURI(x) != null)
+ {
+ fragmentBuffer.append(" xmlns='");
+ fragmentBuffer.append(reader.getNamespaceURI(x)).append("'");
+ }
+ }
+
+ // attributes
+ if (reader.getAttributeCount() > 0)
+ {
+ for (int i = 0; i < reader.getAttributeCount(); i++)
+ {
+ QName attQName = reader.getAttributeName(i);
+ fragmentBuffer.append(" ").append(getFQElementName(attQName));
+ fragmentBuffer.append("='").append(reader.getAttributeValue(i)).append("'");
+ }
+ }
+
+ fragmentBuffer.append(CLOSING_BRACKET);
+ }
+
+ private String getFQElementName(QName qName)
+ {
+ return !qName.getPrefix().equals(EMPTY_STRING) ? qName.getPrefix() + ":" + qName.getLocalPart() : qName.getLocalPart();
+ }
+
+ private void copyAttributes(Element destElement)
+ {
+
+ if (reader.getAttributeCount() == 0)
+ return;
+
+ for (int i = 0; i < reader.getAttributeCount(); i++)
+ {
+ destElement.setAttributeNS(reader.getAttributeNamespace(i), reader.getAttributeLocalName(i), reader.getAttributeValue(i));
+ }
+ }
+
+ private boolean atPartMargin()
+ {
+ return previousPart != currentPart;
+ }
+
+ private static 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();
+ }
+}
Property changes on: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/soap/SAAJPayloadBuilderStax.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/soap/SOAPElementWriter.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/soap/SOAPElementWriter.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/soap/SOAPElementWriter.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -0,0 +1,157 @@
+/*
+ * 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.soap;
+
+// $Id$
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.io.UnsupportedEncodingException;
+import java.io.Writer;
+
+import javax.xml.soap.SOAPEnvelope;
+
+import org.jboss.ws.utils.DOMUtils;
+import org.jboss.ws.utils.DOMWriter;
+import org.jboss.ws.WSException;
+
+/**
+ * Writes a SAAJ elements to an output stream.
+ *
+ * @author Heiko Braun <heiko.braun at jboss.com>
+ * @author Thomas.Diesler at jboss.com
+ * @since 4-Aug-2006
+ */
+public class SOAPElementWriter
+{
+
+ // Print writer
+ private PrintWriter out;
+ // True, if the XML declaration should be written
+ private boolean writeXMLDeclaration;
+ // Explicit character set encoding
+ private String charsetName;
+
+ public SOAPElementWriter(Writer w)
+ {
+ this.out = new PrintWriter(w);
+ }
+
+ public SOAPElementWriter(OutputStream stream)
+ {
+ try
+ {
+ this.out = new PrintWriter(new OutputStreamWriter(stream, "UTF-8"));
+ }
+ catch (UnsupportedEncodingException e)
+ {
+ // ignore, UTF-8 should be available
+ }
+ }
+
+ public SOAPElementWriter(OutputStream stream, String charsetName)
+ {
+ try
+ {
+ this.out = new PrintWriter(new OutputStreamWriter(stream, charsetName));
+ this.charsetName = charsetName;
+ }
+ catch (UnsupportedEncodingException e)
+ {
+ throw new IllegalArgumentException("Unsupported encoding: " + charsetName);
+ }
+ }
+
+ /**
+ * Set wheter the XML declaration should be written.
+ * The default is false.
+ */
+ public SOAPElementWriter setWriteXMLDeclaration(boolean writeXMLDeclaration)
+ {
+ this.writeXMLDeclaration = writeXMLDeclaration;
+ return this;
+ }
+
+ /**
+ * Print a node with explicit prettyprinting.
+ * The defaults for all other DOMWriter properties apply.
+ */
+ public static String writeElement(SOAPElementImpl element, boolean pretty)
+ {
+ if (element == null)
+ return null;
+
+ StringWriter strw = new StringWriter();
+ new SOAPElementWriter(strw).writeElement(element);
+ String xmlStr = strw.toString();
+
+ if (pretty)
+ {
+ // This is expensive. Make sure it only happens for debugging
+ try
+ {
+ xmlStr = DOMWriter.printNode(DOMUtils.parse(xmlStr), true);
+ }
+ catch (IOException ex)
+ {
+ throw new WSException ("Cannot parse xml: " + xmlStr, ex);
+ }
+ }
+
+ return xmlStr;
+ }
+
+ public void writeElement(SOAPElementImpl element)
+ {
+ writeElementInternal(element);
+ }
+
+ private void writeElementInternal(SOAPElementImpl element)
+ {
+ if (element != null)
+ {
+ try
+ {
+ if (writeXMLDeclaration == true && element instanceof SOAPEnvelope)
+ {
+ out.print("<?xml version='1.0'");
+ if (charsetName != null)
+ out.print(" encoding='" + charsetName + "'");
+
+ out.println("?>");
+ writeXMLDeclaration = false;
+ }
+
+ element.writeElement(out);
+
+ out.flush();
+ }
+ catch (IOException ex)
+ {
+ throw new WSException("Cannot write SOAP element", ex);
+ }
+ }
+ }
+}
Property changes on: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/soap/SOAPElementWriter.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Deleted: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/soap/SOAPMessageContextImpl.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/soap/SOAPMessageContextImpl.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/soap/SOAPMessageContextImpl.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -1,153 +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.soap;
-
-// $Id$
-
-import javax.xml.rpc.handler.soap.SOAPMessageContext;
-import javax.xml.soap.SOAPException;
-import javax.xml.soap.SOAPMessage;
-
-import org.jboss.ws.WSException;
-import org.jboss.ws.handler.MessageContextImpl;
-import org.jboss.ws.jaxrpc.encoding.SerializationContextImpl;
-import org.jboss.ws.metadata.EndpointMetaData;
-import org.jboss.ws.metadata.OperationMetaData;
-import org.jboss.ws.metadata.ServiceMetaData;
-import org.jboss.xb.binding.NamespaceRegistry;
-
-/**
- * Provides access to the SOAP message for either RPC request or response.
- *
- * @author Thomas.Diesler at jboss.org
- * @since 14-Dec-2004
- */
-public class SOAPMessageContextImpl extends MessageContextImpl implements SOAPMessageContext
-{
- // The current SOAPMessage, maybe a request or response message
- private SOAPMessage soapMessage;
- // The operation for this message ctx
- private EndpointMetaData epMetaData;
- // The operation for this message ctx
- private OperationMetaData opMetaData;
- // The serialization context for this message ctx
- private SerializationContextImpl serContext;
-
- /** Default constuctor
- */
- public SOAPMessageContextImpl()
- {
- }
-
- /** Gets the SOAPMessage from this message context
- *
- * @return Returns the SOAPMessage; returns null if no SOAPMessage is present in this message context
- */
- public SOAPMessage getMessage()
- {
- return soapMessage;
- }
-
- /** Sets the SOAPMessage in this message context
- *
- * @param message SOAP message
- * @throws javax.xml.rpc.JAXRPCException If any error during the setting of the SOAPMessage in this message context
- * @throws UnsupportedOperationException - If this operation is not supported
- */
- public void setMessage(SOAPMessage message)
- {
- this.soapMessage = message;
- }
-
- /**
- * Gets the SOAP actor roles associated with an execution of the HandlerChain and its contained Handler instances.
- * Note that SOAP actor roles apply to the SOAP node and are managed using HandlerChain.setRoles and HandlerChain.getRoles.
- * Handler instances in the HandlerChain use this information about the SOAP actor roles to process the SOAP header blocks.
- * Note that the SOAP actor roles are invariant during the processing of SOAP message through the HandlerChain.
- *
- * @return Array of URIs for SOAP actor roles
- */
- public String[] getRoles()
- {
- return new String[0];
- }
-
- public EndpointMetaData getEndpointMetaData()
- {
- if (epMetaData == null && opMetaData != null)
- epMetaData = opMetaData.getEndpointMetaData();
-
- return epMetaData;
- }
-
- public void setEndpointMetaData(EndpointMetaData epMetaData)
- {
- this.epMetaData = epMetaData;
- }
-
- public OperationMetaData getOperationMetaData()
- {
- return opMetaData;
- }
-
- public void setOperationMetaData(OperationMetaData opMetaData)
- {
- this.opMetaData = opMetaData;
- }
-
- /** Get or create the serialization context
- */
- public SerializationContextImpl getSerializationContext()
- {
- if (serContext == null)
- {
- ServiceMetaData serviceMetaData = getEndpointMetaData().getServiceMetaData();
-
- serContext = new SerializationContextImpl();
- serContext.setTypeMapping(serviceMetaData.getTypeMapping());
- serContext.setJavaWsdlMapping(serviceMetaData.getJavaWsdlMapping());
- }
-
- serContext.setNamespaceRegistry(getNamespaceRegistry());
-
- return serContext;
- }
-
- /** Get the namespace registry from the current SOAPEnvelope
- */
- public NamespaceRegistry getNamespaceRegistry()
- {
- if (soapMessage == null)
- throw new WSException("Cannot obtain NamespaceRegistry, because there is no SOAPMessage associated with this context");
-
- try
- {
- SOAPEnvelopeImpl soapEnv = (SOAPEnvelopeImpl)soapMessage.getSOAPPart().getEnvelope();
- NamespaceRegistry nsRegistry = soapEnv.getNamespaceRegistry();
- return nsRegistry;
- }
- catch (SOAPException e)
- {
- throw new WSException("Cannot get SOAPEnvelope: " + e);
- }
- }
-}
Deleted: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/soap/STAXEnvelopeBuilder.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/soap/STAXEnvelopeBuilder.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/soap/STAXEnvelopeBuilder.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -1,480 +0,0 @@
-package org.jboss.ws.soap;
-
-import com.ctc.wstx.stax.WstxInputFactory;
-import org.jboss.ws.utils.DOMWriter;
-import org.jboss.ws.jaxrpc.Style;
-import org.jboss.xb.binding.NamespaceRegistry;
-import org.w3c.dom.Element;
-
-import javax.xml.namespace.QName;
-import javax.xml.soap.*;
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import java.io.*;
-
-/**
- * @author Heiko Braun, <heiko.braun at jboss.com>
- * @since 15-Apr-2006
- */
-public class STAXEnvelopeBuilder implements SAAJEnvelopeBuilder {
-
- private static final String END_ELEMENT_BRACKET = "</";
- private static final String EMPTY_STRING = "";
- private static final String CLOSING_BRACKET = ">";
- private static final String START_ELEMENT_BRACKET = "<";
- private static final String HEADER_ELEMENT_NAME = "Header";
- private static final String BODY_ELEMENT_NAME = "Body";
- private static final String FAULT_ELEMENT_NAME = "Fault";
-
- private static enum Part { ENVELOPE, HEADER, BODY, FAULT, RPC_PAYLOAD, DOC_PAYLOAD, BARE_PAYLOAD}
-
- private Part currentPart = Part.ENVELOPE;
- private Part previousPart = null;
-
- private boolean ignoreParseException = false;
- private Style style;
-
- // saaj
- private SOAPMessage soapMessage;
- private SOAPPartImpl soapPart;
- private SOAPEnvelopeImpl soapEnv;
- private NamespaceRegistry namespaceRegistry;
-
- private StringBuffer fragmentBuffer;
- private QName fragmentRootCursor = null;
- private QName currentRootElement = null;
- private XMLStreamReader reader;
-
- private static XMLInputFactory factory;
-
- public STAXEnvelopeBuilder() {
- resetFragmentBuffer();
- }
-
- private void resetFragmentBuffer() {
- this.fragmentBuffer = new StringBuffer();
- this.fragmentBuffer.ensureCapacity(2048);
- }
-
- public static void main(String[] args) throws Exception {
-
- for(int i=0; i<1; i++)
- {
- SAAJEnvelopeBuilder builder = new STAXEnvelopeBuilder();
- builder.setSOAPMessage(new SOAPMessageImpl());
- builder.setStyle(Style.DOCUMENT);
- File source = new File("C:/dev/prj/Stax_JBoss/resource/req8.xml");
- InputStream in = new BufferedInputStream(new FileInputStream(source));
-
- long start = System.currentTimeMillis();
- SOAPEnvelope soapEnv = builder.build(in);
- System.out.println( (System.currentTimeMillis()-start) + " ms");
- System.out.println(DOMWriter.printNode(soapEnv, true));
-
- in.close();
- }
- }
-
- public void setStyle(Style style) {
- this.style = style;
- }
-
- public void setSOAPMessage(SOAPMessage soapMessage) {
- this.soapMessage = soapMessage;
- }
-
- public void setIgnoreParseException(boolean b) {
- this.ignoreParseException = b;
- }
-
- public SOAPEnvelope build(InputStream in) throws IOException, SOAPException {
-
- try
- {
- reader = getFactoryInstance().createXMLStreamReader(in);
- }
- catch (XMLStreamException e)
- {
- throw new IOException("Failed to create stream reader:" + e.getMessage());
- }
-
- try
- {
- soapPart = (SOAPPartImpl)soapMessage.getSOAPPart();
-
- while (reader.hasNext()) {
-
- if(reader.isStartElement())
- {
- processStartElement();
- }
- else if(reader.isCharacters())
- {
- processCharacters();
- }
- else if(reader.isEndElement())
- {
- processEndElement();
- }
-
- reader.next();
- }
-
- }
- catch(XMLStreamException e)
- {
- if(!ignoreParseException)
- throw new IOException("Failed to parse stream: " + e.getMessage());
- }
- catch(SOAPException e)
- {
- e.printStackTrace();
- throw e;
- }
- finally{
- try
- {
- if(reader!=null)
- reader.close();
- }
- catch (XMLStreamException e)
- {
- // ignore
- }
- }
-
- return soapEnv;
- }
-
- private static synchronized XMLInputFactory getFactoryInstance() {
- if(null == factory)
- {
- System.setProperty("javax.xml.stream.XMLInputFactory", "com.ctc.wstx.stax.WstxInputFactory");
- //System.setProperty("javax.xml.stream.XMLInputFactory", "com.sun.xml.stream.ZephyrParserFactory");
- factory = XMLInputFactory.newInstance();
- factory.setProperty(XMLInputFactory.IS_VALIDATING, Boolean.FALSE);
- ((WstxInputFactory)factory).configureForSpeed();
- }
- return factory;
-
- }
-
- private void processCharacters() throws SOAPException {
- if(fragmentRootCursor != null)
- consumeCharacters();
- }
-
- private void consumeCharacters() throws SOAPException {
-
- String text = normalize( reader.getText() );
-
- if(!atPartMargin() && !reader.isWhiteSpace()) {
-
- fragmentBuffer.append(text);
-
- if(Part.FAULT == currentPart)
- {
- String localName = currentRootElement.getLocalPart();
- SOAPFault fault = soapEnv.getBody().getFault();
- if("faultcode".equalsIgnoreCase(localName))
- fault.setFaultCode(text);
- else if("faultactor".equalsIgnoreCase(localName))
- fault.setFaultActor(text);
- else if("faultstring".equalsIgnoreCase(localName))
- fault.setFaultString(text);
- }
- }
- }
-
- private void processEndElement() throws SOAPException {
- if(fragmentRootCursor != null)
- consumeEndElement();
- }
-
- private void consumeEndElement() throws SOAPException {
-
- QName qName = reader.getName();
-
- fragmentBuffer.append(END_ELEMENT_BRACKET);
- fragmentBuffer.append(getFQElementName(qName));
- fragmentBuffer.append(CLOSING_BRACKET);
-
- if(fragmentRootCursor != null && fragmentRootCursor.equals(qName))
- {
- flushBuffer();
- fragmentRootCursor = null;
- }
- }
-
- private void flushBuffer() throws SOAPException {
- if(Part.HEADER == currentPart)
- {
- SOAPHeader soapHeader = soapEnv.getHeader();
- SOAPContentElement lastHeaderElement = (SOAPContentElement)
- soapHeader.getChildNodes().item(
- soapHeader.getChildNodes().getLength()-1
- );
-
- lastHeaderElement.setXMLFragment(fragmentBuffer.toString());
- }
- else if(Part.BODY == currentPart)
- {
- SOAPBody soapBody = soapEnv.getBody();
- SOAPContentElement lastBodyElement = (SOAPContentElement)
- soapBody.getChildNodes().item(
- soapBody.getChildNodes().getLength()-1
- );
- lastBodyElement.setXMLFragment(fragmentBuffer.toString());
- }
- else if(Part.FAULT == currentPart)
- {
- SOAPBody soapBody = soapEnv.getBody();
- SOAPContentElement faultElement = (SOAPContentElement)soapBody.getFault();
- faultElement.setXMLFragment(fragmentBuffer.toString());
- }
-
- System.out.println(fragmentBuffer.toString());
- resetFragmentBuffer();
- }
-
- private void processStartElement() throws SOAPException{
-
- QName qName = reader.getName();
- currentRootElement = qName;
-
- // identify current envelope part
- togglePartMargin(qName);
-
- // toggle current element
- Element destElement = null;
- if(Part.ENVELOPE == currentPart)
- {
- // setup envelope impl
- soapEnv = new SOAPEnvelopeImpl(soapPart, qName.getNamespaceURI());
- namespaceRegistry = soapEnv.getNamespaceRegistry();
- destElement = soapEnv; // soapEnv becomes current
- }
- else if(Part.HEADER == currentPart)
- {
- if(atPartMargin())
- {
- // the env:Header element itself
- SOAPHeader soapHeader = soapEnv.getHeader();
- destElement = soapHeader; // header becomes current
- previousPart = Part.HEADER;
- }
- else
- {
- // child element of env:Header
- if(fragmentRootCursor == null)
- {
- Name name = new NameImpl(qName.getLocalPart(), qName.getPrefix(), qName.getNamespaceURI());
- SOAPContentElement headerElement = new SOAPHeaderElementImpl(name);
- soapEnv.getHeader().addChildElement(headerElement);
-
- destElement = headerElement; // headerElement becomes current
- fragmentRootCursor = qName;
- }
-
- consumeStartElement();
- }
- }
- else if(Part.BODY == currentPart)
- {
-
- SOAPBody soapBody = soapEnv.getBody();
-
- if(atPartMargin())
- {
- // the env:Body element
- destElement = soapBody;
- previousPart = Part.BODY;
- }
- else
- {
- // payload not fault
- Name bodyElementName = new NameImpl(qName.getLocalPart(), qName.getPrefix(), qName.getNamespaceURI());
-
- if(fragmentRootCursor == null)
- {
- SOAPBodyElementDoc docBodyElement = new SOAPBodyElementDoc(bodyElementName);
- docBodyElement = (SOAPBodyElementDoc)soapBody.addChildElement(docBodyElement);
-
- destElement = docBodyElement;
- fragmentRootCursor = qName;
- }
-
- consumeStartElement();
- }
- }
- else if (Part.FAULT == currentPart)
- {
- // payload is fault
- if(atPartMargin())
- {
- SOAPBody soapBody = soapEnv.getBody();
- SOAPFaultImpl soapFault = new SOAPFaultImpl( soapEnv.getNamespaceURI() );
- soapBody.addChildElement(soapFault);
- destElement = soapFault;
- previousPart = Part.FAULT;
- }
-
- if(fragmentRootCursor == null)
- {
- fragmentRootCursor = qName;
- }
-
- consumeStartElement();
- }
-
- if(fragmentRootCursor == null) // constructing soap elements
- {
- copyAttributes(destElement);
- registerNameSpaces(namespaceRegistry);
- }
- }
-
- private void togglePartMargin(QName qName) {
- // identify the current part
- if(qName.getLocalPart().equalsIgnoreCase(HEADER_ELEMENT_NAME))
- {
- previousPart = currentPart;
- currentPart = Part.HEADER;
- }
- else if(qName.getLocalPart().equalsIgnoreCase(BODY_ELEMENT_NAME))
- {
- previousPart = currentPart;
- currentPart = Part.BODY;
- }
- else if (qName.getLocalPart().equalsIgnoreCase(FAULT_ELEMENT_NAME))
- {
- previousPart = currentPart;
- currentPart = Part.FAULT;
- }
- }
-
- private void consumeStartElement() {
-
- QName qName = reader.getName();
-
- // element
- fragmentBuffer.append(START_ELEMENT_BRACKET);
- fragmentBuffer.append( getFQElementName(qName) );
-
- // local namespaces
- for(int x=0; x<reader.getNamespaceCount();x++)
- {
- if(reader.getNamespacePrefix(x)!=null)
- {
- fragmentBuffer.append(" xmlns:");
- fragmentBuffer.append(reader.getNamespacePrefix(x)).append("='");
- fragmentBuffer.append(reader.getNamespaceURI(x)).append("'");
- }
- else if(reader.getNamespaceURI(x)!=null)
- {
- fragmentBuffer.append(" xmlns='");
- fragmentBuffer.append(reader.getNamespaceURI(x)).append("'");
- }
- }
-
- // attributes
- if(reader.getAttributeCount()>0)
- {
- for(int i=0; i<reader.getAttributeCount(); i++)
- {
- QName attQName = reader.getAttributeName(i);
- fragmentBuffer.append(" ").append( getFQElementName(attQName) );
- fragmentBuffer.append("='").append(reader.getAttributeValue(i)).append("'");
- }
- }
-
- fragmentBuffer.append(CLOSING_BRACKET);
- }
-
- private String getFQElementName(QName qName) {
- return !qName.getPrefix().equals(EMPTY_STRING) ? qName.getPrefix()+":"+qName.getLocalPart() : qName.getLocalPart();
- }
-
- private void registerNameSpaces(NamespaceRegistry reg) {
-
- for(int i=0; i<reader.getNamespaceCount(); i++)
- {
- String prefix = reader.getNamespacePrefix(i);
- String uri = reader.getNamespaceURI(i);
- reg.registerURI(uri,prefix);
-
- soapEnv.addNamespaceDeclaration(prefix, uri);
- }
- }
-
- private void copyAttributes(Element destElement) {
-
- if(reader.getAttributeCount()==0)
- return;
-
- for(int i=0; i<reader.getAttributeCount(); i++)
- {
- destElement.setAttributeNS(
- reader.getAttributeNamespace(i),
- reader.getAttributeLocalName(i),
- reader.getAttributeValue(i)
- );
- }
- }
-
- private boolean atPartMargin() {
- return previousPart !=currentPart;
- }
-
- private static 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();
- }
-}
Deleted: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/transport/jms/JMSMessageDispatcher.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/transport/jms/JMSMessageDispatcher.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/transport/jms/JMSMessageDispatcher.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -1,107 +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.transport.jms;
-
-// $Id: JMSMessageDispatcher.java 356 2006-05-16 17:26:40Z thomas.diesler at jboss.com $
-
-import java.io.InputStream;
-import java.rmi.RemoteException;
-
-import javax.management.ObjectName;
-import javax.xml.soap.SOAPMessage;
-
-import org.jboss.logging.Logger;
-import org.jboss.util.NotImplementedException;
-import org.jboss.webservice.transport.jms.MessageDispatcher;
-import org.jboss.ws.WSException;
-import org.jboss.ws.binding.BindingException;
-import org.jboss.ws.integration.jboss.ServiceEndpointInvokerMDB;
-import org.jboss.ws.server.ServiceEndpoint;
-import org.jboss.ws.server.ServiceEndpointInvoker;
-import org.jboss.ws.server.ServiceEndpointManager;
-import org.jboss.ws.server.ServiceEndpointManagerFactory;
-
-/**
- * A dispatcher for SOAPMessages
- *
- * @author Thomas.Diesler at jboss.org
- */
-public class JMSMessageDispatcher implements MessageDispatcher
-{
- // logging support
- protected Logger log = Logger.getLogger(JMSMessageDispatcher.class);
-
- /** Dispatch the message to the underlying SOAP engine
- */
- public SOAPMessage dipatchMessage(String fromName, Object targetBean, InputStream reqMessage) throws RemoteException
- {
- try
- {
- ServiceEndpointManagerFactory factory = ServiceEndpointManagerFactory.getInstance();
- ServiceEndpointManager epManager = factory.getServiceEndpointManager();
- ObjectName sepID = getServiceEndpointForDestination(epManager, fromName);
-
- if (sepID == null)
- throw new WSException("Cannot find serviceID for: " + fromName);
-
- log.debug("dipatchMessage: " + sepID);
-
- // Setup the MDB invoker
- ServiceEndpoint sep = epManager.getServiceEndpointByID(sepID);
- ServiceEndpointInvoker invoker = sep.getServiceEndpointInfo().getInvoker();
- if (invoker instanceof ServiceEndpointInvokerMDB)
- {
- ServiceEndpointInvokerMDB mdbInvoker = (ServiceEndpointInvokerMDB)invoker;
- mdbInvoker.setTargetBeanObject(targetBean);
- }
-
- return sep.handleRequest(null, null, reqMessage);
- }
- catch (BindingException ex)
- {
- throw new WSException("Cannot bind incomming soap message", ex);
- }
- }
-
- /** Dispatch the message to the underlying SOAP engine
- */
- public SOAPMessage delegateMessage(String serviceID, InputStream soapMessage) throws RemoteException
- {
- throw new NotImplementedException();
- }
-
- // The destination jndiName is encoded in the service object name under key 'jms'
- private ObjectName getServiceEndpointForDestination(ServiceEndpointManager epManager, String fromName)
- {
- ObjectName sepID = null;
- for (ObjectName aux : epManager.getServiceEndpoints())
- {
- String jmsProp = aux.getKeyProperty("jms");
- if (jmsProp != null && jmsProp.equals(fromName))
- {
- sepID = aux;
- break;
- }
- }
- return sepID;
- }
-}
Deleted: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/wsse/WSSecurityHandler.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/wsse/WSSecurityHandler.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/wsse/WSSecurityHandler.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -1,128 +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.wsse;
-
-// $Id$
-
-import javax.xml.namespace.QName;
-import javax.xml.rpc.handler.GenericHandler;
-import javax.xml.rpc.handler.MessageContext;
-import javax.xml.rpc.soap.SOAPFaultException;
-import javax.xml.soap.SOAPException;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.metadata.EndpointMetaData;
-import org.jboss.ws.metadata.wsse.WSSecurityConfiguration;
-import org.jboss.ws.soap.SOAPMessageContextImpl;
-
-/**
- * An abstract JAXRPC handler that delegates to the WSSecurityDispatcher
- *
- * @author Thomas.Diesler at jboss.org
- * @since 12-Nov-2005
- */
-public abstract class WSSecurityHandler extends GenericHandler
-{
- protected static String FAULT_THROWN = "org.jboss.ws.wsse.faultThrown";
-
- // provide logging
- private static Logger log = Logger.getLogger(WSSecurityHandler.class);
-
- public QName[] getHeaders()
- {
- return null;
- }
-
- protected boolean thrownByMe(MessageContext msgContext)
- {
- Boolean bool = (Boolean) msgContext.getProperty(FAULT_THROWN);
- return bool != null && bool.booleanValue();
- }
-
- protected boolean handleInboundSecurity(MessageContext msgContext)
- {
- Exception exception = null;
- try
- {
- if (getSecurityConfiguration(msgContext) != null)
- {
- WSSecurityDispatcher.handleInbound((SOAPMessageContextImpl)msgContext);
- }
- }
- catch (Exception ex)
- {
- exception = ex;
- }
-
- if (exception != null)
- {
- msgContext.setProperty(FAULT_THROWN, true);
- if (exception instanceof SOAPFaultException)
- throw (SOAPFaultException)exception;
-
- // Unexpected exception, log it
- log.error("Cannot handle inbound ws-security", exception);
- return false;
- }
-
- return true;
- }
-
- protected boolean handleOutboundSecurity(MessageContext msgContext)
- {
- Exception exception = null;
- try
- {
- if (getSecurityConfiguration(msgContext) != null)
- {
- WSSecurityDispatcher.handleOutbound((SOAPMessageContextImpl)msgContext);
- }
- }
- catch (Exception ex)
- {
- exception = ex;
- }
-
- if (exception != null)
- {
- msgContext.setProperty(FAULT_THROWN, true);
- if (exception instanceof SOAPFaultException)
- throw (SOAPFaultException)exception;
-
- // Unexpected exception, log it
- log.error("Cannot handle outbound ws-security", exception);
- return false;
- }
-
- return true;
- }
-
- private WSSecurityConfiguration getSecurityConfiguration(MessageContext msgContext)
- {
- EndpointMetaData epMetaData = ((SOAPMessageContextImpl)msgContext).getEndpointMetaData();
- WSSecurityConfiguration securityConfiguration = epMetaData.getServiceMetaData().getSecurityConfiguration();
- if (securityConfiguration == null)
- log.warn("Cannot obtain security configuration");
-
- return securityConfiguration;
- }
-}
\ No newline at end of file
Deleted: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/wsse/WSSecurityHandlerInbound.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/wsse/WSSecurityHandlerInbound.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/wsse/WSSecurityHandlerInbound.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -1,61 +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.wsse;
-
-// $Id$
-
-import javax.xml.rpc.handler.MessageContext;
-import javax.xml.rpc.handler.soap.SOAPMessageContext;
-
-import org.jboss.ws.soap.SOAPMessageImpl;
-
-/**
- * A JAXRPC handler that delegates to the WSSecurityDispatcher
- * where the request is an inbound message.
- *
- * @author Thomas.Diesler at jboss.org
- * @since 12-Nov-2005
- */
-public class WSSecurityHandlerInbound extends WSSecurityHandler
-{
- public boolean handleRequest(MessageContext msgContext)
- {
- return handleInboundSecurity(msgContext);
- }
-
- public boolean handleResponse(MessageContext msgContext)
- {
- return handleOutboundSecurity(msgContext);
- }
-
- public boolean handleFault(MessageContext msgContext)
- {
- // Skip any WS-Security Faults
- if (thrownByMe(msgContext))
- return true;
-
- // Mark the message as a fault, in case it ends up being encrypted
- ((SOAPMessageImpl)((SOAPMessageContext)msgContext).getMessage()).setFaultMessage(true);
-
- return handleOutboundSecurity(msgContext);
- }
-}
\ No newline at end of file
Deleted: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/wsse/WSSecurityHandlerOutbound.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/wsse/WSSecurityHandlerOutbound.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/wsse/WSSecurityHandlerOutbound.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -1,60 +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.wsse;
-
-// $Id$
-
-import javax.xml.rpc.handler.MessageContext;
-
-/**
- * A JAXRPC handler that delegates to the WSSecurityDispatcher
- *
- * @author Thomas.Diesler at jboss.org
- * @since 12-Nov-2005
- */
-public class WSSecurityHandlerOutbound extends WSSecurityHandler
-{
- public boolean handleRequest(MessageContext msgContext)
- {
- return handleOutboundSecurity(msgContext);
- }
-
- public boolean handleResponse(MessageContext msgContext)
- {
- return handleInboundSecurity(msgContext);
- }
-
- /* Their is a potential problem that can't be avoided using the JAX-RPC handler framework.
- * If a request handler (outbound for the client) throws an exception, this will get called,
- * but it will be incorrectly treated as an inbound message.
- *
- * This is intended to be called when the response message from the server (inbound)
- * is a fault message.
- */
- public boolean handleFault(MessageContext msgContext)
- {
- if (thrownByMe(msgContext))
- return true;
-
- return handleInboundSecurity(msgContext);
- }
-}
Added: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/wsse/jaxrpc/WSSecurityHandler.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/wsse/jaxrpc/WSSecurityHandler.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/wsse/jaxrpc/WSSecurityHandler.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -0,0 +1,96 @@
+/*
+* 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.wsse.jaxrpc;
+
+// $Id$
+
+import javax.xml.namespace.QName;
+import javax.xml.rpc.handler.GenericHandler;
+import javax.xml.rpc.handler.MessageContext;
+import javax.xml.soap.SOAPException;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.jaxrpc.handler.SOAPMessageContextJAXRPC;
+import org.jboss.ws.metadata.EndpointMetaData;
+import org.jboss.ws.metadata.wsse.WSSecurityConfiguration;
+import org.jboss.ws.wsse.WSSecurityDispatcher;
+
+/**
+ * An abstract JAXRPC handler that delegates to the WSSecurityDispatcher
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 12-Nov-2005
+ */
+public abstract class WSSecurityHandler extends GenericHandler
+{
+ // provide logging
+ private static Logger log = Logger.getLogger(WSSecurityHandler.class);
+
+ public QName[] getHeaders()
+ {
+ return null;
+ }
+
+ protected boolean handleInboundSecurity(MessageContext msgContext)
+ {
+ try
+ {
+ if (getSecurityConfiguration(msgContext) != null)
+ {
+ WSSecurityDispatcher.handleInbound((SOAPMessageContextJAXRPC)msgContext);
+ }
+ }
+ catch (SOAPException ex)
+ {
+ log.error("Cannot handle inbound ws-security", ex);
+ return false;
+ }
+ return true;
+ }
+
+ protected boolean handleOutboundSecurity(MessageContext msgContext)
+ {
+ try
+ {
+ if (getSecurityConfiguration(msgContext) != null)
+ {
+ WSSecurityDispatcher.handleOutbound((SOAPMessageContextJAXRPC)msgContext);
+ }
+ }
+ catch (SOAPException ex)
+ {
+ log.error("Cannot handle outbound ws-security", ex);
+ return false;
+ }
+ return true;
+ }
+
+ private WSSecurityConfiguration getSecurityConfiguration(MessageContext msgContext)
+ {
+ EndpointMetaData epMetaData = ((SOAPMessageContextJAXRPC)msgContext).getEndpointMetaData();
+ WSSecurityConfiguration securityConfiguration = epMetaData.getServiceMetaData().getSecurityConfiguration();
+ if (securityConfiguration == null)
+ log.warn("Cannot obtain security configuration");
+
+ return securityConfiguration;
+ }
+}
Property changes on: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/wsse/jaxrpc/WSSecurityHandler.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/wsse/jaxrpc/WSSecurityHandlerInbound.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/wsse/jaxrpc/WSSecurityHandlerInbound.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/wsse/jaxrpc/WSSecurityHandlerInbound.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -0,0 +1,47 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ws.wsse.jaxrpc;
+
+// $Id$
+
+import javax.xml.rpc.handler.MessageContext;
+
+
+/**
+ * A JAXRPC handler that delegates to the WSSecurityDispatcher
+ * where the request is an inbound message.
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 12-Nov-2005
+ */
+public class WSSecurityHandlerInbound extends WSSecurityHandler
+{
+ public boolean handleRequest(MessageContext msgContext)
+ {
+ return handleInboundSecurity(msgContext);
+ }
+
+ public boolean handleResponse(MessageContext msgContext)
+ {
+ return handleOutboundSecurity(msgContext);
+ }
+}
Property changes on: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/wsse/jaxrpc/WSSecurityHandlerInbound.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/wsse/jaxrpc/WSSecurityHandlerOutbound.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/wsse/jaxrpc/WSSecurityHandlerOutbound.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/wsse/jaxrpc/WSSecurityHandlerOutbound.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -0,0 +1,46 @@
+/*
+ * 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.wsse.jaxrpc;
+
+// $Id$
+
+import javax.xml.rpc.handler.MessageContext;
+
+
+/**
+ * A JAXRPC handler that delegates to the WSSecurityDispatcher
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 12-Nov-2005
+ */
+public class WSSecurityHandlerOutbound extends WSSecurityHandler
+{
+ public boolean handleRequest(MessageContext msgContext)
+ {
+ return handleOutboundSecurity(msgContext);
+ }
+
+ public boolean handleResponse(MessageContext msgContext)
+ {
+ return handleInboundSecurity(msgContext);
+ }
+}
Property changes on: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/wsse/jaxrpc/WSSecurityHandlerOutbound.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/tdiesler/jbossws-1.0/src/main/resources/jbossws.sar/META-INF/standard-jaxrpc-client-config.xml
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/resources/jbossws.sar/META-INF/standard-jaxrpc-client-config.xml 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/resources/jbossws.sar/META-INF/standard-jaxrpc-client-config.xml 2006-09-07 09:49:54 UTC (rev 910)
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- $Id$ -->
+
+<jaxrpc-config xmlns="urn:jboss:jaxrpc-config:2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:j2ee="http://java.sun.com/xml/ns/j2ee"
+ xsi:schemaLocation="urn:jboss:jaxrpc-config:2.0 jaxrpc-config_2_0.xsd">
+
+ <client-config>
+ <config-name>Standard Client</config-name>
+ </client-config>
+
+ <client-config>
+ <config-name>Standard WSAddressing Client</config-name>
+ <post-handler-chain>
+ <handler-chain-name>WSAddressing Handlers</handler-chain-name>
+ <handler>
+ <j2ee:handler-name>WSAddressingClientHandler</j2ee:handler-name>
+ <j2ee:handler-class>org.jboss.ws.addressing.jaxrpc.WSAddressingClientHandler</j2ee:handler-class>
+ </handler>
+ </post-handler-chain>
+ </client-config>
+
+ <client-config>
+ <config-name>Standard WSSecurity Client</config-name>
+ <post-handler-chain>
+ <handler-chain-name>WSSecurity Handlers</handler-chain-name>
+ <handler>
+ <j2ee:handler-name>WSSecurityHandlerOutbound</j2ee:handler-name>
+ <j2ee:handler-class>org.jboss.ws.wsse.jaxrpc.WSSecurityHandlerOutbound</j2ee:handler-class>
+ </handler>
+ </post-handler-chain>
+ </client-config>
+
+</jaxrpc-config>
\ No newline at end of file
Property changes on: branches/tdiesler/jbossws-1.0/src/main/resources/jbossws.sar/META-INF/standard-jaxrpc-client-config.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/tdiesler/jbossws-1.0/src/main/resources/jbossws.sar/META-INF/standard-jaxrpc-endpoint-config.xml
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/resources/jbossws.sar/META-INF/standard-jaxrpc-endpoint-config.xml 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/resources/jbossws.sar/META-INF/standard-jaxrpc-endpoint-config.xml 2006-09-07 09:49:54 UTC (rev 910)
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- $Id$ -->
+
+<jaxrpc-config xmlns="urn:jboss:jaxrpc-config:2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:j2ee="http://java.sun.com/xml/ns/j2ee"
+ xsi:schemaLocation="urn:jboss:jaxrpc-config:2.0 jaxrpc-config_2_0.xsd">
+
+ <endpoint-config>
+ <config-name>Standard Endpoint</config-name>
+ </endpoint-config>
+
+ <endpoint-config>
+ <config-name>Standard WSAddressing Endpoint</config-name>
+ <pre-handler-chain>
+ <handler-chain-name>WSAddressing Handlers</handler-chain-name>
+ <handler>
+ <j2ee:handler-name>WSAddressing Handler</j2ee:handler-name>
+ <j2ee:handler-class>org.jboss.ws.addressing.jaxrpc.WSAddressingServerHandler</j2ee:handler-class>
+ </handler>
+ </pre-handler-chain>
+ </endpoint-config>
+
+ <endpoint-config>
+ <config-name>Standard WSSecurity Endpoint</config-name>
+ <pre-handler-chain>
+ <handler-chain-name>WSSecurity Handlers</handler-chain-name>
+ <handler>
+ <j2ee:handler-name>WSSecurityHandlerInbound</j2ee:handler-name>
+ <j2ee:handler-class>org.jboss.ws.wsse.jaxrpc.WSSecurityHandlerInbound</j2ee:handler-class>
+ </handler>
+ </pre-handler-chain>
+ </endpoint-config>
+
+</jaxrpc-config>
\ No newline at end of file
Property changes on: branches/tdiesler/jbossws-1.0/src/main/resources/jbossws.sar/META-INF/standard-jaxrpc-endpoint-config.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Deleted: branches/tdiesler/jbossws-1.0/src/main/resources/jbossws.sar/META-INF/standard-jbossws-client-config.xml
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/resources/jbossws.sar/META-INF/standard-jbossws-client-config.xml 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/resources/jbossws.sar/META-INF/standard-jbossws-client-config.xml 2006-09-07 09:49:54 UTC (rev 910)
@@ -1,36 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!-- $Id$ -->
-
-<jbossws-config xmlns="urn:jboss:jbossws-config:5.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:j2ee="http://java.sun.com/xml/ns/j2ee"
- xsi:schemaLocation="urn:jboss:jbossws-config:5.0 http://www.jboss.com/xml/jbossws-config_1_0.xsd">
-
- <client-config>
- <config-name>Standard Client</config-name>
- </client-config>
-
- <client-config>
- <config-name>Standard Secure Client</config-name>
- <post-handler-chain>
- <handler-chain-name>PostHandlerChain</handler-chain-name>
- <handler>
- <j2ee:handler-name>WSSecurityHandlerOutbound</j2ee:handler-name>
- <j2ee:handler-class>org.jboss.ws.wsse.WSSecurityHandlerOutbound</j2ee:handler-class>
- </handler>
- </post-handler-chain>
- </client-config>
-
- <client-config>
- <config-name>Standard Addressing Client</config-name>
- <post-handler-chain>
- <handler-chain-name>PostHandlerChain</handler-chain-name>
- <handler>
- <j2ee:handler-name>SOAPClientHandler</j2ee:handler-name>
- <j2ee:handler-class>org.jboss.ws.addressing.soap.SOAPClientHandler</j2ee:handler-class>
- </handler>
- </post-handler-chain>
- </client-config>
-
-</jbossws-config>
\ No newline at end of file
Deleted: branches/tdiesler/jbossws-1.0/src/main/resources/jbossws.sar/META-INF/standard-jbossws-endpoint-config.xml
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/resources/jbossws.sar/META-INF/standard-jbossws-endpoint-config.xml 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/resources/jbossws.sar/META-INF/standard-jbossws-endpoint-config.xml 2006-09-07 09:49:54 UTC (rev 910)
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!-- $Id$ -->
-
-<jbossws-config xmlns="urn:jboss:jbossws-config:5.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:j2ee="http://java.sun.com/xml/ns/j2ee"
- xsi:schemaLocation="urn:jboss:jbossws-config:5.0 http://www.jboss.com/xml/jbossws-config_1_0.xsd">
-
- <endpoint-config>
- <config-name>Standard Endpoint</config-name>
- </endpoint-config>
-
- <endpoint-config>
- <config-name>Standard Secure Endpoint</config-name>
- <pre-handler-chain>
- <handler-chain-name>PreHandlerChain</handler-chain-name>
- <handler>
- <j2ee:handler-name>WSSecurityHandlerInbound</j2ee:handler-name>
- <j2ee:handler-class>org.jboss.ws.wsse.WSSecurityHandlerInbound</j2ee:handler-class>
- </handler>
- </pre-handler-chain>
- </endpoint-config>
-
-</jbossws-config>
\ No newline at end of file
Added: branches/tdiesler/jbossws-1.0/src/main/resources/schema/handler-chain.xsd
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/resources/schema/handler-chain.xsd 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/resources/schema/handler-chain.xsd 2006-09-07 09:49:54 UTC (rev 910)
@@ -0,0 +1,252 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsd:schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://java.sun.com/xml/ns/javaee"
+ xmlns:javaee="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ elementFormDefault="qualified"
+ attributeFormDefault="unqualified"
+ version="1.0">
+
+ <xsd:include schemaLocation="javaee_5.xsd"/>
+
+<!-- **************************************************** -->
+
+ <xsd:element name="handler-chains" type="javaee:handler-chainsType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The handler-chains element is the root element for defining handlerchains.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="handler-chainsType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The handler-chains element defines the handlerchains associated with this
+ service or service endpoint.
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:sequence>
+ <xsd:element name="handler-chain"
+ type="javaee:handler-chainType"
+ minOccurs="1" maxOccurs="unbounded"/>
+ </xsd:sequence>
+
+ <xsd:attribute name="id" type="xsd:ID"/>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="handler-chainType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The handler-chain element defines the handlerchain.
+ Handlerchain can be defined such that the handlers in the
+ handlerchain operate,all ports of a service, on a specific
+ port or on a list of protocol-bindings. The choice of elements
+ service-name-pattern, port-name-pattern and protocol-bindings
+ are used to specify whether the handlers in handler-chain are
+ for a service, port or protocol binding. If none of these
+ choices are specified with the handler-chain element then the
+ handlers specified in the handler-chain will be applied on
+ everything.
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:sequence>
+
+ <xsd:choice minOccurs="0" maxOccurs="1">
+ <xsd:element name="service-name-pattern"
+ type="javaee:qname-pattern" />
+ <xsd:element name="port-name-pattern"
+ type="javaee:qname-pattern" />
+ <xsd:element name="protocol-bindings"
+ type="javaee:protocol-bindingListType"/>
+ </xsd:choice>
+
+ <xsd:element name="handler"
+ type="javaee:handlerType"
+ minOccurs="1" maxOccurs="unbounded"/>
+ </xsd:sequence>
+
+ <xsd:attribute name="id" type="xsd:ID"/>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:simpleType name="protocol-URIAliasType">
+ <xsd:annotation>
+ <xsd:documentation>
+ Defines the type that is used for specifying tokens that
+ start with ## which are used to alias existing standard
+ protocol bindings and support aliases for new standard
+ binding URIs that are introduced in future specifications.
+
+ The following tokens alias the standard protocol binding
+ URIs:
+
+ ##SOAP11_HTTP = "http://schemas.xmlsoap.org/wsdl/soap/http"
+ ##SOAP12_HTTP = "http://www.w3.org/2003/05/soap/bindings/HTTP/"
+ ##XML_HTTP = "http://www.w3.org/2004/08/wsdl/http"
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:restriction base="xsd:token">
+ <xsd:pattern value="##.+"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+
+<!-- **************************************************** -->
+
+ <xsd:simpleType name="protocol-bindingListType">
+ <xsd:annotation>
+ <xsd:documentation>
+ Defines the type used for specifying a list of
+ protocol-bindingType(s). For e.g.
+
+ ##SOAP11_HTTP ##SOAP12_HTTP ##XML_HTTP
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:list itemType="javaee:protocol-bindingType"/>
+ </xsd:simpleType>
+
+<!-- **************************************************** -->
+
+ <xsd:simpleType name="protocol-bindingType">
+ <xsd:annotation>
+ <xsd:documentation>
+ Defines the type used for specifying the URI for the
+ protocol binding used by the port-component. For
+ portability one could use one of the following tokens that
+ alias the standard binding types:
+
+ ##SOAP11_HTTP
+ ##SOAP12_HTTP
+ ##XML_HTTP
+
+ Other specifications could define tokens that start with ##
+ to alias new standard binding URIs that are introduced.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:union memberTypes="xsd:anyURI javaee:protocol-URIAliasType"/>
+ </xsd:simpleType>
+
+<!-- **************************************************** -->
+
+ <xsd:simpleType name="qname-pattern">
+ <xsd:annotation>
+ <xsd:documentation>
+ This is used to specify the QName pattern in the
+ attribute service-name-pattern and port-name-pattern in
+ the handler-chain element
+
+ For example, the various forms acceptable here for
+ service-name-pattern attribute in handler-chain element
+ are :
+
+ Exact Name: service-name-pattern="ns1:EchoService"
+
+ In this case, handlers specified in this
+ handler-chain element will apply to all ports with
+ this exact service name. The namespace prefix must
+ have been declared in a namespace declaration
+ attribute in either the start-tag of the element
+ where the prefix is used or in an an ancestor
+ element (i.e. an element in whose content the
+ prefixed markup occurs)
+
+ Pattern : service-name-pattern="ns1:EchoService*"
+
+ In this case, handlers specified in this
+ handler-chain element will apply to all ports whose
+ Service names are like EchoService1, EchoServiceFoo
+ etc. The namespace prefix must have been declared in
+ a namespace declaration attribute in either the
+ start-tag of the element where the prefix is used or
+ in an an ancestor element (i.e. an element in whose
+ content the prefixed markup occurs)
+
+ Wild Card : service-name-pattern="*"
+
+ In this case, handlers specified in this handler-chain
+ element will apply to ports of all service names.
+
+ The same can be applied to port-name attribute in
+ handler-chain element.
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:restriction base="xsd:token">
+ <xsd:pattern value="\*|([\i-[:]][\c-[:]]*:)?[\i-[:]][\c-[:]]*\*?"/>
+ </xsd:restriction>
+
+ </xsd:simpleType>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="handlerType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ Declares the handler. Handlers can access the
+ init-param name/value pairs using the HandlerInfo interface.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:group ref="javaee:descriptionGroup"/>
+ <xsd:element name="handler-name"
+ type="javaee:string">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ Defines the name of the handler.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="handler-class"
+ type="javaee:fully-qualified-classType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ Defines a fully qualified class name for the handler implementation.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="init-param"
+ type="javaee:param-valueType"
+ minOccurs="0" maxOccurs="unbounded"/>
+
+ <xsd:element name="soap-role"
+ type="javaee:string"
+ minOccurs="0" maxOccurs="unbounded">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The soap-role element contains a SOAP actor definition that the
+ Handler will play as a role.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ </xsd:sequence>
+ <xsd:attribute name="id" type="xsd:ID"/>
+ </xsd:complexType>
+
+</xsd:schema>
+
Property changes on: branches/tdiesler/jbossws-1.0/src/main/resources/schema/handler-chain.xsd
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Deleted: branches/tdiesler/jbossws-1.0/src/main/resources/schema/handler-config_1_0.xsd
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/resources/schema/handler-config_1_0.xsd 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/resources/schema/handler-config_1_0.xsd 2006-09-07 09:49:54 UTC (rev 910)
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<xsd:schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.bea.com/xml/ns/jws" xmlns:jws="http://www.bea.com/xml/ns/jws"
- xmlns:j2ee="http://java.sun.com/xml/ns/j2ee" xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified" version="1.1">
-
- <xsd:annotation>
- <xsd:documentation>
- <![CDATA[
- This is the schema definition for the handler chain configuration
- file used by JSR-181. It relies on the handler definitions that
- are part of the standard J2EE deployment descriptors.
- ]]>
- </xsd:documentation>
- </xsd:annotation>
-
- <xsd:include schemaLocation="j2ee_1_4.xsd"/>
- <xsd:include schemaLocation="j2ee_web_services_1_1.xsd"/>
-
- <xsd:complexType name="handler-chainType">
- <xsd:sequence>
- <xsd:element name="handler-chain-name" type="j2ee:string"/>
- <xsd:element name="handler" type="j2ee:port-component_handlerType" minOccurs="0" maxOccurs="unbounded"/>
- </xsd:sequence>
- </xsd:complexType>
-
- <xsd:complexType name="handler-configType">
- <xsd:sequence>
- <xsd:element name="handler-chain" type="jws:handler-chainType" minOccurs="1" maxOccurs="unbounded"/>
- </xsd:sequence>
- </xsd:complexType>
-
- <xsd:element name="handler-config" type="jws:handler-configType"/>
-
-</xsd:schema>
\ No newline at end of file
Added: branches/tdiesler/jbossws-1.0/src/main/resources/schema/javaee_5.xsd
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/resources/schema/javaee_5.xsd 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/resources/schema/javaee_5.xsd 2006-09-07 09:49:54 UTC (rev 910)
@@ -0,0 +1,2095 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsd:schema
+ targetNamespace="http://java.sun.com/xml/ns/javaee"
+ xmlns:javaee="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ elementFormDefault="qualified"
+ attributeFormDefault="unqualified"
+ version="5">
+ <xsd:annotation>
+ <xsd:documentation>
+ @(#)javaee_5.xsds 1.65 06/02/17
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:annotation>
+ <xsd:documentation>
+
+ Copyright 2003-2006 Sun Microsystems, Inc.
+ 4150 Network Circle
+ Santa Clara, California 95054
+ U.S.A
+ All rights reserved.
+
+ Sun Microsystems, Inc. has intellectual property rights
+ relating to technology described in this document. In
+ particular, and without limitation, these intellectual
+ property rights may include one or more of the U.S. patents
+ listed at http://www.sun.com/patents and one or more
+ additional patents or pending patent applications in the
+ U.S. and other countries.
+
+ This document and the technology which it describes are
+ distributed under licenses restricting their use, copying,
+ distribution, and decompilation. No part of this document
+ may be reproduced in any form by any means without prior
+ written authorization of Sun and its licensors, if any.
+
+ Third-party software, including font technology, is
+ copyrighted and licensed from Sun suppliers.
+
+ Sun, Sun Microsystems, the Sun logo, Solaris, Java, J2EE,
+ JavaServer Pages, Enterprise JavaBeans and the Java Coffee
+ Cup logo are trademarks or registered trademarks of Sun
+ Microsystems, Inc. in the U.S. and other countries.
+
+ Federal Acquisitions: Commercial Software - Government Users
+ Subject to Standard License Terms and Conditions.
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+<xsd:annotation>
+<xsd:documentation>
+
+The following definitions that appear in the common
+shareable schema(s) of J2EE deployment descriptors should be
+interpreted with respect to the context they are included:
+
+Deployment Component may indicate one of the following:
+ j2ee application;
+ application client;
+ web application;
+ enterprise bean;
+ resource adapter;
+
+Deployment File may indicate one of the following:
+ ear file;
+ war file;
+ jar file;
+ rar file;
+
+</xsd:documentation>
+</xsd:annotation>
+
+ <xsd:import namespace="http://www.w3.org/XML/1998/namespace"
+ schemaLocation="http://www.w3.org/2001/xml.xsd"/>
+
+ <xsd:include schemaLocation="javaee_web_services_client_1_2.xsd"/>
+
+
+<!-- **************************************************** -->
+
+ <xsd:group name="descriptionGroup">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ This group keeps the usage of the contained description related
+ elements consistent across Java EE deployment descriptors.
+
+ All elements may occur multiple times with different languages,
+ to support localization of the content.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="description"
+ type="javaee:descriptionType"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ <xsd:element name="display-name"
+ type="javaee:display-nameType"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ <xsd:element name="icon"
+ type="javaee:iconType"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ </xsd:sequence>
+ </xsd:group>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="descriptionType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The description type is used by a description element to
+ provide text describing the parent element. The elements
+ that use this type should include any information that the
+ Deployment Component's Deployment File file producer wants
+ to provide to the consumer of the Deployment Component's
+ Deployment File (i.e., to the Deployer). Typically, the
+ tools used by such a Deployment File consumer will display
+ the description when processing the parent element that
+ contains the description.
+
+ The lang attribute defines the language that the
+ description is provided in. The default value is "en" (English).
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:extension base="javaee:xsdStringType">
+ <xsd:attribute ref="xml:lang"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:simpleType name="dewey-versionType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ This type defines a dewey decimal that is used
+ to describe versions of documents.
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:restriction base="xsd:token">
+ <xsd:pattern value="\.?[0-9]+(\.[0-9]+)*"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="display-nameType">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+
+ The display-name type contains a short name that is intended
+ to be displayed by tools. It is used by display-name
+ elements. The display name need not be unique.
+
+ Example:
+
+ ...
+ <display-name xml:lang="en">
+ Employee Self Service
+ </display-name>
+
+ The value of the xml:lang attribute is "en" (English) by default.
+
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:extension base="javaee:string">
+ <xsd:attribute ref="xml:lang"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="ejb-linkType">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+
+ The ejb-linkType is used by ejb-link
+ elements in the ejb-ref or ejb-local-ref elements to specify
+ that an EJB reference is linked to enterprise bean.
+
+ The value of the ejb-link element must be the ejb-name of an
+ enterprise bean in the same ejb-jar file or in another ejb-jar
+ file in the same Java EE application unit.
+
+ Alternatively, the name in the ejb-link element may be
+ composed of a path name specifying the ejb-jar containing the
+ referenced enterprise bean with the ejb-name of the target
+ bean appended and separated from the path name by "#". The
+ path name is relative to the Deployment File containing
+ Deployment Component that is referencing the enterprise
+ bean. This allows multiple enterprise beans with the same
+ ejb-name to be uniquely identified.
+
+ Examples:
+
+ <ejb-link>EmployeeRecord</ejb-link>
+
+ <ejb-link>../products/product.jar#ProductEJB</ejb-link>
+
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:restriction base="javaee:string"/>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="ejb-local-refType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The ejb-local-refType is used by ejb-local-ref elements for
+ the declaration of a reference to an enterprise bean's local
+ home or to the local business interface of a 3.0 bean.
+ The declaration consists of:
+
+ - an optional description
+ - the EJB reference name used in the code of the Deployment
+ Component that's referencing the enterprise bean.
+ - the optional expected type of the referenced enterprise bean
+ - the optional expected local interface of the referenced
+ enterprise bean or the local business interface of the
+ referenced enterprise bean.
+ - the optional expected local home interface of the referenced
+ enterprise bean. Not applicable if this ejb-local-ref refers
+ to the local business interface of a 3.0 bean.
+ - optional ejb-link information, used to specify the
+ referenced enterprise bean
+ - optional elements to define injection of the named enterprise
+ bean into a component field or property.
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:sequence>
+ <xsd:element name="description"
+ type="javaee:descriptionType"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ <xsd:element name="ejb-ref-name"
+ type="javaee:ejb-ref-nameType"/>
+ <xsd:element name="ejb-ref-type"
+ type="javaee:ejb-ref-typeType"
+ minOccurs="0"/>
+ <xsd:element name="local-home"
+ type="javaee:local-homeType"
+ minOccurs="0"/>
+ <xsd:element name="local"
+ type="javaee:localType"
+ minOccurs="0"/>
+ <xsd:element name="ejb-link"
+ type="javaee:ejb-linkType"
+ minOccurs="0"/>
+ <xsd:group ref="javaee:resourceGroup"/>
+ </xsd:sequence>
+ <xsd:attribute name="id" type="xsd:ID"/>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="ejb-ref-nameType">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+
+ The ejb-ref-name element contains the name of an EJB
+ reference. The EJB reference is an entry in the
+ Deployment Component's environment and is relative to the
+ java:comp/env context. The name must be unique within the
+ Deployment Component.
+
+ It is recommended that name is prefixed with "ejb/".
+
+ Example:
+
+ <ejb-ref-name>ejb/Payroll</ejb-ref-name>
+
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:restriction base="javaee:jndi-nameType"/>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="ejb-ref-typeType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The ejb-ref-typeType contains the expected type of the
+ referenced enterprise bean.
+
+ The ejb-ref-type designates a value
+ that must be one of the following:
+
+ Entity
+ Session
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:restriction base="javaee:string">
+ <xsd:enumeration value="Entity"/>
+ <xsd:enumeration value="Session"/>
+ </xsd:restriction>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="ejb-refType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The ejb-refType is used by ejb-ref elements for the
+ declaration of a reference to an enterprise bean's home or
+ to the remote business interface of a 3.0 bean.
+ The declaration consists of:
+
+ - an optional description
+ - the EJB reference name used in the code of
+ the Deployment Component that's referencing the enterprise
+ bean.
+ - the optional expected type of the referenced enterprise bean
+ - the optional remote interface of the referenced enterprise bean
+ or the remote business interface of the referenced enterprise
+ bean
+ - the optional expected home interface of the referenced
+ enterprise bean. Not applicable if this ejb-ref
+ refers to the remote business interface of a 3.0 bean.
+ - optional ejb-link information, used to specify the
+ referenced enterprise bean
+ - optional elements to define injection of the named enterprise
+ bean into a component field or property
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:sequence>
+ <xsd:element name="description"
+ type="javaee:descriptionType"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ <xsd:element name="ejb-ref-name"
+ type="javaee:ejb-ref-nameType"/>
+ <xsd:element name="ejb-ref-type"
+ type="javaee:ejb-ref-typeType"
+ minOccurs="0"/>
+ <xsd:element name="home"
+ type="javaee:homeType"
+ minOccurs="0"/>
+ <xsd:element name="remote"
+ type="javaee:remoteType"
+ minOccurs="0"/>
+ <xsd:element name="ejb-link"
+ type="javaee:ejb-linkType"
+ minOccurs="0"/>
+ <xsd:group ref="javaee:resourceGroup"/>
+ </xsd:sequence>
+ <xsd:attribute name="id" type="xsd:ID"/>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="emptyType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ This type is used to designate an empty
+ element when used.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:attribute name="id" type="xsd:ID"/>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="env-entry-type-valuesType">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+
+ This type contains the fully-qualified Java type of the
+ environment entry value that is expected by the
+ application's code.
+
+ The following are the legal values of env-entry-type-valuesType:
+
+ java.lang.Boolean
+ java.lang.Byte
+ java.lang.Character
+ java.lang.String
+ java.lang.Short
+ java.lang.Integer
+ java.lang.Long
+ java.lang.Float
+ java.lang.Double
+
+ Example:
+
+ <env-entry-type>java.lang.Boolean</env-entry-type>
+
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:restriction base="javaee:string">
+ <xsd:enumeration value="java.lang.Boolean"/>
+ <xsd:enumeration value="java.lang.Byte"/>
+ <xsd:enumeration value="java.lang.Character"/>
+ <xsd:enumeration value="java.lang.String"/>
+ <xsd:enumeration value="java.lang.Short"/>
+ <xsd:enumeration value="java.lang.Integer"/>
+ <xsd:enumeration value="java.lang.Long"/>
+ <xsd:enumeration value="java.lang.Float"/>
+ <xsd:enumeration value="java.lang.Double"/>
+ </xsd:restriction>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="env-entryType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The env-entryType is used to declare an application's
+ environment entry. The declaration consists of an optional
+ description, the name of the environment entry, a type
+ (optional if the value is injected, otherwise required), and
+ an optional value.
+
+ It also includes optional elements to define injection of
+ the named resource into fields or JavaBeans properties.
+
+ If a value is not specified and injection is requested,
+ no injection will occur and no entry of the specified name
+ will be created. This allows an initial value to be
+ specified in the source code without being incorrectly
+ changed when no override has been specified.
+
+ If a value is not specified and no injection is requested,
+ a value must be supplied during deployment.
+
+ This type is used by env-entry elements.
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:sequence>
+ <xsd:element name="description"
+ type="javaee:descriptionType"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ <xsd:element name="env-entry-name"
+ type="javaee:jndi-nameType">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+
+ The env-entry-name element contains the name of a
+ Deployment Component's environment entry. The name
+ is a JNDI name relative to the java:comp/env
+ context. The name must be unique within a
+ Deployment Component. The uniqueness
+ constraints must be defined within the declared
+ context.
+
+ Example:
+
+ <env-entry-name>minAmount</env-entry-name>
+
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+
+ <xsd:element name="env-entry-type"
+ type="javaee:env-entry-type-valuesType"
+ minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+
+ The env-entry-type element contains the Java language
+ type of the environment entry. If an injection target
+ is specified for the environment entry, the type may
+ be omitted, or must match the type of the injection
+ target. If no injection target is specified, the type
+ is required.
+
+ Example:
+
+ <env-entry-type>java.lang.Integer</env-entry-type>
+
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+
+ <xsd:element name="env-entry-value"
+ type="javaee:xsdStringType"
+ minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+
+ The env-entry-value designates the value of a
+ Deployment Component's environment entry. The value
+ must be a String that is valid for the
+ constructor of the specified type that takes a
+ single String parameter, or for java.lang.Character,
+ a single character.
+
+ Example:
+
+ <env-entry-value>100.00</env-entry-value>
+
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+
+ <xsd:group ref="javaee:resourceGroup"/>
+
+ </xsd:sequence>
+ <xsd:attribute name="id" type="xsd:ID"/>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="fully-qualified-classType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The elements that use this type designate the name of a
+ Java class or interface. The name is in the form of a
+ "binary name", as defined in the JLS. This is the form
+ of name used in Class.forName(). Tools that need the
+ canonical name (the name used in source code) will need
+ to convert this binary name to the canonical name.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:restriction base="javaee:string"/>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="generic-booleanType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ This type defines four different values which can designate
+ boolean values. This includes values yes and no which are
+ not designated by xsd:boolean
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:restriction base="javaee:string">
+ <xsd:enumeration value="true"/>
+ <xsd:enumeration value="false"/>
+ <xsd:enumeration value="yes"/>
+ <xsd:enumeration value="no"/>
+ </xsd:restriction>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="homeType">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+
+ The homeType defines the fully-qualified name of
+ an enterprise bean's home interface.
+
+ Example:
+
+ <home>com.aardvark.payroll.PayrollHome</home>
+
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:restriction base="javaee:fully-qualified-classType"/>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="iconType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The icon type contains small-icon and large-icon elements
+ that specify the file names for small and large GIF, JPEG,
+ or PNG icon images used to represent the parent element in a
+ GUI tool.
+
+ The xml:lang attribute defines the language that the
+ icon file names are provided in. Its value is "en" (English)
+ by default.
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:sequence>
+ <xsd:element name="small-icon" type="javaee:pathType"
+ minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+
+ The small-icon element contains the name of a file
+ containing a small (16 x 16) icon image. The file
+ name is a relative path within the Deployment
+ Component's Deployment File.
+
+ The image may be in the GIF, JPEG, or PNG format.
+ The icon can be used by tools.
+
+ Example:
+
+ <small-icon>employee-service-icon16x16.jpg</small-icon>
+
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="large-icon" type="javaee:pathType"
+ minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+
+ The large-icon element contains the name of a file
+ containing a large
+ (32 x 32) icon image. The file name is a relative
+ path within the Deployment Component's Deployment
+ File.
+
+ The image may be in the GIF, JPEG, or PNG format.
+ The icon can be used by tools.
+
+ Example:
+
+ <large-icon>employee-service-icon32x32.jpg</large-icon>
+
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+
+ </xsd:sequence>
+
+ <xsd:attribute ref="xml:lang"/>
+ <xsd:attribute name="id" type="xsd:ID"/>
+
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="injection-targetType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ An injection target specifies a class and a name within
+ that class into which a resource should be injected.
+
+ The injection target class specifies the fully qualified
+ class name that is the target of the injection. The
+ Java EE specifications describe which classes can be an
+ injection target.
+
+ The injection target name specifies the target within
+ the specified class. The target is first looked for as a
+ JavaBeans property name. If not found, the target is
+ looked for as a field name.
+
+ The specified resource will be injected into the target
+ during initialization of the class by either calling the
+ set method for the target property or by setting a value
+ into the named field.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="injection-target-class"
+ type="javaee:fully-qualified-classType"/>
+ <xsd:element name="injection-target-name"
+ type="javaee:java-identifierType"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="java-identifierType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The java-identifierType defines a Java identifier.
+ The users of this type should further verify that
+ the content does not contain Java reserved keywords.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:restriction base="javaee:string">
+ <xsd:pattern value="($|_|\p{L})(\p{L}|\p{Nd}|_|$)*"/>
+ </xsd:restriction>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="java-typeType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ This is a generic type that designates a Java primitive
+ type or a fully qualified name of a Java interface/type,
+ or an array of such types.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:restriction base="javaee:string">
+ <xsd:pattern value="[^\p{Z}]*"/>
+ </xsd:restriction>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="jndi-nameType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The jndi-nameType type designates a JNDI name in the
+ Deployment Component's environment and is relative to the
+ java:comp/env context. A JNDI name must be unique within the
+ Deployment Component.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:restriction base="javaee:string"/>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:group name="jndiEnvironmentRefsGroup">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ This group keeps the usage of the contained JNDI environment
+ reference elements consistent across Java EE deployment descriptors.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="env-entry"
+ type="javaee:env-entryType"
+ minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="ejb-ref"
+ type="javaee:ejb-refType"
+ minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="ejb-local-ref"
+ type="javaee:ejb-local-refType"
+ minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:group ref="javaee:service-refGroup"/>
+ <xsd:element name="resource-ref"
+ type="javaee:resource-refType"
+ minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="resource-env-ref"
+ type="javaee:resource-env-refType"
+ minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="message-destination-ref"
+ type="javaee:message-destination-refType"
+ minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="persistence-context-ref"
+ type="javaee:persistence-context-refType"
+ minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="persistence-unit-ref"
+ type="javaee:persistence-unit-refType"
+ minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="post-construct"
+ type="javaee:lifecycle-callbackType"
+ minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="pre-destroy"
+ type="javaee:lifecycle-callbackType"
+ minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ </xsd:group>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="lifecycle-callbackType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The lifecycle-callback type specifies a method on a
+ class to be called when a lifecycle event occurs.
+ Note that each class may have only one lifecycle callback
+ method for any given event and that the method may not
+ be overloaded.
+
+ If the lifefycle-callback-class element is missing then
+ the class defining the callback is assumed to be the
+ component class in scope at the place in the descriptor
+ in which the callback definition appears.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="lifecycle-callback-class"
+ type="javaee:fully-qualified-classType"
+ minOccurs="0"/>
+ <xsd:element name="lifecycle-callback-method"
+ type="javaee:java-identifierType"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="listenerType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The listenerType indicates the deployment properties for a web
+ application listener bean.
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:sequence>
+ <xsd:group ref="javaee:descriptionGroup"/>
+ <xsd:element name="listener-class"
+ type="javaee:fully-qualified-classType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The listener-class element declares a class in the
+ application must be registered as a web
+ application listener bean. The value is the fully
+ qualified classname of the listener class.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ </xsd:sequence>
+ <xsd:attribute name="id" type="xsd:ID"/>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="local-homeType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The local-homeType defines the fully-qualified
+ name of an enterprise bean's local home interface.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:restriction base="javaee:fully-qualified-classType"/>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="localType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The localType defines the fully-qualified name of an
+ enterprise bean's local interface.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:restriction base="javaee:fully-qualified-classType"/>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="message-destination-linkType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The message-destination-linkType is used to link a message
+ destination reference or message-driven bean to a message
+ destination.
+
+ The Assembler sets the value to reflect the flow of messages
+ between producers and consumers in the application.
+
+ The value must be the message-destination-name of a message
+ destination in the same Deployment File or in another
+ Deployment File in the same Java EE application unit.
+
+ Alternatively, the value may be composed of a path name
+ specifying a Deployment File containing the referenced
+ message destination with the message-destination-name of the
+ destination appended and separated from the path name by
+ "#". The path name is relative to the Deployment File
+ containing Deployment Component that is referencing the
+ message destination. This allows multiple message
+ destinations with the same name to be uniquely identified.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:restriction base="javaee:string"/>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="message-destination-refType">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+
+ The message-destination-ref element contains a declaration
+ of Deployment Component's reference to a message destination
+ associated with a resource in Deployment Component's
+ environment. It consists of:
+
+ - an optional description
+ - the message destination reference name
+ - an optional message destination type
+ - an optional specification as to whether
+ the destination is used for
+ consuming or producing messages, or both.
+ if not specified, "both" is assumed.
+ - an optional link to the message destination
+ - optional injection targets
+
+ The message destination type must be supplied unless an
+ injection target is specified, in which case the type
+ of the target is used. If both are specified, the type
+ must be assignment compatible with the type of the injection
+ target.
+
+ Examples:
+
+ <message-destination-ref>
+ <message-destination-ref-name>jms/StockQueue
+ </message-destination-ref-name>
+ <message-destination-type>javax.jms.Queue
+ </message-destination-type>
+ <message-destination-usage>Consumes
+ </message-destination-usage>
+ <message-destination-link>CorporateStocks
+ </message-destination-link>
+ </message-destination-ref>
+
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="description"
+ type="javaee:descriptionType"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ <xsd:element name="message-destination-ref-name"
+ type="javaee:jndi-nameType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The message-destination-ref-name element specifies
+ the name of a message destination reference; its
+ value is the environment entry name used in
+ Deployment Component code. The name is a JNDI name
+ relative to the java:comp/env context and must be
+ unique within an ejb-jar (for enterprise beans) or a
+ Deployment File (for others).
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="message-destination-type"
+ type="javaee:message-destination-typeType"
+ minOccurs="0"/>
+ <xsd:element name="message-destination-usage"
+ type="javaee:message-destination-usageType"
+ minOccurs="0"/>
+ <xsd:element name="message-destination-link"
+ type="javaee:message-destination-linkType"
+ minOccurs="0"/>
+
+ <xsd:group ref="javaee:resourceGroup"/>
+
+ </xsd:sequence>
+ <xsd:attribute name="id" type="xsd:ID"/>
+
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="message-destination-typeType">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+
+ The message-destination-typeType specifies the type of
+ the destination. The type is specified by the Java interface
+ expected to be implemented by the destination.
+
+ Example:
+
+ <message-destination-type>javax.jms.Queue
+ </message-destination-type>
+
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:restriction base="javaee:fully-qualified-classType"/>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="message-destination-usageType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The message-destination-usageType specifies the use of the
+ message destination indicated by the reference. The value
+ indicates whether messages are consumed from the message
+ destination, produced for the destination, or both. The
+ Assembler makes use of this information in linking producers
+ of a destination with its consumers.
+
+ The value of the message-destination-usage element must be
+ one of the following:
+ Consumes
+ Produces
+ ConsumesProduces
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:restriction base="javaee:string">
+ <xsd:enumeration value="Consumes"/>
+ <xsd:enumeration value="Produces"/>
+ <xsd:enumeration value="ConsumesProduces"/>
+ </xsd:restriction>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="message-destinationType">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+
+ The message-destinationType specifies a message
+ destination. The logical destination described by this
+ element is mapped to a physical destination by the Deployer.
+
+ The message destination element contains:
+
+ - an optional description
+ - an optional display-name
+ - an optional icon
+ - a message destination name which must be unique
+ among message destination names within the same
+ Deployment File.
+ - an optional mapped name
+
+ Example:
+
+ <message-destination>
+ <message-destination-name>CorporateStocks
+ </message-destination-name>
+ </message-destination>
+
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:group ref="javaee:descriptionGroup"/>
+ <xsd:element name="message-destination-name"
+ type="javaee:string">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The message-destination-name element specifies a
+ name for a message destination. This name must be
+ unique among the names of message destinations
+ within the Deployment File.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="mapped-name"
+ type="javaee:xsdStringType"
+ minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+
+ A product specific name that this message destination
+ should be mapped to. Each message-destination-ref
+ element that references this message destination will
+ define a name in the namespace of the referencing
+ component. (It's a name in the JNDI java:comp/env
+ namespace.) Many application servers provide a way to
+ map these local names to names of resources known to the
+ application server. This mapped name is often a global
+ JNDI name, but may be a name of any form. Each of the
+ local names should be mapped to this same global name.
+
+ Application servers are not required to support any
+ particular form or type of mapped name, nor the ability
+ to use mapped names. The mapped name is
+ product-dependent and often installation-dependent. No
+ use of a mapped name is portable.
+
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ </xsd:sequence>
+ <xsd:attribute name="id" type="xsd:ID"/>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="param-valueType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ This type is a general type that can be used to declare
+ parameter/value lists.
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:sequence>
+ <xsd:element name="description"
+ type="javaee:descriptionType"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ <xsd:element name="param-name"
+ type="javaee:string">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The param-name element contains the name of a
+ parameter.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+
+ <xsd:element name="param-value"
+ type="javaee:xsdStringType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The param-value element contains the value of a
+ parameter.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ </xsd:sequence>
+ <xsd:attribute name="id" type="xsd:ID"/>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="pathType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The elements that use this type designate either a relative
+ path or an absolute path starting with a "/".
+
+ In elements that specify a pathname to a file within the
+ same Deployment File, relative filenames (i.e., those not
+ starting with "/") are considered relative to the root of
+ the Deployment File's namespace. Absolute filenames (i.e.,
+ those starting with "/") also specify names in the root of
+ the Deployment File's namespace. In general, relative names
+ are preferred. The exception is .war files where absolute
+ names are preferred for consistency with the Servlet API.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:restriction base="javaee:string"/>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="persistence-context-refType">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+
+ The persistence-context-ref element contains a declaration
+ of Deployment Component's reference to a persistence context
+ associated within a Deployment Component's
+ environment. It consists of:
+
+ - an optional description
+ - the persistence context reference name
+ - an optional persistence unit name. If not specified,
+ the default persistence unit is assumed.
+ - an optional specification as to whether
+ the persistence context type is Transaction or
+ Extended. If not specified, Transaction is assumed.
+ - an optional list of persistence properties
+ - optional injection targets
+
+ Examples:
+
+ <persistence-context-ref>
+ <persistence-context-ref-name>myPersistenceContext
+ </persistence-context-ref-name>
+ </persistence-context-ref>
+
+ <persistence-context-ref>
+ <persistence-context-ref-name>myPersistenceContext
+ </persistence-context-ref-name>
+ <persistence-unit-name>PersistenceUnit1
+ </persistence-unit-name>
+ <persistence-context-type>Extended</persistence-context-type>
+ </persistence-context-ref>
+
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="description"
+ type="javaee:descriptionType"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ <xsd:element name="persistence-context-ref-name"
+ type="javaee:jndi-nameType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The persistence-context-ref-name element specifies
+ the name of a persistence context reference; its
+ value is the environment entry name used in
+ Deployment Component code. The name is a JNDI name
+ relative to the java:comp/env context.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="persistence-unit-name"
+ type="javaee:string"
+ minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The Application Assembler(or BeanProvider) may use the
+ following syntax to avoid the need to rename persistence
+ units to have unique names within a Java EE application.
+
+ The Application Assembler specifies the pathname of the
+ root of the persistence.xml file for the referenced
+ persistence unit and appends the name of the persistence
+ unit separated from the pathname by #. The pathname is
+ relative to the referencing application component jar file.
+ In this manner, multiple persistence units with the same
+ persistence unit name may be uniquely identified when the
+ Application Assembler cannot change persistence unit names.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+
+ <xsd:element name="persistence-context-type"
+ type="javaee:persistence-context-typeType"
+ minOccurs="0"/>
+
+ <xsd:element name="persistence-property"
+ type="javaee:propertyType"
+ minOccurs="0"
+ maxOccurs="unbounded">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ Used to specify properties for the container or persistence
+ provider. Vendor-specific properties may be included in
+ the set of properties. Properties that are not recognized
+ by a vendor must be ignored. Entries that make use of the
+ namespace javax.persistence and its subnamespaces must not
+ be used for vendor-specific properties. The namespace
+ javax.persistence is reserved for use by the specification.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+
+ <xsd:group ref="javaee:resourceGroup"/>
+
+ </xsd:sequence>
+ <xsd:attribute name="id" type="xsd:ID"/>
+
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="persistence-context-typeType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The persistence-context-typeType specifies the transactional
+ nature of a persistence context reference.
+
+ The value of the persistence-context-type element must be
+ one of the following:
+ Transaction
+ Extended
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:restriction base="javaee:string">
+ <xsd:enumeration value="Transaction"/>
+ <xsd:enumeration value="Extended"/>
+ </xsd:restriction>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="persistence-unit-refType">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+
+ The persistence-unit-ref element contains a declaration
+ of Deployment Component's reference to a persistence unit
+ associated within a Deployment Component's
+ environment. It consists of:
+
+ - an optional description
+ - the persistence unit reference name
+ - an optional persistence unit name. If not specified,
+ the default persistence unit is assumed.
+ - optional injection targets
+
+ Examples:
+
+ <persistence-unit-ref>
+ <persistence-unit-ref-name>myPersistenceUnit
+ </persistence-unit-ref-name>
+ </persistence-unit-ref>
+
+ <persistence-unit-ref>
+ <persistence-unit-ref-name>myPersistenceUnit
+ </persistence-unit-ref-name>
+ <persistence-unit-name>PersistenceUnit1
+ </persistence-unit-name>
+ </persistence-unit-ref>
+
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="description"
+ type="javaee:descriptionType"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ <xsd:element name="persistence-unit-ref-name"
+ type="javaee:jndi-nameType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The persistence-unit-ref-name element specifies
+ the name of a persistence unit reference; its
+ value is the environment entry name used in
+ Deployment Component code. The name is a JNDI name
+ relative to the java:comp/env context.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="persistence-unit-name"
+ type="javaee:string"
+ minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The Application Assembler(or BeanProvider) may use the
+ following syntax to avoid the need to rename persistence
+ units to have unique names within a Java EE application.
+
+ The Application Assembler specifies the pathname of the
+ root of the persistence.xml file for the referenced
+ persistence unit and appends the name of the persistence
+ unit separated from the pathname by #. The pathname is
+ relative to the referencing application component jar file.
+ In this manner, multiple persistence units with the same
+ persistence unit name may be uniquely identified when the
+ Application Assembler cannot change persistence unit names.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+
+ <xsd:group ref="javaee:resourceGroup"/>
+
+ </xsd:sequence>
+ <xsd:attribute name="id" type="xsd:ID"/>
+
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="propertyType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ Specifies a name/value pair.
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:sequence>
+ <xsd:element name="name"
+ type="javaee:xsdStringType">
+ </xsd:element>
+ <xsd:element name="value"
+ type="javaee:xsdStringType">
+ </xsd:element>
+ </xsd:sequence>
+ <xsd:attribute name="id" type="xsd:ID"/>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="remoteType">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+
+ The remote element contains the fully-qualified name
+ of the enterprise bean's remote interface.
+
+ Example:
+
+ <remote>com.wombat.empl.EmployeeService</remote>
+
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:restriction base="javaee:fully-qualified-classType"/>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="res-authType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The res-authType specifies whether the Deployment Component
+ code signs on programmatically to the resource manager, or
+ whether the Container will sign on to the resource manager
+ on behalf of the Deployment Component. In the latter case,
+ the Container uses information that is supplied by the
+ Deployer.
+
+ The value must be one of the two following:
+
+ Application
+ Container
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:restriction base="javaee:string">
+ <xsd:enumeration value="Application"/>
+ <xsd:enumeration value="Container"/>
+ </xsd:restriction>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="res-sharing-scopeType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The res-sharing-scope type specifies whether connections
+ obtained through the given resource manager connection
+ factory reference can be shared. The value, if specified,
+ must be one of the two following:
+
+ Shareable
+ Unshareable
+
+ The default value is Shareable.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:restriction base="javaee:string">
+ <xsd:enumeration value="Shareable"/>
+ <xsd:enumeration value="Unshareable"/>
+ </xsd:restriction>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="resource-env-refType">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+
+ The resource-env-refType is used to define
+ resource-env-type elements. It contains a declaration of a
+ Deployment Component's reference to an administered object
+ associated with a resource in the Deployment Component's
+ environment. It consists of an optional description, the
+ resource environment reference name, and an optional
+ indication of the resource environment reference type
+ expected by the Deployment Component code.
+
+ It also includes optional elements to define injection of
+ the named resource into fields or JavaBeans properties.
+
+ The resource environment type must be supplied unless an
+ injection target is specified, in which case the type
+ of the target is used. If both are specified, the type
+ must be assignment compatible with the type of the injection
+ target.
+
+ Example:
+
+ <resource-env-ref>
+ <resource-env-ref-name>jms/StockQueue
+ </resource-env-ref-name>
+ <resource-env-ref-type>javax.jms.Queue
+ </resource-env-ref-type>
+ </resource-env-ref>
+
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:sequence>
+ <xsd:element name="description"
+ type="javaee:descriptionType"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ <xsd:element name="resource-env-ref-name"
+ type="javaee:jndi-nameType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The resource-env-ref-name element specifies the name
+ of a resource environment reference; its value is
+ the environment entry name used in
+ the Deployment Component code. The name is a JNDI
+ name relative to the java:comp/env context and must
+ be unique within a Deployment Component.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+
+ <xsd:element name="resource-env-ref-type"
+ type="javaee:fully-qualified-classType"
+ minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The resource-env-ref-type element specifies the type
+ of a resource environment reference. It is the
+ fully qualified name of a Java language class or
+ interface.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+
+ <xsd:group ref="javaee:resourceGroup"/>
+
+ </xsd:sequence>
+ <xsd:attribute name="id" type="xsd:ID"/>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="resource-refType">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+
+ The resource-refType contains a declaration of a
+ Deployment Component's reference to an external resource. It
+ consists of an optional description, the resource manager
+ connection factory reference name, an optional indication of
+ the resource manager connection factory type expected by the
+ Deployment Component code, an optional type of authentication
+ (Application or Container), and an optional specification of
+ the shareability of connections obtained from the resource
+ (Shareable or Unshareable).
+
+ It also includes optional elements to define injection of
+ the named resource into fields or JavaBeans properties.
+
+ The connection factory type must be supplied unless an
+ injection target is specified, in which case the type
+ of the target is used. If both are specified, the type
+ must be assignment compatible with the type of the injection
+ target.
+
+ Example:
+
+ <resource-ref>
+ <res-ref-name>jdbc/EmployeeAppDB</res-ref-name>
+ <res-type>javax.sql.DataSource</res-type>
+ <res-auth>Container</res-auth>
+ <res-sharing-scope>Shareable</res-sharing-scope>
+ </resource-ref>
+
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:sequence>
+ <xsd:element name="description"
+ type="javaee:descriptionType"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ <xsd:element name="res-ref-name"
+ type="javaee:jndi-nameType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The res-ref-name element specifies the name of a
+ resource manager connection factory reference.
+ The name is a JNDI name relative to the
+ java:comp/env context.
+ The name must be unique within a Deployment File.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+
+ <xsd:element name="res-type"
+ type="javaee:fully-qualified-classType"
+ minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The res-type element specifies the type of the data
+ source. The type is specified by the fully qualified
+ Java language class or interface
+ expected to be implemented by the data source.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+
+ <xsd:element name="res-auth"
+ type="javaee:res-authType"
+ minOccurs="0"/>
+
+ <xsd:element name="res-sharing-scope"
+ type="javaee:res-sharing-scopeType"
+ minOccurs="0"/>
+
+ <xsd:group ref="javaee:resourceGroup"/>
+
+ </xsd:sequence>
+ <xsd:attribute name="id" type="xsd:ID"/>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:group name="resourceGroup">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ This group collects elements that are common to all the
+ JNDI resource elements.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="mapped-name"
+ type="javaee:xsdStringType"
+ minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+
+ A product specific name that this resource should be
+ mapped to. The name of this resource, as defined by the
+ resource's name element or defaulted, is a name that is
+ local to the application component using the resource.
+ (It's a name in the JNDI java:comp/env namespace.) Many
+ application servers provide a way to map these local
+ names to names of resources known to the application
+ server. This mapped name is often a global JNDI name,
+ but may be a name of any form.
+
+ Application servers are not required to support any
+ particular form or type of mapped name, nor the ability
+ to use mapped names. The mapped name is
+ product-dependent and often installation-dependent. No
+ use of a mapped name is portable.
+
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+
+ <xsd:element name="injection-target"
+ type="javaee:injection-targetType"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ </xsd:sequence>
+ </xsd:group>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="role-nameType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The role-nameType designates the name of a security role.
+
+ The name must conform to the lexical rules for a token.
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:simpleContent>
+ <xsd:restriction base="javaee:string"/>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="run-asType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The run-asType specifies the run-as identity to be
+ used for the execution of a component. It contains an
+ optional description, and the name of a security role.
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:sequence>
+ <xsd:element name="description"
+ type="javaee:descriptionType"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ <xsd:element name="role-name"
+ type="javaee:role-nameType"/>
+ </xsd:sequence>
+ <xsd:attribute name="id" type="xsd:ID"/>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="security-role-refType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The security-role-refType contains the declaration of a
+ security role reference in a component's or a
+ Deployment Component's code. The declaration consists of an
+ optional description, the security role name used in the
+ code, and an optional link to a security role. If the
+ security role is not specified, the Deployer must choose an
+ appropriate security role.
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:sequence>
+ <xsd:element name="description"
+ type="javaee:descriptionType"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ <xsd:element name="role-name"
+ type="javaee:role-nameType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The value of the role-name element must be the String used
+ as the parameter to the
+ EJBContext.isCallerInRole(String roleName) method or the
+ HttpServletRequest.isUserInRole(String role) method.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+
+ <xsd:element name="role-link"
+ type="javaee:role-nameType"
+ minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The role-link element is a reference to a defined
+ security role. The role-link element must contain
+ the name of one of the security roles defined in the
+ security-role elements.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ </xsd:sequence>
+ <xsd:attribute name="id" type="xsd:ID"/>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="security-roleType">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+
+ The security-roleType contains the definition of a security
+ role. The definition consists of an optional description of
+ the security role, and the security role name.
+
+ Example:
+
+ <security-role>
+ <description>
+ This role includes all employees who are authorized
+ to access the employee service application.
+ </description>
+ <role-name>employee</role-name>
+ </security-role>
+
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:sequence>
+ <xsd:element name="description"
+ type="javaee:descriptionType"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ <xsd:element name="role-name"
+ type="javaee:role-nameType"/>
+ </xsd:sequence>
+ <xsd:attribute name="id" type="xsd:ID"/>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="string">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ This is a special string datatype that is defined by Java EE as
+ a base type for defining collapsed strings. When schemas
+ require trailing/leading space elimination as well as
+ collapsing the existing whitespace, this base type may be
+ used.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:token">
+ <xsd:attribute name="id" type="xsd:ID"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="true-falseType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ This simple type designates a boolean with only two
+ permissible values
+
+ - true
+ - false
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:restriction base="javaee:xsdBooleanType">
+ <xsd:pattern value="(true|false)"/>
+ </xsd:restriction>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="url-patternType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The url-patternType contains the url pattern of the mapping.
+ It must follow the rules specified in Section 11.2 of the
+ Servlet API Specification. This pattern is assumed to be in
+ URL-decoded form and must not contain CR(#xD) or LF(#xA).
+ If it contains those characters, the container must inform
+ the developer with a descriptive error message.
+ The container must preserve all characters including whitespaces.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:string"/>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="xsdAnyURIType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ This type adds an "id" attribute to xsd:anyURI.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:anyURI">
+ <xsd:attribute name="id" type="xsd:ID"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="xsdBooleanType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ This type adds an "id" attribute to xsd:boolean.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:boolean">
+ <xsd:attribute name="id" type="xsd:ID"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="xsdIntegerType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ This type adds an "id" attribute to xsd:integer.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:integer">
+ <xsd:attribute name="id" type="xsd:ID"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="xsdNMTOKENType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ This type adds an "id" attribute to xsd:NMTOKEN.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:NMTOKEN">
+ <xsd:attribute name="id" type="xsd:ID"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="xsdNonNegativeIntegerType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ This type adds an "id" attribute to xsd:nonNegativeInteger.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:nonNegativeInteger">
+ <xsd:attribute name="id" type="xsd:ID"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="xsdPositiveIntegerType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ This type adds an "id" attribute to xsd:positiveInteger.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:positiveInteger">
+ <xsd:attribute name="id" type="xsd:ID"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="xsdQNameType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ This type adds an "id" attribute to xsd:QName.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:QName">
+ <xsd:attribute name="id" type="xsd:ID"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="xsdStringType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ This type adds an "id" attribute to xsd:string.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:string">
+ <xsd:attribute name="id" type="xsd:ID"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+</xsd:schema>
+
Property changes on: branches/tdiesler/jbossws-1.0/src/main/resources/schema/javaee_5.xsd
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/tdiesler/jbossws-1.0/src/main/resources/schema/jaxrpc-config_2_0.xsd
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/resources/schema/jaxrpc-config_2_0.xsd 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/resources/schema/jaxrpc-config_2_0.xsd 2006-09-07 09:49:54 UTC (rev 910)
@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<xsd:schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="urn:jboss:jaxrpc-config:2.0"
+ xmlns:tns="urn:jboss:jaxrpc-config:2.0"
+ xmlns:jbxb="http://www.jboss.org/xml/ns/jbxb"
+ xmlns:j2ee="http://java.sun.com/xml/ns/j2ee"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ elementFormDefault="qualified" attributeFormDefault="unqualified" version="1.1">
+
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+ This is the schema definition for JBossWS configurations JAXRPC.
+ It relies on the handler definitions that are part of the standard J2EE-1.4 deployment descriptors.
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:import namespace="http://java.sun.com/xml/ns/j2ee" schemaLocation="j2ee_web_services_1_1.xsd"/>
+
+ <xsd:complexType name="jaxrpcConfigType">
+ <xsd:annotation>
+ <xsd:appinfo>
+ <jbxb:class impl="org.jboss.ws.metadata.config.WSConfig"/>
+ </xsd:appinfo>
+ </xsd:annotation>
+ <xsd:choice>
+ <xsd:element name="endpoint-config" type="tns:endpointConfigType" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="client-config" type="tns:clientConfigType" minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:choice>
+ </xsd:complexType>
+
+ <xsd:element name="jaxrpc-config" type="tns:jaxrpcConfigType"/>
+
+ <xsd:complexType name="endpointConfigType">
+ <xsd:annotation>
+ <xsd:appinfo>
+ <jbxb:class impl="org.jboss.ws.metadata.config.WSEndpointConfig"/>
+ </xsd:appinfo>
+ </xsd:annotation>
+ <xsd:complexContent>
+ <xsd:extension base="tns:commonConfigType"/>
+ </xsd:complexContent>
+ </xsd:complexType>
+
+ <xsd:complexType name="clientConfigType">
+ <xsd:annotation>
+ <xsd:appinfo>
+ <jbxb:class impl="org.jboss.ws.metadata.config.WSClientConfig"/>
+ </xsd:appinfo>
+ </xsd:annotation>
+ <xsd:complexContent>
+ <xsd:extension base="tns:commonConfigType"/>
+ </xsd:complexContent>
+ </xsd:complexType>
+
+ <xsd:complexType name="commonConfigType">
+ <xsd:sequence>
+ <xsd:element name="config-name" type="xsd:string"/>
+ <xsd:element name="pre-handler-chain" type="tns:handlerChainType" minOccurs="0"/>
+ <xsd:element name="post-handler-chain" type="tns:handlerChainType" minOccurs="0"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="handlerChainType">
+ <xsd:annotation>
+ <xsd:appinfo>
+ <jbxb:class impl="org.jboss.ws.metadata.config.WSHandlerChainConfig"/>
+ </xsd:appinfo>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="handler-chain-name" type="xsd:string"/>
+ <xsd:element name="handler" type="j2ee:port-component_handlerType" minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+</xsd:schema>
\ No newline at end of file
Property changes on: branches/tdiesler/jbossws-1.0/src/main/resources/schema/jaxrpc-config_2_0.xsd
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Deleted: branches/tdiesler/jbossws-1.0/src/main/resources/schema/jbossws-config_1_0.xsd
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/resources/schema/jbossws-config_1_0.xsd 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/main/resources/schema/jbossws-config_1_0.xsd 2006-09-07 09:49:54 UTC (rev 910)
@@ -1,78 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<xsd:schema xmlns="http://www.w3.org/2001/XMLSchema"
- targetNamespace="urn:jboss:jbossws-config:5.0"
- xmlns:tns="urn:jboss:jbossws-config:5.0"
- xmlns:jbxb="http://www.jboss.org/xml/ns/jbxb"
- xmlns:j2ee="http://java.sun.com/xml/ns/j2ee"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- elementFormDefault="qualified" attributeFormDefault="unqualified" version="1.1">
-
- <xsd:annotation>
- <xsd:documentation>
- <![CDATA[
- This is the schema definition for the jboss webservice configurations.
- It relies on the handler definitions that are part of the standard J2EE deployment descriptors.
- ]]>
- </xsd:documentation>
- </xsd:annotation>
-
- <xsd:import namespace="http://java.sun.com/xml/ns/j2ee" schemaLocation="j2ee_web_services_1_1.xsd"/>
-
- <xsd:complexType name="jbosswsConfigType">
- <xsd:annotation>
- <xsd:appinfo>
- <jbxb:class impl="org.jboss.ws.metadata.config.WSConfig"/>
- </xsd:appinfo>
- </xsd:annotation>
- <xsd:choice>
- <xsd:element name="endpoint-config" type="tns:endpointConfigType" minOccurs="0" maxOccurs="unbounded"/>
- <xsd:element name="client-config" type="tns:clientConfigType" minOccurs="0" maxOccurs="unbounded"/>
- </xsd:choice>
- </xsd:complexType>
-
- <xsd:element name="jbossws-config" type="tns:jbosswsConfigType"/>
-
- <xsd:complexType name="endpointConfigType">
- <xsd:annotation>
- <xsd:appinfo>
- <jbxb:class impl="org.jboss.ws.metadata.config.WSEndpointConfig"/>
- </xsd:appinfo>
- </xsd:annotation>
- <xsd:complexContent>
- <xsd:extension base="tns:commonConfigType"/>
- </xsd:complexContent>
- </xsd:complexType>
-
- <xsd:complexType name="clientConfigType">
- <xsd:annotation>
- <xsd:appinfo>
- <jbxb:class impl="org.jboss.ws.metadata.config.WSClientConfig"/>
- </xsd:appinfo>
- </xsd:annotation>
- <xsd:complexContent>
- <xsd:extension base="tns:commonConfigType"/>
- </xsd:complexContent>
- </xsd:complexType>
-
- <xsd:complexType name="commonConfigType">
- <xsd:sequence>
- <xsd:element name="config-name" type="xsd:string"/>
- <xsd:element name="pre-handler-chain" type="tns:handlerChainType" minOccurs="0"/>
- <xsd:element name="post-handler-chain" type="tns:handlerChainType" minOccurs="0"/>
- </xsd:sequence>
- </xsd:complexType>
-
- <xsd:complexType name="handlerChainType">
- <xsd:annotation>
- <xsd:appinfo>
- <jbxb:class impl="org.jboss.ws.metadata.config.WSHandlerChainConfig"/>
- </xsd:appinfo>
- </xsd:annotation>
- <xsd:sequence>
- <xsd:element name="handler-chain-name" type="xsd:string"/>
- <xsd:element name="handler" type="j2ee:port-component_handlerType" minOccurs="0" maxOccurs="unbounded"/>
- </xsd:sequence>
- </xsd:complexType>
-
-</xsd:schema>
\ No newline at end of file
Deleted: branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/SerializerDeserializerTestCase.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/SerializerDeserializerTestCase.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/SerializerDeserializerTestCase.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -1,214 +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.test.ws.jaxb;
-
-import java.math.BigDecimal;
-import java.math.BigInteger;
-import java.net.URI;
-import java.util.Calendar;
-import java.util.GregorianCalendar;
-
-import javax.xml.namespace.QName;
-import javax.xml.rpc.encoding.TypeMappingRegistry;
-
-import org.jboss.test.ws.JBossWSTest;
-import org.jboss.ws.Constants;
-import org.jboss.ws.jaxrpc.LiteralTypeMapping;
-import org.jboss.ws.jaxrpc.TypeMappingImpl;
-import org.jboss.ws.jaxrpc.TypeMappingRegistryImpl;
-import org.jboss.ws.jaxrpc.encoding.DeserializerFactoryBase;
-import org.jboss.ws.jaxrpc.encoding.DeserializerSupport;
-import org.jboss.ws.jaxrpc.encoding.SerializationContextImpl;
-import org.jboss.ws.jaxrpc.encoding.SerializerFactoryBase;
-import org.jboss.ws.jaxrpc.encoding.SerializerSupport;
-import org.jboss.xb.binding.NamespaceRegistry;
-
-/**
- * Test simple type serialization/deserialization
- *
- * [TODO] please provide additional tests as you add more types
- *
- * @author Thomas.Diesler at jboss.org
- * @since 18-Oct-2004
- */
-public class SerializerDeserializerTestCase extends JBossWSTest
-{
- private QName xmlName = new QName("http://org.jboss.ws", "root", "tns");
-
- private SerializationContextImpl serContext;
- private NamespaceRegistry nsRegistry;
- private TypeMappingImpl typeMapping;
-
- protected void setUp() throws Exception
- {
- TypeMappingRegistry tmRegistry = new TypeMappingRegistryImpl();
- typeMapping = (TypeMappingImpl)tmRegistry.getDefaultTypeMapping();
-
- serContext = new SerializationContextImpl();
- nsRegistry = new NamespaceRegistry();
-
- serContext.setTypeMapping(typeMapping);
- serContext.setNamespaceRegistry(nsRegistry);
- }
-
- public void testStringType() throws Exception
- {
- QName xmlType = Constants.TYPE_LITERAL_STRING;
- String value = "Hello World!";
-
- SerializerFactoryBase serializerFactory = (SerializerFactoryBase)typeMapping.getSerializer(String.class, xmlType);
- SerializerSupport ser = (SerializerSupport)serializerFactory.getSerializer();
- String xmlFragment = ser.serialize(xmlName, xmlType, value, serContext, null);
- assertNotNull(xmlFragment);
-
- DeserializerFactoryBase deserializerFactory = (DeserializerFactoryBase)typeMapping.getDeserializer(String.class, xmlType);
- DeserializerSupport des = (DeserializerSupport)deserializerFactory.getDeserializer();
- String out = (String)des.deserialize(xmlName, xmlType, xmlFragment, serContext);
-
- assertEquals(value, out);
- }
-
- public void testDateTime() throws Exception
- {
- QName xmlType = Constants.TYPE_LITERAL_DATETIME;
- Calendar value = new GregorianCalendar(2004, 10, 20, 14, 53, 25);
-
- SerializerFactoryBase serializerFactory = (SerializerFactoryBase)typeMapping.getSerializer(Calendar.class, xmlType);
- SerializerSupport ser = (SerializerSupport)serializerFactory.getSerializer();
- String xmlFragment = ser.serialize(xmlName, xmlType, value, serContext, null);
- assertNotNull(xmlFragment);
-
- DeserializerFactoryBase deserializerFactory = (DeserializerFactoryBase)typeMapping.getDeserializer(Calendar.class, xmlType);
- DeserializerSupport des = (DeserializerSupport)deserializerFactory.getDeserializer();
- Calendar out = (Calendar)des.deserialize(xmlName, xmlType, xmlFragment, serContext);
-
- assertEquals(value.getTime(), out.getTime());
- assertEquals(value.getTimeZone().getRawOffset(), out.getTimeZone().getRawOffset());
- }
-
- public void testInteger() throws Exception
- {
- QName xmlType = Constants.TYPE_LITERAL_INTEGER;
- BigInteger value = new BigInteger("12345678901234567890");
-
- SerializerFactoryBase serializerFactory = (SerializerFactoryBase)typeMapping.getSerializer(BigInteger.class, xmlType);
- SerializerSupport ser = (SerializerSupport)serializerFactory.getSerializer();
- String xmlFragment = ser.serialize(xmlName, xmlType, value, serContext, null);
- assertNotNull(xmlFragment);
-
- DeserializerFactoryBase deserializerFactory = (DeserializerFactoryBase)typeMapping.getDeserializer(BigInteger.class, xmlType);
- DeserializerSupport des = (DeserializerSupport)deserializerFactory.getDeserializer();
- BigInteger out = (BigInteger)des.deserialize(xmlName, xmlType, xmlFragment, serContext);
-
- assertEquals(value, out);
- }
-
- public void testDecimal() throws Exception
- {
- QName xmlType = Constants.TYPE_LITERAL_DECIMAL;
- BigDecimal value = new BigDecimal("12345678901234567890");
-
- SerializerFactoryBase serializerFactory = (SerializerFactoryBase)typeMapping.getSerializer(BigDecimal.class, xmlType);
- SerializerSupport ser = (SerializerSupport)serializerFactory.getSerializer();
- String xmlFragment = ser.serialize(xmlName, xmlType, value, serContext, null);
- assertNotNull(xmlFragment);
-
- DeserializerFactoryBase deserializerFactory = (DeserializerFactoryBase)typeMapping.getDeserializer(BigDecimal.class, xmlType);
- DeserializerSupport des = (DeserializerSupport)deserializerFactory.getDeserializer();
- BigDecimal out = (BigDecimal)des.deserialize(xmlName, xmlType, xmlFragment, serContext);
-
- assertEquals(value, out);
- }
-
- public void testQName() throws Exception
- {
- QName xmlType = Constants.TYPE_LITERAL_QNAME;
- QName value = new QName("http://some-ns", "localPart", "ns1");
-
- SerializerFactoryBase serializerFactory = (SerializerFactoryBase)typeMapping.getSerializer(QName.class, xmlType);
- SerializerSupport ser = (SerializerSupport)serializerFactory.getSerializer();
- String xmlFragment = ser.serialize(xmlName, xmlType, value, serContext, null);
- assertNotNull(xmlFragment);
-
- // serialization registers the prefix
- assertEquals("ns1", nsRegistry.getPrefix("http://some-ns"));
- nsRegistry.unregisterURI("http://some-ns");
-
- DeserializerFactoryBase deserializerFactory = (DeserializerFactoryBase)typeMapping.getDeserializer(QName.class, xmlType);
- DeserializerSupport des = (DeserializerSupport)deserializerFactory.getDeserializer();
- QName out = (QName)des.deserialize(xmlName, xmlType, xmlFragment, serContext);
-
- assertEquals(value, out);
- }
-
- public void testURI() throws Exception
- {
- QName xmlType = Constants.TYPE_LITERAL_ANYURI;
- URI value = new URI("http://someURI:that:has:more:parts");
-
- SerializerFactoryBase serializerFactory = (SerializerFactoryBase)typeMapping.getSerializer(URI.class, xmlType);
- SerializerSupport ser = (SerializerSupport)serializerFactory.getSerializer();
- String xmlFragment = ser.serialize(xmlName, xmlType, value, serContext, null);
- assertNotNull(xmlFragment);
-
- DeserializerFactoryBase deserializerFactory = (DeserializerFactoryBase)typeMapping.getDeserializer(URI.class, xmlType);
- DeserializerSupport des = (DeserializerSupport)deserializerFactory.getDeserializer();
- URI out = (URI)des.deserialize(xmlName, xmlType, xmlFragment, serContext);
-
- assertEquals(value, out);
- }
-
- public void testBase64Binary() throws Exception
- {
- QName xmlType = Constants.TYPE_LITERAL_BASE64BINARY;
- byte[] value = new String("Some base64 binary string").getBytes();
-
- SerializerFactoryBase serializerFactory = (SerializerFactoryBase)typeMapping.getSerializer(byte[].class, xmlType);
- SerializerSupport ser = (SerializerSupport)serializerFactory.getSerializer();
- String xmlFragment = ser.serialize(xmlName, xmlType, value, serContext, null);
- assertNotNull(xmlFragment);
-
- DeserializerFactoryBase deserializerFactory = (DeserializerFactoryBase)typeMapping.getDeserializer(byte[].class, xmlType);
- DeserializerSupport des = (DeserializerSupport)deserializerFactory.getDeserializer();
- byte[] out = (byte[])des.deserialize(xmlName, xmlType, xmlFragment, serContext);
-
- assertEquals(new String(value), new String(out));
- }
-
- public void testHexBinary() throws Exception
- {
- QName xmlType = Constants.TYPE_LITERAL_HEXBINARY;
- byte[] value = new String("Some hex binary string").getBytes();
-
- SerializerFactoryBase serializerFactory = (SerializerFactoryBase)typeMapping.getSerializer(byte[].class, xmlType);
- SerializerSupport ser = (SerializerSupport)serializerFactory.getSerializer();
- String xmlFragment = ser.serialize(xmlName, xmlType, value, serContext, null);
- assertNotNull(xmlFragment);
-
- DeserializerFactoryBase deserializerFactory = (DeserializerFactoryBase)typeMapping.getDeserializer(byte[].class, xmlType);
- DeserializerSupport des = (DeserializerSupport)deserializerFactory.getDeserializer();
- byte[] out = (byte[])des.deserialize(xmlName, xmlType, xmlFragment, serContext);
-
- assertEquals(new String(value), new String(out));
- }
-
-}
Deleted: branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/array/BigDecimalArray.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/array/BigDecimalArray.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/array/BigDecimalArray.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -1,80 +0,0 @@
-// This class was generated by the JAXRPC SI, do not edit.
-// Contents subject to change without notice.
-// JAX-RPC Standard Implementation (1.1.2_01, build R40)
-
-/*
- * 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.test.ws.jaxb.array;
-
-import java.util.Arrays;
-
-
-public class BigDecimalArray
-{
- private java.math.BigDecimal[] value;
-
- public BigDecimalArray()
- {
- }
-
- public BigDecimalArray(java.math.BigDecimal[] sourceArray)
- {
- value = sourceArray;
- }
-
- public void fromArray(java.math.BigDecimal[] sourceArray)
- {
- this.value = sourceArray;
- }
-
- public java.math.BigDecimal[] toArray()
- {
- return value;
- }
-
- public java.math.BigDecimal[] getValue()
- {
- return value;
- }
-
- public void setValue(java.math.BigDecimal[] value)
- {
- this.value = value;
- }
-
- public boolean equals(Object o)
- {
- if (this == o) return true;
- if (!(o instanceof BigDecimalArray)) return false;
-
- final BigDecimalArray bigDecimalArray = (BigDecimalArray)o;
-
- if (!Arrays.equals(value, bigDecimalArray.value)) return false;
-
- return true;
- }
-
- public int hashCode()
- {
- return 0;
- }
-}
Deleted: branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/array/BigDecimalArrayMarshallerTestCase.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/array/BigDecimalArrayMarshallerTestCase.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/array/BigDecimalArrayMarshallerTestCase.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -1,110 +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.test.ws.jaxb.array;
-
-import java.io.StringWriter;
-import java.math.BigDecimal;
-
-import javax.xml.namespace.QName;
-
-import org.apache.xerces.xs.XSModel;
-import org.jboss.test.ws.tools.WSToolsTest;
-import org.jboss.ws.utils.DOMUtils;
-import org.jboss.ws.jaxb.JAXBConstants;
-import org.jboss.ws.jaxb.JBossXBMarshallerImpl;
-import org.jboss.ws.jaxb.JAXBMarshaller;
-import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping;
-
-/**
- * Test the JAXB marshalling of array types
- *
- * @author Thomas.Diesler at jboss.org
- * @since 29-Apr-2005
- */
-public class BigDecimalArrayMarshallerTestCase extends WSToolsTest
-{
-
- private static final String TARGET_NAMESPACE = "http://org.jboss.ws/types";
-
- private static final QName xmlName = new QName(TARGET_NAMESPACE, "arrayOfBigDecimal", "ns1");
-
- private static final QName xmlType = new QName(TARGET_NAMESPACE, "BigDecimalArray", "ns1");
-
- public void testGenerateSchema() throws Exception
- {
- String xsdSchema = generateSchema(xmlType, BigDecimal[].class);
-
- String exp = "<schema targetNamespace='http://org.jboss.ws/types' " + SCHEMA_NAMESPACES
- + " xmlns:tns='http://org.jboss.ws/types'>" + " <complexType name='BigDecimalArray'>" + " <sequence>"
- + " <element name='value' type='decimal' nillable='true' minOccurs='0' maxOccurs='unbounded'/>" + " </sequence>"
- + " </complexType>" + "</schema>";
-
- assertEquals(DOMUtils.parse(exp), DOMUtils.parse(xsdSchema));
- }
-
- public void testMarshallArrayType() throws Exception
- {
- BigDecimal[] objArr = new BigDecimal[] { new BigDecimal(100), new BigDecimal(200), new BigDecimal(300) };
-
- XSModel model = generateSchemaXSModel(xmlType, BigDecimal[].class);
-
-// XSModel model = XsdBinder.loadSchema("<schema targetNamespace='http://org.jboss.ws/types' " + SCHEMA_NAMESPACES
-// + " xmlns:tns='http://org.jboss.ws/types'>" + " <complexType name='BigDecimalArray'>" + " <sequence>"
-// + " <element name='value' type='decimal' nillable='true' minOccurs='0' maxOccurs='unbounded'/>" + " </sequence>"
-// + " </complexType>" + "</schema>", "UTF-8");
- StringWriter strwr;
- JAXBMarshaller marshaller = new JBossXBMarshallerImpl();
- marshaller.setProperty(JAXBConstants.JAXB_XS_MODEL, model);
- marshaller.setProperty(JAXBConstants.JAXB_TYPE_QNAME, xmlType);
- marshaller.setProperty(JAXBConstants.JAXB_ROOT_QNAME, xmlName);
- marshaller.setProperty(JAXBConstants.JAXB_JAVA_MAPPING, getJavaWSDLMapping());
-
- strwr = new StringWriter();
- marshaller.marshal(objArr, strwr);
-
- String was = strwr.toString();
- assertNotNull("Resulting fragment cannot be null", was);
- assertTrue("Resulting fragment cannot be empty", was.length() > 0);
-
- String exp = "<ns1:arrayOfBigDecimal xmlns:ns1='" + TARGET_NAMESPACE
- + "' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>" + " <value>100</value>" + " <value>200</value>"
- + " <value>300</value>" + "</ns1:arrayOfBigDecimal>";
- assertEquals(DOMUtils.parse(exp), DOMUtils.parse(was));
- }
-
- /**
- * Setup the required jaxrpc-mapping meta data
- */
- private JavaWsdlMapping getJavaWSDLMapping()
- {
- JavaWsdlMapping javaWsdlMapping = new JavaWsdlMapping();
- /*
- * This mapping should be optional JavaXmlTypeMapping xmlTypeMapping = new
- * JavaXmlTypeMapping(javaWsdlMapping);
- * xmlTypeMapping.setJavaType("java.math.BigDecimal[]");
- * xmlTypeMapping.setRootTypeQName(xmlType);
- * xmlTypeMapping.setQnameScope("complexType");
- * javaWsdlMapping.addJavaXmlTypeMappings(xmlTypeMapping);
- */
- return javaWsdlMapping;
- }
-}
Deleted: branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/array/BigDecimalArrayUnmarshallerTestCase.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/array/BigDecimalArrayUnmarshallerTestCase.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/array/BigDecimalArrayUnmarshallerTestCase.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -1,108 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.test.ws.jaxb.array;
-
-import java.io.ByteArrayInputStream;
-import java.math.BigDecimal;
-
-import javax.xml.namespace.QName;
-
-import org.apache.xerces.xs.XSModel;
-import org.jboss.test.ws.tools.WSToolsTest;
-import org.jboss.ws.utils.DOMUtils;
-import org.jboss.ws.jaxb.JAXBConstants;
-import org.jboss.ws.jaxb.JBossXBUnmarshallerImpl;
-import org.jboss.ws.jaxb.JAXBUnmarshaller;
-import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping;
-
-/**
- * Test the JAXB marshalling of array types
- *
- * @author Thomas.Diesler at jboss.org
- * @since 29-Apr-2005
- */
-public class BigDecimalArrayUnmarshallerTestCase extends WSToolsTest
-{
-
- private static final String TARGET_NAMESPACE = "http://org.jboss.ws/types";
-
- private static final QName xmlName = new QName("result");
-
- private static final QName xmlType = new QName(TARGET_NAMESPACE, "BigDecimalArray", "ns1");
-
- public void testGenerateSchema() throws Exception
- {
- String xsdSchema = generateSchema(xmlType, BigDecimal[].class);
-
- String exp =
- "<schema targetNamespace='http://org.jboss.ws/types' " + SCHEMA_NAMESPACES + " xmlns:tns='http://org.jboss.ws/types'>" +
- " <complexType name='BigDecimalArray'>" +
- " <sequence>" +
- " <element name='value' type='decimal' nillable='true' minOccurs='0' maxOccurs='unbounded'/>" +
- " </sequence>" +
- " </complexType>" +
- "</schema>";
-
- assertEquals(DOMUtils.parse(exp), DOMUtils.parse(xsdSchema));
- }
-
- public void testUnmarshallArrayType() throws Exception
- {
- XSModel model = generateSchemaXSModel(xmlType, BigDecimal[].class);
-
- BigDecimal[] objArr = null;
- // Get the JAXB marshaller
- JAXBUnmarshaller unmarshaller = new JBossXBUnmarshallerImpl();
- unmarshaller.setProperty(JAXBConstants.JAXB_XS_MODEL, model);
- unmarshaller.setProperty(JAXBConstants.JAXB_ROOT_QNAME, xmlName);
- unmarshaller.setProperty(JAXBConstants.JAXB_TYPE_QNAME, xmlType);
- unmarshaller.setProperty(JAXBConstants.JAXB_JAVA_MAPPING, getJavaWSDLMapping());
-
- String xml = "<result>" + " <value>100</value>" + " <value>200</value>" + " <value>300</value>" + "</result>";
-
- objArr = (BigDecimal[]) unmarshaller.unmarshal(new ByteArrayInputStream(xml.getBytes()));
-
- assertNotNull("Resulting obj array cannot be null", objArr);
-
- assertEquals("Unexpected array length", 3, objArr.length);
- assertEquals(new BigDecimal(100), objArr[0]);
- assertEquals(new BigDecimal(200), objArr[1]);
- assertEquals(new BigDecimal(300), objArr[2]);
- }
-
- /**
- * Setup the required jaxrpc-mapping meta data
- */
- private JavaWsdlMapping getJavaWSDLMapping()
- {
- JavaWsdlMapping javaWsdlMapping = new JavaWsdlMapping();
- /*
- * This mapping should be optional JavaXmlTypeMapping xmlTypeMapping = new
- * JavaXmlTypeMapping(javaWsdlMapping);
- * xmlTypeMapping.setJavaType("java.math.BigDecimal[]");
- * xmlTypeMapping.setRootTypeQName(xmlType);
- * xmlTypeMapping.setQnameScope("complexType");
- * javaWsdlMapping.addJavaXmlTypeMappings(xmlTypeMapping);
- */
- return javaWsdlMapping;
- }
-}
Deleted: branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/array/CalendarArrayMarshallerTestCase.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/array/CalendarArrayMarshallerTestCase.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/array/CalendarArrayMarshallerTestCase.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -1,115 +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.test.ws.jaxb.array;
-
-import java.io.StringWriter;
-import java.util.Calendar;
-import java.util.GregorianCalendar;
-import java.util.TimeZone;
-
-import javax.xml.namespace.QName;
-
-import org.apache.xerces.xs.XSModel;
-import org.jboss.test.ws.tools.WSToolsTest;
-import org.jboss.ws.utils.DOMUtils;
-import org.jboss.ws.jaxb.JAXBConstants;
-import org.jboss.ws.jaxb.JBossXBMarshallerImpl;
-import org.jboss.ws.jaxb.JAXBMarshaller;
-import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping;
-
-/**
- * Test the JAXB marshalling of array types
- *
- * @author Thomas.Diesler at jboss.org
- * @since 29-Apr-2005
- */
-public class CalendarArrayMarshallerTestCase extends WSToolsTest
-{
-
- private static final String TARGET_NAMESPACE = "http://org.jboss.ws/types";
-
- private static final QName xmlName = new QName(TARGET_NAMESPACE, "arrayOfCalendar", "ns1");
-
- private static final QName xmlType = new QName(TARGET_NAMESPACE, "CalendarArray", "ns1");
-
- public void testGenerateSchema() throws Exception
- {
- String xsdSchema = generateSchema(xmlType, Calendar[].class);
-
- String exp = "<schema targetNamespace='http://org.jboss.ws/types' " + SCHEMA_NAMESPACES
- + " xmlns:tns='http://org.jboss.ws/types'>" + " <complexType name='CalendarArray'>" + " <sequence>"
- + " <element name='value' type='dateTime' nillable='true' minOccurs='0' maxOccurs='unbounded'/>" + " </sequence>"
- + " </complexType>" + "</schema>";
-
- assertEquals(DOMUtils.parse(exp), DOMUtils.parse(xsdSchema));
- }
-
- public void testMarshallArrayType() throws Exception
- {
- Calendar cal1 = new GregorianCalendar(1968, 5, 16, 14, 23, 55);
- cal1.setTimeZone(TimeZone.getTimeZone("GMT"));
- Calendar cal2 = new GregorianCalendar(1969, 6, 17, 15, 24, 56);
- cal2.setTimeZone(TimeZone.getTimeZone("GMT"));
- Calendar cal3 = new GregorianCalendar(1970, 7, 18, 16, 25, 57);
- cal3.setTimeZone(TimeZone.getTimeZone("GMT"));
- Calendar[] objArr = new Calendar[] { cal1, cal2, cal3 };
-
- XSModel model = generateSchemaXSModel(xmlType, Calendar[].class);
-
- StringWriter strwr;
- JAXBMarshaller marshaller = new JBossXBMarshallerImpl();
- marshaller.setProperty(JAXBConstants.JAXB_XS_MODEL, model);
- marshaller.setProperty(JAXBConstants.JAXB_TYPE_QNAME, xmlType);
- marshaller.setProperty(JAXBConstants.JAXB_ROOT_QNAME, xmlName);
- marshaller.setProperty(JAXBConstants.JAXB_JAVA_MAPPING, getJavaWSDLMapping());
-
- strwr = new StringWriter();
- marshaller.marshal(objArr, strwr);
-
- String was = strwr.toString();
- assertNotNull("Resulting fragment cannot be null", was);
- assertTrue("Resulting fragment cannot be empty", was.length() > 0);
-
- String exp = "<ns1:arrayOfCalendar xmlns:ns1='" + TARGET_NAMESPACE
- + "' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>" + " <value>1968-06-16T14:23:55.000Z</value>"
- + " <value>1969-07-17T15:24:56.000Z</value>" + " <value>1970-08-18T16:25:57.000Z</value>" + "</ns1:arrayOfCalendar>";
-
- assertEquals(DOMUtils.parse(exp), DOMUtils.parse(was));
- }
-
- /**
- * Setup the required jaxrpc-mapping meta data
- */
- private JavaWsdlMapping getJavaWSDLMapping()
- {
- JavaWsdlMapping javaWsdlMapping = new JavaWsdlMapping();
- /*
- * This mapping should be optional JavaXmlTypeMapping xmlTypeMapping = new
- * JavaXmlTypeMapping(javaWsdlMapping);
- * xmlTypeMapping.setJavaType("java.util.Calendar[]");
- * xmlTypeMapping.setRootTypeQName(xmlType);
- * xmlTypeMapping.setQnameScope("complexType");
- * javaWsdlMapping.addJavaXmlTypeMappings(xmlTypeMapping);
- */
- return javaWsdlMapping;
- }
-}
Deleted: branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/array/CalendarArrayUnmarshallerTestCase.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/array/CalendarArrayUnmarshallerTestCase.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/array/CalendarArrayUnmarshallerTestCase.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -1,113 +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.test.ws.jaxb.array;
-
-import java.io.ByteArrayInputStream;
-import java.util.Calendar;
-import java.util.GregorianCalendar;
-import java.util.TimeZone;
-
-import javax.xml.namespace.QName;
-
-import org.apache.xerces.xs.XSModel;
-import org.jboss.test.ws.tools.WSToolsTest;
-import org.jboss.ws.utils.DOMUtils;
-import org.jboss.ws.jaxb.JAXBConstants;
-import org.jboss.ws.jaxb.JBossXBUnmarshallerImpl;
-import org.jboss.ws.jaxb.JAXBUnmarshaller;
-import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping;
-
-/**
- * Test the JAXB marshalling of array types
- *
- * @author Thomas.Diesler at jboss.org
- * @since 29-Apr-2005
- */
-public class CalendarArrayUnmarshallerTestCase extends WSToolsTest
-{
-
- private static final String TARGET_NAMESPACE = "http://org.jboss.ws/types";
-
- private static final QName xmlName = new QName(TARGET_NAMESPACE, "arrayOfCalendar", "ns1");
-
- private static final QName xmlType = new QName(TARGET_NAMESPACE, "CalendarArray", "ns1");
-
- public void testGenerateSchema() throws Exception
- {
- String xsdSchema = generateSchema(xmlType, Calendar[].class);
-
- String exp = "<schema targetNamespace='http://org.jboss.ws/types' " + SCHEMA_NAMESPACES
- + " xmlns:tns='http://org.jboss.ws/types'>" + " <complexType name='CalendarArray'>" + " <sequence>"
- + " <element name='value' type='dateTime' nillable='true' minOccurs='0' maxOccurs='unbounded'/>" + " </sequence>"
- + " </complexType>" + "</schema>";
-
- assertEquals(DOMUtils.parse(exp), DOMUtils.parse(xsdSchema));
- }
-
- public void testUnmarshallArrayType() throws Exception
- {
- XSModel model = generateSchemaXSModel(xmlType, Calendar[].class);
-
- Calendar[] objArr = null;
- JAXBUnmarshaller unmarshaller = new JBossXBUnmarshallerImpl();
- unmarshaller.setProperty(JAXBConstants.JAXB_XS_MODEL, model);
- unmarshaller.setProperty(JAXBConstants.JAXB_ROOT_QNAME, xmlName);
- unmarshaller.setProperty(JAXBConstants.JAXB_TYPE_QNAME, xmlType);
- unmarshaller.setProperty(JAXBConstants.JAXB_JAVA_MAPPING, getJavaWSDLMapping());
-
- String xml = "<ns1:arrayOfCalendar xmlns:ns1='" + TARGET_NAMESPACE + "'>" + " <value>1968-06-16T14:23:55.000Z</value>"
- + " <value>1969-07-17T15:24:56.000Z</value>" + " <value>1970-08-18T16:25:57.000Z</value>" + "</ns1:arrayOfCalendar>";
-
- objArr = (Calendar[]) unmarshaller.unmarshal(new ByteArrayInputStream(xml.getBytes()));
-
- assertNotNull("Resulting obj array cannot be null", objArr);
- assertEquals("Unexpected array length", 3, objArr.length);
-
- Calendar cal1 = new GregorianCalendar(1968, 5, 16, 14, 23, 55);
- cal1.setTimeZone(TimeZone.getTimeZone("GMT"));
- Calendar cal2 = new GregorianCalendar(1969, 6, 17, 15, 24, 56);
- cal2.setTimeZone(TimeZone.getTimeZone("GMT"));
- Calendar cal3 = new GregorianCalendar(1970, 7, 18, 16, 25, 57);
- cal3.setTimeZone(TimeZone.getTimeZone("GMT"));
-
- assertEquals(cal1, objArr[0]);
- assertEquals(cal2, objArr[1]);
- assertEquals(cal3, objArr[2]);
- }
-
- /**
- * Setup the required jaxrpc-mapping meta data
- */
- private JavaWsdlMapping getJavaWSDLMapping()
- {
- JavaWsdlMapping javaWsdlMapping = new JavaWsdlMapping();
- /*
- * This mapping should be optional JavaXmlTypeMapping xmlTypeMapping = new
- * JavaXmlTypeMapping(javaWsdlMapping);
- * xmlTypeMapping.setJavaType("java.util.Calendar[]");
- * xmlTypeMapping.setRootTypeQName(xmlType);
- * xmlTypeMapping.setQnameScope("complexType");
- * javaWsdlMapping.addJavaXmlTypeMappings(xmlTypeMapping);
- */
- return javaWsdlMapping;
- }
-}
Deleted: branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/array/QNameArrayMarshallerTestCase.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/array/QNameArrayMarshallerTestCase.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/array/QNameArrayMarshallerTestCase.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -1,107 +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.test.ws.jaxb.array;
-
-import java.io.StringWriter;
-
-import javax.xml.namespace.QName;
-
-import org.apache.xerces.xs.XSModel;
-import org.jboss.test.ws.tools.WSToolsTest;
-import org.jboss.ws.utils.DOMUtils;
-import org.jboss.ws.jaxb.JAXBConstants;
-import org.jboss.ws.jaxb.JBossXBMarshallerImpl;
-import org.jboss.ws.jaxb.JAXBMarshaller;
-import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping;
-
-/**
- * Test the JAXB marshalling of array types
- *
- * @author Thomas.Diesler at jboss.org
- * @since 29-Apr-2005
- */
-public class QNameArrayMarshallerTestCase extends WSToolsTest
-{
-
- private static final String TARGET_NAMESPACE = "http://org.jboss.ws/types";
-
- private static final QName xmlName = new QName(TARGET_NAMESPACE, "arrayOfQName", "ns1");
-
- private static final QName xmlType = new QName(TARGET_NAMESPACE, "QNameArray", "ns1");
-
- public void testGenerateSchema() throws Exception
- {
- String xsdSchema = generateSchema(xmlType, QName[].class);
-
- String exp = "<schema targetNamespace='http://org.jboss.ws/types' " + SCHEMA_NAMESPACES
- + " xmlns:tns='http://org.jboss.ws/types'>" + " <complexType name='QNameArray'>" + " <sequence>"
- + " <element name='value' type='QName' nillable='true' minOccurs='0' maxOccurs='unbounded'/>" + " </sequence>"
- + " </complexType>" + "</schema>";
-
- assertEquals(DOMUtils.parse(exp), DOMUtils.parse(xsdSchema));
- }
-
- public void testMarshallArrayType() throws Exception
- {
- QName[] objArr = new QName[] { new QName("http://ns2", "local2", "ns2"), new QName("http://ns3", "local3", "ns3"),
- new QName("http://ns4", "local4", "ns4") };
-
- XSModel model = generateSchemaXSModel(xmlType, QName[].class);
-
- StringWriter strwr;
- JAXBMarshaller marshaller = new JBossXBMarshallerImpl();
- marshaller.setProperty(JAXBConstants.JAXB_XS_MODEL, model);
- marshaller.setProperty(JAXBConstants.JAXB_TYPE_QNAME, xmlType);
- marshaller.setProperty(JAXBConstants.JAXB_ROOT_QNAME, xmlName);
- marshaller.setProperty(JAXBConstants.JAXB_JAVA_MAPPING, getJavaWSDLMapping());
-
- strwr = new StringWriter();
- marshaller.marshal(objArr, strwr);
-
- String was = strwr.toString();
- assertNotNull("Resulting fragment cannot be null", was);
- assertTrue("Resulting fragment cannot be empty", was.length() > 0);
-
- String exp = "<ns1:arrayOfQName xmlns:ns1='" + TARGET_NAMESPACE + "' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>"
- + " <value xmlns:ns2='http://ns2'>ns2:local2</value>" + " <value xmlns:ns3='http://ns3'>ns3:local3</value>"
- + " <value xmlns:ns4='http://ns4'>ns4:local4</value>" + "</ns1:arrayOfQName>";
-
- assertEquals(DOMUtils.parse(exp), DOMUtils.parse(was));
- }
-
- /**
- * Setup the required jaxrpc-mapping meta data
- */
- private JavaWsdlMapping getJavaWSDLMapping()
- {
- JavaWsdlMapping javaWsdlMapping = new JavaWsdlMapping();
- /*
- * This mapping should be optional JavaXmlTypeMapping xmlTypeMapping = new
- * JavaXmlTypeMapping(javaWsdlMapping);
- * xmlTypeMapping.setJavaType("javax.xml.namespace.QName[]");
- * xmlTypeMapping.setRootTypeQName(xmlType);
- * xmlTypeMapping.setQnameScope("complexType");
- * javaWsdlMapping.addJavaXmlTypeMappings(xmlTypeMapping);
- */
- return javaWsdlMapping;
- }
-}
Deleted: branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/array/QNameArrayUnmarshallerTestCase.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/array/QNameArrayUnmarshallerTestCase.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/array/QNameArrayUnmarshallerTestCase.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -1,103 +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.test.ws.jaxb.array;
-
-import java.io.ByteArrayInputStream;
-
-import javax.xml.namespace.QName;
-
-import org.apache.xerces.xs.XSModel;
-import org.jboss.test.ws.tools.WSToolsTest;
-import org.jboss.ws.utils.DOMUtils;
-import org.jboss.ws.jaxb.JAXBConstants;
-import org.jboss.ws.jaxb.JBossXBUnmarshallerImpl;
-import org.jboss.ws.jaxb.JAXBUnmarshaller;
-import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping;
-
-/**
- * Test the JAXB marshalling of array types
- *
- * @author Thomas.Diesler at jboss.org
- * @since 29-Apr-2005
- */
-public class QNameArrayUnmarshallerTestCase extends WSToolsTest
-{
-
- private static final String TARGET_NAMESPACE = "http://org.jboss.ws/types";
-
- private static final QName xmlName = new QName(TARGET_NAMESPACE, "arrayOfQName", "ns1");
-
- private static final QName xmlType = new QName(TARGET_NAMESPACE, "QNameArray", "ns1");
-
- public void testGenerateSchema() throws Exception
- {
- String xsdSchema = generateSchema(xmlType, QName[].class);
-
- String exp = "<schema targetNamespace='http://org.jboss.ws/types' " + SCHEMA_NAMESPACES
- + " xmlns:tns='http://org.jboss.ws/types'>" + " <complexType name='QNameArray'>" + " <sequence>"
- + " <element name='value' type='QName' nillable='true' minOccurs='0' maxOccurs='unbounded'/>" + " </sequence>"
- + " </complexType>" + "</schema>";
-
- assertEquals(DOMUtils.parse(exp), DOMUtils.parse(xsdSchema));
- }
-
- public void testUnmarshallArrayType() throws Exception
- {
- XSModel model = generateSchemaXSModel(xmlType, QName[].class);
-
- QName[] objArr = null;
- JAXBUnmarshaller unmarshaller = new JBossXBUnmarshallerImpl();
- unmarshaller.setProperty(JAXBConstants.JAXB_XS_MODEL, model);
- unmarshaller.setProperty(JAXBConstants.JAXB_ROOT_QNAME, xmlName);
- unmarshaller.setProperty(JAXBConstants.JAXB_TYPE_QNAME, xmlType);
- unmarshaller.setProperty(JAXBConstants.JAXB_JAVA_MAPPING, getJavaWSDLMapping());
-
- String xml = "<ns1:arrayOfQName xmlns:ns1='" + TARGET_NAMESPACE + "'>" + " <value xmlns:ns2='http://ns2'>ns2:local2</value>"
- + " <value xmlns:ns3='http://ns3'>ns3:local3</value>" + " <value xmlns:ns4='http://ns4'>ns4:local4</value>"
- + "</ns1:arrayOfQName>";
-
- objArr = (QName[]) unmarshaller.unmarshal(new ByteArrayInputStream(xml.getBytes()));
-
- assertNotNull("Resulting obj array cannot be null", objArr);
- assertEquals("Unexpected array length", 3, objArr.length);
- assertEquals(new QName("http://ns2", "local2"), objArr[0]);
- assertEquals(new QName("http://ns3", "local3"), objArr[1]);
- assertEquals(new QName("http://ns4", "local4"), objArr[2]);
- }
-
- /**
- * Setup the required jaxrpc-mapping meta data
- */
- private JavaWsdlMapping getJavaWSDLMapping()
- {
- JavaWsdlMapping javaWsdlMapping = new JavaWsdlMapping();
- /*
- * This mapping should be optional JavaXmlTypeMapping xmlTypeMapping = new
- * JavaXmlTypeMapping(javaWsdlMapping);
- * xmlTypeMapping.setJavaType("javax.xml.namespace.QName[]");
- * xmlTypeMapping.setRootTypeQName(xmlType);
- * xmlTypeMapping.setQnameScope("complexType");
- * javaWsdlMapping.addJavaXmlTypeMappings(xmlTypeMapping);
- */
- return javaWsdlMapping;
- }
-}
Deleted: branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/complex/Base.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/complex/Base.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/complex/Base.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -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.test.ws.jaxb.complex;
-
-/**
- * 5.4 JAX-RPC Value Type
- *
- * This section specifies requirements for the JAX-RPC value types.
- * A JAX-RPC value type is a Java class whose value can be moved between a service
- * client and service endpoint. A Java class must follow these rules to be a JAX-RPC
- * conformant value type:
- *
- * - Java class must have a public default constructor.
- *
- * - Java class must not implement (directly or indirectly) the java.rmi.Remote interface.
- *
- * - Java class may implement any Java interface (except the java.rmi.Remote interface) or extend another Java class.
- *
- * - Java class may contain public, private, protected, package-level fields. The Java type
- * of a public field must be a supported JAX-RPC type as specified in the section 5.1,
- * �JAX-RPC Supported Java Types�.
- *
- * - Java class may contain methods. There are no specified restrictions on the nature of
- * these methods. Refer to the later rule about the JavaBeans properties.
- *
- * - Java class may contain static or transient fields.
- *
- * - Java class for a JAX-RPC value type may be designed as a JavaBeans class. In this
- * case, the bean properties (as defined by the JavaBeans introspection) are required to
- * follow the JavaBeans design pattern of setter and getter methods. The Java type of a
- * bean property must be a supported JAX-RPC type as specified in the section 5.1,
- *
- * @author Thomas.Diesler at jboss.org
- * @since 14-Oct-2004
- */
-public class Base
-{
- public int a;
- private int b;
- private int c;
-
- public Base()
- {
- }
-
- public int getB()
- {
- return b;
- }
-
- public void setB(int b)
- {
- this.b = b;
- }
-
- public void someMethod()
- {
- }
-
- public boolean equals(Object o)
- {
- if (this == o) return true;
- if (!(o instanceof Base)) return false;
-
- final Base base = (Base)o;
-
- if (a != base.a) return false;
- if (b != base.b) return false;
- if (c != base.c) return false;
-
- return true;
- }
-
- public int hashCode()
- {
- int result;
- result = a;
- result = 29 * result + b;
- result = 29 * result + c;
- return result;
- }
-
- public String toString()
- {
- return "[a=" + a + ",b=" + b + ",c=" + c + "]";
- }
-}
\ No newline at end of file
Deleted: branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/complex/ComplexTypeMarshallerGenTestCase.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/complex/ComplexTypeMarshallerGenTestCase.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/complex/ComplexTypeMarshallerGenTestCase.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -1,45 +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.test.ws.jaxb.complex;
-
-import org.apache.xerces.xs.XSModel;
-import org.jboss.logging.Logger;
-
-import javax.xml.namespace.QName;
-
-/**
- * Test the JAXB marshalling of complex types with generation fo the schema for these types
- *
- * @author Thomas.Diesler at jboss.org
- * @since 03-Dec-2004
- */
-public class ComplexTypeMarshallerGenTestCase extends ComplexTypeMarshallerTestCase
-{
- // provide logging
- private static final Logger log = Logger.getLogger(ComplexTypeMarshallerGenTestCase.class);
-
- protected XSModel getSchemaModel(QName xmlType, Class javaType) throws Exception
- {
- log.debug(generateSchema(xmlType, javaType));
- return generateSchemaXSModel(xmlType, javaType);
- }
-}
Deleted: branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/complex/ComplexTypeMarshallerTestCase.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/complex/ComplexTypeMarshallerTestCase.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/complex/ComplexTypeMarshallerTestCase.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -1,169 +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.test.ws.jaxb.complex;
-
-import java.io.File;
-import java.io.StringWriter;
-import java.math.BigInteger;
-import java.net.URL;
-
-import javax.xml.namespace.QName;
-
-import org.apache.xerces.xs.XSModel;
-import org.jboss.test.ws.tools.WSToolsTest;
-import org.jboss.ws.utils.DOMUtils;
-import org.jboss.ws.jaxb.JAXBConstants;
-import org.jboss.ws.jaxb.JBossXBMarshallerImpl;
-import org.jboss.ws.jaxb.JAXBMarshaller;
-import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping;
-import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMappingFactory;
-
-/**
- * Test the JAXB marshalling of complex types
- *
- * @author Thomas.Diesler at jboss.org
- * @since 18-Oct-2004
- */
-public class ComplexTypeMarshallerTestCase extends WSToolsTest
-{
-
- private static final String TARGET_NAMESPACE = "http://org.jboss.ws/types";
-
- /** Get the URL to the defining schema */
- protected XSModel getSchemaModel(QName xmlType, Class javaType) throws Exception
- {
- File xsdFile = new File("resources/jaxb/ComplexTypesService_RPC.xsd");
- assertTrue(xsdFile.exists());
-
- return parseSchema(xsdFile.toURL());
- }
-
- public void testBaseType() throws Exception
- {
- Base obj = new Base();
- obj.a = 100;
- obj.setB(200);
-
- QName xmlName = new QName(TARGET_NAMESPACE, "Base_1", "ns1");
- QName xmlType = new QName(TARGET_NAMESPACE, "Base", "ns1");
-
- XSModel model = getSchemaModel(xmlType, Base.class);
-
- StringWriter strwr;
- JAXBMarshaller marshaller = new JBossXBMarshallerImpl();
- marshaller.setProperty(JAXBConstants.JAXB_XS_MODEL, model);
- marshaller.setProperty(JAXBConstants.JAXB_ROOT_QNAME, xmlName);
- marshaller.setProperty(JAXBConstants.JAXB_TYPE_QNAME, xmlType);
- marshaller.setProperty(JAXBConstants.JAXB_JAVA_MAPPING, getJavaWSDLMapping());
-
- strwr = new StringWriter();
- marshaller.marshal(obj, strwr);
-
- String exp = "<ns1:Base_1 xmlns:ns1='" + TARGET_NAMESPACE + "' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>"
- + " <a>100</a>" + " <b>200</b>" + "</ns1:Base_1>";
- String was = strwr.toString();
- assertEquals(DOMUtils.parse(exp), DOMUtils.parse(was));
- }
-
- public void testDerivedType() throws Exception
- {
- Derived obj = new Derived();
- obj.a = 100;
- obj.setB(200);
- obj.x = 300;
-
- QName xmlName = new QName(TARGET_NAMESPACE, "Derived_1", "ns1");
- QName xmlType = new QName(TARGET_NAMESPACE, "Derived", "ns1");
-
- XSModel model = getSchemaModel(xmlType, Derived.class);
-
- StringWriter strwr;
- JAXBMarshaller marshaller = new JBossXBMarshallerImpl();
- marshaller.setProperty(JAXBConstants.JAXB_XS_MODEL, model);
- marshaller.setProperty(JAXBConstants.JAXB_ROOT_QNAME, xmlName);
- marshaller.setProperty(JAXBConstants.JAXB_TYPE_QNAME, xmlType);
- marshaller.setProperty(JAXBConstants.JAXB_JAVA_MAPPING, getJavaWSDLMapping());
-
- strwr = new StringWriter();
- marshaller.marshal(obj, strwr);
-
- String exp = "<ns1:Derived_1 xmlns:ns1='" + TARGET_NAMESPACE + "' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>"
- + " <a>100</a>" + " <b>200</b>" + " <x>300</x>" + "</ns1:Derived_1>";
-
- String was = strwr.toString();
- assertEquals(DOMUtils.parse(exp), DOMUtils.parse(was));
- }
-
- public void testCompositeType() throws Exception
- {
- QName xmlName = new QName(TARGET_NAMESPACE, "CompositeType_1", "ns1");
- QName xmlType = new QName(TARGET_NAMESPACE, "Composite", "ns1");
-
- Composite obj = new Composite();
- obj.integer = new BigInteger("100");
- obj.string = "Hello World!";
- obj.composite = null;
- obj.dateTime = null;
- obj.qname = null;
-
- Composite sub = new Composite();
- sub.integer = new BigInteger("200");
- sub.string = "Hello Sub World!";
- obj.composite = null;
- sub.dateTime = null;
- sub.qname = null;
-
- obj.composite = sub;
-
- XSModel model = getSchemaModel(xmlType, Composite.class);
-
- StringWriter strwr;
- JAXBMarshaller marshaller = new JBossXBMarshallerImpl();
- marshaller.setProperty(JAXBConstants.JAXB_XS_MODEL, model);
- marshaller.setProperty(JAXBConstants.JAXB_ROOT_QNAME, xmlName);
- marshaller.setProperty(JAXBConstants.JAXB_TYPE_QNAME, xmlType);
- marshaller.setProperty(JAXBConstants.JAXB_JAVA_MAPPING, getJavaWSDLMapping());
-
- strwr = new StringWriter();
- marshaller.marshal(obj, strwr);
-
- String exp = "<ns1:CompositeType_1 xmlns:ns1='" + TARGET_NAMESPACE
- + "' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>" + " <composite>" + " <composite xsi:nil='1'/>"
- + " <dateTime xsi:nil='1'/>" + " <integer>200</integer>" + " <qname xsi:nil='1'/>"
- + " <string>Hello Sub World!</string>" + " </composite>" + " <dateTime xsi:nil='1'/>" + " <integer>100</integer>"
- + " <qname xsi:nil='1'/>" + " <string>Hello World!</string>" + "</ns1:CompositeType_1>";
-
- String was = strwr.toString();
- assertEquals(DOMUtils.parse(exp), DOMUtils.parse(was));
- }
-
- /**
- * Setup the required jaxrpc-mapping meta data
- */
- private JavaWsdlMapping getJavaWSDLMapping() throws Exception
- {
- JavaWsdlMappingFactory factory = JavaWsdlMappingFactory.newInstance();
- URL mappingURL = new File("resources/jaxb/ComplexTypesService_RPC.xml").toURL();
- JavaWsdlMapping javaWsdlMapping = factory.parse(mappingURL);
- return javaWsdlMapping;
- }
-}
Deleted: branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/complex/ComplexTypeUnmarshallerGenTestCase.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/complex/ComplexTypeUnmarshallerGenTestCase.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/complex/ComplexTypeUnmarshallerGenTestCase.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -1,45 +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.test.ws.jaxb.complex;
-
-import org.apache.xerces.xs.XSModel;
-import org.jboss.logging.Logger;
-
-import javax.xml.namespace.QName;
-
-/**
- * Test the JAXB unmarshalling of complex types with generation fo the schema for these types
- *
- * @author Thomas.Diesler at jboss.org
- * @since 03-Dec-2004
- */
-public class ComplexTypeUnmarshallerGenTestCase extends ComplexTypeUnmarshallerTestCase
-{
- // provide logging
- private static final Logger log = Logger.getLogger(ComplexTypeUnmarshallerGenTestCase.class);
-
- /** Get the URL to the defining schema */
- protected XSModel getSchemaModel(QName xmlType, Class javaType) throws Exception
- {
- return generateSchemaXSModel(xmlType, javaType);
- }
-}
Deleted: branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/complex/ComplexTypeUnmarshallerTestCase.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/complex/ComplexTypeUnmarshallerTestCase.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/complex/ComplexTypeUnmarshallerTestCase.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -1,171 +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.test.ws.jaxb.complex;
-
-import java.io.ByteArrayInputStream;
-import java.io.File;
-import java.math.BigInteger;
-import java.net.URL;
-
-import javax.xml.namespace.QName;
-
-import org.apache.xerces.xs.XSModel;
-import org.jboss.test.ws.tools.WSToolsTest;
-import org.jboss.ws.jaxb.JAXBConstants;
-import org.jboss.ws.jaxb.JBossXBUnmarshallerImpl;
-import org.jboss.ws.jaxb.JAXBUnmarshaller;
-import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping;
-import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMappingFactory;
-import org.jboss.ws.tools.JavaToXSD;
-
-/**
- * Test the JAXB unmarshalling of complex types
- *
- * @author Thomas.Diesler at jboss.org
- * @since 18-Oct-2004
- */
-public class ComplexTypeUnmarshallerTestCase extends WSToolsTest
-{
-
- private static final String TARGET_NAMESPACE = "http://org.jboss.ws/types";
-
- /** Get the URL to the defining schema */
- protected XSModel getSchemaModel(QName xmlType, Class javaType) throws Exception
- {
- File xsdFile = new File("resources/jaxb/ComplexTypesService_RPC.xsd");
- assertTrue(xsdFile.exists());
-
- return new JavaToXSD().parseSchema(xsdFile.toURL());
- }
-
-
- public void testBaseType() throws Exception
- {
- String xmlStr = "" + "<ns1:Base_1 xmlns:ns1='" + TARGET_NAMESPACE + "'>" + " <a>100</a>" + " <b>200</b>" + "</ns1:Base_1>";
-
- QName xmlName = new QName(TARGET_NAMESPACE, "Base_1");
- QName xmlType = new QName(TARGET_NAMESPACE, "Base");
-
- XSModel model = getSchemaModel(xmlType, Base.class);
-
- Base exp = new Base();
- exp.a = 100;
- exp.setB(200);
-
- JAXBUnmarshaller unmarshaller = new JBossXBUnmarshallerImpl();
- unmarshaller.setProperty(JAXBConstants.JAXB_XS_MODEL, model);
- unmarshaller.setProperty(JAXBConstants.JAXB_JAVA_MAPPING, getJavaWSDLMapping());
- unmarshaller.setProperty(JAXBConstants.JAXB_TYPE_QNAME, xmlType);
- unmarshaller.setProperty(JAXBConstants.JAXB_ROOT_QNAME, xmlName);
-
- Object obj = unmarshaller.unmarshal(new ByteArrayInputStream(xmlStr.getBytes()));
- assertTrue("Unexpected return type: " + obj.getClass().getName(), obj instanceof Base);
- assertEquals(exp, obj);
- }
-
- public void testDerivedType() throws Exception
- {
- String xmlStr = "<ns1:Derived_1 xmlns:ns1='" + TARGET_NAMESPACE + "'>" + " <a>100</a>" + " <b>200</b>" + " <x>300</x>"
- + "</ns1:Derived_1>";
-
- Derived exp = new Derived();
- exp.a = 100;
- exp.setB(200);
- exp.x = 300;
-
- QName xmlName = new QName(TARGET_NAMESPACE, "Derived_1", "ns1");
- QName xmlType = new QName(TARGET_NAMESPACE, "Derived", "ns1");
-
- XSModel model = getSchemaModel(xmlType, Derived.class);
-
- JAXBUnmarshaller unmarshaller = new JBossXBUnmarshallerImpl();
- unmarshaller.setProperty(JAXBConstants.JAXB_XS_MODEL, model);
- unmarshaller.setProperty(JAXBConstants.JAXB_JAVA_MAPPING, getJavaWSDLMapping());
- unmarshaller.setProperty(JAXBConstants.JAXB_TYPE_QNAME, xmlType);
- unmarshaller.setProperty(JAXBConstants.JAXB_ROOT_QNAME, xmlName);
-
- Object obj = unmarshaller.unmarshal(new ByteArrayInputStream(xmlStr.getBytes()));
- assertNotNull("Unexpected null object", obj);
- assertTrue("Unexpected return type: " + obj.getClass().getName(), obj instanceof Derived);
- assertEquals(exp, obj);
- }
-
- public void testCompositeType() throws Exception
- {
- String xmlStr = "<ns1:CompositeType_1 xmlns:ns1='" + TARGET_NAMESPACE
- + "' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>" +
- " <composite>" +
- " <composite xsi:nil='1'/>" +
- " <dateTime xsi:nil='1'/>" +
- " <integer>200</integer>" +
- " <qname xsi:nil='1'/>" +
- " <string>Hello Sub World!</string>" +
- " </composite>" +
- " <dateTime xsi:nil='1'/>" +
- " <integer>100</integer>" +
- " <qname xsi:nil='1'/>" +
- " <string>Hello World!</string>" +
- "</ns1:CompositeType_1>";
-
- QName xmlName = new QName(TARGET_NAMESPACE, "CompositeType_1", "ns1");
- QName xmlType = new QName(TARGET_NAMESPACE, "Composite", "ns1");
-
- XSModel model = getSchemaModel(xmlType, Composite.class);
-
- Composite exp = new Composite();
- exp.integer = new BigInteger("100");
- exp.string = "Hello World!";
- exp.dateTime = null;
- exp.qname = null;
-
- Composite sub = new Composite();
- sub.integer = new BigInteger("200");
- sub.string = "Hello Sub World!";
- sub.composite = null;
- sub.dateTime = null;
- sub.qname = null;
-
- exp.composite = sub;
-
- JAXBUnmarshaller unmarshaller = new JBossXBUnmarshallerImpl();
- unmarshaller.setProperty(JAXBConstants.JAXB_XS_MODEL, model);
- unmarshaller.setProperty(JAXBConstants.JAXB_JAVA_MAPPING, getJavaWSDLMapping());
- unmarshaller.setProperty(JAXBConstants.JAXB_TYPE_QNAME, xmlType);
- unmarshaller.setProperty(JAXBConstants.JAXB_ROOT_QNAME, xmlName);
-
- Object obj = unmarshaller.unmarshal(new ByteArrayInputStream(xmlStr.getBytes()));
- assertNotNull("Unexpected null object", obj);
- assertTrue("Unexpected return type: " + obj.getClass().getName(), obj instanceof Composite);
- assertEquals(exp, obj);
- }
-
- /**
- * Setup the required jaxrpc-mapping meta data
- */
- private JavaWsdlMapping getJavaWSDLMapping() throws Exception
- {
- JavaWsdlMappingFactory factory = JavaWsdlMappingFactory.newInstance();
- URL mappingURL = new File("resources/jaxb/ComplexTypesService_RPC.xml").toURL();
- JavaWsdlMapping javaWsdlMapping = factory.parse(mappingURL);
- return javaWsdlMapping;
- }
-}
Deleted: branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/complex/ComplexTypes.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/complex/ComplexTypes.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/complex/ComplexTypes.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -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.test.ws.jaxb.complex;
-
-import java.rmi.Remote;
-import java.rmi.RemoteException;
-
-
-/**
- * An SEI for complex types
- *
- * See jaxrpc-1.1 (5.3.1)
- *
- * @author Thomas.Diesler at jboss.org
- * @since 14-Oct-2004
- */
-public interface ComplexTypes extends Remote
-{
- Base echoBase(Base v) throws RemoteException;
-
- Derived echoDerived(Derived v) throws RemoteException;
-
- Composite echoCompositeType(Composite v) throws RemoteException;
-}
Deleted: branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/complex/Composite.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/complex/Composite.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/complex/Composite.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -1,99 +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.test.ws.jaxb.complex;
-
-import javax.xml.namespace.QName;
-import java.math.BigInteger;
-import java.util.Calendar;
-
-/**
- * The composite complexType
- *
- * @author Thomas.Diesler at jboss.org
- * @since 14-Oct-2004
- */
-public class Composite
-{
- public BigInteger integer;
- public Calendar dateTime;
- public String string;
- public QName qname;
- public Composite composite;
-
- public Composite()
- {
- }
-
- public String toString()
- {
- return "[composite integer=" + integer + ", dateTime=" + dateTime + ", string=" + string + ", qname=" + qname +
- ", composite=" + composite + "]";
- }
-
- public boolean equals(Object o)
- {
- if (this == o)
- {
- return true;
- }
- if (!(o instanceof Composite))
- {
- return false;
- }
-
- final Composite composite1 = (Composite)o;
-
- if (composite != null ? !composite.equals(composite1.composite) : composite1.composite != null)
- {
- return false;
- }
- if (dateTime != null ? !dateTime.equals(composite1.dateTime) : composite1.dateTime != null)
- {
- return false;
- }
- if (integer != null ? !integer.equals(composite1.integer) : composite1.integer != null)
- {
- return false;
- }
- if (qname != null ? !qname.equals(composite1.qname) : composite1.qname != null)
- {
- return false;
- }
- if (string != null ? !string.equals(composite1.string) : composite1.string != null)
- {
- return false;
- }
-
- return true;
- }
-
- public int hashCode()
- {
- int result;
- result = (integer != null ? integer.hashCode() : 0);
- result = 29 * result + (dateTime != null ? dateTime.hashCode() : 0);
- result = 29 * result + (string != null ? string.hashCode() : 0);
- result = 29 * result + (qname != null ? qname.hashCode() : 0);
- result = 29 * result + (composite != null ? composite.hashCode() : 0);
- return result;
- }
-}
\ No newline at end of file
Deleted: branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/complex/Derived.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/complex/Derived.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/complex/Derived.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -1,69 +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.test.ws.jaxb.complex;
-
-
-
-/**
- * A derived complexType
- *
- * See jaxrpc-1.1 (5.4)
- *
- * @author Thomas.Diesler at jboss.org
- * @since 14-Oct-2004
- */
-public class Derived extends Base
-{
- public int x;
- private int y;
-
- public Derived()
- {
- }
-
- public boolean equals(Object o)
- {
- if (this == o) return true;
- if (!(o instanceof Derived)) return false;
- if (!super.equals(o)) return false;
-
- final Derived derived = (Derived)o;
-
- if (x != derived.x) return false;
- if (y != derived.y) return false;
-
- return true;
- }
-
- public int hashCode()
- {
- int result = super.hashCode();
- result = 29 * result + x;
- result = 29 * result + y;
- return result;
- }
-
- public String toString()
- {
- return "[a=" + a + ",b=" + getB() + ",x=" + x + ",y=" + y + "]";
- }
-}
\ No newline at end of file
Deleted: branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/docstyle/DocumentStyleMarshallerTestCase.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/docstyle/DocumentStyleMarshallerTestCase.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/docstyle/DocumentStyleMarshallerTestCase.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -1,100 +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.test.ws.jaxb.docstyle;
-
-import java.io.File;
-import java.io.StringWriter;
-import java.net.URL;
-import java.util.Map;
-
-import javax.xml.namespace.QName;
-
-import org.apache.xerces.xs.XSModel;
-import org.jboss.test.ws.tools.WSToolsTest;
-import org.jboss.ws.utils.DOMUtils;
-import org.jboss.ws.jaxb.JAXBConstants;
-import org.jboss.ws.jaxb.JBossXBMarshallerImpl;
-import org.jboss.ws.jaxb.JAXBMarshaller;
-import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping;
-import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMappingFactory;
-
-/**
- * Test the JAXB marshalling of complex types
- *
- * @author Thomas.Diesler at jboss.org
- * @since 18-Oct-2004
- */
-public class DocumentStyleMarshallerTestCase extends WSToolsTest
-{
-
- private static final String TARGET_NAMESPACE = "http://org.jboss.ws/jaxrpc/types";
-
- protected XSModel getSchemaModel() throws Exception
- {
- File xsdFile = new File("resources/jaxb/DocumentStyle.xsd");
- assertTrue(xsdFile.exists());
-
- return parseSchema(xsdFile.toURL());
- }
-
- /** Release the schema URL, used for removing temp files */
- protected void releaseSchemaLocations(Map xsdURLMap)
- {
- }
-
- public void testEchoStringRequest() throws Exception
- {
- EchoString_RequestStruct req = new EchoString_RequestStruct("Hello", "world!");
-
- QName xmlName = new QName(TARGET_NAMESPACE, "echoString", "ns1");
- QName xmlType = new QName(TARGET_NAMESPACE, "echoString", "ns1");
-
- XSModel model = getSchemaModel();
-
- StringWriter strwr;
- JAXBMarshaller marshaller = new JBossXBMarshallerImpl();
- marshaller.setProperty(JAXBConstants.JAXB_XS_MODEL, model);
- marshaller.setProperty(JAXBConstants.JAXB_ROOT_QNAME, xmlName);
- marshaller.setProperty(JAXBConstants.JAXB_TYPE_QNAME, xmlType);
- marshaller.setProperty(JAXBConstants.JAXB_JAVA_MAPPING, getJavaWSDLMapping());
-
- strwr = new StringWriter();
- marshaller.marshal(req, strwr);
-
- String exp = "<ns1:echoString xmlns:ns1='" + TARGET_NAMESPACE + "' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>"
- + " <String_1>Hello</String_1>" + " <String_2>world!</String_2>" + "</ns1:echoString>";
- String was = strwr.toString();
-
- assertEquals(DOMUtils.parse(exp), DOMUtils.parse(was));
- }
-
- /**
- * Setup the required jaxrpc-mapping meta data
- */
- private JavaWsdlMapping getJavaWSDLMapping() throws Exception
- {
- JavaWsdlMappingFactory factory = JavaWsdlMappingFactory.newInstance();
- URL mappingURL = new File("resources/jaxb/DocumentStyle.xml").toURL();
- JavaWsdlMapping javaWsdlMapping = factory.parse(mappingURL);
- return javaWsdlMapping;
- }
-}
Deleted: branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/docstyle/DocumentStyleUnmarshallerTestCase.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/docstyle/DocumentStyleUnmarshallerTestCase.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/docstyle/DocumentStyleUnmarshallerTestCase.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -1,91 +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.test.ws.jaxb.docstyle;
-
-import java.io.ByteArrayInputStream;
-import java.io.File;
-import java.net.URL;
-
-import javax.xml.namespace.QName;
-
-import org.apache.xerces.xs.XSModel;
-import org.jboss.test.ws.tools.WSToolsTest;
-import org.jboss.ws.jaxb.JAXBConstants;
-import org.jboss.ws.jaxb.JBossXBUnmarshallerImpl;
-import org.jboss.ws.jaxb.JAXBUnmarshaller;
-import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping;
-import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMappingFactory;
-
-/**
- * Test the JAXB unmarshalling of complex types
- *
- * @author Thomas.Diesler at jboss.org
- * @since 18-Oct-2004
- */
-public class DocumentStyleUnmarshallerTestCase extends WSToolsTest
-{
-
- private static final String TARGET_NAMESPACE = "http://org.jboss.ws/jaxrpc/types";
-
- protected XSModel getSchemaModel() throws Exception
- {
- File xsdFile = new File("resources/jaxb/DocumentStyle.xsd");
- assertTrue(xsdFile.exists());
-
- return parseSchema(xsdFile.toURL());
- }
-
- public void testEchoStringRequest() throws Exception
- {
- String xmlStr = "" + "<ns1:echoString xmlns:ns1='" + TARGET_NAMESPACE
- + "' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>" + " <String_1>Hello</String_1>"
- + " <String_2>world!</String_2>" + "</ns1:echoString>";
-
- QName xmlName = new QName(TARGET_NAMESPACE, "echoString");
- QName xmlType = new QName(TARGET_NAMESPACE, "echoString");
-
- XSModel model = getSchemaModel();
-
- EchoString_RequestStruct exp = new EchoString_RequestStruct("Hello", "world!");
-
- JAXBUnmarshaller unmarshaller = new JBossXBUnmarshallerImpl();
- unmarshaller.setProperty(JAXBConstants.JAXB_XS_MODEL, model);
- unmarshaller.setProperty(JAXBConstants.JAXB_JAVA_MAPPING, getJavaWSDLMapping());
- unmarshaller.setProperty(JAXBConstants.JAXB_TYPE_QNAME, xmlType);
- unmarshaller.setProperty(JAXBConstants.JAXB_ROOT_QNAME, xmlName);
-
- Object obj = unmarshaller.unmarshal(new ByteArrayInputStream(xmlStr.getBytes()));
-
- assertEquals(exp, obj);
- }
-
- /**
- * Setup the required jaxrpc-mapping meta data
- */
- private JavaWsdlMapping getJavaWSDLMapping() throws Exception
- {
- JavaWsdlMappingFactory factory = JavaWsdlMappingFactory.newInstance();
- URL mappingURL = new File("resources/jaxb/DocumentStyle.xml").toURL();
- JavaWsdlMapping javaWsdlMapping = factory.parse(mappingURL);
- return javaWsdlMapping;
- }
-}
Deleted: branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/docstyle/EchoString_RequestStruct.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/docstyle/EchoString_RequestStruct.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/docstyle/EchoString_RequestStruct.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -1,89 +0,0 @@
-// This class was generated by the JAXRPC SI, do not edit.
-// Contents subject to change without notice.
-// JAX-RPC Standard Implementation (1.1.2_01, build R40)
-
-/*
- * 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.test.ws.jaxb.docstyle;
-
-
-public class EchoString_RequestStruct
-{
- protected String String_1;
- protected String String_2;
-
- public EchoString_RequestStruct()
- {
- }
-
- public EchoString_RequestStruct(String String_1, String String_2)
- {
- this.String_1 = String_1;
- this.String_2 = String_2;
- }
-
- public String getString_1()
- {
- return String_1;
- }
-
- public void setString_1(String String_1)
- {
- this.String_1 = String_1;
- }
-
- public String getString_2()
- {
- return String_2;
- }
-
- public void setString_2(String String_2)
- {
- this.String_2 = String_2;
- }
-
- public boolean equals(Object o)
- {
- if (this == o) return true;
- if (!(o instanceof EchoString_RequestStruct)) return false;
-
- final EchoString_RequestStruct echoString_requestStruct = (EchoString_RequestStruct)o;
-
- if (String_1 != null ? !String_1.equals(echoString_requestStruct.String_1) : echoString_requestStruct.String_1 != null) return false;
- if (String_2 != null ? !String_2.equals(echoString_requestStruct.String_2) : echoString_requestStruct.String_2 != null) return false;
-
- return true;
- }
-
- public int hashCode()
- {
- int result;
- result = (String_1 != null ? String_1.hashCode() : 0);
- result = 29 * result + (String_2 != null ? String_2.hashCode() : 0);
- return result;
- }
-
- public String toString()
- {
- return "[String_1=" + String_1 + ",String_2=" + String_2 + "]";
- }
-}
Deleted: branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/docstyle/EchoString_ResponseStruct.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/docstyle/EchoString_ResponseStruct.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/docstyle/EchoString_ResponseStruct.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -1,73 +0,0 @@
-// This class was generated by the JAXRPC SI, do not edit.
-// Contents subject to change without notice.
-// JAX-RPC Standard Implementation (1.1.2_01, build R40)
-
-/*
- * 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.test.ws.jaxb.docstyle;
-
-
-public class EchoString_ResponseStruct
-{
- protected String result;
-
- public EchoString_ResponseStruct()
- {
- }
-
- public EchoString_ResponseStruct(String result)
- {
- this.result = result;
- }
-
- public String getResult()
- {
- return result;
- }
-
- public void setResult(String result)
- {
- this.result = result;
- }
-
- public boolean equals(Object o)
- {
- if (this == o) return true;
- if (!(o instanceof EchoString_ResponseStruct)) return false;
-
- final EchoString_ResponseStruct echoString_responseStruct = (EchoString_ResponseStruct)o;
-
- if (result != null ? !result.equals(echoString_responseStruct.result) : echoString_responseStruct.result != null) return false;
-
- return true;
- }
-
- public int hashCode()
- {
- return (result != null ? result.hashCode() : 0);
- }
-
- public String toString()
- {
- return "[result=" + result + "]";
- }
-}
Deleted: branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/holders/HoldersServiceInterface.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/holders/HoldersServiceInterface.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/holders/HoldersServiceInterface.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -1,35 +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.test.ws.jaxb.holders;
-
-import java.rmi.Remote;
-
-/**
- * A Java SEI that includes Standard jaxrpc holders
- * @author <mailto:Anil.Saldhana at jboss.org>Anil Saldhana
- * @since Aug 2, 2005
- */
-public interface HoldersServiceInterface extends Remote
-{
- public javax.xml.rpc.holders.FloatHolder processHolder( javax.xml.rpc.holders.CalendarHolder id,
- javax.xml.rpc.holders.IntHolder amount) throws java.rmi.RemoteException;
-}
Deleted: branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/multixsd/Order.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/multixsd/Order.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/multixsd/Order.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -1,81 +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.test.ws.jaxb.multixsd;
-
-import org.jboss.test.ws.jaxb.multixsd.packa.Person;
-import org.jboss.test.ws.jaxb.multixsd.packb.Item;
-
-public class Order
-{
- private Person person;
- private Item item;
-
- public Order()
- {
- }
-
- public Order(Person person, Item item)
- {
- this.person = person;
- this.item = item;
- }
-
-
- public Item getItem()
- {
- return item;
- }
-
- public void setItem(Item item)
- {
- this.item = item;
- }
-
- public Person getPerson()
- {
- return person;
- }
-
- public void setPerson(Person person)
- {
- this.person = person;
- }
-
- public boolean equals(Object obj)
- {
- if (this == obj) return true;
- if (!(obj instanceof Order)) return false;
-
- final Order o = (Order)obj;
- return toString().equals(o.toString());
- }
-
- public int hashCode()
- {
- return toString().hashCode();
- }
-
- public String toString()
- {
- return "[person=" + person + ",item=" + item + "]";
- }
-}
\ No newline at end of file
Deleted: branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/multixsd/packa/Person.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/multixsd/packa/Person.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/multixsd/packa/Person.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -1,66 +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.test.ws.jaxb.multixsd.packa;
-
-
-public class Person
-{
- public String name;
-
- public Person()
- {
- }
-
- public Person(String name)
- {
- this.name = name;
- }
-
- public String getName()
- {
- return name;
- }
-
- public void setName(String name)
- {
- this.name = name;
- }
-
- public boolean equals(Object o)
- {
- if (this == o) return true;
- if (!(o instanceof Person)) return false;
-
- final Person p = (Person)o;
- return toString().equals(p.toString());
- }
-
- public int hashCode()
- {
- return toString().hashCode();
- }
-
- public String toString()
- {
- return "[name=" + name + "]";
- }
-}
\ No newline at end of file
Deleted: branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/multixsd/packb/Item.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/multixsd/packb/Item.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/multixsd/packb/Item.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -1,69 +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.test.ws.jaxb.multixsd.packb;
-
-
-public class Item
-{
- public String name;
-
- public Item()
- {
- }
-
- public Item(String name)
- {
- this.name = name;
- }
-
- public String getName()
- {
- return name;
- }
-
- public void setName(String name)
- {
- this.name = name;
- }
-
- public boolean equals(Object o)
- {
- if (this == o) return true;
- if (!(o instanceof Item)) return false;
-
- final Item p = (Item)o;
- if (name == null && p.name == null) return true;
- if (name != null && name.equals(p.name)) return true;
-
- return false;
- }
-
- public int hashCode()
- {
- return toString().hashCode();
- }
-
- public String toString()
- {
- return "[name=" + name + "]";
- }
-}
\ No newline at end of file
Deleted: branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/simple/EchoSimpleUserType_RequestStruct.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/simple/EchoSimpleUserType_RequestStruct.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/simple/EchoSimpleUserType_RequestStruct.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -1,90 +0,0 @@
-// This class was generated by the JAXRPC SI, do not edit.
-// Contents subject to change without notice.
-// JAX-RPC Standard Implementation (1.1.2_01, build R40)
-
-/*
- * 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.test.ws.jaxb.simple;
-
-
-
-public class EchoSimpleUserType_RequestStruct
-{
- protected String String_1;
- protected SimpleUserType SimpleUserType_2;
-
- public EchoSimpleUserType_RequestStruct()
- {
- }
-
- public EchoSimpleUserType_RequestStruct(String String_1, SimpleUserType SimpleUserType_2)
- {
- this.String_1 = String_1;
- this.SimpleUserType_2 = SimpleUserType_2;
- }
-
- public String getString_1()
- {
- return String_1;
- }
-
- public void setString_1(String String_1)
- {
- this.String_1 = String_1;
- }
-
- public SimpleUserType getSimpleUserType_2()
- {
- return SimpleUserType_2;
- }
-
- public void setSimpleUserType_2(SimpleUserType SimpleUserType_2)
- {
- this.SimpleUserType_2 = SimpleUserType_2;
- }
-
- public boolean equals(Object o)
- {
- if (this == o) return true;
- if (!(o instanceof EchoSimpleUserType_RequestStruct)) return false;
-
- final EchoSimpleUserType_RequestStruct echoSimpleUserType_requestStruct = (EchoSimpleUserType_RequestStruct)o;
-
- if (SimpleUserType_2 != null ? !SimpleUserType_2.equals(echoSimpleUserType_requestStruct.SimpleUserType_2) : echoSimpleUserType_requestStruct.SimpleUserType_2 != null) return false;
- if (String_1 != null ? !String_1.equals(echoSimpleUserType_requestStruct.String_1) : echoSimpleUserType_requestStruct.String_1 != null) return false;
-
- return true;
- }
-
- public int hashCode()
- {
- int result;
- result = (String_1 != null ? String_1.hashCode() : 0);
- result = 29 * result + (SimpleUserType_2 != null ? SimpleUserType_2.hashCode() : 0);
- return result;
- }
-
- public String toString()
- {
- return "[String_1=" + String_1 + ",SimpleUserType_2=" + SimpleUserType_2 + "]";
- }
-}
Deleted: branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/simple/EchoSimpleUserType_ResponseStruct.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/simple/EchoSimpleUserType_ResponseStruct.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/simple/EchoSimpleUserType_ResponseStruct.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -1,74 +0,0 @@
-// This class was generated by the JAXRPC SI, do not edit.
-// Contents subject to change without notice.
-// JAX-RPC Standard Implementation (1.1.2_01, build R40)
-
-/*
- * 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.test.ws.jaxb.simple;
-
-
-
-public class EchoSimpleUserType_ResponseStruct
-{
- protected SimpleUserType result;
-
- public EchoSimpleUserType_ResponseStruct()
- {
- }
-
- public EchoSimpleUserType_ResponseStruct(SimpleUserType result)
- {
- this.result = result;
- }
-
- public SimpleUserType getResult()
- {
- return result;
- }
-
- public void setResult(SimpleUserType result)
- {
- this.result = result;
- }
-
- public boolean equals(Object o)
- {
- if (this == o) return true;
- if (!(o instanceof EchoSimpleUserType_ResponseStruct)) return false;
-
- final EchoSimpleUserType_ResponseStruct echoSimpleUserType_responseStruct = (EchoSimpleUserType_ResponseStruct)o;
-
- if (result != null ? !result.equals(echoSimpleUserType_responseStruct.result) : echoSimpleUserType_responseStruct.result != null) return false;
-
- return true;
- }
-
- public int hashCode()
- {
- return (result != null ? result.hashCode() : 0);
- }
-
- public String toString()
- {
- return "[result=" + result + "]";
- }
-}
Deleted: branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/simple/SimpleUserType.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/simple/SimpleUserType.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/simple/SimpleUserType.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -1,78 +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.test.ws.jaxb.simple;
-
-/**
- * @author Thomas.Diesler at jboss.org
- * @since 29-Apr-2005
- */
-public class SimpleUserType
-{
- public int a;
- private int b;
-
- public SimpleUserType()
- {
- }
-
- public SimpleUserType(int a, int b)
- {
- this.a = a;
- this.b = b;
- }
-
- public int getB()
- {
- return b;
- }
-
- public void setB(int b)
- {
- this.b = b;
- }
-
- public boolean equals(Object o)
- {
- if (this == o) return true;
- if (!(o instanceof SimpleUserType)) return false;
-
- final SimpleUserType simpleUserType = (SimpleUserType)o;
-
- if (a != simpleUserType.a) return false;
- if (b != simpleUserType.b) return false;
-
- return true;
- }
-
- public int hashCode()
- {
- int result;
- result = a;
- result = 29 * result + b;
- return result;
- }
-
- public String toString()
- {
- return "[a=" + a + ",b=" + b + "]";
- }
-}
Deleted: branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/simple/SimpleUserTypeMarshallerTestCase.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/simple/SimpleUserTypeMarshallerTestCase.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/simple/SimpleUserTypeMarshallerTestCase.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -1,135 +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.test.ws.jaxb.simple;
-
-import java.io.StringWriter;
-
-import javax.xml.namespace.QName;
-
-import org.apache.xerces.xs.XSModel;
-import org.jboss.test.ws.tools.WSToolsTest;
-import org.jboss.ws.utils.DOMUtils;
-import org.jboss.ws.jaxb.JAXBConstants;
-import org.jboss.ws.jaxb.JBossXBMarshallerImpl;
-import org.jboss.ws.jaxb.JAXBMarshaller;
-import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping;
-import org.jboss.ws.metadata.jaxrpcmapping.PackageMapping;
-
-/**
- * Test the JAXB marshalling of a SimpleUserType
- *
- * @author Thomas.Diesler at jboss.org
- * @since 29-Apr-2005
- */
-public class SimpleUserTypeMarshallerTestCase extends WSToolsTest
-{
-
- private static final String TARGET_NAMESPACE = "http://org.jboss.ws/types";
-
- public void testGenerateSchema() throws Exception
- {
- QName xmlType = new QName(TARGET_NAMESPACE, "SimpleUserType", "ns1");
- String xsdSchema = generateSchema(xmlType, SimpleUserType.class);
-
- String exp =
- "<schema targetNamespace='http://org.jboss.ws/types' " + SCHEMA_NAMESPACES
- + " xmlns:tns='http://org.jboss.ws/types'>" +
- " <complexType name='SimpleUserType'>" +
- " <sequence>" +
- " <element name='a' type='int'/>" +
- " <element name='b' type='int'/>" +
- " </sequence>" +
- " </complexType>" +
- "</schema>";
-
- assertEquals(DOMUtils.parse(exp), DOMUtils.parse(xsdSchema));
- }
-
- public void testMarshallSimpleUserType() throws Exception
- {
- SimpleUserType obj = new SimpleUserType();
-
- QName xmlName = new QName(TARGET_NAMESPACE, "SimpleUser", "ns1");
- QName xmlType = new QName(TARGET_NAMESPACE, "SimpleUserType", "ns1");
-
- XSModel model = generateSchemaXSModel(xmlType, SimpleUserType.class);
- StringWriter strwr;
- JAXBMarshaller marshaller = new JBossXBMarshallerImpl();
- marshaller.setProperty(JAXBConstants.JAXB_XS_MODEL, model);
- marshaller.setProperty(JAXBConstants.JAXB_ROOT_QNAME, xmlName);
- marshaller.setProperty(JAXBConstants.JAXB_TYPE_QNAME, xmlType);
- marshaller.setProperty(JAXBConstants.JAXB_JAVA_MAPPING, getJavaWSDLMapping());
-
- strwr = new StringWriter();
- marshaller.marshal(obj, strwr);
-
- String was = strwr.toString();
- assertNotNull("Resulting fragment cannot be null", was);
- assertTrue("Resulting fragment cannot be empty", was.length() > 0);
-
- String exp = "<ns1:SimpleUser xmlns:ns1='" + TARGET_NAMESPACE + "' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>"
- + " <a>0</a>" + " <b>0</b>" + "</ns1:SimpleUser>";
-
- assertEquals(DOMUtils.parse(exp), DOMUtils.parse(was));
- }
-
- public void testMarshallSimpleUserTypeNoPrefix() throws Exception
- {
- SimpleUserType obj = new SimpleUserType();
-
- QName xmlName = new QName(TARGET_NAMESPACE, "SimpleUser");
- QName xmlType = new QName(TARGET_NAMESPACE, "SimpleUserType");
-
- XSModel model = generateSchemaXSModel(xmlType, SimpleUserType.class);
-
- StringWriter strwr;
- try
- {
- JAXBMarshaller marshaller = new JBossXBMarshallerImpl();
- marshaller.setProperty(JAXBConstants.JAXB_XS_MODEL, model);
- marshaller.setProperty(JAXBConstants.JAXB_ROOT_QNAME, xmlName);
- marshaller.setProperty(JAXBConstants.JAXB_TYPE_QNAME, xmlType);
- marshaller.setProperty(JAXBConstants.JAXB_JAVA_MAPPING, getJavaWSDLMapping());
-
- strwr = new StringWriter();
- marshaller.marshal(obj, strwr);
- fail("The given root element name must be prefix qualified");
- }
- catch (RuntimeException ex)
- {
- // expected: The given root element name must be prefix qualified
- }
- }
-
- /**
- * Setup the required jaxrpc-mapping meta data
- */
- private JavaWsdlMapping getJavaWSDLMapping()
- {
- JavaWsdlMapping javaWsdlMapping = new JavaWsdlMapping();
- PackageMapping packageMapping = new PackageMapping(javaWsdlMapping);
- javaWsdlMapping.addPackageMapping(packageMapping);
- packageMapping.setNamespaceURI(TARGET_NAMESPACE);
- packageMapping.setPackageType("org.jboss.test.ws.jaxb");
- return javaWsdlMapping;
- }
-}
Deleted: branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/simple/SimpleUserTypeUnmarshallerTestCase.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/simple/SimpleUserTypeUnmarshallerTestCase.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxb/simple/SimpleUserTypeUnmarshallerTestCase.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -1,118 +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.test.ws.jaxb.simple;
-
-import java.io.ByteArrayInputStream;
-
-import javax.xml.namespace.QName;
-
-import org.apache.xerces.xs.XSModel;
-import org.jboss.test.ws.tools.WSToolsTest;
-import org.jboss.ws.utils.DOMUtils;
-import org.jboss.ws.jaxb.JAXBConstants;
-import org.jboss.ws.jaxb.JBossXBUnmarshallerImpl;
-import org.jboss.ws.jaxb.JAXBUnmarshaller;
-import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping;
-import org.jboss.ws.metadata.jaxrpcmapping.PackageMapping;
-
-/**
- * Test the JAXB unmarshalling of a SimpleUserType
- *
- * @author Thomas.Diesler at jboss.org
- * @since 29-Apr-2005
- */
-public class SimpleUserTypeUnmarshallerTestCase extends WSToolsTest
-{
-
- private static final String TARGET_NAMESPACE = "http://org.jboss.ws/types";
-
- public void testGenerateSchema() throws Exception
- {
- QName xmlType = new QName(TARGET_NAMESPACE, "SimpleUserType", "ns1");
- String xsdSchema = generateSchema(xmlType, SimpleUserType.class);
-
- String exp = "<schema targetNamespace='http://org.jboss.ws/types' " + SCHEMA_NAMESPACES + " xmlns:tns='http://org.jboss.ws/types'>"
- + " <complexType name='SimpleUserType'>" + " <sequence>" + " <element name='a' type='int'/>" + " <element name='b' type='int'/>" + " </sequence>"
- + " </complexType>" + "</schema>";
-
- assertEquals(DOMUtils.parse(exp), DOMUtils.parse(xsdSchema));
- }
-
- public void testUnmarshallSimpleUserType() throws Exception
- {
- QName xmlName = new QName(TARGET_NAMESPACE, "SimpleUser", "ns1");
- QName xmlType = new QName(TARGET_NAMESPACE, "SimpleUserType", "ns1");
-
- XSModel model = generateSchemaXSModel(xmlType, SimpleUserType.class);
-
- SimpleUserType obj = null;
- JAXBUnmarshaller unmarshaller = new JBossXBUnmarshallerImpl();
- unmarshaller.setProperty(JAXBConstants.JAXB_XS_MODEL, model);
- unmarshaller.setProperty(JAXBConstants.JAXB_ROOT_QNAME, xmlName);
- unmarshaller.setProperty(JAXBConstants.JAXB_TYPE_QNAME, xmlType);
- unmarshaller.setProperty(JAXBConstants.JAXB_JAVA_MAPPING, getJavaWSDLMapping());
-
- String xml = "<ns1:SimpleUser xmlns:ns1='" + TARGET_NAMESPACE + "'>" + " <a>0</a>" + " <b>0</b>" + "</ns1:SimpleUser>";
-
- obj = (SimpleUserType)unmarshaller.unmarshal(new ByteArrayInputStream(xml.getBytes()));
-
- SimpleUserType exp = new SimpleUserType();
- assertNotNull("Resulting object cannot be null", obj);
- assertEquals(exp, obj);
- }
-
- public void testUnmarshallSimpleUserTypeNoPrefix() throws Exception
- {
- QName xmlName = new QName(TARGET_NAMESPACE, "SimpleUser");
- QName xmlType = new QName(TARGET_NAMESPACE, "SimpleUserType");
-
- XSModel model = generateSchemaXSModel(xmlType, SimpleUserType.class);
-
- SimpleUserType obj = null;
- JAXBUnmarshaller unmarshaller = new JBossXBUnmarshallerImpl();
- unmarshaller.setProperty(JAXBConstants.JAXB_XS_MODEL, model);
- unmarshaller.setProperty(JAXBConstants.JAXB_ROOT_QNAME, xmlName);
- unmarshaller.setProperty(JAXBConstants.JAXB_TYPE_QNAME, xmlType);
- unmarshaller.setProperty(JAXBConstants.JAXB_JAVA_MAPPING, getJavaWSDLMapping());
-
- String xml = "<SimpleUser xmlns='" + TARGET_NAMESPACE + "'>" + " <a xmlns=''>0</a>" + " <b xmlns=''>0</b>" + "</SimpleUser>";
-
- obj = (SimpleUserType)unmarshaller.unmarshal(new ByteArrayInputStream(xml.getBytes()));
-
- SimpleUserType exp = new SimpleUserType();
- assertNotNull("Resulting object cannot be null", obj);
- assertEquals(exp, obj);
- }
-
- /**
- * Setup the required jaxrpc-mapping meta data
- */
- private JavaWsdlMapping getJavaWSDLMapping()
- {
- JavaWsdlMapping javaWsdlMapping = new JavaWsdlMapping();
- PackageMapping packageMapping = new PackageMapping(javaWsdlMapping);
- javaWsdlMapping.addPackageMapping(packageMapping);
- packageMapping.setNamespaceURI(TARGET_NAMESPACE);
- packageMapping.setPackageType("org.jboss.test.ws.jaxb.simple");
- return javaWsdlMapping;
- }
-}
Added: branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/SerializerDeserializerTestCase.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/SerializerDeserializerTestCase.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/SerializerDeserializerTestCase.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -0,0 +1,211 @@
+/*
+ * 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.test.ws.jbossxb;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.net.URI;
+import java.util.Calendar;
+import java.util.GregorianCalendar;
+
+import javax.xml.namespace.QName;
+import javax.xml.rpc.encoding.TypeMappingRegistry;
+
+import org.jboss.test.ws.JBossWSTest;
+import org.jboss.ws.Constants;
+import org.jboss.ws.binding.DeserializerSupport;
+import org.jboss.ws.binding.SerializationContext;
+import org.jboss.ws.binding.SerializerSupport;
+import org.jboss.ws.jaxrpc.SerializationContextJAXRPC;
+import org.jboss.ws.jaxrpc.TypeMappingImpl;
+import org.jboss.ws.jaxrpc.TypeMappingRegistryImpl;
+import org.jboss.ws.jaxrpc.encoding.DeserializerFactoryBase;
+import org.jboss.ws.jaxrpc.encoding.SerializerFactoryBase;
+import org.jboss.xb.binding.NamespaceRegistry;
+
+/**
+ * Test simple type serialization/deserialization
+ *
+ * [TODO] please provide additional tests as you add more types
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 18-Oct-2004
+ */
+public class SerializerDeserializerTestCase extends JBossWSTest
+{
+ private QName xmlName = new QName("http://org.jboss.ws", "root", "tns");
+
+ private SerializationContext serContext;
+ private TypeMappingImpl typeMapping;
+
+ protected void setUp() throws Exception
+ {
+ TypeMappingRegistry tmRegistry = new TypeMappingRegistryImpl();
+ typeMapping = (TypeMappingImpl)tmRegistry.getDefaultTypeMapping();
+
+ serContext = new SerializationContextJAXRPC();
+ serContext.setTypeMapping(typeMapping);
+ }
+
+ public void testStringType() throws Exception
+ {
+ QName xmlType = Constants.TYPE_LITERAL_STRING;
+ String value = "Hello World!";
+
+ SerializerFactoryBase serializerFactory = (SerializerFactoryBase)typeMapping.getSerializer(String.class, xmlType);
+ SerializerSupport ser = (SerializerSupport)serializerFactory.getSerializer();
+ String xmlFragment = ser.serialize(xmlName, xmlType, value, serContext, null);
+ assertNotNull(xmlFragment);
+
+ DeserializerFactoryBase deserializerFactory = (DeserializerFactoryBase)typeMapping.getDeserializer(String.class, xmlType);
+ DeserializerSupport des = (DeserializerSupport)deserializerFactory.getDeserializer();
+ String out = (String)des.deserialize(xmlName, xmlType, xmlFragment, serContext);
+
+ assertEquals(value, out);
+ }
+
+ public void testDateTime() throws Exception
+ {
+ QName xmlType = Constants.TYPE_LITERAL_DATETIME;
+ Calendar value = new GregorianCalendar(2004, 10, 20, 14, 53, 25);
+
+ SerializerFactoryBase serializerFactory = (SerializerFactoryBase)typeMapping.getSerializer(Calendar.class, xmlType);
+ SerializerSupport ser = (SerializerSupport)serializerFactory.getSerializer();
+ String xmlFragment = ser.serialize(xmlName, xmlType, value, serContext, null);
+ assertNotNull(xmlFragment);
+
+ DeserializerFactoryBase deserializerFactory = (DeserializerFactoryBase)typeMapping.getDeserializer(Calendar.class, xmlType);
+ DeserializerSupport des = (DeserializerSupport)deserializerFactory.getDeserializer();
+ Calendar out = (Calendar)des.deserialize(xmlName, xmlType, xmlFragment, serContext);
+
+ assertEquals(value.getTime(), out.getTime());
+ assertEquals(value.getTimeZone().getRawOffset(), out.getTimeZone().getRawOffset());
+ }
+
+ public void testInteger() throws Exception
+ {
+ QName xmlType = Constants.TYPE_LITERAL_INTEGER;
+ BigInteger value = new BigInteger("12345678901234567890");
+
+ SerializerFactoryBase serializerFactory = (SerializerFactoryBase)typeMapping.getSerializer(BigInteger.class, xmlType);
+ SerializerSupport ser = (SerializerSupport)serializerFactory.getSerializer();
+ String xmlFragment = ser.serialize(xmlName, xmlType, value, serContext, null);
+ assertNotNull(xmlFragment);
+
+ DeserializerFactoryBase deserializerFactory = (DeserializerFactoryBase)typeMapping.getDeserializer(BigInteger.class, xmlType);
+ DeserializerSupport des = (DeserializerSupport)deserializerFactory.getDeserializer();
+ BigInteger out = (BigInteger)des.deserialize(xmlName, xmlType, xmlFragment, serContext);
+
+ assertEquals(value, out);
+ }
+
+ public void testDecimal() throws Exception
+ {
+ QName xmlType = Constants.TYPE_LITERAL_DECIMAL;
+ BigDecimal value = new BigDecimal("12345678901234567890");
+
+ SerializerFactoryBase serializerFactory = (SerializerFactoryBase)typeMapping.getSerializer(BigDecimal.class, xmlType);
+ SerializerSupport ser = (SerializerSupport)serializerFactory.getSerializer();
+ String xmlFragment = ser.serialize(xmlName, xmlType, value, serContext, null);
+ assertNotNull(xmlFragment);
+
+ DeserializerFactoryBase deserializerFactory = (DeserializerFactoryBase)typeMapping.getDeserializer(BigDecimal.class, xmlType);
+ DeserializerSupport des = (DeserializerSupport)deserializerFactory.getDeserializer();
+ BigDecimal out = (BigDecimal)des.deserialize(xmlName, xmlType, xmlFragment, serContext);
+
+ assertEquals(value, out);
+ }
+
+ public void testQName() throws Exception
+ {
+ QName xmlType = Constants.TYPE_LITERAL_QNAME;
+ QName value = new QName("http://some-ns", "localPart", "ns1");
+
+ SerializerFactoryBase serializerFactory = (SerializerFactoryBase)typeMapping.getSerializer(QName.class, xmlType);
+ SerializerSupport ser = (SerializerSupport)serializerFactory.getSerializer();
+ String xmlFragment = ser.serialize(xmlName, xmlType, value, serContext, null);
+ assertNotNull(xmlFragment);
+
+ // serialization registers the prefix
+ NamespaceRegistry nsRegistry = serContext.getNamespaceRegistry();
+ assertEquals("ns1", nsRegistry.getPrefix("http://some-ns"));
+ nsRegistry.unregisterURI("http://some-ns");
+
+ DeserializerFactoryBase deserializerFactory = (DeserializerFactoryBase)typeMapping.getDeserializer(QName.class, xmlType);
+ DeserializerSupport des = (DeserializerSupport)deserializerFactory.getDeserializer();
+ QName out = (QName)des.deserialize(xmlName, xmlType, xmlFragment, serContext);
+
+ assertEquals(value, out);
+ }
+
+ public void testURI() throws Exception
+ {
+ QName xmlType = Constants.TYPE_LITERAL_ANYURI;
+ URI value = new URI("http://someURI:that:has:more:parts");
+
+ SerializerFactoryBase serializerFactory = (SerializerFactoryBase)typeMapping.getSerializer(URI.class, xmlType);
+ SerializerSupport ser = (SerializerSupport)serializerFactory.getSerializer();
+ String xmlFragment = ser.serialize(xmlName, xmlType, value, serContext, null);
+ assertNotNull(xmlFragment);
+
+ DeserializerFactoryBase deserializerFactory = (DeserializerFactoryBase)typeMapping.getDeserializer(URI.class, xmlType);
+ DeserializerSupport des = (DeserializerSupport)deserializerFactory.getDeserializer();
+ URI out = (URI)des.deserialize(xmlName, xmlType, xmlFragment, serContext);
+
+ assertEquals(value, out);
+ }
+
+ public void testBase64Binary() throws Exception
+ {
+ QName xmlType = Constants.TYPE_LITERAL_BASE64BINARY;
+ byte[] value = new String("Some base64 binary string").getBytes();
+
+ SerializerFactoryBase serializerFactory = (SerializerFactoryBase)typeMapping.getSerializer(byte[].class, xmlType);
+ SerializerSupport ser = (SerializerSupport)serializerFactory.getSerializer();
+ String xmlFragment = ser.serialize(xmlName, xmlType, value, serContext, null);
+ assertNotNull(xmlFragment);
+
+ DeserializerFactoryBase deserializerFactory = (DeserializerFactoryBase)typeMapping.getDeserializer(byte[].class, xmlType);
+ DeserializerSupport des = (DeserializerSupport)deserializerFactory.getDeserializer();
+ byte[] out = (byte[])des.deserialize(xmlName, xmlType, xmlFragment, serContext);
+
+ assertEquals(new String(value), new String(out));
+ }
+
+ public void testHexBinary() throws Exception
+ {
+ QName xmlType = Constants.TYPE_LITERAL_HEXBINARY;
+ byte[] value = new String("Some hex binary string").getBytes();
+
+ SerializerFactoryBase serializerFactory = (SerializerFactoryBase)typeMapping.getSerializer(byte[].class, xmlType);
+ SerializerSupport ser = (SerializerSupport)serializerFactory.getSerializer();
+ String xmlFragment = ser.serialize(xmlName, xmlType, value, serContext, null);
+ assertNotNull(xmlFragment);
+
+ DeserializerFactoryBase deserializerFactory = (DeserializerFactoryBase)typeMapping.getDeserializer(byte[].class, xmlType);
+ DeserializerSupport des = (DeserializerSupport)deserializerFactory.getDeserializer();
+ byte[] out = (byte[])des.deserialize(xmlName, xmlType, xmlFragment, serContext);
+
+ assertEquals(new String(value), new String(out));
+ }
+
+}
Property changes on: branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/SerializerDeserializerTestCase.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/array/BigDecimalArray.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/array/BigDecimalArray.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/array/BigDecimalArray.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -0,0 +1,80 @@
+// This class was generated by the JAXRPC SI, do not edit.
+// Contents subject to change without notice.
+// JAX-RPC Standard Implementation (1.1.2_01, build R40)
+
+/*
+ * 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.test.ws.jbossxb.array;
+
+import java.util.Arrays;
+
+
+public class BigDecimalArray
+{
+ private java.math.BigDecimal[] value;
+
+ public BigDecimalArray()
+ {
+ }
+
+ public BigDecimalArray(java.math.BigDecimal[] sourceArray)
+ {
+ value = sourceArray;
+ }
+
+ public void fromArray(java.math.BigDecimal[] sourceArray)
+ {
+ this.value = sourceArray;
+ }
+
+ public java.math.BigDecimal[] toArray()
+ {
+ return value;
+ }
+
+ public java.math.BigDecimal[] getValue()
+ {
+ return value;
+ }
+
+ public void setValue(java.math.BigDecimal[] value)
+ {
+ this.value = value;
+ }
+
+ public boolean equals(Object o)
+ {
+ if (this == o) return true;
+ if (!(o instanceof BigDecimalArray)) return false;
+
+ final BigDecimalArray bigDecimalArray = (BigDecimalArray)o;
+
+ if (!Arrays.equals(value, bigDecimalArray.value)) return false;
+
+ return true;
+ }
+
+ public int hashCode()
+ {
+ return 0;
+ }
+}
Property changes on: branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/array/BigDecimalArray.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/array/BigDecimalArrayMarshallerTestCase.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/array/BigDecimalArrayMarshallerTestCase.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/array/BigDecimalArrayMarshallerTestCase.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -0,0 +1,109 @@
+/*
+ * 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.test.ws.jbossxb.array;
+
+import java.io.StringWriter;
+import java.math.BigDecimal;
+
+import javax.xml.namespace.QName;
+
+import org.apache.xerces.xs.XSModel;
+import org.jboss.test.ws.tools.WSToolsTest;
+import org.jboss.ws.utils.DOMUtils;
+import org.jboss.ws.jbossxb.JBossXBConstants;
+import org.jboss.ws.jbossxb.JBossXBMarshallerImpl;
+import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping;
+
+/**
+ * Test the JAXB marshalling of array types
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 29-Apr-2005
+ */
+public class BigDecimalArrayMarshallerTestCase extends WSToolsTest
+{
+
+ private static final String TARGET_NAMESPACE = "http://org.jboss.ws/types";
+
+ private static final QName xmlName = new QName(TARGET_NAMESPACE, "arrayOfBigDecimal", "ns1");
+
+ private static final QName xmlType = new QName(TARGET_NAMESPACE, "BigDecimalArray", "ns1");
+
+ public void testGenerateSchema() throws Exception
+ {
+ String xsdSchema = generateSchema(xmlType, BigDecimal[].class);
+
+ String exp = "<schema targetNamespace='http://org.jboss.ws/types' " + SCHEMA_NAMESPACES
+ + " xmlns:tns='http://org.jboss.ws/types'>" + " <complexType name='BigDecimalArray'>" + " <sequence>"
+ + " <element name='value' type='decimal' nillable='true' minOccurs='0' maxOccurs='unbounded'/>" + " </sequence>"
+ + " </complexType>" + "</schema>";
+
+ assertEquals(DOMUtils.parse(exp), DOMUtils.parse(xsdSchema));
+ }
+
+ public void testMarshallArrayType() throws Exception
+ {
+ BigDecimal[] objArr = new BigDecimal[] { new BigDecimal(100), new BigDecimal(200), new BigDecimal(300) };
+
+ XSModel model = generateSchemaXSModel(xmlType, BigDecimal[].class);
+
+// XSModel model = XsdBinder.loadSchema("<schema targetNamespace='http://org.jboss.ws/types' " + SCHEMA_NAMESPACES
+// + " xmlns:tns='http://org.jboss.ws/types'>" + " <complexType name='BigDecimalArray'>" + " <sequence>"
+// + " <element name='value' type='decimal' nillable='true' minOccurs='0' maxOccurs='unbounded'/>" + " </sequence>"
+// + " </complexType>" + "</schema>", "UTF-8");
+ StringWriter strwr;
+ JBossXBMarshallerImpl marshaller = new JBossXBMarshallerImpl();
+ marshaller.setProperty(JBossXBConstants.JBXB_XS_MODEL, model);
+ marshaller.setProperty(JBossXBConstants.JBXB_TYPE_QNAME, xmlType);
+ marshaller.setProperty(JBossXBConstants.JBXB_ROOT_QNAME, xmlName);
+ marshaller.setProperty(JBossXBConstants.JBXB_JAVA_MAPPING, getJavaWSDLMapping());
+
+ strwr = new StringWriter();
+ marshaller.marshal(objArr, strwr);
+
+ String was = strwr.toString();
+ assertNotNull("Resulting fragment cannot be null", was);
+ assertTrue("Resulting fragment cannot be empty", was.length() > 0);
+
+ String exp = "<ns1:arrayOfBigDecimal xmlns:ns1='" + TARGET_NAMESPACE
+ + "' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>" + " <value>100</value>" + " <value>200</value>"
+ + " <value>300</value>" + "</ns1:arrayOfBigDecimal>";
+ assertEquals(DOMUtils.parse(exp), DOMUtils.parse(was));
+ }
+
+ /**
+ * Setup the required jaxrpc-mapping meta data
+ */
+ private JavaWsdlMapping getJavaWSDLMapping()
+ {
+ JavaWsdlMapping javaWsdlMapping = new JavaWsdlMapping();
+ /*
+ * This mapping should be optional JavaXmlTypeMapping xmlTypeMapping = new
+ * JavaXmlTypeMapping(javaWsdlMapping);
+ * xmlTypeMapping.setJavaType("java.math.BigDecimal[]");
+ * xmlTypeMapping.setRootTypeQName(xmlType);
+ * xmlTypeMapping.setQnameScope("complexType");
+ * javaWsdlMapping.addJavaXmlTypeMappings(xmlTypeMapping);
+ */
+ return javaWsdlMapping;
+ }
+}
Property changes on: branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/array/BigDecimalArrayMarshallerTestCase.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/array/BigDecimalArrayUnmarshallerTestCase.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/array/BigDecimalArrayUnmarshallerTestCase.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/array/BigDecimalArrayUnmarshallerTestCase.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -0,0 +1,107 @@
+/*
+ * 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.test.ws.jbossxb.array;
+
+import java.io.ByteArrayInputStream;
+import java.math.BigDecimal;
+
+import javax.xml.namespace.QName;
+
+import org.apache.xerces.xs.XSModel;
+import org.jboss.test.ws.tools.WSToolsTest;
+import org.jboss.ws.utils.DOMUtils;
+import org.jboss.ws.jbossxb.JBossXBConstants;
+import org.jboss.ws.jbossxb.JBossXBUnmarshallerImpl;
+import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping;
+
+/**
+ * Test the JAXB marshalling of array types
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 29-Apr-2005
+ */
+public class BigDecimalArrayUnmarshallerTestCase extends WSToolsTest
+{
+
+ private static final String TARGET_NAMESPACE = "http://org.jboss.ws/types";
+
+ private static final QName xmlName = new QName("result");
+
+ private static final QName xmlType = new QName(TARGET_NAMESPACE, "BigDecimalArray", "ns1");
+
+ public void testGenerateSchema() throws Exception
+ {
+ String xsdSchema = generateSchema(xmlType, BigDecimal[].class);
+
+ String exp =
+ "<schema targetNamespace='http://org.jboss.ws/types' " + SCHEMA_NAMESPACES + " xmlns:tns='http://org.jboss.ws/types'>" +
+ " <complexType name='BigDecimalArray'>" +
+ " <sequence>" +
+ " <element name='value' type='decimal' nillable='true' minOccurs='0' maxOccurs='unbounded'/>" +
+ " </sequence>" +
+ " </complexType>" +
+ "</schema>";
+
+ assertEquals(DOMUtils.parse(exp), DOMUtils.parse(xsdSchema));
+ }
+
+ public void testUnmarshallArrayType() throws Exception
+ {
+ XSModel model = generateSchemaXSModel(xmlType, BigDecimal[].class);
+
+ BigDecimal[] objArr = null;
+ // Get the JAXB marshaller
+ JBossXBUnmarshallerImpl unmarshaller = new JBossXBUnmarshallerImpl();
+ 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, getJavaWSDLMapping());
+
+ String xml = "<result>" + " <value>100</value>" + " <value>200</value>" + " <value>300</value>" + "</result>";
+
+ objArr = (BigDecimal[]) unmarshaller.unmarshal(new ByteArrayInputStream(xml.getBytes()));
+
+ assertNotNull("Resulting obj array cannot be null", objArr);
+
+ assertEquals("Unexpected array length", 3, objArr.length);
+ assertEquals(new BigDecimal(100), objArr[0]);
+ assertEquals(new BigDecimal(200), objArr[1]);
+ assertEquals(new BigDecimal(300), objArr[2]);
+ }
+
+ /**
+ * Setup the required jaxrpc-mapping meta data
+ */
+ private JavaWsdlMapping getJavaWSDLMapping()
+ {
+ JavaWsdlMapping javaWsdlMapping = new JavaWsdlMapping();
+ /*
+ * This mapping should be optional JavaXmlTypeMapping xmlTypeMapping = new
+ * JavaXmlTypeMapping(javaWsdlMapping);
+ * xmlTypeMapping.setJavaType("java.math.BigDecimal[]");
+ * xmlTypeMapping.setRootTypeQName(xmlType);
+ * xmlTypeMapping.setQnameScope("complexType");
+ * javaWsdlMapping.addJavaXmlTypeMappings(xmlTypeMapping);
+ */
+ return javaWsdlMapping;
+ }
+}
Property changes on: branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/array/BigDecimalArrayUnmarshallerTestCase.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/array/CalendarArrayMarshallerTestCase.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/array/CalendarArrayMarshallerTestCase.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/array/CalendarArrayMarshallerTestCase.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -0,0 +1,114 @@
+/*
+ * 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.test.ws.jbossxb.array;
+
+import java.io.StringWriter;
+import java.util.Calendar;
+import java.util.GregorianCalendar;
+import java.util.TimeZone;
+
+import javax.xml.namespace.QName;
+
+import org.apache.xerces.xs.XSModel;
+import org.jboss.test.ws.tools.WSToolsTest;
+import org.jboss.ws.utils.DOMUtils;
+import org.jboss.ws.jbossxb.JBossXBConstants;
+import org.jboss.ws.jbossxb.JBossXBMarshallerImpl;
+import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping;
+
+/**
+ * Test the JAXB marshalling of array types
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 29-Apr-2005
+ */
+public class CalendarArrayMarshallerTestCase extends WSToolsTest
+{
+
+ private static final String TARGET_NAMESPACE = "http://org.jboss.ws/types";
+
+ private static final QName xmlName = new QName(TARGET_NAMESPACE, "arrayOfCalendar", "ns1");
+
+ private static final QName xmlType = new QName(TARGET_NAMESPACE, "CalendarArray", "ns1");
+
+ public void testGenerateSchema() throws Exception
+ {
+ String xsdSchema = generateSchema(xmlType, Calendar[].class);
+
+ String exp = "<schema targetNamespace='http://org.jboss.ws/types' " + SCHEMA_NAMESPACES
+ + " xmlns:tns='http://org.jboss.ws/types'>" + " <complexType name='CalendarArray'>" + " <sequence>"
+ + " <element name='value' type='dateTime' nillable='true' minOccurs='0' maxOccurs='unbounded'/>" + " </sequence>"
+ + " </complexType>" + "</schema>";
+
+ assertEquals(DOMUtils.parse(exp), DOMUtils.parse(xsdSchema));
+ }
+
+ public void testMarshallArrayType() throws Exception
+ {
+ Calendar cal1 = new GregorianCalendar(1968, 5, 16, 14, 23, 55);
+ cal1.setTimeZone(TimeZone.getTimeZone("GMT"));
+ Calendar cal2 = new GregorianCalendar(1969, 6, 17, 15, 24, 56);
+ cal2.setTimeZone(TimeZone.getTimeZone("GMT"));
+ Calendar cal3 = new GregorianCalendar(1970, 7, 18, 16, 25, 57);
+ cal3.setTimeZone(TimeZone.getTimeZone("GMT"));
+ Calendar[] objArr = new Calendar[] { cal1, cal2, cal3 };
+
+ XSModel model = generateSchemaXSModel(xmlType, Calendar[].class);
+
+ StringWriter strwr;
+ JBossXBMarshallerImpl marshaller = new JBossXBMarshallerImpl();
+ marshaller.setProperty(JBossXBConstants.JBXB_XS_MODEL, model);
+ marshaller.setProperty(JBossXBConstants.JBXB_TYPE_QNAME, xmlType);
+ marshaller.setProperty(JBossXBConstants.JBXB_ROOT_QNAME, xmlName);
+ marshaller.setProperty(JBossXBConstants.JBXB_JAVA_MAPPING, getJavaWSDLMapping());
+
+ strwr = new StringWriter();
+ marshaller.marshal(objArr, strwr);
+
+ String was = strwr.toString();
+ assertNotNull("Resulting fragment cannot be null", was);
+ assertTrue("Resulting fragment cannot be empty", was.length() > 0);
+
+ String exp = "<ns1:arrayOfCalendar xmlns:ns1='" + TARGET_NAMESPACE
+ + "' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>" + " <value>1968-06-16T14:23:55.000Z</value>"
+ + " <value>1969-07-17T15:24:56.000Z</value>" + " <value>1970-08-18T16:25:57.000Z</value>" + "</ns1:arrayOfCalendar>";
+
+ assertEquals(DOMUtils.parse(exp), DOMUtils.parse(was));
+ }
+
+ /**
+ * Setup the required jaxrpc-mapping meta data
+ */
+ private JavaWsdlMapping getJavaWSDLMapping()
+ {
+ JavaWsdlMapping javaWsdlMapping = new JavaWsdlMapping();
+ /*
+ * This mapping should be optional JavaXmlTypeMapping xmlTypeMapping = new
+ * JavaXmlTypeMapping(javaWsdlMapping);
+ * xmlTypeMapping.setJavaType("java.util.Calendar[]");
+ * xmlTypeMapping.setRootTypeQName(xmlType);
+ * xmlTypeMapping.setQnameScope("complexType");
+ * javaWsdlMapping.addJavaXmlTypeMappings(xmlTypeMapping);
+ */
+ return javaWsdlMapping;
+ }
+}
Property changes on: branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/array/CalendarArrayMarshallerTestCase.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/array/CalendarArrayUnmarshallerTestCase.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/array/CalendarArrayUnmarshallerTestCase.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/array/CalendarArrayUnmarshallerTestCase.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -0,0 +1,112 @@
+/*
+ * 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.test.ws.jbossxb.array;
+
+import java.io.ByteArrayInputStream;
+import java.util.Calendar;
+import java.util.GregorianCalendar;
+import java.util.TimeZone;
+
+import javax.xml.namespace.QName;
+
+import org.apache.xerces.xs.XSModel;
+import org.jboss.test.ws.tools.WSToolsTest;
+import org.jboss.ws.utils.DOMUtils;
+import org.jboss.ws.jbossxb.JBossXBConstants;
+import org.jboss.ws.jbossxb.JBossXBUnmarshallerImpl;
+import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping;
+
+/**
+ * Test the JAXB marshalling of array types
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 29-Apr-2005
+ */
+public class CalendarArrayUnmarshallerTestCase extends WSToolsTest
+{
+
+ private static final String TARGET_NAMESPACE = "http://org.jboss.ws/types";
+
+ private static final QName xmlName = new QName(TARGET_NAMESPACE, "arrayOfCalendar", "ns1");
+
+ private static final QName xmlType = new QName(TARGET_NAMESPACE, "CalendarArray", "ns1");
+
+ public void testGenerateSchema() throws Exception
+ {
+ String xsdSchema = generateSchema(xmlType, Calendar[].class);
+
+ String exp = "<schema targetNamespace='http://org.jboss.ws/types' " + SCHEMA_NAMESPACES
+ + " xmlns:tns='http://org.jboss.ws/types'>" + " <complexType name='CalendarArray'>" + " <sequence>"
+ + " <element name='value' type='dateTime' nillable='true' minOccurs='0' maxOccurs='unbounded'/>" + " </sequence>"
+ + " </complexType>" + "</schema>";
+
+ assertEquals(DOMUtils.parse(exp), DOMUtils.parse(xsdSchema));
+ }
+
+ public void testUnmarshallArrayType() throws Exception
+ {
+ XSModel model = generateSchemaXSModel(xmlType, Calendar[].class);
+
+ Calendar[] objArr = null;
+ JBossXBUnmarshallerImpl unmarshaller = new JBossXBUnmarshallerImpl();
+ 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, getJavaWSDLMapping());
+
+ String xml = "<ns1:arrayOfCalendar xmlns:ns1='" + TARGET_NAMESPACE + "'>" + " <value>1968-06-16T14:23:55.000Z</value>"
+ + " <value>1969-07-17T15:24:56.000Z</value>" + " <value>1970-08-18T16:25:57.000Z</value>" + "</ns1:arrayOfCalendar>";
+
+ objArr = (Calendar[]) unmarshaller.unmarshal(new ByteArrayInputStream(xml.getBytes()));
+
+ assertNotNull("Resulting obj array cannot be null", objArr);
+ assertEquals("Unexpected array length", 3, objArr.length);
+
+ Calendar cal1 = new GregorianCalendar(1968, 5, 16, 14, 23, 55);
+ cal1.setTimeZone(TimeZone.getTimeZone("GMT"));
+ Calendar cal2 = new GregorianCalendar(1969, 6, 17, 15, 24, 56);
+ cal2.setTimeZone(TimeZone.getTimeZone("GMT"));
+ Calendar cal3 = new GregorianCalendar(1970, 7, 18, 16, 25, 57);
+ cal3.setTimeZone(TimeZone.getTimeZone("GMT"));
+
+ assertEquals(cal1, objArr[0]);
+ assertEquals(cal2, objArr[1]);
+ assertEquals(cal3, objArr[2]);
+ }
+
+ /**
+ * Setup the required jaxrpc-mapping meta data
+ */
+ private JavaWsdlMapping getJavaWSDLMapping()
+ {
+ JavaWsdlMapping javaWsdlMapping = new JavaWsdlMapping();
+ /*
+ * This mapping should be optional JavaXmlTypeMapping xmlTypeMapping = new
+ * JavaXmlTypeMapping(javaWsdlMapping);
+ * xmlTypeMapping.setJavaType("java.util.Calendar[]");
+ * xmlTypeMapping.setRootTypeQName(xmlType);
+ * xmlTypeMapping.setQnameScope("complexType");
+ * javaWsdlMapping.addJavaXmlTypeMappings(xmlTypeMapping);
+ */
+ return javaWsdlMapping;
+ }
+}
Property changes on: branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/array/CalendarArrayUnmarshallerTestCase.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/array/QNameArrayMarshallerTestCase.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/array/QNameArrayMarshallerTestCase.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/array/QNameArrayMarshallerTestCase.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -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.test.ws.jbossxb.array;
+
+import java.io.StringWriter;
+
+import javax.xml.namespace.QName;
+
+import org.apache.xerces.xs.XSModel;
+import org.jboss.test.ws.tools.WSToolsTest;
+import org.jboss.ws.utils.DOMUtils;
+import org.jboss.ws.jbossxb.JBossXBConstants;
+import org.jboss.ws.jbossxb.JBossXBMarshallerImpl;
+import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping;
+
+/**
+ * Test the JAXB marshalling of array types
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 29-Apr-2005
+ */
+public class QNameArrayMarshallerTestCase extends WSToolsTest
+{
+
+ private static final String TARGET_NAMESPACE = "http://org.jboss.ws/types";
+
+ private static final QName xmlName = new QName(TARGET_NAMESPACE, "arrayOfQName", "ns1");
+
+ private static final QName xmlType = new QName(TARGET_NAMESPACE, "QNameArray", "ns1");
+
+ public void testGenerateSchema() throws Exception
+ {
+ String xsdSchema = generateSchema(xmlType, QName[].class);
+
+ String exp = "<schema targetNamespace='http://org.jboss.ws/types' " + SCHEMA_NAMESPACES
+ + " xmlns:tns='http://org.jboss.ws/types'>" + " <complexType name='QNameArray'>" + " <sequence>"
+ + " <element name='value' type='QName' nillable='true' minOccurs='0' maxOccurs='unbounded'/>" + " </sequence>"
+ + " </complexType>" + "</schema>";
+
+ assertEquals(DOMUtils.parse(exp), DOMUtils.parse(xsdSchema));
+ }
+
+ public void testMarshallArrayType() throws Exception
+ {
+ QName[] objArr = new QName[] { new QName("http://ns2", "local2", "ns2"), new QName("http://ns3", "local3", "ns3"),
+ new QName("http://ns4", "local4", "ns4") };
+
+ XSModel model = generateSchemaXSModel(xmlType, QName[].class);
+
+ StringWriter strwr;
+ JBossXBMarshallerImpl marshaller = new JBossXBMarshallerImpl();
+ marshaller.setProperty(JBossXBConstants.JBXB_XS_MODEL, model);
+ marshaller.setProperty(JBossXBConstants.JBXB_TYPE_QNAME, xmlType);
+ marshaller.setProperty(JBossXBConstants.JBXB_ROOT_QNAME, xmlName);
+ marshaller.setProperty(JBossXBConstants.JBXB_JAVA_MAPPING, getJavaWSDLMapping());
+
+ strwr = new StringWriter();
+ marshaller.marshal(objArr, strwr);
+
+ String was = strwr.toString();
+ assertNotNull("Resulting fragment cannot be null", was);
+ assertTrue("Resulting fragment cannot be empty", was.length() > 0);
+
+ String exp = "<ns1:arrayOfQName xmlns:ns1='" + TARGET_NAMESPACE + "' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>"
+ + " <value xmlns:ns2='http://ns2'>ns2:local2</value>" + " <value xmlns:ns3='http://ns3'>ns3:local3</value>"
+ + " <value xmlns:ns4='http://ns4'>ns4:local4</value>" + "</ns1:arrayOfQName>";
+
+ assertEquals(DOMUtils.parse(exp), DOMUtils.parse(was));
+ }
+
+ /**
+ * Setup the required jaxrpc-mapping meta data
+ */
+ private JavaWsdlMapping getJavaWSDLMapping()
+ {
+ JavaWsdlMapping javaWsdlMapping = new JavaWsdlMapping();
+ /*
+ * This mapping should be optional JavaXmlTypeMapping xmlTypeMapping = new
+ * JavaXmlTypeMapping(javaWsdlMapping);
+ * xmlTypeMapping.setJavaType("javax.xml.namespace.QName[]");
+ * xmlTypeMapping.setRootTypeQName(xmlType);
+ * xmlTypeMapping.setQnameScope("complexType");
+ * javaWsdlMapping.addJavaXmlTypeMappings(xmlTypeMapping);
+ */
+ return javaWsdlMapping;
+ }
+}
Property changes on: branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/array/QNameArrayMarshallerTestCase.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/array/QNameArrayUnmarshallerTestCase.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/array/QNameArrayUnmarshallerTestCase.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/array/QNameArrayUnmarshallerTestCase.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -0,0 +1,102 @@
+/*
+ * 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.test.ws.jbossxb.array;
+
+import java.io.ByteArrayInputStream;
+
+import javax.xml.namespace.QName;
+
+import org.apache.xerces.xs.XSModel;
+import org.jboss.test.ws.tools.WSToolsTest;
+import org.jboss.ws.utils.DOMUtils;
+import org.jboss.ws.jbossxb.JBossXBConstants;
+import org.jboss.ws.jbossxb.JBossXBUnmarshallerImpl;
+import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping;
+
+/**
+ * Test the JAXB marshalling of array types
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 29-Apr-2005
+ */
+public class QNameArrayUnmarshallerTestCase extends WSToolsTest
+{
+
+ private static final String TARGET_NAMESPACE = "http://org.jboss.ws/types";
+
+ private static final QName xmlName = new QName(TARGET_NAMESPACE, "arrayOfQName", "ns1");
+
+ private static final QName xmlType = new QName(TARGET_NAMESPACE, "QNameArray", "ns1");
+
+ public void testGenerateSchema() throws Exception
+ {
+ String xsdSchema = generateSchema(xmlType, QName[].class);
+
+ String exp = "<schema targetNamespace='http://org.jboss.ws/types' " + SCHEMA_NAMESPACES
+ + " xmlns:tns='http://org.jboss.ws/types'>" + " <complexType name='QNameArray'>" + " <sequence>"
+ + " <element name='value' type='QName' nillable='true' minOccurs='0' maxOccurs='unbounded'/>" + " </sequence>"
+ + " </complexType>" + "</schema>";
+
+ assertEquals(DOMUtils.parse(exp), DOMUtils.parse(xsdSchema));
+ }
+
+ public void testUnmarshallArrayType() throws Exception
+ {
+ XSModel model = generateSchemaXSModel(xmlType, QName[].class);
+
+ QName[] objArr = null;
+ JBossXBUnmarshallerImpl unmarshaller = new JBossXBUnmarshallerImpl();
+ 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, getJavaWSDLMapping());
+
+ String xml = "<ns1:arrayOfQName xmlns:ns1='" + TARGET_NAMESPACE + "'>" + " <value xmlns:ns2='http://ns2'>ns2:local2</value>"
+ + " <value xmlns:ns3='http://ns3'>ns3:local3</value>" + " <value xmlns:ns4='http://ns4'>ns4:local4</value>"
+ + "</ns1:arrayOfQName>";
+
+ objArr = (QName[]) unmarshaller.unmarshal(new ByteArrayInputStream(xml.getBytes()));
+
+ assertNotNull("Resulting obj array cannot be null", objArr);
+ assertEquals("Unexpected array length", 3, objArr.length);
+ assertEquals(new QName("http://ns2", "local2"), objArr[0]);
+ assertEquals(new QName("http://ns3", "local3"), objArr[1]);
+ assertEquals(new QName("http://ns4", "local4"), objArr[2]);
+ }
+
+ /**
+ * Setup the required jaxrpc-mapping meta data
+ */
+ private JavaWsdlMapping getJavaWSDLMapping()
+ {
+ JavaWsdlMapping javaWsdlMapping = new JavaWsdlMapping();
+ /*
+ * This mapping should be optional JavaXmlTypeMapping xmlTypeMapping = new
+ * JavaXmlTypeMapping(javaWsdlMapping);
+ * xmlTypeMapping.setJavaType("javax.xml.namespace.QName[]");
+ * xmlTypeMapping.setRootTypeQName(xmlType);
+ * xmlTypeMapping.setQnameScope("complexType");
+ * javaWsdlMapping.addJavaXmlTypeMappings(xmlTypeMapping);
+ */
+ return javaWsdlMapping;
+ }
+}
Property changes on: branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/array/QNameArrayUnmarshallerTestCase.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/complex/Base.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/complex/Base.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/complex/Base.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -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.test.ws.jbossxb.complex;
+
+/**
+ * 5.4 JAX-RPC Value Type
+ *
+ * This section specifies requirements for the JAX-RPC value types.
+ * A JAX-RPC value type is a Java class whose value can be moved between a service
+ * client and service endpoint. A Java class must follow these rules to be a JAX-RPC
+ * conformant value type:
+ *
+ * - Java class must have a public default constructor.
+ *
+ * - Java class must not implement (directly or indirectly) the java.rmi.Remote interface.
+ *
+ * - Java class may implement any Java interface (except the java.rmi.Remote interface) or extend another Java class.
+ *
+ * - Java class may contain public, private, protected, package-level fields. The Java type
+ * of a public field must be a supported JAX-RPC type as specified in the section 5.1,
+ * �JAX-RPC Supported Java Types�.
+ *
+ * - Java class may contain methods. There are no specified restrictions on the nature of
+ * these methods. Refer to the later rule about the JavaBeans properties.
+ *
+ * - Java class may contain static or transient fields.
+ *
+ * - Java class for a JAX-RPC value type may be designed as a JavaBeans class. In this
+ * case, the bean properties (as defined by the JavaBeans introspection) are required to
+ * follow the JavaBeans design pattern of setter and getter methods. The Java type of a
+ * bean property must be a supported JAX-RPC type as specified in the section 5.1,
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 14-Oct-2004
+ */
+public class Base
+{
+ public int a;
+ private int b;
+ private int c;
+
+ public Base()
+ {
+ }
+
+ public int getB()
+ {
+ return b;
+ }
+
+ public void setB(int b)
+ {
+ this.b = b;
+ }
+
+ public void someMethod()
+ {
+ }
+
+ public boolean equals(Object o)
+ {
+ if (this == o) return true;
+ if (!(o instanceof Base)) return false;
+
+ final Base base = (Base)o;
+
+ if (a != base.a) return false;
+ if (b != base.b) return false;
+ if (c != base.c) return false;
+
+ return true;
+ }
+
+ public int hashCode()
+ {
+ int result;
+ result = a;
+ result = 29 * result + b;
+ result = 29 * result + c;
+ return result;
+ }
+
+ public String toString()
+ {
+ return "[a=" + a + ",b=" + b + ",c=" + c + "]";
+ }
+}
\ No newline at end of file
Property changes on: branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/complex/Base.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/complex/ComplexTypeMarshallerGenTestCase.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/complex/ComplexTypeMarshallerGenTestCase.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/complex/ComplexTypeMarshallerGenTestCase.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -0,0 +1,45 @@
+/*
+ * 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.test.ws.jbossxb.complex;
+
+import org.apache.xerces.xs.XSModel;
+import org.jboss.logging.Logger;
+
+import javax.xml.namespace.QName;
+
+/**
+ * Test the JAXB marshalling of complex types with generation fo the schema for these types
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 03-Dec-2004
+ */
+public class ComplexTypeMarshallerGenTestCase extends ComplexTypeMarshallerTestCase
+{
+ // provide logging
+ private static final Logger log = Logger.getLogger(ComplexTypeMarshallerGenTestCase.class);
+
+ protected XSModel getSchemaModel(QName xmlType, Class javaType) throws Exception
+ {
+ log.debug(generateSchema(xmlType, javaType));
+ return generateSchemaXSModel(xmlType, javaType);
+ }
+}
Property changes on: branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/complex/ComplexTypeMarshallerGenTestCase.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/complex/ComplexTypeMarshallerTestCase.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/complex/ComplexTypeMarshallerTestCase.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/complex/ComplexTypeMarshallerTestCase.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -0,0 +1,185 @@
+/*
+ * 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.test.ws.jbossxb.complex;
+
+import java.io.File;
+import java.io.StringWriter;
+import java.math.BigInteger;
+import java.net.URL;
+
+import javax.xml.namespace.QName;
+
+import org.apache.xerces.xs.XSModel;
+import org.jboss.test.ws.tools.WSToolsTest;
+import org.jboss.ws.utils.DOMUtils;
+import org.jboss.ws.jbossxb.JBossXBConstants;
+import org.jboss.ws.jbossxb.JBossXBMarshallerImpl;
+import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping;
+import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMappingFactory;
+
+/**
+ * Test the JAXB marshalling of complex types
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 18-Oct-2004
+ */
+public class ComplexTypeMarshallerTestCase extends WSToolsTest
+{
+
+ private static final String TARGET_NAMESPACE = "http://org.jboss.ws/types";
+
+ /** Get the URL to the defining schema */
+ protected XSModel getSchemaModel(QName xmlType, Class javaType) throws Exception
+ {
+ File xsdFile = new File("resources/jbossxb/ComplexTypesService_RPC.xsd");
+ assertTrue(xsdFile.exists());
+
+ return parseSchema(xsdFile.toURL());
+ }
+
+ public void testBaseType() throws Exception
+ {
+ Base obj = new Base();
+ obj.a = 100;
+ obj.setB(200);
+
+ QName xmlName = new QName(TARGET_NAMESPACE, "Base_1", "ns1");
+ QName xmlType = new QName(TARGET_NAMESPACE, "Base", "ns1");
+
+ XSModel model = getSchemaModel(xmlType, Base.class);
+
+ StringWriter strwr;
+ JBossXBMarshallerImpl marshaller = new JBossXBMarshallerImpl();
+ marshaller.setProperty(JBossXBConstants.JBXB_XS_MODEL, model);
+ marshaller.setProperty(JBossXBConstants.JBXB_ROOT_QNAME, xmlName);
+ marshaller.setProperty(JBossXBConstants.JBXB_TYPE_QNAME, xmlType);
+ marshaller.setProperty(JBossXBConstants.JBXB_JAVA_MAPPING, getJavaWSDLMapping());
+
+ strwr = new StringWriter();
+ marshaller.marshal(obj, strwr);
+
+ String exp =
+ "<ns1:Base_1 xmlns:ns1='" + TARGET_NAMESPACE + "' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>" +
+ " <a>100</a>" +
+ " <b>200</b>" +
+ "</ns1:Base_1>";
+
+ String was = strwr.toString();
+ assertEquals(DOMUtils.parse(exp), DOMUtils.parse(was));
+ }
+
+ public void testDerivedType() throws Exception
+ {
+ Derived obj = new Derived();
+ obj.a = 100;
+ obj.setB(200);
+ obj.x = 300;
+
+ QName xmlName = new QName(TARGET_NAMESPACE, "Derived_1", "ns1");
+ QName xmlType = new QName(TARGET_NAMESPACE, "Derived", "ns1");
+
+ XSModel model = getSchemaModel(xmlType, Derived.class);
+
+ StringWriter strwr;
+ JBossXBMarshallerImpl marshaller = new JBossXBMarshallerImpl();
+ marshaller.setProperty(JBossXBConstants.JBXB_XS_MODEL, model);
+ marshaller.setProperty(JBossXBConstants.JBXB_ROOT_QNAME, xmlName);
+ marshaller.setProperty(JBossXBConstants.JBXB_TYPE_QNAME, xmlType);
+ marshaller.setProperty(JBossXBConstants.JBXB_JAVA_MAPPING, getJavaWSDLMapping());
+
+ strwr = new StringWriter();
+ marshaller.marshal(obj, strwr);
+
+ String exp =
+ "<ns1:Derived_1 xmlns:ns1='" + TARGET_NAMESPACE + "' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>" +
+ " <a>100</a>" +
+ " <b>200</b>" +
+ " <x>300</x>" +
+ "</ns1:Derived_1>";
+
+ String was = strwr.toString();
+ assertEquals(DOMUtils.parse(exp), DOMUtils.parse(was));
+ }
+
+ public void testCompositeType() throws Exception
+ {
+ QName xmlName = new QName(TARGET_NAMESPACE, "CompositeType_1", "ns1");
+ QName xmlType = new QName(TARGET_NAMESPACE, "Composite", "ns1");
+
+ Composite obj = new Composite();
+ obj.integer = new BigInteger("100");
+ obj.string = "Hello World!";
+ obj.composite = null;
+ obj.dateTime = null;
+ obj.qname = null;
+
+ Composite sub = new Composite();
+ sub.integer = new BigInteger("200");
+ sub.string = "Hello Sub World!";
+ obj.composite = null;
+ sub.dateTime = null;
+ sub.qname = null;
+
+ obj.composite = sub;
+
+ XSModel model = getSchemaModel(xmlType, Composite.class);
+
+ StringWriter strwr;
+ JBossXBMarshallerImpl marshaller = new JBossXBMarshallerImpl();
+ marshaller.setProperty(JBossXBConstants.JBXB_XS_MODEL, model);
+ marshaller.setProperty(JBossXBConstants.JBXB_ROOT_QNAME, xmlName);
+ marshaller.setProperty(JBossXBConstants.JBXB_TYPE_QNAME, xmlType);
+ marshaller.setProperty(JBossXBConstants.JBXB_JAVA_MAPPING, getJavaWSDLMapping());
+
+ strwr = new StringWriter();
+ marshaller.marshal(obj, strwr);
+
+ String exp =
+ "<ns1:CompositeType_1 xmlns:ns1='" + TARGET_NAMESPACE + "' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>" +
+ " <composite>" +
+ " <composite xsi:nil='1'/>" +
+ " <dateTime xsi:nil='1'/>" +
+ " <integer>200</integer>" +
+ " <qname xsi:nil='1'/>" +
+ " <string>Hello Sub World!</string>" +
+ " </composite>" +
+ " <dateTime xsi:nil='1'/>" +
+ " <integer>100</integer>" +
+ " <qname xsi:nil='1'/>" +
+ " <string>Hello World!</string>" +
+ "</ns1:CompositeType_1>";
+
+ String was = strwr.toString();
+ assertEquals(DOMUtils.parse(exp), DOMUtils.parse(was));
+ }
+
+ /**
+ * Setup the required jaxrpc-mapping meta data
+ */
+ private JavaWsdlMapping getJavaWSDLMapping() throws Exception
+ {
+ JavaWsdlMappingFactory factory = JavaWsdlMappingFactory.newInstance();
+ URL mappingURL = new File("resources/jbossxb/ComplexTypesService_RPC.xml").toURL();
+ JavaWsdlMapping javaWsdlMapping = factory.parse(mappingURL);
+ return javaWsdlMapping;
+ }
+}
Property changes on: branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/complex/ComplexTypeMarshallerTestCase.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/complex/ComplexTypeUnmarshallerGenTestCase.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/complex/ComplexTypeUnmarshallerGenTestCase.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/complex/ComplexTypeUnmarshallerGenTestCase.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -0,0 +1,45 @@
+/*
+ * 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.test.ws.jbossxb.complex;
+
+import org.apache.xerces.xs.XSModel;
+import org.jboss.logging.Logger;
+
+import javax.xml.namespace.QName;
+
+/**
+ * Test the JAXB unmarshalling of complex types with generation fo the schema for these types
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 03-Dec-2004
+ */
+public class ComplexTypeUnmarshallerGenTestCase extends ComplexTypeUnmarshallerTestCase
+{
+ // provide logging
+ private static final Logger log = Logger.getLogger(ComplexTypeUnmarshallerGenTestCase.class);
+
+ /** Get the URL to the defining schema */
+ protected XSModel getSchemaModel(QName xmlType, Class javaType) throws Exception
+ {
+ return generateSchemaXSModel(xmlType, javaType);
+ }
+}
Property changes on: branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/complex/ComplexTypeUnmarshallerGenTestCase.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/complex/ComplexTypeUnmarshallerTestCase.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/complex/ComplexTypeUnmarshallerTestCase.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/complex/ComplexTypeUnmarshallerTestCase.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -0,0 +1,170 @@
+/*
+ * 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.test.ws.jbossxb.complex;
+
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.math.BigInteger;
+import java.net.URL;
+
+import javax.xml.namespace.QName;
+
+import org.apache.xerces.xs.XSModel;
+import org.jboss.test.ws.tools.WSToolsTest;
+import org.jboss.ws.jbossxb.JBossXBConstants;
+import org.jboss.ws.jbossxb.JBossXBUnmarshallerImpl;
+import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping;
+import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMappingFactory;
+import org.jboss.ws.tools.JavaToXSD;
+
+/**
+ * Test the JAXB unmarshalling of complex types
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 18-Oct-2004
+ */
+public class ComplexTypeUnmarshallerTestCase extends WSToolsTest
+{
+
+ private static final String TARGET_NAMESPACE = "http://org.jboss.ws/types";
+
+ /** Get the URL to the defining schema */
+ protected XSModel getSchemaModel(QName xmlType, Class javaType) throws Exception
+ {
+ File xsdFile = new File("resources/jbossxb/ComplexTypesService_RPC.xsd");
+ assertTrue(xsdFile.exists());
+
+ return new JavaToXSD().parseSchema(xsdFile.toURL());
+ }
+
+
+ public void testBaseType() throws Exception
+ {
+ String xmlStr = "" + "<ns1:Base_1 xmlns:ns1='" + TARGET_NAMESPACE + "'>" + " <a>100</a>" + " <b>200</b>" + "</ns1:Base_1>";
+
+ QName xmlName = new QName(TARGET_NAMESPACE, "Base_1");
+ QName xmlType = new QName(TARGET_NAMESPACE, "Base");
+
+ XSModel model = getSchemaModel(xmlType, Base.class);
+
+ Base exp = new Base();
+ exp.a = 100;
+ exp.setB(200);
+
+ JBossXBUnmarshallerImpl unmarshaller = new JBossXBUnmarshallerImpl();
+ unmarshaller.setProperty(JBossXBConstants.JBXB_XS_MODEL, model);
+ unmarshaller.setProperty(JBossXBConstants.JBXB_JAVA_MAPPING, getJavaWSDLMapping());
+ unmarshaller.setProperty(JBossXBConstants.JBXB_TYPE_QNAME, xmlType);
+ unmarshaller.setProperty(JBossXBConstants.JBXB_ROOT_QNAME, xmlName);
+
+ Object obj = unmarshaller.unmarshal(new ByteArrayInputStream(xmlStr.getBytes()));
+ assertTrue("Unexpected return type: " + obj.getClass().getName(), obj instanceof Base);
+ assertEquals(exp, obj);
+ }
+
+ public void testDerivedType() throws Exception
+ {
+ String xmlStr = "<ns1:Derived_1 xmlns:ns1='" + TARGET_NAMESPACE + "'>" + " <a>100</a>" + " <b>200</b>" + " <x>300</x>"
+ + "</ns1:Derived_1>";
+
+ Derived exp = new Derived();
+ exp.a = 100;
+ exp.setB(200);
+ exp.x = 300;
+
+ QName xmlName = new QName(TARGET_NAMESPACE, "Derived_1", "ns1");
+ QName xmlType = new QName(TARGET_NAMESPACE, "Derived", "ns1");
+
+ XSModel model = getSchemaModel(xmlType, Derived.class);
+
+ JBossXBUnmarshallerImpl unmarshaller = new JBossXBUnmarshallerImpl();
+ unmarshaller.setProperty(JBossXBConstants.JBXB_XS_MODEL, model);
+ unmarshaller.setProperty(JBossXBConstants.JBXB_JAVA_MAPPING, getJavaWSDLMapping());
+ unmarshaller.setProperty(JBossXBConstants.JBXB_TYPE_QNAME, xmlType);
+ unmarshaller.setProperty(JBossXBConstants.JBXB_ROOT_QNAME, xmlName);
+
+ Object obj = unmarshaller.unmarshal(new ByteArrayInputStream(xmlStr.getBytes()));
+ assertNotNull("Unexpected null object", obj);
+ assertTrue("Unexpected return type: " + obj.getClass().getName(), obj instanceof Derived);
+ assertEquals(exp, obj);
+ }
+
+ public void testCompositeType() throws Exception
+ {
+ String xmlStr = "<ns1:CompositeType_1 xmlns:ns1='" + TARGET_NAMESPACE
+ + "' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>" +
+ " <composite>" +
+ " <composite xsi:nil='1'/>" +
+ " <dateTime xsi:nil='1'/>" +
+ " <integer>200</integer>" +
+ " <qname xsi:nil='1'/>" +
+ " <string>Hello Sub World!</string>" +
+ " </composite>" +
+ " <dateTime xsi:nil='1'/>" +
+ " <integer>100</integer>" +
+ " <qname xsi:nil='1'/>" +
+ " <string>Hello World!</string>" +
+ "</ns1:CompositeType_1>";
+
+ QName xmlName = new QName(TARGET_NAMESPACE, "CompositeType_1", "ns1");
+ QName xmlType = new QName(TARGET_NAMESPACE, "Composite", "ns1");
+
+ XSModel model = getSchemaModel(xmlType, Composite.class);
+
+ Composite exp = new Composite();
+ exp.integer = new BigInteger("100");
+ exp.string = "Hello World!";
+ exp.dateTime = null;
+ exp.qname = null;
+
+ Composite sub = new Composite();
+ sub.integer = new BigInteger("200");
+ sub.string = "Hello Sub World!";
+ sub.composite = null;
+ sub.dateTime = null;
+ sub.qname = null;
+
+ exp.composite = sub;
+
+ JBossXBUnmarshallerImpl unmarshaller = new JBossXBUnmarshallerImpl();
+ unmarshaller.setProperty(JBossXBConstants.JBXB_XS_MODEL, model);
+ unmarshaller.setProperty(JBossXBConstants.JBXB_JAVA_MAPPING, getJavaWSDLMapping());
+ unmarshaller.setProperty(JBossXBConstants.JBXB_TYPE_QNAME, xmlType);
+ unmarshaller.setProperty(JBossXBConstants.JBXB_ROOT_QNAME, xmlName);
+
+ Object obj = unmarshaller.unmarshal(new ByteArrayInputStream(xmlStr.getBytes()));
+ assertNotNull("Unexpected null object", obj);
+ assertTrue("Unexpected return type: " + obj.getClass().getName(), obj instanceof Composite);
+ assertEquals(exp, obj);
+ }
+
+ /**
+ * Setup the required jaxrpc-mapping meta data
+ */
+ private JavaWsdlMapping getJavaWSDLMapping() throws Exception
+ {
+ JavaWsdlMappingFactory factory = JavaWsdlMappingFactory.newInstance();
+ URL mappingURL = new File("resources/jbossxb/ComplexTypesService_RPC.xml").toURL();
+ JavaWsdlMapping javaWsdlMapping = factory.parse(mappingURL);
+ return javaWsdlMapping;
+ }
+}
Property changes on: branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/complex/ComplexTypeUnmarshallerTestCase.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/complex/ComplexTypes.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/complex/ComplexTypes.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/complex/ComplexTypes.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -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.test.ws.jbossxb.complex;
+
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+
+
+/**
+ * An SEI for complex types
+ *
+ * See jaxrpc-1.1 (5.3.1)
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 14-Oct-2004
+ */
+public interface ComplexTypes extends Remote
+{
+ Base echoBase(Base v) throws RemoteException;
+
+ Derived echoDerived(Derived v) throws RemoteException;
+
+ Composite echoCompositeType(Composite v) throws RemoteException;
+}
Property changes on: branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/complex/ComplexTypes.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/complex/Composite.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/complex/Composite.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/complex/Composite.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -0,0 +1,99 @@
+/*
+ * 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.test.ws.jbossxb.complex;
+
+import javax.xml.namespace.QName;
+import java.math.BigInteger;
+import java.util.Calendar;
+
+/**
+ * The composite complexType
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 14-Oct-2004
+ */
+public class Composite
+{
+ public BigInteger integer;
+ public Calendar dateTime;
+ public String string;
+ public QName qname;
+ public Composite composite;
+
+ public Composite()
+ {
+ }
+
+ public String toString()
+ {
+ return "[composite integer=" + integer + ", dateTime=" + dateTime + ", string=" + string + ", qname=" + qname +
+ ", composite=" + composite + "]";
+ }
+
+ public boolean equals(Object o)
+ {
+ if (this == o)
+ {
+ return true;
+ }
+ if (!(o instanceof Composite))
+ {
+ return false;
+ }
+
+ final Composite composite1 = (Composite)o;
+
+ if (composite != null ? !composite.equals(composite1.composite) : composite1.composite != null)
+ {
+ return false;
+ }
+ if (dateTime != null ? !dateTime.equals(composite1.dateTime) : composite1.dateTime != null)
+ {
+ return false;
+ }
+ if (integer != null ? !integer.equals(composite1.integer) : composite1.integer != null)
+ {
+ return false;
+ }
+ if (qname != null ? !qname.equals(composite1.qname) : composite1.qname != null)
+ {
+ return false;
+ }
+ if (string != null ? !string.equals(composite1.string) : composite1.string != null)
+ {
+ return false;
+ }
+
+ return true;
+ }
+
+ public int hashCode()
+ {
+ int result;
+ result = (integer != null ? integer.hashCode() : 0);
+ result = 29 * result + (dateTime != null ? dateTime.hashCode() : 0);
+ result = 29 * result + (string != null ? string.hashCode() : 0);
+ result = 29 * result + (qname != null ? qname.hashCode() : 0);
+ result = 29 * result + (composite != null ? composite.hashCode() : 0);
+ return result;
+ }
+}
\ No newline at end of file
Property changes on: branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/complex/Composite.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/complex/Derived.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/complex/Derived.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/complex/Derived.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -0,0 +1,69 @@
+/*
+ * 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.test.ws.jbossxb.complex;
+
+
+
+/**
+ * A derived complexType
+ *
+ * See jaxrpc-1.1 (5.4)
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 14-Oct-2004
+ */
+public class Derived extends Base
+{
+ public int x;
+ private int y;
+
+ public Derived()
+ {
+ }
+
+ public boolean equals(Object o)
+ {
+ if (this == o) return true;
+ if (!(o instanceof Derived)) return false;
+ if (!super.equals(o)) return false;
+
+ final Derived derived = (Derived)o;
+
+ if (x != derived.x) return false;
+ if (y != derived.y) return false;
+
+ return true;
+ }
+
+ public int hashCode()
+ {
+ int result = super.hashCode();
+ result = 29 * result + x;
+ result = 29 * result + y;
+ return result;
+ }
+
+ public String toString()
+ {
+ return "[a=" + a + ",b=" + getB() + ",x=" + x + ",y=" + y + "]";
+ }
+}
\ No newline at end of file
Property changes on: branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/complex/Derived.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/docstyle/DocumentStyleMarshallerTestCase.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/docstyle/DocumentStyleMarshallerTestCase.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/docstyle/DocumentStyleMarshallerTestCase.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -0,0 +1,99 @@
+/*
+ * 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.test.ws.jbossxb.docstyle;
+
+import java.io.File;
+import java.io.StringWriter;
+import java.net.URL;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+import org.apache.xerces.xs.XSModel;
+import org.jboss.test.ws.tools.WSToolsTest;
+import org.jboss.ws.utils.DOMUtils;
+import org.jboss.ws.jbossxb.JBossXBConstants;
+import org.jboss.ws.jbossxb.JBossXBMarshallerImpl;
+import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping;
+import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMappingFactory;
+
+/**
+ * Test the JAXB marshalling of complex types
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 18-Oct-2004
+ */
+public class DocumentStyleMarshallerTestCase extends WSToolsTest
+{
+
+ private static final String TARGET_NAMESPACE = "http://org.jboss.ws/jaxrpc/types";
+
+ protected XSModel getSchemaModel() throws Exception
+ {
+ File xsdFile = new File("resources/jbossxb/DocumentStyle.xsd");
+ assertTrue(xsdFile.exists());
+
+ return parseSchema(xsdFile.toURL());
+ }
+
+ /** Release the schema URL, used for removing temp files */
+ protected void releaseSchemaLocations(Map xsdURLMap)
+ {
+ }
+
+ public void testEchoStringRequest() throws Exception
+ {
+ EchoString_RequestStruct req = new EchoString_RequestStruct("Hello", "world!");
+
+ QName xmlName = new QName(TARGET_NAMESPACE, "echoString", "ns1");
+ QName xmlType = new QName(TARGET_NAMESPACE, "echoString", "ns1");
+
+ XSModel model = getSchemaModel();
+
+ StringWriter strwr;
+ JBossXBMarshallerImpl marshaller = new JBossXBMarshallerImpl();
+ marshaller.setProperty(JBossXBConstants.JBXB_XS_MODEL, model);
+ marshaller.setProperty(JBossXBConstants.JBXB_ROOT_QNAME, xmlName);
+ marshaller.setProperty(JBossXBConstants.JBXB_TYPE_QNAME, xmlType);
+ marshaller.setProperty(JBossXBConstants.JBXB_JAVA_MAPPING, getJavaWSDLMapping());
+
+ strwr = new StringWriter();
+ marshaller.marshal(req, strwr);
+
+ String exp = "<ns1:echoString xmlns:ns1='" + TARGET_NAMESPACE + "' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>"
+ + " <String_1>Hello</String_1>" + " <String_2>world!</String_2>" + "</ns1:echoString>";
+ String was = strwr.toString();
+
+ assertEquals(DOMUtils.parse(exp), DOMUtils.parse(was));
+ }
+
+ /**
+ * Setup the required jaxrpc-mapping meta data
+ */
+ private JavaWsdlMapping getJavaWSDLMapping() throws Exception
+ {
+ JavaWsdlMappingFactory factory = JavaWsdlMappingFactory.newInstance();
+ URL mappingURL = new File("resources/jbossxb/DocumentStyle.xml").toURL();
+ JavaWsdlMapping javaWsdlMapping = factory.parse(mappingURL);
+ return javaWsdlMapping;
+ }
+}
Property changes on: branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/docstyle/DocumentStyleMarshallerTestCase.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/docstyle/DocumentStyleUnmarshallerTestCase.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/docstyle/DocumentStyleUnmarshallerTestCase.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/docstyle/DocumentStyleUnmarshallerTestCase.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -0,0 +1,90 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.ws.jbossxb.docstyle;
+
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.net.URL;
+
+import javax.xml.namespace.QName;
+
+import org.apache.xerces.xs.XSModel;
+import org.jboss.test.ws.tools.WSToolsTest;
+import org.jboss.ws.jbossxb.JBossXBConstants;
+import org.jboss.ws.jbossxb.JBossXBUnmarshallerImpl;
+import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping;
+import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMappingFactory;
+
+/**
+ * Test the JAXB unmarshalling of complex types
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 18-Oct-2004
+ */
+public class DocumentStyleUnmarshallerTestCase extends WSToolsTest
+{
+
+ private static final String TARGET_NAMESPACE = "http://org.jboss.ws/jaxrpc/types";
+
+ protected XSModel getSchemaModel() throws Exception
+ {
+ File xsdFile = new File("resources/jbossxb/DocumentStyle.xsd");
+ assertTrue(xsdFile.exists());
+
+ return parseSchema(xsdFile.toURL());
+ }
+
+ public void testEchoStringRequest() throws Exception
+ {
+ String xmlStr = "" + "<ns1:echoString xmlns:ns1='" + TARGET_NAMESPACE
+ + "' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>" + " <String_1>Hello</String_1>"
+ + " <String_2>world!</String_2>" + "</ns1:echoString>";
+
+ QName xmlName = new QName(TARGET_NAMESPACE, "echoString");
+ QName xmlType = new QName(TARGET_NAMESPACE, "echoString");
+
+ XSModel model = getSchemaModel();
+
+ EchoString_RequestStruct exp = new EchoString_RequestStruct("Hello", "world!");
+
+ JBossXBUnmarshallerImpl unmarshaller = new JBossXBUnmarshallerImpl();
+ unmarshaller.setProperty(JBossXBConstants.JBXB_XS_MODEL, model);
+ unmarshaller.setProperty(JBossXBConstants.JBXB_JAVA_MAPPING, getJavaWSDLMapping());
+ unmarshaller.setProperty(JBossXBConstants.JBXB_TYPE_QNAME, xmlType);
+ unmarshaller.setProperty(JBossXBConstants.JBXB_ROOT_QNAME, xmlName);
+
+ Object obj = unmarshaller.unmarshal(new ByteArrayInputStream(xmlStr.getBytes()));
+
+ assertEquals(exp, obj);
+ }
+
+ /**
+ * Setup the required jaxrpc-mapping meta data
+ */
+ private JavaWsdlMapping getJavaWSDLMapping() throws Exception
+ {
+ JavaWsdlMappingFactory factory = JavaWsdlMappingFactory.newInstance();
+ URL mappingURL = new File("resources/jbossxb/DocumentStyle.xml").toURL();
+ JavaWsdlMapping javaWsdlMapping = factory.parse(mappingURL);
+ return javaWsdlMapping;
+ }
+}
Property changes on: branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/docstyle/DocumentStyleUnmarshallerTestCase.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/docstyle/EchoString_RequestStruct.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/docstyle/EchoString_RequestStruct.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/docstyle/EchoString_RequestStruct.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -0,0 +1,89 @@
+// This class was generated by the JAXRPC SI, do not edit.
+// Contents subject to change without notice.
+// JAX-RPC Standard Implementation (1.1.2_01, build R40)
+
+/*
+ * 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.test.ws.jbossxb.docstyle;
+
+
+public class EchoString_RequestStruct
+{
+ protected String String_1;
+ protected String String_2;
+
+ public EchoString_RequestStruct()
+ {
+ }
+
+ public EchoString_RequestStruct(String String_1, String String_2)
+ {
+ this.String_1 = String_1;
+ this.String_2 = String_2;
+ }
+
+ public String getString_1()
+ {
+ return String_1;
+ }
+
+ public void setString_1(String String_1)
+ {
+ this.String_1 = String_1;
+ }
+
+ public String getString_2()
+ {
+ return String_2;
+ }
+
+ public void setString_2(String String_2)
+ {
+ this.String_2 = String_2;
+ }
+
+ public boolean equals(Object o)
+ {
+ if (this == o) return true;
+ if (!(o instanceof EchoString_RequestStruct)) return false;
+
+ final EchoString_RequestStruct echoString_requestStruct = (EchoString_RequestStruct)o;
+
+ if (String_1 != null ? !String_1.equals(echoString_requestStruct.String_1) : echoString_requestStruct.String_1 != null) return false;
+ if (String_2 != null ? !String_2.equals(echoString_requestStruct.String_2) : echoString_requestStruct.String_2 != null) return false;
+
+ return true;
+ }
+
+ public int hashCode()
+ {
+ int result;
+ result = (String_1 != null ? String_1.hashCode() : 0);
+ result = 29 * result + (String_2 != null ? String_2.hashCode() : 0);
+ return result;
+ }
+
+ public String toString()
+ {
+ return "[String_1=" + String_1 + ",String_2=" + String_2 + "]";
+ }
+}
Property changes on: branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/docstyle/EchoString_RequestStruct.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/docstyle/EchoString_ResponseStruct.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/docstyle/EchoString_ResponseStruct.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/docstyle/EchoString_ResponseStruct.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -0,0 +1,73 @@
+// This class was generated by the JAXRPC SI, do not edit.
+// Contents subject to change without notice.
+// JAX-RPC Standard Implementation (1.1.2_01, build R40)
+
+/*
+ * 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.test.ws.jbossxb.docstyle;
+
+
+public class EchoString_ResponseStruct
+{
+ protected String result;
+
+ public EchoString_ResponseStruct()
+ {
+ }
+
+ public EchoString_ResponseStruct(String result)
+ {
+ this.result = result;
+ }
+
+ public String getResult()
+ {
+ return result;
+ }
+
+ public void setResult(String result)
+ {
+ this.result = result;
+ }
+
+ public boolean equals(Object o)
+ {
+ if (this == o) return true;
+ if (!(o instanceof EchoString_ResponseStruct)) return false;
+
+ final EchoString_ResponseStruct echoString_responseStruct = (EchoString_ResponseStruct)o;
+
+ if (result != null ? !result.equals(echoString_responseStruct.result) : echoString_responseStruct.result != null) return false;
+
+ return true;
+ }
+
+ public int hashCode()
+ {
+ return (result != null ? result.hashCode() : 0);
+ }
+
+ public String toString()
+ {
+ return "[result=" + result + "]";
+ }
+}
Property changes on: branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/docstyle/EchoString_ResponseStruct.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/holders/HoldersServiceInterface.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/holders/HoldersServiceInterface.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/holders/HoldersServiceInterface.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -0,0 +1,35 @@
+/*
+ * 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.test.ws.jbossxb.holders;
+
+import java.rmi.Remote;
+
+/**
+ * A Java SEI that includes Standard jaxrpc holders
+ * @author <mailto:Anil.Saldhana at jboss.org>Anil Saldhana
+ * @since Aug 2, 2005
+ */
+public interface HoldersServiceInterface extends Remote
+{
+ public javax.xml.rpc.holders.FloatHolder processHolder( javax.xml.rpc.holders.CalendarHolder id,
+ javax.xml.rpc.holders.IntHolder amount) throws java.rmi.RemoteException;
+}
Property changes on: branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/holders/HoldersServiceInterface.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/multixsd/Order.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/multixsd/Order.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/multixsd/Order.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -0,0 +1,81 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.ws.jbossxb.multixsd;
+
+import org.jboss.test.ws.jbossxb.multixsd.packa.Person;
+import org.jboss.test.ws.jbossxb.multixsd.packb.Item;
+
+public class Order
+{
+ private Person person;
+ private Item item;
+
+ public Order()
+ {
+ }
+
+ public Order(Person person, Item item)
+ {
+ this.person = person;
+ this.item = item;
+ }
+
+
+ public Item getItem()
+ {
+ return item;
+ }
+
+ public void setItem(Item item)
+ {
+ this.item = item;
+ }
+
+ public Person getPerson()
+ {
+ return person;
+ }
+
+ public void setPerson(Person person)
+ {
+ this.person = person;
+ }
+
+ public boolean equals(Object obj)
+ {
+ if (this == obj) return true;
+ if (!(obj instanceof Order)) return false;
+
+ final Order o = (Order)obj;
+ return toString().equals(o.toString());
+ }
+
+ public int hashCode()
+ {
+ return toString().hashCode();
+ }
+
+ public String toString()
+ {
+ return "[person=" + person + ",item=" + item + "]";
+ }
+}
\ No newline at end of file
Property changes on: branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/multixsd/Order.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/multixsd/packa/Person.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/multixsd/packa/Person.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/multixsd/packa/Person.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -0,0 +1,66 @@
+/*
+ * 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.test.ws.jbossxb.multixsd.packa;
+
+
+public class Person
+{
+ public String name;
+
+ public Person()
+ {
+ }
+
+ public Person(String name)
+ {
+ this.name = name;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ public boolean equals(Object o)
+ {
+ if (this == o) return true;
+ if (!(o instanceof Person)) return false;
+
+ final Person p = (Person)o;
+ return toString().equals(p.toString());
+ }
+
+ public int hashCode()
+ {
+ return toString().hashCode();
+ }
+
+ public String toString()
+ {
+ return "[name=" + name + "]";
+ }
+}
\ No newline at end of file
Property changes on: branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/multixsd/packa/Person.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/multixsd/packb/Item.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/multixsd/packb/Item.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/multixsd/packb/Item.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -0,0 +1,69 @@
+/*
+ * 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.test.ws.jbossxb.multixsd.packb;
+
+
+public class Item
+{
+ public String name;
+
+ public Item()
+ {
+ }
+
+ public Item(String name)
+ {
+ this.name = name;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ public boolean equals(Object o)
+ {
+ if (this == o) return true;
+ if (!(o instanceof Item)) return false;
+
+ final Item p = (Item)o;
+ if (name == null && p.name == null) return true;
+ if (name != null && name.equals(p.name)) return true;
+
+ return false;
+ }
+
+ public int hashCode()
+ {
+ return toString().hashCode();
+ }
+
+ public String toString()
+ {
+ return "[name=" + name + "]";
+ }
+}
\ No newline at end of file
Property changes on: branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/multixsd/packb/Item.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/simple/EchoSimpleUserType_RequestStruct.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/simple/EchoSimpleUserType_RequestStruct.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/simple/EchoSimpleUserType_RequestStruct.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -0,0 +1,90 @@
+// This class was generated by the JAXRPC SI, do not edit.
+// Contents subject to change without notice.
+// JAX-RPC Standard Implementation (1.1.2_01, build R40)
+
+/*
+ * 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.test.ws.jbossxb.simple;
+
+
+
+public class EchoSimpleUserType_RequestStruct
+{
+ protected String String_1;
+ protected SimpleUserType SimpleUserType_2;
+
+ public EchoSimpleUserType_RequestStruct()
+ {
+ }
+
+ public EchoSimpleUserType_RequestStruct(String String_1, SimpleUserType SimpleUserType_2)
+ {
+ this.String_1 = String_1;
+ this.SimpleUserType_2 = SimpleUserType_2;
+ }
+
+ public String getString_1()
+ {
+ return String_1;
+ }
+
+ public void setString_1(String String_1)
+ {
+ this.String_1 = String_1;
+ }
+
+ public SimpleUserType getSimpleUserType_2()
+ {
+ return SimpleUserType_2;
+ }
+
+ public void setSimpleUserType_2(SimpleUserType SimpleUserType_2)
+ {
+ this.SimpleUserType_2 = SimpleUserType_2;
+ }
+
+ public boolean equals(Object o)
+ {
+ if (this == o) return true;
+ if (!(o instanceof EchoSimpleUserType_RequestStruct)) return false;
+
+ final EchoSimpleUserType_RequestStruct echoSimpleUserType_requestStruct = (EchoSimpleUserType_RequestStruct)o;
+
+ if (SimpleUserType_2 != null ? !SimpleUserType_2.equals(echoSimpleUserType_requestStruct.SimpleUserType_2) : echoSimpleUserType_requestStruct.SimpleUserType_2 != null) return false;
+ if (String_1 != null ? !String_1.equals(echoSimpleUserType_requestStruct.String_1) : echoSimpleUserType_requestStruct.String_1 != null) return false;
+
+ return true;
+ }
+
+ public int hashCode()
+ {
+ int result;
+ result = (String_1 != null ? String_1.hashCode() : 0);
+ result = 29 * result + (SimpleUserType_2 != null ? SimpleUserType_2.hashCode() : 0);
+ return result;
+ }
+
+ public String toString()
+ {
+ return "[String_1=" + String_1 + ",SimpleUserType_2=" + SimpleUserType_2 + "]";
+ }
+}
Property changes on: branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/simple/EchoSimpleUserType_RequestStruct.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/simple/EchoSimpleUserType_ResponseStruct.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/simple/EchoSimpleUserType_ResponseStruct.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/simple/EchoSimpleUserType_ResponseStruct.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -0,0 +1,74 @@
+// This class was generated by the JAXRPC SI, do not edit.
+// Contents subject to change without notice.
+// JAX-RPC Standard Implementation (1.1.2_01, build R40)
+
+/*
+ * 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.test.ws.jbossxb.simple;
+
+
+
+public class EchoSimpleUserType_ResponseStruct
+{
+ protected SimpleUserType result;
+
+ public EchoSimpleUserType_ResponseStruct()
+ {
+ }
+
+ public EchoSimpleUserType_ResponseStruct(SimpleUserType result)
+ {
+ this.result = result;
+ }
+
+ public SimpleUserType getResult()
+ {
+ return result;
+ }
+
+ public void setResult(SimpleUserType result)
+ {
+ this.result = result;
+ }
+
+ public boolean equals(Object o)
+ {
+ if (this == o) return true;
+ if (!(o instanceof EchoSimpleUserType_ResponseStruct)) return false;
+
+ final EchoSimpleUserType_ResponseStruct echoSimpleUserType_responseStruct = (EchoSimpleUserType_ResponseStruct)o;
+
+ if (result != null ? !result.equals(echoSimpleUserType_responseStruct.result) : echoSimpleUserType_responseStruct.result != null) return false;
+
+ return true;
+ }
+
+ public int hashCode()
+ {
+ return (result != null ? result.hashCode() : 0);
+ }
+
+ public String toString()
+ {
+ return "[result=" + result + "]";
+ }
+}
Property changes on: branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/simple/EchoSimpleUserType_ResponseStruct.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/simple/SimpleUserType.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/simple/SimpleUserType.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/simple/SimpleUserType.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -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.test.ws.jbossxb.simple;
+
+/**
+ * @author Thomas.Diesler at jboss.org
+ * @since 29-Apr-2005
+ */
+public class SimpleUserType
+{
+ public int a;
+ private int b;
+
+ public SimpleUserType()
+ {
+ }
+
+ public SimpleUserType(int a, int b)
+ {
+ this.a = a;
+ this.b = b;
+ }
+
+ public int getB()
+ {
+ return b;
+ }
+
+ public void setB(int b)
+ {
+ this.b = b;
+ }
+
+ public boolean equals(Object o)
+ {
+ if (this == o) return true;
+ if (!(o instanceof SimpleUserType)) return false;
+
+ final SimpleUserType simpleUserType = (SimpleUserType)o;
+
+ if (a != simpleUserType.a) return false;
+ if (b != simpleUserType.b) return false;
+
+ return true;
+ }
+
+ public int hashCode()
+ {
+ int result;
+ result = a;
+ result = 29 * result + b;
+ return result;
+ }
+
+ public String toString()
+ {
+ return "[a=" + a + ",b=" + b + "]";
+ }
+}
Property changes on: branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/simple/SimpleUserType.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/simple/SimpleUserTypeMarshallerTestCase.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/simple/SimpleUserTypeMarshallerTestCase.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/simple/SimpleUserTypeMarshallerTestCase.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -0,0 +1,136 @@
+/*
+ * 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.test.ws.jbossxb.simple;
+
+import java.io.StringWriter;
+
+import javax.xml.namespace.QName;
+
+import org.apache.xerces.xs.XSModel;
+import org.jboss.test.ws.tools.WSToolsTest;
+import org.jboss.ws.utils.DOMUtils;
+import org.jboss.ws.jbossxb.JBossXBConstants;
+import org.jboss.ws.jbossxb.JBossXBMarshallerImpl;
+import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping;
+import org.jboss.ws.metadata.jaxrpcmapping.PackageMapping;
+
+/**
+ * Test the JAXB marshalling of a SimpleUserType
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 29-Apr-2005
+ */
+public class SimpleUserTypeMarshallerTestCase extends WSToolsTest
+{
+
+ private static final String TARGET_NAMESPACE = "http://org.jboss.ws/types";
+
+ public void testGenerateSchema() throws Exception
+ {
+ QName xmlType = new QName(TARGET_NAMESPACE, "SimpleUserType", "ns1");
+ String xsdSchema = generateSchema(xmlType, SimpleUserType.class);
+
+ String exp =
+ "<schema targetNamespace='http://org.jboss.ws/types' " + SCHEMA_NAMESPACES + " xmlns:tns='http://org.jboss.ws/types'>" +
+ " <complexType name='SimpleUserType'>" +
+ " <sequence>" +
+ " <element name='a' type='int'/>" +
+ " <element name='b' type='int'/>" +
+ " </sequence>" +
+ " </complexType>" +
+ "</schema>";
+
+ assertEquals(DOMUtils.parse(exp), DOMUtils.parse(xsdSchema));
+ }
+
+ public void testMarshallSimpleUserType() throws Exception
+ {
+ SimpleUserType obj = new SimpleUserType();
+
+ QName xmlName = new QName(TARGET_NAMESPACE, "SimpleUser", "ns1");
+ QName xmlType = new QName(TARGET_NAMESPACE, "SimpleUserType", "ns1");
+
+ XSModel model = generateSchemaXSModel(xmlType, SimpleUserType.class);
+ StringWriter strwr;
+ JBossXBMarshallerImpl marshaller = new JBossXBMarshallerImpl();
+ marshaller.setProperty(JBossXBConstants.JBXB_XS_MODEL, model);
+ marshaller.setProperty(JBossXBConstants.JBXB_ROOT_QNAME, xmlName);
+ marshaller.setProperty(JBossXBConstants.JBXB_TYPE_QNAME, xmlType);
+ marshaller.setProperty(JBossXBConstants.JBXB_JAVA_MAPPING, getJavaWSDLMapping());
+
+ strwr = new StringWriter();
+ marshaller.marshal(obj, strwr);
+
+ String was = strwr.toString();
+ assertNotNull("Resulting fragment cannot be null", was);
+ assertTrue("Resulting fragment cannot be empty", was.length() > 0);
+
+ String exp =
+ "<ns1:SimpleUser xmlns:ns1='" + TARGET_NAMESPACE + "' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>" +
+ " <a>0</a>" +
+ " <b>0</b>" +
+ "</ns1:SimpleUser>";
+
+ assertEquals(DOMUtils.parse(exp), DOMUtils.parse(was));
+ }
+
+ public void testMarshallSimpleUserTypeNoPrefix() throws Exception
+ {
+ SimpleUserType obj = new SimpleUserType();
+
+ QName xmlName = new QName(TARGET_NAMESPACE, "SimpleUser");
+ QName xmlType = new QName(TARGET_NAMESPACE, "SimpleUserType");
+
+ XSModel model = generateSchemaXSModel(xmlType, SimpleUserType.class);
+
+ StringWriter strwr;
+ try
+ {
+ JBossXBMarshallerImpl marshaller = new JBossXBMarshallerImpl();
+ marshaller.setProperty(JBossXBConstants.JBXB_XS_MODEL, model);
+ marshaller.setProperty(JBossXBConstants.JBXB_ROOT_QNAME, xmlName);
+ marshaller.setProperty(JBossXBConstants.JBXB_TYPE_QNAME, xmlType);
+ marshaller.setProperty(JBossXBConstants.JBXB_JAVA_MAPPING, getJavaWSDLMapping());
+
+ strwr = new StringWriter();
+ marshaller.marshal(obj, strwr);
+ fail("The given root element name must be prefix qualified");
+ }
+ catch (RuntimeException ex)
+ {
+ // expected: The given root element name must be prefix qualified
+ }
+ }
+
+ /**
+ * Setup the required jaxrpc-mapping meta data
+ */
+ private JavaWsdlMapping getJavaWSDLMapping()
+ {
+ JavaWsdlMapping javaWsdlMapping = new JavaWsdlMapping();
+ PackageMapping packageMapping = new PackageMapping(javaWsdlMapping);
+ javaWsdlMapping.addPackageMapping(packageMapping);
+ packageMapping.setNamespaceURI(TARGET_NAMESPACE);
+ packageMapping.setPackageType("org.jboss.test.ws.jbossxb");
+ return javaWsdlMapping;
+ }
+}
Property changes on: branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/simple/SimpleUserTypeMarshallerTestCase.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/simple/SimpleUserTypeUnmarshallerTestCase.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/simple/SimpleUserTypeUnmarshallerTestCase.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/simple/SimpleUserTypeUnmarshallerTestCase.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -0,0 +1,127 @@
+/*
+ * 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.test.ws.jbossxb.simple;
+
+import java.io.ByteArrayInputStream;
+
+import javax.xml.namespace.QName;
+
+import org.apache.xerces.xs.XSModel;
+import org.jboss.test.ws.tools.WSToolsTest;
+import org.jboss.ws.utils.DOMUtils;
+import org.jboss.ws.jbossxb.JBossXBConstants;
+import org.jboss.ws.jbossxb.JBossXBUnmarshallerImpl;
+import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping;
+import org.jboss.ws.metadata.jaxrpcmapping.PackageMapping;
+
+/**
+ * Test the JAXB unmarshalling of a SimpleUserType
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 29-Apr-2005
+ */
+public class SimpleUserTypeUnmarshallerTestCase extends WSToolsTest
+{
+
+ private static final String TARGET_NAMESPACE = "http://org.jboss.ws/types";
+
+ public void testGenerateSchema() throws Exception
+ {
+ QName xmlType = new QName(TARGET_NAMESPACE, "SimpleUserType", "ns1");
+ String xsdSchema = generateSchema(xmlType, SimpleUserType.class);
+
+ String exp =
+ "<schema targetNamespace='http://org.jboss.ws/types' " + SCHEMA_NAMESPACES + " xmlns:tns='http://org.jboss.ws/types'>" +
+ " <complexType name='SimpleUserType'>" +
+ " <sequence>" +
+ " <element name='a' type='int'/>" +
+ " <element name='b' type='int'/>" +
+ " </sequence>" +
+ " </complexType>" +
+ "</schema>";
+
+ assertEquals(DOMUtils.parse(exp), DOMUtils.parse(xsdSchema));
+ }
+
+ public void testUnmarshallSimpleUserType() throws Exception
+ {
+ QName xmlName = new QName(TARGET_NAMESPACE, "SimpleUser", "ns1");
+ QName xmlType = new QName(TARGET_NAMESPACE, "SimpleUserType", "ns1");
+
+ XSModel model = generateSchemaXSModel(xmlType, SimpleUserType.class);
+
+ SimpleUserType obj = null;
+ JBossXBUnmarshallerImpl unmarshaller = new JBossXBUnmarshallerImpl();
+ 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, getJavaWSDLMapping());
+
+ String xml =
+ "<ns1:SimpleUser xmlns:ns1='" + TARGET_NAMESPACE + "'>" +
+ " <a>0</a>" +
+ " <b>0</b>" +
+ "</ns1:SimpleUser>";
+
+ obj = (SimpleUserType)unmarshaller.unmarshal(new ByteArrayInputStream(xml.getBytes()));
+
+ SimpleUserType exp = new SimpleUserType();
+ assertNotNull("Resulting object cannot be null", obj);
+ assertEquals(exp, obj);
+ }
+
+ public void testUnmarshallSimpleUserTypeNoPrefix() throws Exception
+ {
+ QName xmlName = new QName(TARGET_NAMESPACE, "SimpleUser");
+ QName xmlType = new QName(TARGET_NAMESPACE, "SimpleUserType");
+
+ XSModel model = generateSchemaXSModel(xmlType, SimpleUserType.class);
+
+ SimpleUserType obj = null;
+ JBossXBUnmarshallerImpl unmarshaller = new JBossXBUnmarshallerImpl();
+ 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, getJavaWSDLMapping());
+
+ String xml = "<SimpleUser xmlns='" + TARGET_NAMESPACE + "'>" + " <a xmlns=''>0</a>" + " <b xmlns=''>0</b>" + "</SimpleUser>";
+
+ obj = (SimpleUserType)unmarshaller.unmarshal(new ByteArrayInputStream(xml.getBytes()));
+
+ SimpleUserType exp = new SimpleUserType();
+ assertNotNull("Resulting object cannot be null", obj);
+ assertEquals(exp, obj);
+ }
+
+ /**
+ * Setup the required jaxrpc-mapping meta data
+ */
+ private JavaWsdlMapping getJavaWSDLMapping()
+ {
+ JavaWsdlMapping javaWsdlMapping = new JavaWsdlMapping();
+ PackageMapping packageMapping = new PackageMapping(javaWsdlMapping);
+ javaWsdlMapping.addPackageMapping(packageMapping);
+ packageMapping.setNamespaceURI(TARGET_NAMESPACE);
+ packageMapping.setPackageType("org.jboss.test.ws.jbossxb.simple");
+ return javaWsdlMapping;
+ }
+}
Property changes on: branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jbossxb/simple/SimpleUserTypeUnmarshallerTestCase.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Deleted: branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/soap/SAAJElementWriterTestCase.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/soap/SAAJElementWriterTestCase.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/soap/SAAJElementWriterTestCase.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -1,154 +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.test.ws.soap;
-
-import org.jboss.test.ws.JBossWSTest;
-import org.jboss.ws.jaxrpc.Style;
-import org.jboss.ws.soap.MessageFactoryImpl;
-import org.jboss.ws.soap.SOAPElementImpl;
-import org.jboss.ws.soap.SAAJElementWriter;
-import org.jboss.ws.utils.DOMWriter;
-
-import javax.xml.soap.SOAPEnvelope;
-import javax.xml.soap.SOAPMessage;
-import java.io.*;
-
-/**
- * @author Heiko Braun <heiko.braun at jboss.com>
- * @version $Id$
- * @since Aug 4, 2006
- */
-public class SAAJElementWriterTestCase extends JBossWSTest {
-
- String envStr =
- "<env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>" +
- " <env:Body>" +
- " <businessList generic='2.0' operator='JBOSS' xmlns='urn:uddi-org:api_v2'>" +
- " <businessInfos>" +
- " <businessInfo businessKey='892ac280-c16b-11d5-85ad-801eef211111'>" +
- " <name xml:lang='en'>Demi Credit</name>" +
- " <description xml:lang='en'>A smaller demo app used for illustrating UDDI inquiry.</description>" +
- " <serviceInfos>" +
- " <serviceInfo businessKey='9a26b6e0-c15f-11d5-85a3-801eef208714' serviceKey='860eca90-c16d-11d5-85ad-801eef208714'>" +
- " <name xml:lang='en'>DCAmail</name>" +
- " </serviceInfo>" +
- " </serviceInfos>" +
- " </businessInfo>" +
- " </businessInfos>" +
- " </businessList>" +
- " </env:Body>" +
- "</env:Envelope>";
-
- public void testWriterDocLit() throws Exception {
-
- for(int i=1; i<10; i++)
- {
- String fileName = "resources/soap/req" + i + ".xml";
- System.out.println("\nTesting " + fileName);
-
- File source = new File(fileName);
- InputStream inputStream = new BufferedInputStream(new FileInputStream(source));
-
- MessageFactoryImpl factory = new MessageFactoryImpl();
- factory.setStyle(Style.DOCUMENT);
- SOAPMessage soapMsg = factory.createMessage(null, inputStream);
- SOAPEnvelope env = soapMsg.getSOAPPart().getEnvelope();
-
- try
- {
- String saajMarshalled = marshall(env);
- String domMarshalled = verify(saajMarshalled);
-
- System.out.println(saajMarshalled);
- System.out.println("");
- System.out.println(domMarshalled);
-
- }
- catch (Exception e)
- {
- System.err.println(fileName + " FAILED:");
- System.err.println(e.getMessage());
- fail(e.getMessage());
- }
-
- }
- }
-
- public void testWriterRPC() throws Exception {
-
- for(int i=1; i<10; i++)
- {
- String fileName = "resources/soap/req" + i + ".xml";
- //System.out.println("Testing " + fileName);
-
- File source = new File(fileName);
- InputStream inputStream = new BufferedInputStream(new FileInputStream(source));
-
- MessageFactoryImpl factory = new MessageFactoryImpl();
- factory.setStyle(Style.RPC);
- SOAPMessage soapMsg = factory.createMessage(null, inputStream);
- SOAPEnvelope env = soapMsg.getSOAPPart().getEnvelope();
-
- String xml = marshall(env);
- verify(xml);
- }
- }
-
- public void testWriterMessage() throws Exception {
-
- for(int i=1; i<10; i++)
- {
- String fileName = "resources/soap/req" + i + ".xml";
- //System.out.println("Testing " + fileName);
-
- File source = new File(fileName);
- InputStream inputStream = new BufferedInputStream(new FileInputStream(source));
-
- MessageFactoryImpl factory = new MessageFactoryImpl();
- factory.setStyle(null);
- SOAPMessage soapMsg = factory.createMessage(null, inputStream);
- SOAPEnvelope env = soapMsg.getSOAPPart().getEnvelope();
-
- String xml = marshall(env);
- verify(xml);
- }
- }
-
- private String marshall(SOAPEnvelope env) throws Exception
- {
- String xml = SAAJElementWriter.printSOAPElement((SOAPElementImpl)env, true);
- //System.out.println(xml);
- //System.out.println("");
- return xml;
- }
-
- private String verify(String xml) throws Exception {
- ByteArrayInputStream inputStream = new ByteArrayInputStream(xml.getBytes());
-
- MessageFactoryImpl factory = new MessageFactoryImpl();
- factory.setStyle(Style.RPC);
- SOAPMessage soapMsg = factory.createMessage(null, inputStream);
- SOAPEnvelope env = soapMsg.getSOAPPart().getEnvelope();
-
- return DOMWriter.printNode(env, true);
- }
-}
Added: branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/util/DOMWriterTestCase.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/util/DOMWriterTestCase.java 2006-09-07 09:27:25 UTC (rev 909)
+++ branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/util/DOMWriterTestCase.java 2006-09-07 09:49:54 UTC (rev 910)
@@ -0,0 +1,175 @@
+/*
+ * 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.test.ws.util;
+
+import java.io.ByteArrayInputStream;
+
+import javax.xml.soap.MessageFactory;
+import javax.xml.soap.SOAPEnvelope;
+import javax.xml.soap.SOAPMessage;
+
+import org.jboss.test.ws.JBossWSTest;
+import org.jboss.ws.utils.DOMUtils;
+import org.jboss.ws.utils.DOMWriter;
+import org.w3c.dom.Element;
+
+/**
+ * Test the DOMWriter
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 10-Aug-2006
+ */
+public class DOMWriterTestCase extends JBossWSTest
+{
+ /** The element does not contain the required ns declaration.
+ */
+ public void testNamespaceCompletionOne() throws Exception
+ {
+ String inStr =
+ "<env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>" +
+ "<env:Body>" +
+ "<env:Fault>" +
+ "<faultcode>env:Client</faultcode>" +
+ "<faultstring>Endpoint {http://webmethod.jsr181.ws.test.jboss.org/jaws}TestEndpointPort does not contain operation meta data for: {http://webmethod.jsr181.ws.test.jboss.org/jaws}noWebMethod</faultstring>" +
+ "</env:Fault>" +
+ "</env:Body>" +
+ "</env:Envelope>";
+
+ Element env = DOMUtils.parse(inStr);
+ Element body = DOMUtils.getFirstChildElement(env);
+ Element fault = DOMUtils.getFirstChildElement(body);
+
+ String expStr =
+ "<env:Fault xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>" +
+ "<faultcode>env:Client</faultcode>" +
+ "<faultstring>Endpoint {http://webmethod.jsr181.ws.test.jboss.org/jaws}TestEndpointPort does not contain operation meta data for: {http://webmethod.jsr181.ws.test.jboss.org/jaws}noWebMethod</faultstring>" +
+ "</env:Fault>";
+
+ String wasStr = DOMWriter.printNode(fault, false);
+ assertEquals(expStr, wasStr);
+ }
+
+ /** The element already contains the required ns declaration.
+ */
+ public void testNamespaceCompletionTwo() throws Exception
+ {
+ String inStr =
+ "<env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>" +
+ "<env:Body>" +
+ "<ns1:rpc xmlns:ns1='http://somens'>" +
+ "<ns1:param1/>" +
+ "<ns1:param2/>" +
+ "</ns1:rpc>" +
+ "</env:Body>" +
+ "</env:Envelope>";
+
+ Element env = DOMUtils.parse(inStr);
+ Element body = DOMUtils.getFirstChildElement(env);
+ Element rpc = DOMUtils.getFirstChildElement(body);
+
+ String expStr =
+ "<ns1:rpc xmlns:ns1='http://somens'>" +
+ "<ns1:param1/>" +
+ "<ns1:param2/>" +
+ "</ns1:rpc>";
+
+ String wasStr = DOMWriter.printNode(rpc, false);
+ assertEquals(expStr, wasStr);
+ }
+
+ /** The element does not contain the required ns declaration, the child does.
+ */
+ public void testNamespaceCompletionThree() throws Exception
+ {
+ String inStr =
+ "<env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>" +
+ "<env:Body>" +
+ "<ns1:rpc xmlns:ns1='http://somens'>" +
+ "<ns1:param1/>" +
+ "<ns1:param2/>" +
+ "</ns1:rpc>" +
+ "</env:Body>" +
+ "</env:Envelope>";
+
+ Element env = DOMUtils.parse(inStr);
+ Element body = DOMUtils.getFirstChildElement(env);
+
+ String expStr =
+ "<env:Body xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>" +
+ "<ns1:rpc xmlns:ns1='http://somens'>" +
+ "<ns1:param1/>" +
+ "<ns1:param2/>" +
+ "</ns1:rpc>" +
+ "</env:Body>";
+
+ String wasStr = DOMWriter.printNode(body, false);
+ assertEquals(expStr, wasStr);
+ }
+
+ /** The element does not contain the required attribute ns declaration.
+ */
+ public void testNamespaceCompletionAttribute() throws Exception
+ {
+ String inStr =
+ "<env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>" +
+ "<env:Header>" +
+ "<someHeader env:mustUnderstand='1' xml:lang='en'/>" +
+ "</env:Header>" +
+ "<env:Body/>" +
+ "</env:Envelope>";
+
+ Element env = DOMUtils.parse(inStr);
+ Element header = DOMUtils.getFirstChildElement(env);
+ Element headerElement = DOMUtils.getFirstChildElement(header);
+
+ String expStr =
+ "<someHeader env:mustUnderstand='1' xml:lang='en' xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'/>";
+
+ String wasStr = DOMWriter.printNode(headerElement, false);
+ assertEquals(expStr, wasStr);
+ }
+
+ public void testEnvelopeWriter() throws Exception
+ {
+ String xmlEnv = "<env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>"
+ + " <env:Header xmlns:wsa='http://www.w3.org/2005/08/addressing'>"
+ + " <wsa:To>http://fabrikam123.example/Purchasing</wsa:To>"
+ + " <wsa:ReplyTo>"
+ + " <wsa:Address>http://business456.example/client1</wsa:Address>"
+ + " <wsa:ReferenceParameters>"
+ + " <ns1:sessionid xmlns:ns1='http://somens'>someuniqueid</ns1:sessionid>"
+ + " </wsa:ReferenceParameters>"
+ + " </wsa:ReplyTo>"
+ + " <wsa:Action>http://fabrikam123.example/SubmitPO</wsa:Action>"
+ + " <wsa:MessageID>uuid:6B29FC40-CA47-1067-B31D-00DD010662DA</wsa:MessageID>"
+ + " </env:Header>"
+ + " <env:Body/>"
+ + "</env:Envelope>";
+
+ MessageFactory factory = MessageFactory.newInstance();
+ SOAPMessage msgOut = factory.createMessage(null, new ByteArrayInputStream(xmlEnv.getBytes()));
+ SOAPEnvelope soapEnv = msgOut.getSOAPPart().getEnvelope();
+
+ System.out.println("FIXME: JBWS-1130");
+ //assertEquals(DOMUtils.parse(xmlEnv), soapEnv);
+ }
+}
Property changes on: branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/util/DOMWriterTestCase.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
More information about the jboss-svn-commits
mailing list