Author: thomas.diesler(a)jboss.com
Date: 2006-12-05 19:44:31 -0500 (Tue, 05 Dec 2006)
New Revision: 1561
Added:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/BindingException.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/ComplexTypeDeserializer.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/ComplexTypeSerializer.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/DeserializerSupport.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/EndpointInvocation.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/HeaderElement.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/SerializationContext.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/SerializerSupport.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/UnboundHeader.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/soap/
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/soap/SOAPMessageMarshaller.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/soap/SOAPMessageUnMarshaller.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/AbstractServiceEndpointInvoker.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/AbstractServiceEndpointServlet.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/EndpointContext.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/HandlerDelegate.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/HeaderSource.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/HttpContext.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/HttpServer.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/KernelLocator.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/MessageContextInjector.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/ServerConfig.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/ServerConfigFactory.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/ServiceEndpoint.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/ServiceEndpointInfo.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/ServiceEndpointInvoker.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/ServiceEndpointInvokerJSE.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/ServiceEndpointManager.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/ServiceEndpointManagerFactory.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/ServiceEndpointManagerMBean.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/ServiceEndpointMetrics.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/ServletHeaderSource.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/WSDLFilePublisher.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/WSDLRequestHandler.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/AttrImpl.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/DetailEntryImpl.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/DetailImpl.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/DocumentFragmentImpl.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/EndpointInfo.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/JAXWSPayloadBuilder.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/MessageContextAssociation.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/MessageFactoryImpl.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/NameImpl.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/NodeImpl.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/NodeListImpl.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/PayloadBuilder.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/SAAJPayloadBuilderDOM.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/SAAJPayloadBuilderStax.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/SAAJVisitable.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/SAAJVisitor.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/SOAPBodyElementDoc.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/SOAPBodyElementMessage.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/SOAPBodyElementRpc.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/SOAPBodyImpl.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/SOAPConnectionFactoryImpl.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/SOAPConnectionImpl.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/SOAPContentElement.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/SOAPDocument.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/SOAPElementImpl.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/SOAPElementWriter.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/SOAPEnvelopeImpl.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/SOAPFactoryImpl.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/SOAPFaultElementImpl.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/SOAPFaultImpl.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/SOAPHeaderElementImpl.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/SOAPHeaderImpl.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/SOAPMessageDispatcher.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/SOAPMessageImpl.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/SOAPPartImpl.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/TextImpl.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/attachment/
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/attachment/AttachmentPartImpl.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/attachment/BoundaryDelimitedInputStream.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/attachment/ByteArrayContentHandler.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/attachment/CIDGenerator.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/attachment/ContentHandlerRegistry.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/attachment/ImageDataContentHandler.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/attachment/MimeConstants.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/attachment/MultipartRelatedDecoder.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/attachment/MultipartRelatedEncoder.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/attachment/MultipartRelatedSwAEncoder.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/attachment/MultipartRelatedXOPEncoder.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/attachment/RawByteArrayOutputStream.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/attachment/SimpleBoyerMoore.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/attachment/SwapableMemoryDataSource.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/attachment/XmlDataContentHandler.java
Removed:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/binding/BindingException.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/binding/ComplexTypeDeserializer.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/binding/ComplexTypeSerializer.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/binding/DeserializerSupport.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/binding/EndpointInvocation.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/binding/HeaderElement.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/binding/SerializationContext.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/binding/SerializerSupport.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/binding/UnboundHeader.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/binding/soap/
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/soap/SOAPMessageMarshaller.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/soap/SOAPMessageUnMarshaller.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/AbstractServiceEndpointInvoker.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/AbstractServiceEndpointServlet.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/EndpointContext.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/HandlerDelegate.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/HeaderSource.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/HttpContext.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/HttpServer.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/KernelLocator.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/MessageContextInjector.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/ServerConfig.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/ServerConfigFactory.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/ServiceEndpoint.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/ServiceEndpointInfo.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/ServiceEndpointInvoker.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/ServiceEndpointInvokerJSE.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/ServiceEndpointManager.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/ServiceEndpointManagerFactory.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/ServiceEndpointManagerMBean.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/ServiceEndpointMetrics.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/ServletHeaderSource.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/WSDLFilePublisher.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/WSDLRequestHandler.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/attachment/AttachmentPartImpl.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/attachment/BoundaryDelimitedInputStream.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/attachment/ByteArrayContentHandler.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/attachment/CIDGenerator.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/attachment/ContentHandlerRegistry.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/attachment/ImageDataContentHandler.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/attachment/MimeConstants.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/attachment/MultipartRelatedDecoder.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/attachment/MultipartRelatedEncoder.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/attachment/MultipartRelatedSwAEncoder.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/attachment/MultipartRelatedXOPEncoder.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/attachment/RawByteArrayOutputStream.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/attachment/SimpleBoyerMoore.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/attachment/SwapableMemoryDataSource.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/attachment/XmlDataContentHandler.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/server/
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/AttrImpl.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/DetailEntryImpl.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/DetailImpl.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/DocumentFragmentImpl.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/EndpointInfo.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/JAXWSPayloadBuilder.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/MessageContextAssociation.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/MessageFactoryImpl.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/NameImpl.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/NodeImpl.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/NodeListImpl.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/PayloadBuilder.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SAAJPayloadBuilderDOM.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SAAJPayloadBuilderStax.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SAAJVisitable.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SAAJVisitor.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPBodyElementDoc.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPBodyElementMessage.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPBodyElementRpc.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPBodyImpl.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPConnectionFactoryImpl.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPConnectionImpl.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPContentElement.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPDocument.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPElementImpl.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPElementWriter.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPEnvelopeImpl.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPFactoryImpl.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPFaultElementImpl.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPFaultImpl.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPHeaderElementImpl.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPHeaderImpl.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPMessageDispatcher.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPMessageImpl.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPPartImpl.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/TextImpl.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/attachment/
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/Constants.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/CommonBinding.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/CommonClient.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/CommonContextServlet.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/CommonMessageContext.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/CommonSOAP11Binding.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/CommonSOAP12Binding.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/CommonSOAPBinding.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/deployment/ServiceEndpointDeployer.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/addressing/AddressingPropertiesImpl.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/addressing/soap/SOAPAddressingPropertiesImpl.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/eventing/EventingEndpointBase.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/eventing/SubscriptionManagerEndpointImpl.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/eventing/deployment/EventingEndpoint.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/eventing/element/EndpointReference.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/eventing/mgmt/Subscription.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/eventing/mgmt/SubscriptionManagerFactory.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/security/WSSecurityDispatcher.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/xop/CreateAttachmentVisitor.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/xop/RestoreXOPElementVisitor.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/xop/XOPContext.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/xop/jaxrpc/JBossXBContentAdapter.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/xop/jaxrpc/XOPMarshallerImpl.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/xop/jaxrpc/XOPUnmarshallerImpl.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/jboss50/AbstractDeployer.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/jboss50/AbstractJSEDeployer.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/jboss50/JBossContextServlet.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/jboss50/JBossServiceEndpointServlet.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/jboss50/PortComponentLinkServlet.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/jboss50/ServerConfigImpl.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/jboss50/ServiceEndpointGeneratorEJB.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/jboss50/ServiceEndpointInvokerEJB3.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/jboss50/ServiceEndpointLifecycleDeployer.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/tomcat/KernelBootstrap.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/tomcat/ServerConfigImpl.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/tomcat/TomcatContextServlet.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/tomcat/TomcatServiceEndpointServlet.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/CallImpl.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/SOAP11BindingJAXRPC.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/SOAP12BindingJAXRPC.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/SOAPBindingJAXRPC.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/SOAPFaultHelperJAXRPC.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/SerializationContextJAXRPC.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/ServiceObjectFactory.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/ServiceReferenceable.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/ServletEndpointContextImpl.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/Base64Deserializer.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/Base64DeserializerFactory.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/Base64Serializer.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/Base64SerializerFactory.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/CalendarDeserializer.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/CalendarDeserializerFactory.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/CalendarSerializer.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/CalendarSerializerFactory.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/DateDeserializer.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/DateDeserializerFactory.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/DateSerializer.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/DateSerializerFactory.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/DeserializerFactoryBase.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/ElementDeserializer.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/ElementDeserializerFactory.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/ElementSerializer.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/ElementSerializerFactory.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/HexDeserializer.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/HexDeserializerFactory.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/HexSerializer.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/HexSerializerFactory.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/NullValueSerializer.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/QNameDeserializer.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/QNameDeserializerFactory.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/QNameSerializer.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/QNameSerializerFactory.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/SOAPArrayDeserializer.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/SOAPArrayDeserializerFactory.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/SOAPArraySerializer.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/SOAPArraySerializerFactory.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/SOAPElementDeserializer.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/SOAPElementDeserializerFactory.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/SOAPElementSerializer.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/SOAPElementSerializerFactory.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/SerializerFactoryBase.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/SimpleDeserializer.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/SimpleDeserializerFactory.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/SimpleSerializer.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/SimpleSerializerFactory.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/handler/HandlerChainBaseImpl.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/handler/HandlerDelegateJAXRPC.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/handler/MessageContextJAXRPC.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/JAXBDeserializer.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/JAXBDeserializerFactory.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/JAXBSerializer.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/JAXBSerializerFactory.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/SerializationContextJAXWS.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/client/ClientImpl.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/client/DispatchImpl.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/core/HTTPBindingJAXWS.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/core/MessageBinding.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/core/PayloadBinding.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/core/SOAP11BindingJAXWS.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/core/SOAP12BindingJAXWS.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/core/SOAPBindingJAXWS.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/core/SOAPFaultHelperJAXWS.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/handler/HandlerChainExecutor.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/handler/HandlerDelegateJAXWS.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/handler/LogicalMessageImpl.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/handler/MessageContextJAXWS.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/spi/EndpointImpl.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jbossxb/JBossXBDeserializer.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jbossxb/JBossXBDeserializerFactory.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jbossxb/JBossXBSerializer.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jbossxb/JBossXBSerializerFactory.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jbossxb/JBossXBSupport.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/builder/MetaDataBuilder.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/umdm/ServerEndpointMetaData.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/umdm/UnifiedMetaData.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/xsd/SchemaUtils.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/utils/IOUtils.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/utils/ThreadLocalAssociation.java
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/binding/SOAPBindingTestCase.java
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/jbossxb/SerializerDeserializerTestCase.java
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/soap/MessageFactoryTestCase.java
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/soap/SOAPConnectionTestCase.java
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/soap/SOAPContentElementTestCase.java
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/soap/SOAPEnvelopeTestCase.java
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/soap/SOAPFactoryTestCase.java
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/soap/SOAPHeaderElementTestCase.java
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/soap/SOAPHeaderTestCase.java
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/soap/attachment/GenericAttachmentTestCase.java
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/jbws1179/TestEndpointImpl.java
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/jbws1186/ServerHandler.java
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/jbws1190/TestEndpointImpl.java
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/jbws1205/TestEndpointImpl.java
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/samples/swa/AttachmentSAAJTestCase.java
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/wsse/MicrosoftInteropTestCase.java
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/wsse/RoundTripTestCase.java
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/wsse/SunInteropTestCase.java
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/xop/doclit/InlineHandler.java
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/xop/rpclit/InlineHandler.java
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/xop/shared/MTOMServiceBase.java
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/endpoint/EndpointServlet.java
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/exception/ExceptionEndpointImpl.java
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1190/TestEndpointImpl.java
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/jsr181/soapbinding/JSR181SOAPBindingTestCase.java
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/jsr181/webmethod/JSR181WebMethodTestCase.java
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/jsr181/webresult/JSR181WebResultTestCase.java
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/samples/retail/handler/SOAPMessageTrace.java
Log:
partial commit
Modified: branches/tdiesler/trunk/src/main/java/org/jboss/ws/Constants.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/Constants.java 2006-12-06 00:32:54
UTC (rev 1560)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/Constants.java 2006-12-06 00:44:31
UTC (rev 1561)
@@ -25,7 +25,7 @@
import javax.xml.namespace.QName;
import javax.xml.soap.Name;
-import org.jboss.ws.soap.NameImpl;
+import org.jboss.ws.core.soap.NameImpl;
/**
* A collection of constants relevant to JBossWS
Deleted: branches/tdiesler/trunk/src/main/java/org/jboss/ws/binding/BindingException.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/binding/BindingException.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/binding/BindingException.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -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;
-
-// $Id$
-
-/** An exception that may occur during message binding
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 16-Oct-2004
- */
-public class BindingException extends Exception
-{
- /**
- * Constructs a new exception with <code>null</code> as its detail
message.
- * The cause is not initialized, and may subsequently be initialized by a
- * call to {@link #initCause}.
- */
- public BindingException()
- {
- }
-
- /**
- * Constructs a new exception with the specified detail message. The
- * cause is not initialized, and may subsequently be initialized by
- * a call to {@link #initCause}.
- *
- * @param message the detail message. The detail message is saved for
- * later retrieval by the {@link #getMessage()} method.
- */
- public BindingException(String message)
- {
- super(message);
- }
-
- /**
- * Constructs a new exception with the specified cause and a detail
- * message of <tt>(cause==null ? null : cause.toString())</tt> (which
- * typically contains the class and detail message of <tt>cause</tt>).
- * This constructor is useful for exceptions that are little more than
- * wrappers for other throwables (for example, {@link
- * java.security.PrivilegedActionException}).
- *
- * @param cause the cause (which is saved for later retrieval by the
- * {@link #getCause()} method). (A <tt>null</tt> value is
- * permitted, and indicates that the cause is nonexistent or
- * unknown.)
- * @since 1.4
- */
- public BindingException(Throwable cause)
- {
- super(cause);
- }
-
- /**
- * Constructs a new exception with the specified detail message and
- * cause. <p>Note that the detail message associated with
- * <code>cause</code> is <i>not</i> automatically incorporated
in
- * this exception's detail message.
- *
- * @param message the detail message (which is saved for later retrieval
- * by the {@link #getMessage()} method).
- * @param cause the cause (which is saved for later retrieval by the
- * {@link #getCause()} method). (A <tt>null</tt> value is
- * permitted, and indicates that the cause is nonexistent or
- * unknown.)
- * @since 1.4
- */
- public BindingException(String message, Throwable cause)
- {
- super(message, cause);
- }
-}
Deleted:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/binding/ComplexTypeDeserializer.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/binding/ComplexTypeDeserializer.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/binding/ComplexTypeDeserializer.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -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.ws.binding;
-
-// $Id$
-
-/**
- * A Deserializer that can handle complex types by delegating to JAXB.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 04-Dec-2004
- */
-public abstract class ComplexTypeDeserializer extends DeserializerSupport
-{
-
-}
Deleted:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/binding/ComplexTypeSerializer.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/binding/ComplexTypeSerializer.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/binding/ComplexTypeSerializer.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -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.ws.binding;
-
-// $Id$
-
-/**
- * A Serializer that can handle complex types by delegating to JAXB.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 04-Dec-2004
- */
-public abstract class ComplexTypeSerializer extends SerializerSupport
-{
-
-}
Deleted:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/binding/DeserializerSupport.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/binding/DeserializerSupport.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/binding/DeserializerSupport.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -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.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(a)jboss.org
- * @since 04-Dec-2004
- */
-public abstract class DeserializerSupport implements Deserializer
-{
-
- /** Deserialize an XML fragment to an object value
- *
- * @param xmlName The root element name of the resulting fragment
- * @param xmlType The associated schema type
- * @param xmlFragment The XML fragment to deserialize
- * @param serContext The serialization context
- */
- public abstract Object deserialize(QName xmlName, QName xmlType, String xmlFragment,
SerializationContext serContext) throws BindingException;
-
- /** Unwrap the value string from the XML fragment
- *
- * @return The value string or null if the startTag contains a xsi:nil='true'
attribute
- */
- protected String unwrapValueStr(String xmlFragment)
- {
- // We only scan for :nil if the xmlFragment is an empty element
- if (isEmptyElement(xmlFragment))
- {
- return (isNil(xmlFragment) ? null : "");
- }
-
- int endOfStartTag = xmlFragment.indexOf(">");
- int startOfEndTag = xmlFragment.lastIndexOf("</");
- if (endOfStartTag < 0 || startOfEndTag < 0)
- throw new IllegalArgumentException("Invalid XML fragment: " +
xmlFragment);
-
- String valueStr = xmlFragment.substring(endOfStartTag + 1, startOfEndTag);
-
- return XMLPredefinedEntityReferenceResolver.resolve(valueStr);
- }
-
- protected boolean isEmptyElement(String xmlFragment)
- {
- return xmlFragment.startsWith("<") &&
xmlFragment.endsWith("/>");
- }
-
- protected boolean isNil(String xmlFragment)
- {
- boolean isNil = false;
- if (isEmptyElement(xmlFragment))
- {
- int endOfStartTag = xmlFragment.indexOf(">");
- String startTag = xmlFragment.substring(0, endOfStartTag);
- isNil = startTag.indexOf(":nil='1'") > 0 ||
startTag.indexOf(":nil=\"1\"") > 0;
- isNil = isNil || startTag.indexOf(":nil='true'") > 0 ||
startTag.indexOf(":nil=\"true\"") > 0;
- }
- return isNil;
- }
-
- public String getMechanismType()
- {
- throw new NotImplementedException();
- }
-}
Deleted:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/binding/EndpointInvocation.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/binding/EndpointInvocation.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/binding/EndpointInvocation.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -1,357 +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.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import javax.activation.DataHandler;
-import javax.xml.namespace.QName;
-import javax.xml.rpc.ParameterMode;
-import javax.xml.soap.AttachmentPart;
-import javax.xml.soap.SOAPException;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.WSException;
-import org.jboss.ws.jaxrpc.ParameterWrapping;
-import org.jboss.ws.metadata.umdm.OperationMetaData;
-import org.jboss.ws.metadata.umdm.ParameterMetaData;
-import org.jboss.ws.metadata.umdm.WrappedParameter;
-import org.jboss.ws.soap.SOAPContentElement;
-import org.jboss.ws.utils.HolderUtils;
-import org.jboss.ws.utils.JavaUtils;
-import org.jboss.ws.utils.MimeUtils;
-
-/** A web service invocation.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 16-Oct-2004
- */
-public class EndpointInvocation
-{
- // provide logging
- private static final Logger log = Logger.getLogger(EndpointInvocation.class);
-
- // The operation meta data for this invocation
- private OperationMetaData opMetaData;
- // Map the named endpoint parameters
- private Map<QName, Object> reqPayload = new LinkedHashMap<QName,
Object>();
- // Map the named endpoint parameters
- private Map<QName, Object> resPayload = new LinkedHashMap<QName,
Object>();
- // The return value
- private Object returnValue;
- // Map of output parameters, key being the parameter index in the method signature
- private Map<Integer, Object> outParameters = new HashMap<Integer,
Object>();
-
- public EndpointInvocation(OperationMetaData opMetaData)
- {
- this.opMetaData = opMetaData;
- }
-
- public OperationMetaData getOperationMetaData()
- {
- return opMetaData;
- }
-
- public Method getJavaMethod()
- {
- return opMetaData.getJavaMethod();
- }
-
- public Map<Integer, Object> getOutParameters()
- {
- return outParameters;
- }
-
- public List<QName> getRequestParamNames()
- {
- List<QName> xmlNames = new ArrayList<QName>();
- xmlNames.addAll(reqPayload.keySet());
- return xmlNames;
- }
-
- public void setRequestParamValue(QName xmlName, Object value)
- {
- log.debug("setRequestParamValue: [name=" + xmlName + ",value="
+ getTypeName(value) + "]");
- reqPayload.put(xmlName, value);
- }
-
- public Object getRequestParamValue(QName xmlName) throws SOAPException
- {
- log.debug("getRequestParamValue: " + xmlName);
- Object paramValue = reqPayload.get(xmlName);
- ParameterMetaData paramMetaData = opMetaData.getParameter(xmlName);
- paramValue = transformPayloadValue(paramMetaData, paramValue);
- return paramValue;
- }
-
- /** Returns the payload that can be passed on to the endpoint implementation
- */
- public Object[] getRequestPayload() throws SOAPException
- {
- log.debug("getRequestPayload");
- List<QName> xmlNames = getRequestParamNames();
-
- Object[] payload = new
Object[opMetaData.getJavaMethod().getParameterTypes().length];
- for (int i = 0; i < xmlNames.size(); i++)
- {
- QName xmlName = xmlNames.get(i);
- Object paramValue = getRequestParamValue(xmlName);
-
- ParameterMetaData paramMetaData = opMetaData.getParameter(xmlName);
- syncEndpointInputParam(paramMetaData, paramValue, payload);
- }
-
- return payload;
- }
-
- public List<QName> getResponseParamNames()
- {
- List<QName> xmlNames = new ArrayList<QName>();
- xmlNames.addAll(resPayload.keySet());
- return xmlNames;
- }
-
- public void setResponseParamValue(QName xmlName, Object value)
- {
- log.debug("setResponseParamValue: [name=" + xmlName + ",value="
+ getTypeName(value) + "]");
- resPayload.put(xmlName, value);
- }
-
- public Object getResponseParamValue(QName xmlName) throws SOAPException
- {
- log.debug("getResponseParamValue: " + xmlName);
- Object paramValue = resPayload.get(xmlName);
- ParameterMetaData paramMetaData = opMetaData.getParameter(xmlName);
- paramValue = transformPayloadValue(paramMetaData, paramValue);
- if (paramValue != null)
- {
- Class valueType = paramValue.getClass();
- if (HolderUtils.isHolderType(valueType))
- {
- paramValue = HolderUtils.getHolderValue(paramValue);
- }
- }
- return paramValue;
- }
-
- public void setReturnValue(Object value)
- {
- ParameterMetaData retMetaData = opMetaData.getReturnParameter();
- if (value != null && retMetaData == null)
- throw new WSException("Operation does not have a return value: " +
opMetaData.getQName());
-
- log.debug("setReturnValue: " + getTypeName(value));
- this.returnValue = value;
- }
-
- public Object getReturnValue() throws SOAPException
- {
- log.debug("getReturnValue");
- Object paramValue = returnValue;
- ParameterMetaData paramMetaData = opMetaData.getReturnParameter();
- if (paramMetaData != null)
- {
- paramValue = transformPayloadValue(paramMetaData, paramValue);
- }
- return paramValue;
- }
-
- private Object transformPayloadValue(ParameterMetaData paramMetaData, final Object
paramValue) throws SOAPException
- {
- QName xmlName = paramMetaData.getXmlName();
- QName xmlType = paramMetaData.getXmlType();
- Class javaType = paramMetaData.getJavaType();
- String javaName = paramMetaData.getJavaTypeName();
-
- if (xmlType == null)
- throw new IllegalStateException("Cannot obtain xml type for:
[xmlName=" + xmlName + ",javaName=" + javaName + "]");
-
- Object retValue = paramValue;
-
- // Handle attachment part
- if (paramValue instanceof AttachmentPart)
- {
- AttachmentPart part = (AttachmentPart)paramValue;
-
- Set mimeTypes = paramMetaData.getMimeTypes();
- if (DataHandler.class.isAssignableFrom(javaType) &&
!javaType.equals(Object.class))
- {
- DataHandler handler = part.getDataHandler();
- String mimeType = MimeUtils.getBaseMimeType(handler.getContentType());
-
- if (mimeTypes != null && !MimeUtils.isMemberOf(mimeType, mimeTypes))
- throw new SOAPException("Mime type " + mimeType + " not
allowed for parameter " + xmlName + " allowed types are " + mimeTypes);
-
- retValue = part.getDataHandler();
- }
- else
- {
- retValue = part.getContent();
- String mimeType = MimeUtils.getBaseMimeType(part.getContentType());
-
- if (mimeTypes != null && !MimeUtils.isMemberOf(mimeType, mimeTypes))
- throw new SOAPException("Mime type " + mimeType + " not
allowed for parameter " + xmlName + " allowed types are " + mimeTypes);
-
- if (retValue != null)
- {
- Class valueType = retValue.getClass();
- if (JavaUtils.isAssignableFrom(javaType, valueType) == false)
- throw new SOAPException("javaType [" + javaType.getName() +
"] is not assignable from attachment content: " + valueType.getName());
- }
- }
- }
- else if (paramValue instanceof SOAPContentElement)
- {
- // For type other than xsd:anyType we return the object value
- if (xmlType.getLocalPart().equals("anyType") == false)
- {
- SOAPContentElement soapElement = (SOAPContentElement)paramValue;
- retValue = soapElement.getObjectValue();
- }
- }
-
- log.debug("transformPayloadValue: " + getTypeName(paramValue) + "
-> " + getTypeName(retValue));
- return retValue;
- }
-
- /** Synchronize the operation IN, INOUT paramters with the call input parameters.
- * Essetially it unwrapps holders and converts primitives to wrapper types.
- */
- public void initInputParams(Object[] inputParams)
- {
- for (ParameterMetaData paramMetaData : opMetaData.getParameters())
- {
- QName xmlName = paramMetaData.getXmlName();
- Class javaType = paramMetaData.getJavaType();
-
- Object value;
- if (opMetaData.isDocumentWrapped() && paramMetaData.isInHeader() ==
false)
- {
- value = ParameterWrapping.wrapRequestParameters(paramMetaData, inputParams);
- }
- else
- {
- value = inputParams[paramMetaData.getIndex()];
- if (value != null)
- {
- Class inputType = value.getClass();
-
- if (HolderUtils.isHolderType(inputType))
- {
- // At runtime we lose the generic info for JAX-WS types,
- // So we use the actual instance type if possible
- value = HolderUtils.getHolderValue(value);
- inputType = (value == null) ? HolderUtils.getValueType(inputType) :
value.getClass();
- }
-
- // Verify that the java type matches a registered xmlType
- // Attachments are skipped because they don't use type mapping
- if (!paramMetaData.isSwA() && !paramMetaData.isXOP())
- {
- if (JavaUtils.isAssignableFrom(javaType, inputType) == false)
- throw new WSException("Parameter '" + javaType +
"' not assignable from: " + inputType);
- }
- }
- }
-
- setRequestParamValue(xmlName, value);
- }
- }
-
- /**
- * Synchronize the operation paramters with the endpoint method parameters
- */
- private void syncEndpointInputParam(ParameterMetaData paramMetaData, final Object
paramValue, Object[] payload)
- {
- Object retValue = paramValue;
- Method method = opMetaData.getJavaMethod();
- Class[] targetParameterTypes = method.getParameterTypes();
-
- if (opMetaData.isDocumentWrapped() && paramMetaData.isInHeader() == false
&& paramMetaData.isMessageType() == false)
- {
- outParameters = ParameterWrapping.unwrapRequestParameters(paramMetaData,
paramValue, payload);
- syncOutWrappedParameters(targetParameterTypes);
- }
- else
- {
- // Replace INOUT and OUT parameters by their respective holder values
- int index = paramMetaData.getIndex();
- Class targetParameterType = targetParameterTypes[index];
-
- if (paramMetaData.getMode() == ParameterMode.INOUT || paramMetaData.getMode() ==
ParameterMode.OUT)
- {
- retValue = HolderUtils.createHolderInstance(paramValue,
targetParameterType);
-
- QName xmlName = paramMetaData.getXmlName();
- setResponseParamValue(xmlName, retValue);
- }
-
- if (retValue != null)
- {
- Class valueType = retValue.getClass();
- if (JavaUtils.isAssignableFrom(targetParameterType, valueType) == false)
- throw new WSException("Parameter " +
targetParameterType.getName() + " is not assignable from: " +
getTypeName(retValue));
-
- if (valueType.isArray())
- retValue = JavaUtils.syncArray(retValue, targetParameterType);
- }
-
- log.debug("syncEndpointInputParam: " + getTypeName(paramValue) +
" -> " + getTypeName(retValue) + "(" + index + ")");
- payload[index] = retValue;
- }
- }
-
- private void syncOutWrappedParameters(Class[] targetParameterTypes)
- {
- ParameterMetaData returnMetaData = opMetaData.getReturnParameter();
- if (returnMetaData != null)
- {
- for (WrappedParameter param : returnMetaData.getWrappedParameters())
- {
- try
- {
- if (param.getIndex() >= 0)
- outParameters.put(param.getIndex(),
targetParameterTypes[param.getIndex()].newInstance());
- }
- catch (Exception e)
- {
- throw new WSException("Could not add output param: " +
param.getName(), e);
-
- }
- }
- }
- }
-
- private String getTypeName(Object value)
- {
- String valueType = (value != null ? value.getClass().getName() : null);
- return valueType;
- }
-}
\ No newline at end of file
Deleted: branches/tdiesler/trunk/src/main/java/org/jboss/ws/binding/HeaderElement.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/binding/HeaderElement.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/binding/HeaderElement.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -1,76 +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 javax.xml.namespace.QName;
-
-/**
- * Created by IntelliJ IDEA.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since Jan 4, 2005
- */
-public class HeaderElement
-{
- private QName xmlName;
- private QName xmlType;
- private Class javaType;
- private Object headerValue;
-
- public HeaderElement(QName xmlName, QName xmlType, Class javaType, Object
headerValue)
- {
- if (xmlName == null || xmlType == null || javaType == null)
- throw new IllegalArgumentException("Invalid null argument");
-
- this.xmlName = xmlName;
- this.xmlType = xmlType;
- this.javaType = javaType;
- this.headerValue = headerValue;
- }
-
- public QName getXmlName()
- {
- return xmlName;
- }
-
- public QName getXmlType()
- {
- return xmlType;
- }
-
- public Class getJavaType()
- {
- return javaType;
- }
-
- public Object getHeaderValue()
- {
- return headerValue;
- }
-
- public void setHeaderValue(Object headerValue)
- {
- this.headerValue = headerValue;
- }
-}
Deleted:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/binding/SerializationContext.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/binding/SerializationContext.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/binding/SerializationContext.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -1,71 +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 java.util.Map;
-
-import org.jboss.ws.jaxrpc.TypeMappingImpl;
-import org.jboss.xb.binding.NamespaceRegistry;
-
-/**
- * An abstract serialization context
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 04-Dec-2004
- */
-public abstract class SerializationContext
-{
- // The type mapping that is valid for this serialization context
- private TypeMappingImpl typeMapping;
- // The namespace registry that is valid for this serialization context
- private NamespaceRegistry namespaceRegistry = new NamespaceRegistry();
- // An arbitrary property bag
- private Map<Object, Object> properties = new HashMap<Object, Object>();
-
- public Object getProperty(Object key)
- {
- return properties.get(key);
- }
-
- public void setProperty(Object key, Object value)
- {
- properties.put(key, value);
- }
-
- public TypeMappingImpl getTypeMapping()
- {
- return typeMapping;
- }
-
- public void setTypeMapping(TypeMappingImpl typeMapping)
- {
- this.typeMapping = typeMapping;
- }
-
- public NamespaceRegistry getNamespaceRegistry()
- {
- return namespaceRegistry;
- }
-}
Deleted:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/binding/SerializerSupport.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/binding/SerializerSupport.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/binding/SerializerSupport.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -1,164 +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 javax.xml.namespace.QName;
-import javax.xml.rpc.encoding.Serializer;
-
-import org.jboss.util.NotImplementedException;
-import org.jboss.ws.Constants;
-import org.jboss.xb.binding.NamespaceRegistry;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-
-/**
- * The base class for all Serializers.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @author <a href="mailto:jason.greene@jboss.com">Jason T.
Greene</a>
- * @since 04-Dec-2004
- */
-public abstract class SerializerSupport implements Serializer
-{
- /** Serialize an object value to an XML fragment
- *
- * @param xmlName The root element name of the resulting fragment
- * @param xmlType The associated schema type
- * @param value The value to serialize
- * @param serContext The serialization context
- * @param attributes TODO
- * @param attributes The attributes on this element
- */
- public abstract String serialize(QName xmlName, QName xmlType, Object value,
SerializationContext serContext, NamedNodeMap attributes) throws BindingException;
-
- /** Wrap the value string in a XML fragment with the given name
- */
- protected String wrapValueStr(QName xmlName, String valueStr, NamespaceRegistry
nsRegistry, NamedNodeMap attributes, boolean normalize)
- {
- String nsURI = xmlName.getNamespaceURI();
- String localPart = xmlName.getLocalPart();
- String prefix = xmlName.getPrefix();
-
- StringBuilder nsAttr = new StringBuilder("");
- if (attributes != null)
- {
- for (int i = 0; i < attributes.getLength(); i++)
- {
- Node attr = attributes.item(i);
- String attrName = attr.getNodeName();
- String attrValue = attr.getNodeValue();
- nsAttr.append(" " + attrName + "='" + attrValue +
"'");
- }
- }
-
- String elName;
- if (nsURI.length() > 0)
- {
- xmlName = nsRegistry.registerQName(xmlName);
- prefix = xmlName.getPrefix();
- elName = prefix + ":" + localPart;
-
- String xmlns = " xmlns:" + prefix + "='" + nsURI +
"'";
- if (nsAttr.indexOf(xmlns) < 0)
- {
- nsAttr.append(xmlns);
- }
- }
- else
- {
- elName = localPart;
- }
-
- String xmlFragment;
- if (valueStr == null)
- {
- String xmlns = " xmlns:" + Constants.PREFIX_XSI + "='" +
Constants.NS_SCHEMA_XSI + "'";
- xmlFragment = "<" + elName + nsAttr + " " +
Constants.PREFIX_XSI + ":nil='1'" + xmlns + "/>";
- }
- else
- {
- if(normalize)
- valueStr = normalize(valueStr);
- xmlFragment = "<" + elName + nsAttr + ">" + valueStr +
"</" + elName + ">";
- }
-
- return xmlFragment;
- }
-
- public String getMechanismType()
- {
- throw new NotImplementedException();
- }
-
- private String normalize(String valueStr)
- {
- // We assume most strings will not contain characters that need
"escaping",
- // and optimize for this case.
- boolean found = false;
- int i = 0;
-
- outer: for (; i < valueStr.length(); i++)
- {
- switch (valueStr.charAt(i))
- {
- case '<':
- case '>':
- case '&':
- case '"':
- found = true;
- break outer;
- }
- }
-
- if (!found)
- return valueStr;
-
- // Resume where we left off
- StringBuilder builder = new StringBuilder();
- builder.append(valueStr.substring(0, i));
- for (; i < valueStr.length(); i++)
- {
- char c = valueStr.charAt(i);
- switch (c)
- {
- case '<':
- builder.append("<");
- break;
- case '>':
- builder.append(">");
- break;
- case '&':
- builder.append("&");
- break;
- case '"':
- builder.append(""");
- break;
- default:
- builder.append(c);
- }
- }
-
- return builder.toString();
- }
-}
\ No newline at end of file
Deleted: branches/tdiesler/trunk/src/main/java/org/jboss/ws/binding/UnboundHeader.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/binding/UnboundHeader.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/binding/UnboundHeader.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -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.ws.binding;
-
-// $Id$
-
-import javax.xml.namespace.QName;
-import javax.xml.rpc.ParameterMode;
-
-import org.jboss.ws.metadata.umdm.OperationMetaData;
-import org.jboss.ws.metadata.umdm.ParameterMetaData;
-
-/**
- * Represents an unbound SOAPHeaderElement
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 04-Jan-2005
- */
-public class UnboundHeader
-{
- private QName xmlName;
- private QName xmlType;
- private Class javaType;
- private ParameterMode mode;
- private Object headerValue;
-
- public UnboundHeader(QName xmlName, QName xmlType, Class javaType, ParameterMode
mode)
- {
- this.xmlName = xmlName;
- this.xmlType = xmlType;
- this.javaType = javaType;
- this.mode = mode;
- }
-
- public QName getXmlName()
- {
- return xmlName;
- }
-
- public QName getXmlType()
- {
- return xmlType;
- }
-
- public Class getJavaType()
- {
- return javaType;
- }
-
- public ParameterMode getMode()
- {
- return mode;
- }
-
- public Object getHeaderValue()
- {
- return headerValue;
- }
-
- public void setHeaderValue(Object headerValue)
- {
- this.headerValue = headerValue;
- }
-
- public ParameterMetaData toParameterMetaData(OperationMetaData opMetaData)
- {
- ParameterMetaData paramMetaData = new ParameterMetaData(opMetaData, xmlName,
xmlType, javaType.getName());
- paramMetaData.setInHeader(true);
- return paramMetaData;
- }
-
- public String toString()
- {
- StringBuilder buffer = new StringBuilder("\nUnboundHeader:");
- buffer.append("\n xmlName=" + getXmlName());
- buffer.append("\n xmlType=" + getXmlType());
- buffer.append("\n javaType=" + getJavaType().getName());
- buffer.append("\n mode=" + getMode());
- return buffer.toString();
- }
-}
Modified: branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/CommonBinding.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/CommonBinding.java 2006-12-06
00:32:54 UTC (rev 1560)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/CommonBinding.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -27,9 +27,9 @@
import javax.xml.namespace.QName;
-import org.jboss.ws.binding.BindingException;
-import org.jboss.ws.binding.EndpointInvocation;
-import org.jboss.ws.binding.UnboundHeader;
+import org.jboss.ws.core.binding.BindingException;
+import org.jboss.ws.core.binding.EndpointInvocation;
+import org.jboss.ws.core.binding.UnboundHeader;
import org.jboss.ws.metadata.umdm.OperationMetaData;
/**
Modified: branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/CommonClient.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/CommonClient.java 2006-12-06
00:32:54 UTC (rev 1560)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/CommonClient.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -37,8 +37,12 @@
import org.jboss.logging.Logger;
import org.jboss.ws.Constants;
import org.jboss.ws.WSException;
-import org.jboss.ws.binding.EndpointInvocation;
-import org.jboss.ws.binding.UnboundHeader;
+import org.jboss.ws.core.binding.EndpointInvocation;
+import org.jboss.ws.core.binding.UnboundHeader;
+import org.jboss.ws.core.soap.EndpointInfo;
+import org.jboss.ws.core.soap.MessageContextAssociation;
+import org.jboss.ws.core.soap.SOAPBodyImpl;
+import org.jboss.ws.core.soap.SOAPConnectionImpl;
import org.jboss.ws.extras.addressing.AddressingConstantsImpl;
import org.jboss.ws.jaxrpc.ParameterWrapping;
import org.jboss.ws.jaxrpc.Style;
@@ -51,10 +55,6 @@
import org.jboss.ws.metadata.umdm.UnifiedMetaData;
import org.jboss.ws.metadata.umdm.EndpointMetaData.Type;
import org.jboss.ws.metadata.umdm.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;
/**
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/CommonContextServlet.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/CommonContextServlet.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/CommonContextServlet.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -33,7 +33,7 @@
import javax.servlet.http.HttpServletResponse;
import org.jboss.logging.Logger;
-import org.jboss.ws.server.ServiceEndpointManager;
+import org.jboss.ws.core.server.ServiceEndpointManager;
/**
* The servlet that that is associated with context /jbossws
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/CommonMessageContext.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/CommonMessageContext.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/CommonMessageContext.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -29,7 +29,7 @@
import javax.xml.soap.SOAPMessage;
-import org.jboss.ws.binding.SerializationContext;
+import org.jboss.ws.core.binding.SerializationContext;
import org.jboss.ws.metadata.umdm.EndpointMetaData;
import org.jboss.ws.metadata.umdm.OperationMetaData;
import org.jboss.xb.binding.NamespaceRegistry;
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/CommonSOAP11Binding.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/CommonSOAP11Binding.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/CommonSOAP11Binding.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -28,9 +28,9 @@
import javax.xml.soap.SOAPMessage;
import org.jboss.ws.Constants;
+import org.jboss.ws.core.soap.MessageFactoryImpl;
import org.jboss.ws.jaxrpc.Use;
import org.jboss.ws.metadata.umdm.OperationMetaData;
-import org.jboss.ws.soap.MessageFactoryImpl;
/**
* The SOAP11Binding
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/CommonSOAP12Binding.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/CommonSOAP12Binding.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/CommonSOAP12Binding.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -27,8 +27,8 @@
import javax.xml.soap.SOAPMessage;
import org.jboss.ws.Constants;
+import org.jboss.ws.core.soap.MessageFactoryImpl;
import org.jboss.ws.metadata.umdm.OperationMetaData;
-import org.jboss.ws.soap.MessageFactoryImpl;
/**
* The SOAP11Binding
Modified: branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/CommonSOAPBinding.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/CommonSOAPBinding.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/CommonSOAPBinding.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -48,9 +48,22 @@
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.binding.EndpointInvocation;
-import org.jboss.ws.binding.UnboundHeader;
+import org.jboss.ws.core.binding.BindingException;
+import org.jboss.ws.core.binding.EndpointInvocation;
+import org.jboss.ws.core.binding.UnboundHeader;
+import org.jboss.ws.core.soap.MessageContextAssociation;
+import org.jboss.ws.core.soap.MessageFactoryImpl;
+import org.jboss.ws.core.soap.NameImpl;
+import org.jboss.ws.core.soap.SOAPBodyElementDoc;
+import org.jboss.ws.core.soap.SOAPBodyElementRpc;
+import org.jboss.ws.core.soap.SOAPContentElement;
+import org.jboss.ws.core.soap.SOAPElementImpl;
+import org.jboss.ws.core.soap.SOAPFactoryImpl;
+import org.jboss.ws.core.soap.SOAPFaultImpl;
+import org.jboss.ws.core.soap.SOAPHeaderElementImpl;
+import org.jboss.ws.core.soap.SOAPMessageImpl;
+import org.jboss.ws.core.soap.attachment.AttachmentPartImpl;
+import org.jboss.ws.core.soap.attachment.CIDGenerator;
import org.jboss.ws.extras.xop.XOPContext;
import org.jboss.ws.jaxrpc.ParameterWrapping;
import org.jboss.ws.jaxrpc.StubExt;
@@ -59,19 +72,6 @@
import org.jboss.ws.metadata.umdm.OperationMetaData;
import org.jboss.ws.metadata.umdm.ParameterMetaData;
import org.jboss.ws.metadata.umdm.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.DOMUtils;
import org.jboss.ws.utils.JavaUtils;
import org.jboss.ws.utils.MimeUtils;
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/BindingException.java
(from rev 1557,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/binding/BindingException.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/binding/BindingException.java 2006-12-05
23:29:55 UTC (rev 1557)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/BindingException.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -0,0 +1,92 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+package org.jboss.ws.core.binding;
+
+// $Id$
+
+/** An exception that may occur during message binding
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 16-Oct-2004
+ */
+public class BindingException extends Exception
+{
+ /**
+ * Constructs a new exception with <code>null</code> as its detail
message.
+ * The cause is not initialized, and may subsequently be initialized by a
+ * call to {@link #initCause}.
+ */
+ public BindingException()
+ {
+ }
+
+ /**
+ * Constructs a new exception with the specified detail message. The
+ * cause is not initialized, and may subsequently be initialized by
+ * a call to {@link #initCause}.
+ *
+ * @param message the detail message. The detail message is saved for
+ * later retrieval by the {@link #getMessage()} method.
+ */
+ public BindingException(String message)
+ {
+ super(message);
+ }
+
+ /**
+ * Constructs a new exception with the specified cause and a detail
+ * message of <tt>(cause==null ? null : cause.toString())</tt> (which
+ * typically contains the class and detail message of <tt>cause</tt>).
+ * This constructor is useful for exceptions that are little more than
+ * wrappers for other throwables (for example, {@link
+ * java.security.PrivilegedActionException}).
+ *
+ * @param cause the cause (which is saved for later retrieval by the
+ * {@link #getCause()} method). (A <tt>null</tt> value is
+ * permitted, and indicates that the cause is nonexistent or
+ * unknown.)
+ * @since 1.4
+ */
+ public BindingException(Throwable cause)
+ {
+ super(cause);
+ }
+
+ /**
+ * Constructs a new exception with the specified detail message and
+ * cause. <p>Note that the detail message associated with
+ * <code>cause</code> is <i>not</i> automatically incorporated
in
+ * this exception's detail message.
+ *
+ * @param message the detail message (which is saved for later retrieval
+ * by the {@link #getMessage()} method).
+ * @param cause the cause (which is saved for later retrieval by the
+ * {@link #getCause()} method). (A <tt>null</tt> value is
+ * permitted, and indicates that the cause is nonexistent or
+ * unknown.)
+ * @since 1.4
+ */
+ public BindingException(String message, Throwable cause)
+ {
+ super(message, cause);
+ }
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/ComplexTypeDeserializer.java
(from rev 1557,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/binding/ComplexTypeDeserializer.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/binding/ComplexTypeDeserializer.java 2006-12-05
23:29:55 UTC (rev 1557)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/ComplexTypeDeserializer.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -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.core.binding;
+
+// $Id$
+
+/**
+ * A Deserializer that can handle complex types by delegating to JAXB.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 04-Dec-2004
+ */
+public abstract class ComplexTypeDeserializer extends DeserializerSupport
+{
+
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/ComplexTypeSerializer.java
(from rev 1557,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/binding/ComplexTypeSerializer.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/binding/ComplexTypeSerializer.java 2006-12-05
23:29:55 UTC (rev 1557)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/ComplexTypeSerializer.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -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.core.binding;
+
+// $Id$
+
+/**
+ * A Serializer that can handle complex types by delegating to JAXB.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 04-Dec-2004
+ */
+public abstract class ComplexTypeSerializer extends SerializerSupport
+{
+
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/DeserializerSupport.java
(from rev 1557,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/binding/DeserializerSupport.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/binding/DeserializerSupport.java 2006-12-05
23:29:55 UTC (rev 1557)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/DeserializerSupport.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -0,0 +1,93 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ws.core.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(a)jboss.org
+ * @since 04-Dec-2004
+ */
+public abstract class DeserializerSupport implements Deserializer
+{
+
+ /** Deserialize an XML fragment to an object value
+ *
+ * @param xmlName The root element name of the resulting fragment
+ * @param xmlType The associated schema type
+ * @param xmlFragment The XML fragment to deserialize
+ * @param serContext The serialization context
+ */
+ public abstract Object deserialize(QName xmlName, QName xmlType, String xmlFragment,
SerializationContext serContext) throws BindingException;
+
+ /** Unwrap the value string from the XML fragment
+ *
+ * @return The value string or null if the startTag contains a xsi:nil='true'
attribute
+ */
+ protected String unwrapValueStr(String xmlFragment)
+ {
+ // We only scan for :nil if the xmlFragment is an empty element
+ if (isEmptyElement(xmlFragment))
+ {
+ return (isNil(xmlFragment) ? null : "");
+ }
+
+ int endOfStartTag = xmlFragment.indexOf(">");
+ int startOfEndTag = xmlFragment.lastIndexOf("</");
+ if (endOfStartTag < 0 || startOfEndTag < 0)
+ throw new IllegalArgumentException("Invalid XML fragment: " +
xmlFragment);
+
+ String valueStr = xmlFragment.substring(endOfStartTag + 1, startOfEndTag);
+
+ return XMLPredefinedEntityReferenceResolver.resolve(valueStr);
+ }
+
+ protected boolean isEmptyElement(String xmlFragment)
+ {
+ return xmlFragment.startsWith("<") &&
xmlFragment.endsWith("/>");
+ }
+
+ protected boolean isNil(String xmlFragment)
+ {
+ boolean isNil = false;
+ if (isEmptyElement(xmlFragment))
+ {
+ int endOfStartTag = xmlFragment.indexOf(">");
+ String startTag = xmlFragment.substring(0, endOfStartTag);
+ isNil = startTag.indexOf(":nil='1'") > 0 ||
startTag.indexOf(":nil=\"1\"") > 0;
+ isNil = isNil || startTag.indexOf(":nil='true'") > 0 ||
startTag.indexOf(":nil=\"true\"") > 0;
+ }
+ return isNil;
+ }
+
+ public String getMechanismType()
+ {
+ throw new NotImplementedException();
+ }
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/EndpointInvocation.java
(from rev 1559,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/binding/EndpointInvocation.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/binding/EndpointInvocation.java 2006-12-06
00:29:48 UTC (rev 1559)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/EndpointInvocation.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -0,0 +1,357 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+package org.jboss.ws.core.binding;
+
+// $Id$
+
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.activation.DataHandler;
+import javax.xml.namespace.QName;
+import javax.xml.rpc.ParameterMode;
+import javax.xml.soap.AttachmentPart;
+import javax.xml.soap.SOAPException;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.WSException;
+import org.jboss.ws.core.soap.SOAPContentElement;
+import org.jboss.ws.jaxrpc.ParameterWrapping;
+import org.jboss.ws.metadata.umdm.OperationMetaData;
+import org.jboss.ws.metadata.umdm.ParameterMetaData;
+import org.jboss.ws.metadata.umdm.WrappedParameter;
+import org.jboss.ws.utils.HolderUtils;
+import org.jboss.ws.utils.JavaUtils;
+import org.jboss.ws.utils.MimeUtils;
+
+/** A web service invocation.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 16-Oct-2004
+ */
+public class EndpointInvocation
+{
+ // provide logging
+ private static final Logger log = Logger.getLogger(EndpointInvocation.class);
+
+ // The operation meta data for this invocation
+ private OperationMetaData opMetaData;
+ // Map the named endpoint parameters
+ private Map<QName, Object> reqPayload = new LinkedHashMap<QName,
Object>();
+ // Map the named endpoint parameters
+ private Map<QName, Object> resPayload = new LinkedHashMap<QName,
Object>();
+ // The return value
+ private Object returnValue;
+ // Map of output parameters, key being the parameter index in the method signature
+ private Map<Integer, Object> outParameters = new HashMap<Integer,
Object>();
+
+ public EndpointInvocation(OperationMetaData opMetaData)
+ {
+ this.opMetaData = opMetaData;
+ }
+
+ public OperationMetaData getOperationMetaData()
+ {
+ return opMetaData;
+ }
+
+ public Method getJavaMethod()
+ {
+ return opMetaData.getJavaMethod();
+ }
+
+ public Map<Integer, Object> getOutParameters()
+ {
+ return outParameters;
+ }
+
+ public List<QName> getRequestParamNames()
+ {
+ List<QName> xmlNames = new ArrayList<QName>();
+ xmlNames.addAll(reqPayload.keySet());
+ return xmlNames;
+ }
+
+ public void setRequestParamValue(QName xmlName, Object value)
+ {
+ log.debug("setRequestParamValue: [name=" + xmlName + ",value="
+ getTypeName(value) + "]");
+ reqPayload.put(xmlName, value);
+ }
+
+ public Object getRequestParamValue(QName xmlName) throws SOAPException
+ {
+ log.debug("getRequestParamValue: " + xmlName);
+ Object paramValue = reqPayload.get(xmlName);
+ ParameterMetaData paramMetaData = opMetaData.getParameter(xmlName);
+ paramValue = transformPayloadValue(paramMetaData, paramValue);
+ return paramValue;
+ }
+
+ /** Returns the payload that can be passed on to the endpoint implementation
+ */
+ public Object[] getRequestPayload() throws SOAPException
+ {
+ log.debug("getRequestPayload");
+ List<QName> xmlNames = getRequestParamNames();
+
+ Object[] payload = new
Object[opMetaData.getJavaMethod().getParameterTypes().length];
+ for (int i = 0; i < xmlNames.size(); i++)
+ {
+ QName xmlName = xmlNames.get(i);
+ Object paramValue = getRequestParamValue(xmlName);
+
+ ParameterMetaData paramMetaData = opMetaData.getParameter(xmlName);
+ syncEndpointInputParam(paramMetaData, paramValue, payload);
+ }
+
+ return payload;
+ }
+
+ public List<QName> getResponseParamNames()
+ {
+ List<QName> xmlNames = new ArrayList<QName>();
+ xmlNames.addAll(resPayload.keySet());
+ return xmlNames;
+ }
+
+ public void setResponseParamValue(QName xmlName, Object value)
+ {
+ log.debug("setResponseParamValue: [name=" + xmlName + ",value="
+ getTypeName(value) + "]");
+ resPayload.put(xmlName, value);
+ }
+
+ public Object getResponseParamValue(QName xmlName) throws SOAPException
+ {
+ log.debug("getResponseParamValue: " + xmlName);
+ Object paramValue = resPayload.get(xmlName);
+ ParameterMetaData paramMetaData = opMetaData.getParameter(xmlName);
+ paramValue = transformPayloadValue(paramMetaData, paramValue);
+ if (paramValue != null)
+ {
+ Class valueType = paramValue.getClass();
+ if (HolderUtils.isHolderType(valueType))
+ {
+ paramValue = HolderUtils.getHolderValue(paramValue);
+ }
+ }
+ return paramValue;
+ }
+
+ public void setReturnValue(Object value)
+ {
+ ParameterMetaData retMetaData = opMetaData.getReturnParameter();
+ if (value != null && retMetaData == null)
+ throw new WSException("Operation does not have a return value: " +
opMetaData.getQName());
+
+ log.debug("setReturnValue: " + getTypeName(value));
+ this.returnValue = value;
+ }
+
+ public Object getReturnValue() throws SOAPException
+ {
+ log.debug("getReturnValue");
+ Object paramValue = returnValue;
+ ParameterMetaData paramMetaData = opMetaData.getReturnParameter();
+ if (paramMetaData != null)
+ {
+ paramValue = transformPayloadValue(paramMetaData, paramValue);
+ }
+ return paramValue;
+ }
+
+ private Object transformPayloadValue(ParameterMetaData paramMetaData, final Object
paramValue) throws SOAPException
+ {
+ QName xmlName = paramMetaData.getXmlName();
+ QName xmlType = paramMetaData.getXmlType();
+ Class javaType = paramMetaData.getJavaType();
+ String javaName = paramMetaData.getJavaTypeName();
+
+ if (xmlType == null)
+ throw new IllegalStateException("Cannot obtain xml type for:
[xmlName=" + xmlName + ",javaName=" + javaName + "]");
+
+ Object retValue = paramValue;
+
+ // Handle attachment part
+ if (paramValue instanceof AttachmentPart)
+ {
+ AttachmentPart part = (AttachmentPart)paramValue;
+
+ Set mimeTypes = paramMetaData.getMimeTypes();
+ if (DataHandler.class.isAssignableFrom(javaType) &&
!javaType.equals(Object.class))
+ {
+ DataHandler handler = part.getDataHandler();
+ String mimeType = MimeUtils.getBaseMimeType(handler.getContentType());
+
+ if (mimeTypes != null && !MimeUtils.isMemberOf(mimeType, mimeTypes))
+ throw new SOAPException("Mime type " + mimeType + " not
allowed for parameter " + xmlName + " allowed types are " + mimeTypes);
+
+ retValue = part.getDataHandler();
+ }
+ else
+ {
+ retValue = part.getContent();
+ String mimeType = MimeUtils.getBaseMimeType(part.getContentType());
+
+ if (mimeTypes != null && !MimeUtils.isMemberOf(mimeType, mimeTypes))
+ throw new SOAPException("Mime type " + mimeType + " not
allowed for parameter " + xmlName + " allowed types are " + mimeTypes);
+
+ if (retValue != null)
+ {
+ Class valueType = retValue.getClass();
+ if (JavaUtils.isAssignableFrom(javaType, valueType) == false)
+ throw new SOAPException("javaType [" + javaType.getName() +
"] is not assignable from attachment content: " + valueType.getName());
+ }
+ }
+ }
+ else if (paramValue instanceof SOAPContentElement)
+ {
+ // For type other than xsd:anyType we return the object value
+ if (xmlType.getLocalPart().equals("anyType") == false)
+ {
+ SOAPContentElement soapElement = (SOAPContentElement)paramValue;
+ retValue = soapElement.getObjectValue();
+ }
+ }
+
+ log.debug("transformPayloadValue: " + getTypeName(paramValue) + "
-> " + getTypeName(retValue));
+ return retValue;
+ }
+
+ /** Synchronize the operation IN, INOUT paramters with the call input parameters.
+ * Essetially it unwrapps holders and converts primitives to wrapper types.
+ */
+ public void initInputParams(Object[] inputParams)
+ {
+ for (ParameterMetaData paramMetaData : opMetaData.getParameters())
+ {
+ QName xmlName = paramMetaData.getXmlName();
+ Class javaType = paramMetaData.getJavaType();
+
+ Object value;
+ if (opMetaData.isDocumentWrapped() && paramMetaData.isInHeader() ==
false)
+ {
+ value = ParameterWrapping.wrapRequestParameters(paramMetaData, inputParams);
+ }
+ else
+ {
+ value = inputParams[paramMetaData.getIndex()];
+ if (value != null)
+ {
+ Class inputType = value.getClass();
+
+ if (HolderUtils.isHolderType(inputType))
+ {
+ // At runtime we lose the generic info for JAX-WS types,
+ // So we use the actual instance type if possible
+ value = HolderUtils.getHolderValue(value);
+ inputType = (value == null) ? HolderUtils.getValueType(inputType) :
value.getClass();
+ }
+
+ // Verify that the java type matches a registered xmlType
+ // Attachments are skipped because they don't use type mapping
+ if (!paramMetaData.isSwA() && !paramMetaData.isXOP())
+ {
+ if (JavaUtils.isAssignableFrom(javaType, inputType) == false)
+ throw new WSException("Parameter '" + javaType +
"' not assignable from: " + inputType);
+ }
+ }
+ }
+
+ setRequestParamValue(xmlName, value);
+ }
+ }
+
+ /**
+ * Synchronize the operation paramters with the endpoint method parameters
+ */
+ private void syncEndpointInputParam(ParameterMetaData paramMetaData, final Object
paramValue, Object[] payload)
+ {
+ Object retValue = paramValue;
+ Method method = opMetaData.getJavaMethod();
+ Class[] targetParameterTypes = method.getParameterTypes();
+
+ if (opMetaData.isDocumentWrapped() && paramMetaData.isInHeader() == false
&& paramMetaData.isMessageType() == false)
+ {
+ outParameters = ParameterWrapping.unwrapRequestParameters(paramMetaData,
paramValue, payload);
+ syncOutWrappedParameters(targetParameterTypes);
+ }
+ else
+ {
+ // Replace INOUT and OUT parameters by their respective holder values
+ int index = paramMetaData.getIndex();
+ Class targetParameterType = targetParameterTypes[index];
+
+ if (paramMetaData.getMode() == ParameterMode.INOUT || paramMetaData.getMode() ==
ParameterMode.OUT)
+ {
+ retValue = HolderUtils.createHolderInstance(paramValue,
targetParameterType);
+
+ QName xmlName = paramMetaData.getXmlName();
+ setResponseParamValue(xmlName, retValue);
+ }
+
+ if (retValue != null)
+ {
+ Class valueType = retValue.getClass();
+ if (JavaUtils.isAssignableFrom(targetParameterType, valueType) == false)
+ throw new WSException("Parameter " +
targetParameterType.getName() + " is not assignable from: " +
getTypeName(retValue));
+
+ if (valueType.isArray())
+ retValue = JavaUtils.syncArray(retValue, targetParameterType);
+ }
+
+ log.debug("syncEndpointInputParam: " + getTypeName(paramValue) +
" -> " + getTypeName(retValue) + "(" + index + ")");
+ payload[index] = retValue;
+ }
+ }
+
+ private void syncOutWrappedParameters(Class[] targetParameterTypes)
+ {
+ ParameterMetaData returnMetaData = opMetaData.getReturnParameter();
+ if (returnMetaData != null)
+ {
+ for (WrappedParameter param : returnMetaData.getWrappedParameters())
+ {
+ try
+ {
+ if (param.getIndex() >= 0)
+ outParameters.put(param.getIndex(),
targetParameterTypes[param.getIndex()].newInstance());
+ }
+ catch (Exception e)
+ {
+ throw new WSException("Could not add output param: " +
param.getName(), e);
+
+ }
+ }
+ }
+ }
+
+ private String getTypeName(Object value)
+ {
+ String valueType = (value != null ? value.getClass().getName() : null);
+ return valueType;
+ }
+}
\ No newline at end of file
Copied: branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/HeaderElement.java
(from rev 1557,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/binding/HeaderElement.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/binding/HeaderElement.java 2006-12-05
23:29:55 UTC (rev 1557)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/HeaderElement.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -0,0 +1,76 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+package org.jboss.ws.core.binding;
+
+// $Id$
+
+import javax.xml.namespace.QName;
+
+/**
+ * Created by IntelliJ IDEA.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since Jan 4, 2005
+ */
+public class HeaderElement
+{
+ private QName xmlName;
+ private QName xmlType;
+ private Class javaType;
+ private Object headerValue;
+
+ public HeaderElement(QName xmlName, QName xmlType, Class javaType, Object
headerValue)
+ {
+ if (xmlName == null || xmlType == null || javaType == null)
+ throw new IllegalArgumentException("Invalid null argument");
+
+ this.xmlName = xmlName;
+ this.xmlType = xmlType;
+ this.javaType = javaType;
+ this.headerValue = headerValue;
+ }
+
+ public QName getXmlName()
+ {
+ return xmlName;
+ }
+
+ public QName getXmlType()
+ {
+ return xmlType;
+ }
+
+ public Class getJavaType()
+ {
+ return javaType;
+ }
+
+ public Object getHeaderValue()
+ {
+ return headerValue;
+ }
+
+ public void setHeaderValue(Object headerValue)
+ {
+ this.headerValue = headerValue;
+ }
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/SerializationContext.java
(from rev 1557,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/binding/SerializationContext.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/binding/SerializationContext.java 2006-12-05
23:29:55 UTC (rev 1557)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/SerializationContext.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -0,0 +1,71 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ws.core.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(a)jboss.org
+ * @since 04-Dec-2004
+ */
+public abstract class SerializationContext
+{
+ // The type mapping that is valid for this serialization context
+ private TypeMappingImpl typeMapping;
+ // The namespace registry that is valid for this serialization context
+ private NamespaceRegistry namespaceRegistry = new NamespaceRegistry();
+ // An arbitrary property bag
+ private Map<Object, Object> properties = new HashMap<Object, Object>();
+
+ public Object getProperty(Object key)
+ {
+ return properties.get(key);
+ }
+
+ public void setProperty(Object key, Object value)
+ {
+ properties.put(key, value);
+ }
+
+ public TypeMappingImpl getTypeMapping()
+ {
+ return typeMapping;
+ }
+
+ public void setTypeMapping(TypeMappingImpl typeMapping)
+ {
+ this.typeMapping = typeMapping;
+ }
+
+ public NamespaceRegistry getNamespaceRegistry()
+ {
+ return namespaceRegistry;
+ }
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/SerializerSupport.java
(from rev 1557,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/binding/SerializerSupport.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/binding/SerializerSupport.java 2006-12-05
23:29:55 UTC (rev 1557)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/SerializerSupport.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -0,0 +1,164 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ws.core.binding;
+
+// $Id$
+
+import javax.xml.namespace.QName;
+import javax.xml.rpc.encoding.Serializer;
+
+import org.jboss.util.NotImplementedException;
+import org.jboss.ws.Constants;
+import org.jboss.xb.binding.NamespaceRegistry;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+
+/**
+ * The base class for all Serializers.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @author <a href="mailto:jason.greene@jboss.com">Jason T.
Greene</a>
+ * @since 04-Dec-2004
+ */
+public abstract class SerializerSupport implements Serializer
+{
+ /** Serialize an object value to an XML fragment
+ *
+ * @param xmlName The root element name of the resulting fragment
+ * @param xmlType The associated schema type
+ * @param value The value to serialize
+ * @param serContext The serialization context
+ * @param attributes TODO
+ * @param attributes The attributes on this element
+ */
+ public abstract String serialize(QName xmlName, QName xmlType, Object value,
SerializationContext serContext, NamedNodeMap attributes) throws BindingException;
+
+ /** Wrap the value string in a XML fragment with the given name
+ */
+ protected String wrapValueStr(QName xmlName, String valueStr, NamespaceRegistry
nsRegistry, NamedNodeMap attributes, boolean normalize)
+ {
+ String nsURI = xmlName.getNamespaceURI();
+ String localPart = xmlName.getLocalPart();
+ String prefix = xmlName.getPrefix();
+
+ StringBuilder nsAttr = new StringBuilder("");
+ if (attributes != null)
+ {
+ for (int i = 0; i < attributes.getLength(); i++)
+ {
+ Node attr = attributes.item(i);
+ String attrName = attr.getNodeName();
+ String attrValue = attr.getNodeValue();
+ nsAttr.append(" " + attrName + "='" + attrValue +
"'");
+ }
+ }
+
+ String elName;
+ if (nsURI.length() > 0)
+ {
+ xmlName = nsRegistry.registerQName(xmlName);
+ prefix = xmlName.getPrefix();
+ elName = prefix + ":" + localPart;
+
+ String xmlns = " xmlns:" + prefix + "='" + nsURI +
"'";
+ if (nsAttr.indexOf(xmlns) < 0)
+ {
+ nsAttr.append(xmlns);
+ }
+ }
+ else
+ {
+ elName = localPart;
+ }
+
+ String xmlFragment;
+ if (valueStr == null)
+ {
+ String xmlns = " xmlns:" + Constants.PREFIX_XSI + "='" +
Constants.NS_SCHEMA_XSI + "'";
+ xmlFragment = "<" + elName + nsAttr + " " +
Constants.PREFIX_XSI + ":nil='1'" + xmlns + "/>";
+ }
+ else
+ {
+ if(normalize)
+ valueStr = normalize(valueStr);
+ xmlFragment = "<" + elName + nsAttr + ">" + valueStr +
"</" + elName + ">";
+ }
+
+ return xmlFragment;
+ }
+
+ public String getMechanismType()
+ {
+ throw new NotImplementedException();
+ }
+
+ private String normalize(String valueStr)
+ {
+ // We assume most strings will not contain characters that need
"escaping",
+ // and optimize for this case.
+ boolean found = false;
+ int i = 0;
+
+ outer: for (; i < valueStr.length(); i++)
+ {
+ switch (valueStr.charAt(i))
+ {
+ case '<':
+ case '>':
+ case '&':
+ case '"':
+ found = true;
+ break outer;
+ }
+ }
+
+ if (!found)
+ return valueStr;
+
+ // Resume where we left off
+ StringBuilder builder = new StringBuilder();
+ builder.append(valueStr.substring(0, i));
+ for (; i < valueStr.length(); i++)
+ {
+ char c = valueStr.charAt(i);
+ switch (c)
+ {
+ case '<':
+ builder.append("<");
+ break;
+ case '>':
+ builder.append(">");
+ break;
+ case '&':
+ builder.append("&");
+ break;
+ case '"':
+ builder.append(""");
+ break;
+ default:
+ builder.append(c);
+ }
+ }
+
+ return builder.toString();
+ }
+}
\ No newline at end of file
Copied: branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/UnboundHeader.java
(from rev 1559,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/binding/UnboundHeader.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/binding/UnboundHeader.java 2006-12-06
00:29:48 UTC (rev 1559)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/UnboundHeader.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -0,0 +1,100 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ws.core.binding;
+
+// $Id$
+
+import javax.xml.namespace.QName;
+import javax.xml.rpc.ParameterMode;
+
+import org.jboss.ws.metadata.umdm.OperationMetaData;
+import org.jboss.ws.metadata.umdm.ParameterMetaData;
+
+/**
+ * Represents an unbound SOAPHeaderElement
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 04-Jan-2005
+ */
+public class UnboundHeader
+{
+ private QName xmlName;
+ private QName xmlType;
+ private Class javaType;
+ private ParameterMode mode;
+ private Object headerValue;
+
+ public UnboundHeader(QName xmlName, QName xmlType, Class javaType, ParameterMode
mode)
+ {
+ this.xmlName = xmlName;
+ this.xmlType = xmlType;
+ this.javaType = javaType;
+ this.mode = mode;
+ }
+
+ public QName getXmlName()
+ {
+ return xmlName;
+ }
+
+ public QName getXmlType()
+ {
+ return xmlType;
+ }
+
+ public Class getJavaType()
+ {
+ return javaType;
+ }
+
+ public ParameterMode getMode()
+ {
+ return mode;
+ }
+
+ public Object getHeaderValue()
+ {
+ return headerValue;
+ }
+
+ public void setHeaderValue(Object headerValue)
+ {
+ this.headerValue = headerValue;
+ }
+
+ public ParameterMetaData toParameterMetaData(OperationMetaData opMetaData)
+ {
+ ParameterMetaData paramMetaData = new ParameterMetaData(opMetaData, xmlName,
xmlType, javaType.getName());
+ paramMetaData.setInHeader(true);
+ return paramMetaData;
+ }
+
+ public String toString()
+ {
+ StringBuilder buffer = new StringBuilder("\nUnboundHeader:");
+ buffer.append("\n xmlName=" + getXmlName());
+ buffer.append("\n xmlType=" + getXmlType());
+ buffer.append("\n javaType=" + getJavaType().getName());
+ buffer.append("\n mode=" + getMode());
+ return buffer.toString();
+ }
+}
Copied: branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/soap (from rev
1557, branches/tdiesler/trunk/src/main/java/org/jboss/ws/binding/soap)
Deleted:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/soap/SOAPMessageMarshaller.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/binding/soap/SOAPMessageMarshaller.java 2006-12-05
23:29:55 UTC (rev 1557)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/soap/SOAPMessageMarshaller.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -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.binding.soap;
-
-import java.io.IOException;
-import java.io.OutputStream;
-
-import javax.xml.soap.SOAPEnvelope;
-import javax.xml.soap.SOAPException;
-import javax.xml.soap.SOAPMessage;
-
-import org.jboss.logging.Logger;
-import org.jboss.remoting.InvocationRequest;
-import org.jboss.remoting.invocation.OnewayInvocation;
-import org.jboss.remoting.marshal.Marshaller;
-import org.jboss.ws.utils.DOMUtils;
-import org.jboss.ws.utils.DOMWriter;
-import org.jboss.ws.soap.SOAPElementImpl;
-import org.jboss.ws.soap.SOAPElementWriter;
-import org.jboss.ws.soap.SOAPMessageImpl;
-/**
- * @author Thomas.Diesler(a)jboss.org
- * @since 25-Nov-2004
- */
-public class SOAPMessageMarshaller implements Marshaller
-{
- // Provide logging
- private static Logger log = Logger.getLogger(SOAPMessageMarshaller.class);
-
- /**
- * Marshaller will need to take the dataObject and convert
- * into primitive java data types and write to the
- * given output.
- *
- * @param dataObject Object to be writen to output
- * @param output The data output to write the object
- * data to.
- */
- public void write(Object dataObject, OutputStream output) throws IOException
- {
- if (dataObject instanceof InvocationRequest)
- dataObject = ((InvocationRequest)dataObject).getParameter();
-
- if (dataObject instanceof OnewayInvocation)
- dataObject = ((OnewayInvocation)dataObject).getParameters()[0];
-
- if ((dataObject instanceof SOAPMessage) == false)
- throw new IllegalArgumentException("Not a SOAPMessage: " +
dataObject);
-
- try
- {
- SOAPMessageImpl soapMessage = (SOAPMessageImpl)dataObject;
-
- // debug the outgoing message
- if (log.isTraceEnabled())
- {
- SOAPEnvelope soapEnv = soapMessage.getSOAPPart().getEnvelope();
- String envStr = SOAPElementWriter.writeElement((SOAPElementImpl)soapEnv,
true);
- log.trace("Outgoing SOAPMessage\n" + envStr);
- }
-
- soapMessage.writeTo(output);
- }
- catch (SOAPException e)
- {
- log.error("Cannot marshall SOAPMessage", e);
- throw new IOException(e.toString());
- }
- }
-
- public Marshaller cloneMarshaller() throws CloneNotSupportedException
- {
- return new SOAPMessageMarshaller();
- }
-}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/soap/SOAPMessageMarshaller.java
(from rev 1560,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/binding/soap/SOAPMessageMarshaller.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/binding/soap/SOAPMessageMarshaller.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/soap/SOAPMessageMarshaller.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -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.core.binding.soap;
+
+import java.io.IOException;
+import java.io.OutputStream;
+
+import javax.xml.soap.SOAPEnvelope;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPMessage;
+
+import org.jboss.logging.Logger;
+import org.jboss.remoting.InvocationRequest;
+import org.jboss.remoting.invocation.OnewayInvocation;
+import org.jboss.remoting.marshal.Marshaller;
+import org.jboss.ws.utils.DOMUtils;
+import org.jboss.ws.utils.DOMWriter;
+import org.jboss.ws.core.soap.SOAPElementImpl;
+import org.jboss.ws.core.soap.SOAPElementWriter;
+import org.jboss.ws.core.soap.SOAPMessageImpl;
+/**
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Nov-2004
+ */
+public class SOAPMessageMarshaller implements Marshaller
+{
+ // Provide logging
+ private static Logger log = Logger.getLogger(SOAPMessageMarshaller.class);
+
+ /**
+ * Marshaller will need to take the dataObject and convert
+ * into primitive java data types and write to the
+ * given output.
+ *
+ * @param dataObject Object to be writen to output
+ * @param output The data output to write the object
+ * data to.
+ */
+ public void write(Object dataObject, OutputStream output) throws IOException
+ {
+ if (dataObject instanceof InvocationRequest)
+ dataObject = ((InvocationRequest)dataObject).getParameter();
+
+ if (dataObject instanceof OnewayInvocation)
+ dataObject = ((OnewayInvocation)dataObject).getParameters()[0];
+
+ if ((dataObject instanceof SOAPMessage) == false)
+ throw new IllegalArgumentException("Not a SOAPMessage: " +
dataObject);
+
+ try
+ {
+ SOAPMessageImpl soapMessage = (SOAPMessageImpl)dataObject;
+
+ // debug the outgoing message
+ if (log.isTraceEnabled())
+ {
+ SOAPEnvelope soapEnv = soapMessage.getSOAPPart().getEnvelope();
+ String envStr = SOAPElementWriter.writeElement((SOAPElementImpl)soapEnv,
true);
+ log.trace("Outgoing SOAPMessage\n" + envStr);
+ }
+
+ soapMessage.writeTo(output);
+ }
+ catch (SOAPException e)
+ {
+ log.error("Cannot marshall SOAPMessage", e);
+ throw new IOException(e.toString());
+ }
+ }
+
+ public Marshaller cloneMarshaller() throws CloneNotSupportedException
+ {
+ return new SOAPMessageMarshaller();
+ }
+}
Deleted:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/soap/SOAPMessageUnMarshaller.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/binding/soap/SOAPMessageUnMarshaller.java 2006-12-05
23:29:55 UTC (rev 1557)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/soap/SOAPMessageUnMarshaller.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -1,124 +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.io.IOException;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import javax.servlet.http.HttpServletResponse;
-import javax.xml.soap.MimeHeaders;
-import javax.xml.soap.SOAPException;
-import javax.xml.soap.SOAPMessage;
-
-import org.jboss.logging.Logger;
-import org.jboss.remoting.marshal.UnMarshaller;
-import org.jboss.remoting.transport.http.HTTPMetadataConstants;
-import org.jboss.ws.WSException;
-import org.jboss.ws.soap.MessageFactoryImpl;
-
-/**
- * @author Thomas.Diesler(a)jboss.org
- * @since 25-Nov-2004
- */
-public class SOAPMessageUnMarshaller implements UnMarshaller
-{
- // Provide logging
- private static Logger log = Logger.getLogger(SOAPMessageUnMarshaller.class);
-
- private static List validResponseCodes = new ArrayList();
- static
- {
- validResponseCodes.add(HttpServletResponse.SC_OK);
- validResponseCodes.add(HttpServletResponse.SC_ACCEPTED);
- validResponseCodes.add(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
- }
-
- public Object read(InputStream inputStream, Map metadata) throws IOException,
ClassNotFoundException
- {
- if (log.isTraceEnabled())
- {
- log.trace("Read input stream with metadata=" + metadata);
- }
-
- try
- {
- Integer resCode = (Integer)metadata.get(HTTPMetadataConstants.RESPONSE_CODE);
- String resMessage =
(String)metadata.get(HTTPMetadataConstants.RESPONSE_CODE_MESSAGE);
- if (resCode != null && validResponseCodes.contains(resCode) == false)
- throw new WSException("Invalid HTTP server response [" + resCode +
"] - " + resMessage);
-
- MimeHeaders mimeHeaders = getMimeHeaders(metadata);
- SOAPMessage soapMsg = new
MessageFactoryImpl().createMessageInternal(mimeHeaders, inputStream, true);
- return soapMsg;
- }
- catch (SOAPException e)
- {
- log.error("Cannot unmarshall SOAPMessage", e);
- throw new IOException(e.toString());
- }
- }
-
- /**
- * Set the class loader to use for unmarhsalling. This may
- * be needed when need to have access to class definitions that
- * are not part of this unmarshaller's parent classloader (especially
- * when doing remote classloading).
- *
- * @param classloader
- */
- public void setClassLoader(ClassLoader classloader)
- {
- //NO OP
- }
-
- public UnMarshaller cloneUnMarshaller() throws CloneNotSupportedException
- {
- return new SOAPMessageUnMarshaller();
- }
-
- private MimeHeaders getMimeHeaders(Map metadata)
- {
- log.debug("getMimeHeaders from: " + metadata);
-
- MimeHeaders headers = new MimeHeaders();
- Iterator i = metadata.keySet().iterator();
- while (i.hasNext())
- {
- String key = (String)i.next();
- Object value = metadata.get(key);
- if (key != null && value instanceof List)
- {
- for (Object listValue : (List)value)
- {
- headers.addHeader(key, listValue.toString());
- }
- }
- }
- return headers;
- }
-}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/soap/SOAPMessageUnMarshaller.java
(from rev 1560,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/binding/soap/SOAPMessageUnMarshaller.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/binding/soap/SOAPMessageUnMarshaller.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/soap/SOAPMessageUnMarshaller.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -0,0 +1,124 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ws.core.binding.soap;
+
+// $Id$
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.servlet.http.HttpServletResponse;
+import javax.xml.soap.MimeHeaders;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPMessage;
+
+import org.jboss.logging.Logger;
+import org.jboss.remoting.marshal.UnMarshaller;
+import org.jboss.remoting.transport.http.HTTPMetadataConstants;
+import org.jboss.ws.WSException;
+import org.jboss.ws.core.soap.MessageFactoryImpl;
+
+/**
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Nov-2004
+ */
+public class SOAPMessageUnMarshaller implements UnMarshaller
+{
+ // Provide logging
+ private static Logger log = Logger.getLogger(SOAPMessageUnMarshaller.class);
+
+ private static List validResponseCodes = new ArrayList();
+ static
+ {
+ validResponseCodes.add(HttpServletResponse.SC_OK);
+ validResponseCodes.add(HttpServletResponse.SC_ACCEPTED);
+ validResponseCodes.add(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+ }
+
+ public Object read(InputStream inputStream, Map metadata) throws IOException,
ClassNotFoundException
+ {
+ if (log.isTraceEnabled())
+ {
+ log.trace("Read input stream with metadata=" + metadata);
+ }
+
+ try
+ {
+ Integer resCode = (Integer)metadata.get(HTTPMetadataConstants.RESPONSE_CODE);
+ String resMessage =
(String)metadata.get(HTTPMetadataConstants.RESPONSE_CODE_MESSAGE);
+ if (resCode != null && validResponseCodes.contains(resCode) == false)
+ throw new WSException("Invalid HTTP server response [" + resCode +
"] - " + resMessage);
+
+ MimeHeaders mimeHeaders = getMimeHeaders(metadata);
+ SOAPMessage soapMsg = new
MessageFactoryImpl().createMessageInternal(mimeHeaders, inputStream, true);
+ return soapMsg;
+ }
+ catch (SOAPException e)
+ {
+ log.error("Cannot unmarshall SOAPMessage", e);
+ throw new IOException(e.toString());
+ }
+ }
+
+ /**
+ * Set the class loader to use for unmarhsalling. This may
+ * be needed when need to have access to class definitions that
+ * are not part of this unmarshaller's parent classloader (especially
+ * when doing remote classloading).
+ *
+ * @param classloader
+ */
+ public void setClassLoader(ClassLoader classloader)
+ {
+ //NO OP
+ }
+
+ public UnMarshaller cloneUnMarshaller() throws CloneNotSupportedException
+ {
+ return new SOAPMessageUnMarshaller();
+ }
+
+ private MimeHeaders getMimeHeaders(Map metadata)
+ {
+ log.debug("getMimeHeaders from: " + metadata);
+
+ MimeHeaders headers = new MimeHeaders();
+ Iterator i = metadata.keySet().iterator();
+ while (i.hasNext())
+ {
+ String key = (String)i.next();
+ Object value = metadata.get(key);
+ if (key != null && value instanceof List)
+ {
+ for (Object listValue : (List)value)
+ {
+ headers.addHeader(key, listValue.toString());
+ }
+ }
+ }
+ return headers;
+ }
+}
Copied: branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server (from rev 1557,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/server)
Deleted:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/AbstractServiceEndpointInvoker.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/server/AbstractServiceEndpointInvoker.java 2006-12-05
23:29:55 UTC (rev 1557)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/AbstractServiceEndpointInvoker.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -1,316 +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.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.lang.reflect.UndeclaredThrowableException;
-
-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.Binding;
-import javax.xml.ws.BindingProvider;
-import javax.xml.ws.handler.MessageContext;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.Constants;
-import org.jboss.ws.binding.EndpointInvocation;
-import org.jboss.ws.common.CommonBinding;
-import org.jboss.ws.common.CommonBindingProvider;
-import org.jboss.ws.common.CommonMessageContext;
-import org.jboss.ws.common.CommonSOAPBinding;
-import org.jboss.ws.jaxrpc.handler.HandlerDelegateJAXRPC;
-import org.jboss.ws.jaxws.core.BindingProviderImpl;
-import org.jboss.ws.jaxws.handler.HandlerDelegateJAXWS;
-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(a)jboss.org
- * @since 19-Jan-2005
- */
-public abstract class AbstractServiceEndpointInvoker implements ServiceEndpointInvoker,
HandlerDelegate
-{
- // provide logging
- private static Logger log = Logger.getLogger(AbstractServiceEndpointInvoker.class);
-
- protected CommonBindingProvider bindingProvider;
- protected HandlerDelegate handlerDelegate;
-
- /** Initialize the service endpoint */
- public void initServiceEndpoint(ServiceEndpointInfo seInfo)
- {
- ServerEndpointMetaData sepMetaData = seInfo.getServerEndpointMetaData();
-
- if (sepMetaData.getType() == EndpointMetaData.Type.JAXRPC)
- {
- bindingProvider = new CommonBindingProvider(sepMetaData);
- handlerDelegate = new HandlerDelegateJAXRPC();
- }
- else
- {
- bindingProvider = new BindingProviderImpl(sepMetaData);
- Binding binding = ((BindingProvider)bindingProvider).getBinding();
- handlerDelegate = new HandlerDelegateJAXWS(binding);
- }
- }
-
- /** 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) throws Exception;
-
- /** 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;
- CommonBinding 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 = bindingProvider.getCommonBinding();
-
- // Get the operation meta data from the SOAP message
- opMetaData = getDispatchDestination(epMetaData, reqMessage);
- msgContext.setOperationMetaData(opMetaData);
- oneway = opMetaData.isOneWay();
-
- // 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);
- }
-
- // Set the outbound property
- if (epMetaData.getType() == EndpointMetaData.Type.JAXWS)
- msgContext.setProperty(MessageContext.MESSAGE_OUTBOUND_PROPERTY, new
Boolean(true));
-
- // 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
- {
- CommonSOAPBinding soapBinding =
(CommonSOAPBinding)bindingProvider.getCommonBinding();
- SOAPMessage faultMessage = soapBinding.exceptionToFaultMessage(ex);
- msgContext.setSOAPMessage(faultMessage);
-
- // call the handler chain
- boolean handlersPass = callFaultHandlerChain(seInfo, HandlerType.POST, ex);
- handlersPass = handlersPass && callFaultHandlerChain(seInfo,
HandlerType.ENDPOINT, ex);
- handlersPass = handlersPass && 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 invocation exceptions */
- public void handleInvocationException(Throwable th) throws Exception
- {
- if (th instanceof InvocationTargetException)
- {
- // unwrap the throwable raised by the service endpoint implementation
- Throwable targetEx = ((InvocationTargetException)th).getTargetException();
- handleInvocationThrowable(targetEx);
- }
-
- if (th instanceof MBeanException)
- {
- throw ((MBeanException)th).getTargetException();
- }
-
- handleInvocationThrowable(th);
- }
-
- private void handleInvocationThrowable(Throwable th) throws Exception
- {
- if (th instanceof Exception)
- {
- throw (Exception)th;
- }
- else if (th instanceof Error)
- {
- throw (Error)th;
- }
- else
- {
- throw new UndeclaredThrowableException(th);
- }
- }
-}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/AbstractServiceEndpointInvoker.java
(from rev 1560,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/server/AbstractServiceEndpointInvoker.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/server/AbstractServiceEndpointInvoker.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/AbstractServiceEndpointInvoker.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -0,0 +1,316 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ws.core.server;
+
+// $Id$
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.lang.reflect.UndeclaredThrowableException;
+
+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.Binding;
+import javax.xml.ws.BindingProvider;
+import javax.xml.ws.handler.MessageContext;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.Constants;
+import org.jboss.ws.core.CommonBinding;
+import org.jboss.ws.core.CommonBindingProvider;
+import org.jboss.ws.core.CommonMessageContext;
+import org.jboss.ws.core.CommonSOAPBinding;
+import org.jboss.ws.core.binding.EndpointInvocation;
+import org.jboss.ws.core.soap.MessageContextAssociation;
+import org.jboss.ws.core.soap.SOAPBodyImpl;
+import org.jboss.ws.core.soap.SOAPMessageImpl;
+import org.jboss.ws.jaxrpc.handler.HandlerDelegateJAXRPC;
+import org.jboss.ws.jaxws.core.BindingProviderImpl;
+import org.jboss.ws.jaxws.handler.HandlerDelegateJAXWS;
+import org.jboss.ws.metadata.umdm.EndpointMetaData;
+import org.jboss.ws.metadata.umdm.OperationMetaData;
+import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
+import org.jboss.ws.metadata.umdm.HandlerMetaData.HandlerType;
+import org.jboss.ws.utils.JavaUtils;
+
+/** An implementation handles invocations on the endpoint
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 19-Jan-2005
+ */
+public abstract class AbstractServiceEndpointInvoker implements ServiceEndpointInvoker,
HandlerDelegate
+{
+ // provide logging
+ private static Logger log = Logger.getLogger(AbstractServiceEndpointInvoker.class);
+
+ protected CommonBindingProvider bindingProvider;
+ protected HandlerDelegate handlerDelegate;
+
+ /** Initialize the service endpoint */
+ public void initServiceEndpoint(ServiceEndpointInfo seInfo)
+ {
+ ServerEndpointMetaData sepMetaData = seInfo.getServerEndpointMetaData();
+
+ if (sepMetaData.getType() == EndpointMetaData.Type.JAXRPC)
+ {
+ bindingProvider = new CommonBindingProvider(sepMetaData);
+ handlerDelegate = new HandlerDelegateJAXRPC();
+ }
+ else
+ {
+ bindingProvider = new BindingProviderImpl(sepMetaData);
+ Binding binding = ((BindingProvider)bindingProvider).getBinding();
+ handlerDelegate = new HandlerDelegateJAXWS(binding);
+ }
+ }
+
+ /** 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) throws Exception;
+
+ /** 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;
+ CommonBinding 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 = bindingProvider.getCommonBinding();
+
+ // Get the operation meta data from the SOAP message
+ opMetaData = getDispatchDestination(epMetaData, reqMessage);
+ msgContext.setOperationMetaData(opMetaData);
+ oneway = opMetaData.isOneWay();
+
+ // 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);
+ }
+
+ // Set the outbound property
+ if (epMetaData.getType() == EndpointMetaData.Type.JAXWS)
+ msgContext.setProperty(MessageContext.MESSAGE_OUTBOUND_PROPERTY, new
Boolean(true));
+
+ // 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
+ {
+ CommonSOAPBinding soapBinding =
(CommonSOAPBinding)bindingProvider.getCommonBinding();
+ SOAPMessage faultMessage = soapBinding.exceptionToFaultMessage(ex);
+ msgContext.setSOAPMessage(faultMessage);
+
+ // call the handler chain
+ boolean handlersPass = callFaultHandlerChain(seInfo, HandlerType.POST, ex);
+ handlersPass = handlersPass && callFaultHandlerChain(seInfo,
HandlerType.ENDPOINT, ex);
+ handlersPass = handlersPass && 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 invocation exceptions */
+ public void handleInvocationException(Throwable th) throws Exception
+ {
+ if (th instanceof InvocationTargetException)
+ {
+ // unwrap the throwable raised by the service endpoint implementation
+ Throwable targetEx = ((InvocationTargetException)th).getTargetException();
+ handleInvocationThrowable(targetEx);
+ }
+
+ if (th instanceof MBeanException)
+ {
+ throw ((MBeanException)th).getTargetException();
+ }
+
+ handleInvocationThrowable(th);
+ }
+
+ private void handleInvocationThrowable(Throwable th) throws Exception
+ {
+ if (th instanceof Exception)
+ {
+ throw (Exception)th;
+ }
+ else if (th instanceof Error)
+ {
+ throw (Error)th;
+ }
+ else
+ {
+ throw new UndeclaredThrowableException(th);
+ }
+ }
+}
Deleted:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/AbstractServiceEndpointServlet.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/server/AbstractServiceEndpointServlet.java 2006-12-05
23:29:55 UTC (rev 1557)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/AbstractServiceEndpointServlet.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -1,164 +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: AbstractServiceEndpointServlet.java 396 2006-05-23 09:48:45Z
thomas.diesler(a)jboss.com $
-
-import java.io.IOException;
-import java.io.Writer;
-import java.net.URL;
-
-import javax.management.ObjectName;
-import javax.servlet.ServletConfig;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.xml.rpc.JAXRPCException;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.WSException;
-import org.jboss.ws.metadata.ServerEndpointMetaData;
-import org.jboss.ws.utils.ObjectNameFactory;
-
-/**
- * A servlet that is installed for every web service endpoint.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 15-Jan-2005
- */
-public abstract class AbstractServiceEndpointServlet extends HttpServlet
-{
- // provide logging
- private static final Logger log =
Logger.getLogger(AbstractServiceEndpointServlet.class);
-
- protected ObjectName sepId;
- protected ServiceEndpointManager epManager;
-
- public void init(ServletConfig config) throws ServletException
- {
- super.init(config);
- initServiceEndpointManager();
- }
-
- public void destroy()
- {
- super.destroy();
- }
-
- public void service(HttpServletRequest req, HttpServletResponse res) throws
ServletException, IOException
- {
- if (sepId == null)
- {
- String contextPath = req.getContextPath();
- initServiceEndpoint(contextPath);
- }
- super.service(req, res);
- }
-
- public void doGet(HttpServletRequest req, HttpServletResponse res) throws
ServletException, IOException
- {
- // Process a WSDL request
- if (req.getParameter("wsdl") != null ||
req.getParameter("WSDL") != null)
- {
- res.setContentType("text/xml");
- try
- {
- // For the base document the resourcePath should be null
- String resourcePath = (String)req.getParameter("resource");
- URL requestURL = new URL(req.getRequestURL().toString());
- epManager.processWSDLRequest(sepId, res.getOutputStream(), requestURL,
resourcePath);
- }
- catch (Exception ex)
- {
- handleException(ex);
- }
- }
- else
- {
- res.setStatus(405);
- res.setContentType("text/plain");
- Writer out = res.getWriter();
- out.write("HTTP GET not supported");
- out.flush();
- out.close();
- }
- }
-
- public void doPost(HttpServletRequest req, HttpServletResponse res) throws
ServletException, IOException
- {
- log.debug("doPost: " + req.getRequestURI());
-
- try
- {
- EndpointContext context = new EndpointContext(getServletContext(), req, res);
- epManager.processSOAPRequest(sepId, req.getInputStream(), res.getOutputStream(),
context);
- }
- catch (Exception ex)
- {
- handleException(ex);
- }
- }
-
- private void handleException(Exception ex) throws ServletException
- {
- log.error("Error processing web service request", ex);
-
- if (ex instanceof JAXRPCException)
- throw (JAXRPCException)ex;
-
- throw new ServletException(ex);
- }
-
- protected void initServiceEndpointManager()
- {
- ServiceEndpointManagerFactory factory =
ServiceEndpointManagerFactory.getInstance();
- epManager = factory.getServiceEndpointManager();
- }
-
- /** Initialize the service endpoint
- */
- protected void initServiceEndpoint(String contextPath)
- {
- String servletName = getServletName();
- if (contextPath.startsWith("/"))
- contextPath = contextPath.substring(1);
-
- for (ObjectName sepId : epManager.getServiceEndpoints())
- {
- String context =
sepId.getKeyProperty(ServerEndpointMetaData.SEPID_PROPERTY_CONTEXT);
- String endpoint =
sepId.getKeyProperty(ServerEndpointMetaData.SEPID_PROPERTY_ENDPOINT);
- if (servletName.equals(endpoint) && contextPath.equals(context))
- {
- this.sepId = sepId;
- break;
- }
- }
-
- if (sepId == null)
- {
- ObjectName oname = ObjectNameFactory.create(ServerEndpointMetaData.SEPID_DOMAIN
+ ":" + ServerEndpointMetaData.SEPID_PROPERTY_CONTEXT + "=" +
contextPath
- + "," + ServerEndpointMetaData.SEPID_PROPERTY_ENDPOINT +
"=" + servletName);
- throw new WSException("Cannot obtain endpoint for: " + oname);
- }
- }
-}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/AbstractServiceEndpointServlet.java
(from rev 1560,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/server/AbstractServiceEndpointServlet.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/server/AbstractServiceEndpointServlet.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/AbstractServiceEndpointServlet.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -0,0 +1,164 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ws.core.server;
+
+// $Id: AbstractServiceEndpointServlet.java 396 2006-05-23 09:48:45Z
thomas.diesler(a)jboss.com $
+
+import java.io.IOException;
+import java.io.Writer;
+import java.net.URL;
+
+import javax.management.ObjectName;
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.xml.rpc.JAXRPCException;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.WSException;
+import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
+import org.jboss.ws.utils.ObjectNameFactory;
+
+/**
+ * A servlet that is installed for every web service endpoint.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 15-Jan-2005
+ */
+public abstract class AbstractServiceEndpointServlet extends HttpServlet
+{
+ // provide logging
+ private static final Logger log =
Logger.getLogger(AbstractServiceEndpointServlet.class);
+
+ protected ObjectName sepId;
+ protected ServiceEndpointManager epManager;
+
+ public void init(ServletConfig config) throws ServletException
+ {
+ super.init(config);
+ initServiceEndpointManager();
+ }
+
+ public void destroy()
+ {
+ super.destroy();
+ }
+
+ public void service(HttpServletRequest req, HttpServletResponse res) throws
ServletException, IOException
+ {
+ if (sepId == null)
+ {
+ String contextPath = req.getContextPath();
+ initServiceEndpoint(contextPath);
+ }
+ super.service(req, res);
+ }
+
+ public void doGet(HttpServletRequest req, HttpServletResponse res) throws
ServletException, IOException
+ {
+ // Process a WSDL request
+ if (req.getParameter("wsdl") != null ||
req.getParameter("WSDL") != null)
+ {
+ res.setContentType("text/xml");
+ try
+ {
+ // For the base document the resourcePath should be null
+ String resourcePath = (String)req.getParameter("resource");
+ URL requestURL = new URL(req.getRequestURL().toString());
+ epManager.processWSDLRequest(sepId, res.getOutputStream(), requestURL,
resourcePath);
+ }
+ catch (Exception ex)
+ {
+ handleException(ex);
+ }
+ }
+ else
+ {
+ res.setStatus(405);
+ res.setContentType("text/plain");
+ Writer out = res.getWriter();
+ out.write("HTTP GET not supported");
+ out.flush();
+ out.close();
+ }
+ }
+
+ public void doPost(HttpServletRequest req, HttpServletResponse res) throws
ServletException, IOException
+ {
+ log.debug("doPost: " + req.getRequestURI());
+
+ try
+ {
+ EndpointContext context = new EndpointContext(getServletContext(), req, res);
+ epManager.processSOAPRequest(sepId, req.getInputStream(), res.getOutputStream(),
context);
+ }
+ catch (Exception ex)
+ {
+ handleException(ex);
+ }
+ }
+
+ private void handleException(Exception ex) throws ServletException
+ {
+ log.error("Error processing web service request", ex);
+
+ if (ex instanceof JAXRPCException)
+ throw (JAXRPCException)ex;
+
+ throw new ServletException(ex);
+ }
+
+ protected void initServiceEndpointManager()
+ {
+ ServiceEndpointManagerFactory factory =
ServiceEndpointManagerFactory.getInstance();
+ epManager = factory.getServiceEndpointManager();
+ }
+
+ /** Initialize the service endpoint
+ */
+ protected void initServiceEndpoint(String contextPath)
+ {
+ String servletName = getServletName();
+ if (contextPath.startsWith("/"))
+ contextPath = contextPath.substring(1);
+
+ for (ObjectName sepId : epManager.getServiceEndpoints())
+ {
+ String context =
sepId.getKeyProperty(ServerEndpointMetaData.SEPID_PROPERTY_CONTEXT);
+ String endpoint =
sepId.getKeyProperty(ServerEndpointMetaData.SEPID_PROPERTY_ENDPOINT);
+ if (servletName.equals(endpoint) && contextPath.equals(context))
+ {
+ this.sepId = sepId;
+ break;
+ }
+ }
+
+ if (sepId == null)
+ {
+ ObjectName oname = ObjectNameFactory.create(ServerEndpointMetaData.SEPID_DOMAIN
+ ":" + ServerEndpointMetaData.SEPID_PROPERTY_CONTEXT + "=" +
contextPath
+ + "," + ServerEndpointMetaData.SEPID_PROPERTY_ENDPOINT +
"=" + servletName);
+ throw new WSException("Cannot obtain endpoint for: " + oname);
+ }
+ }
+}
Deleted:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/EndpointContext.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/server/EndpointContext.java 2006-12-05
23:29:55 UTC (rev 1557)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/EndpointContext.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -1,76 +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 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(a)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
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/EndpointContext.java (from
rev 1560, branches/tdiesler/trunk/src/main/java/org/jboss/ws/server/EndpointContext.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/server/EndpointContext.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/EndpointContext.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -0,0 +1,76 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ws.core.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.core.soap.MessageContextAssociation;
+
+/**
+ * Implementation of ServletEndpointContext
+ *
+ * @author Thomas.Diesler(a)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
Deleted:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/HandlerDelegate.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/server/HandlerDelegate.java 2006-12-05
23:29:55 UTC (rev 1557)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/HandlerDelegate.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -1,40 +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 org.jboss.ws.metadata.HandlerMetaData.HandlerType;
-
-/** An implementation of handles invocations on the endpoint
- *
- * @author Thomas.Diesler(a)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);
-}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/HandlerDelegate.java (from
rev 1560, branches/tdiesler/trunk/src/main/java/org/jboss/ws/server/HandlerDelegate.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/server/HandlerDelegate.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/HandlerDelegate.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -0,0 +1,40 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ws.core.server;
+
+// $Id$
+
+import org.jboss.ws.metadata.umdm.HandlerMetaData.HandlerType;
+
+/** An implementation of handles invocations on the endpoint
+ *
+ * @author Thomas.Diesler(a)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);
+}
Deleted: branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/HeaderSource.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/server/HeaderSource.java 2006-12-05
23:29:55 UTC (rev 1557)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/HeaderSource.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -1,49 +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;
-
-import javax.xml.soap.MimeHeaders;
-
-/**
- * Generic abstraction of a source that allows getting and setting
- * of transport specific MIME headers.
- *
- * @author <a href="mailto:jason@stacksmash.com">Jason T.
Greene</a>
- */
-public interface HeaderSource
-{
- /**
- * Gets the MIME headers from an inbound source. An implementation may
- * return <code>null</code> if the transport does not provide headers.
- *
- * @return the MIME headers
- */
- public MimeHeaders getMimeHeaders();
-
- /**
- * Sets the MIME headers for an outbound source. An implementation may
- * return <code>null</code> if the transport does not provide headers.
- *
- * @param headers the MIME headers
- */
- public void setMimeHeaders(MimeHeaders headers);
-}
Copied: branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/HeaderSource.java
(from rev 1560,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/server/HeaderSource.java)
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/server/HeaderSource.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/HeaderSource.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -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 org.jboss.ws.core.server;
+
+import javax.xml.soap.MimeHeaders;
+
+/**
+ * Generic abstraction of a source that allows getting and setting
+ * of transport specific MIME headers.
+ *
+ * @author <a href="mailto:jason@stacksmash.com">Jason T.
Greene</a>
+ */
+public interface HeaderSource
+{
+ /**
+ * Gets the MIME headers from an inbound source. An implementation may
+ * return <code>null</code> if the transport does not provide headers.
+ *
+ * @return the MIME headers
+ */
+ public MimeHeaders getMimeHeaders();
+
+ /**
+ * Sets the MIME headers for an outbound source. An implementation may
+ * return <code>null</code> if the transport does not provide headers.
+ *
+ * @param headers the MIME headers
+ */
+ public void setMimeHeaders(MimeHeaders headers);
+}
Deleted: branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/HttpContext.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/server/HttpContext.java 2006-12-05
23:29:55 UTC (rev 1557)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/HttpContext.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -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.server;
-
-// $Id$
-
-/**
- * An abstract HTTP Context
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 07-Jul-2006
- */
-public class HttpContext
-{
- private HttpServer server;
- private String contextRoot;
-
- public HttpContext(HttpServer server, String contextRoot)
- {
- this.server = server;
- this.contextRoot = contextRoot;
- }
-
- public HttpServer getHttpServer()
- {
- return server;
- }
-
- public String getContextRoot()
- {
- return contextRoot;
- }
-}
Copied: branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/HttpContext.java
(from rev 1560,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/server/HttpContext.java)
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/server/HttpContext.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/HttpContext.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -0,0 +1,52 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ws.core.server;
+
+// $Id$
+
+/**
+ * An abstract HTTP Context
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 07-Jul-2006
+ */
+public class HttpContext
+{
+ private HttpServer server;
+ private String contextRoot;
+
+ public HttpContext(HttpServer server, String contextRoot)
+ {
+ this.server = server;
+ this.contextRoot = contextRoot;
+ }
+
+ public HttpServer getHttpServer()
+ {
+ return server;
+ }
+
+ public String getContextRoot()
+ {
+ return contextRoot;
+ }
+}
Deleted: branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/HttpServer.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/server/HttpServer.java 2006-12-05
23:29:55 UTC (rev 1557)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/HttpServer.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -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.util.HashMap;
-import java.util.Map;
-
-import javax.xml.ws.Endpoint;
-
-import org.jboss.ws.jaxws.util.FactoryFinder;
-
-/**
- * An abstract HTTP Server
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 07-Jul-2006
- */
-public abstract class HttpServer
-{
- public static String HTTP_SERVER_PROPERTY = HttpServer.class.getName();
- public static String DEFAULT_HTTP_SERVER_PROPERTY =
"org.jboss.ws.integration.jboss.JBossHttpServer";
-
- private Map<String, Object> properties = new HashMap<String, Object>();
-
- // Hide constructor
- protected HttpServer ()
- {
- }
-
- /**
- * Create an instance of an HTTP server.
- * The discovery algorithm is described in {@link FactoryFinder.find(String,String)}
- */
- public static HttpServer create()
- {
- HttpServer server = (HttpServer)FactoryFinder.find(HTTP_SERVER_PROPERTY,
DEFAULT_HTTP_SERVER_PROPERTY);
- return server;
- }
-
- /** Start an instance of this HTTP server */
- public abstract void start();
-
- /** Create an HTTP context */
- public abstract HttpContext createContext(String string);
-
- /** Publish an JAXWS endpoint to the HTTP server */
- public abstract void publish(HttpContext context, Endpoint endpoint);
-
- /** Destroys an JAXWS endpoint on the HTTP server */
- public abstract void destroy(HttpContext context, Endpoint endpoint);
-
- public Map<String, Object> getProperties()
- {
- return properties;
- }
-
- public void setProperties(Map<String, Object> map)
- {
- properties = map;
- }
-
- public void setProperty(String key, Object value)
- {
- properties.put(key, value);
- }
-
- public Object getProperty(String key)
- {
- return properties.get(key);
- }
-
-}
Copied: branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/HttpServer.java
(from rev 1560,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/server/HttpServer.java)
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/server/HttpServer.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/HttpServer.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -0,0 +1,93 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ws.core.server;
+
+// $Id$
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.xml.ws.Endpoint;
+
+import org.jboss.ws.jaxws.util.FactoryFinder;
+
+/**
+ * An abstract HTTP Server
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 07-Jul-2006
+ */
+public abstract class HttpServer
+{
+ public static String HTTP_SERVER_PROPERTY = HttpServer.class.getName();
+ public static String DEFAULT_HTTP_SERVER_PROPERTY =
"org.jboss.ws.integration.jboss.JBossHttpServer";
+
+ private Map<String, Object> properties = new HashMap<String, Object>();
+
+ // Hide constructor
+ protected HttpServer ()
+ {
+ }
+
+ /**
+ * Create an instance of an HTTP server.
+ * The discovery algorithm is described in {@link FactoryFinder.find(String,String)}
+ */
+ public static HttpServer create()
+ {
+ HttpServer server = (HttpServer)FactoryFinder.find(HTTP_SERVER_PROPERTY,
DEFAULT_HTTP_SERVER_PROPERTY);
+ return server;
+ }
+
+ /** Start an instance of this HTTP server */
+ public abstract void start();
+
+ /** Create an HTTP context */
+ public abstract HttpContext createContext(String string);
+
+ /** Publish an JAXWS endpoint to the HTTP server */
+ public abstract void publish(HttpContext context, Endpoint endpoint);
+
+ /** Destroys an JAXWS endpoint on the HTTP server */
+ public abstract void destroy(HttpContext context, Endpoint endpoint);
+
+ public Map<String, Object> getProperties()
+ {
+ return properties;
+ }
+
+ public void setProperties(Map<String, Object> map)
+ {
+ properties = map;
+ }
+
+ public void setProperty(String key, Object value)
+ {
+ properties.put(key, value);
+ }
+
+ public Object getProperty(String key)
+ {
+ return properties.get(key);
+ }
+
+}
Deleted:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/KernelLocator.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/server/KernelLocator.java 2006-12-05
23:29:55 UTC (rev 1557)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/KernelLocator.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -1,54 +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: WebServiceDeployer.java 312 2006-05-11 10:49:22Z thomas.diesler(a)jboss.com $
-
-import org.jboss.kernel.Kernel;
-import org.jboss.kernel.spi.dependency.KernelControllerContext;
-import org.jboss.kernel.spi.dependency.KernelControllerContextAware;
-
-/**
- * Locate the single instance of the kernel
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 12-May-2006
- */
-public class KernelLocator implements KernelControllerContextAware
-{
- private static Kernel kernel;
-
- public static Kernel getKernel()
- {
- return kernel;
- }
-
- public void setKernelControllerContext(KernelControllerContext context) throws
Exception
- {
- kernel = context.getKernel();
- }
-
- public void unsetKernelControllerContext(KernelControllerContext arg0) throws
Exception
- {
- kernel = null;
- }
-}
Copied: branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/KernelLocator.java
(from rev 1560,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/server/KernelLocator.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/server/KernelLocator.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/KernelLocator.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -0,0 +1,54 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ws.core.server;
+
+//$Id: WebServiceDeployer.java 312 2006-05-11 10:49:22Z thomas.diesler(a)jboss.com $
+
+import org.jboss.kernel.Kernel;
+import org.jboss.kernel.spi.dependency.KernelControllerContext;
+import org.jboss.kernel.spi.dependency.KernelControllerContextAware;
+
+/**
+ * Locate the single instance of the kernel
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 12-May-2006
+ */
+public class KernelLocator implements KernelControllerContextAware
+{
+ private static Kernel kernel;
+
+ public static Kernel getKernel()
+ {
+ return kernel;
+ }
+
+ public void setKernelControllerContext(KernelControllerContext context) throws
Exception
+ {
+ kernel = context.getKernel();
+ }
+
+ public void unsetKernelControllerContext(KernelControllerContext arg0) throws
Exception
+ {
+ kernel = null;
+ }
+}
Deleted:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/MessageContextInjector.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/server/MessageContextInjector.java 2006-12-05
23:29:55 UTC (rev 1557)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/MessageContextInjector.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -1,85 +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.lang.reflect.Field;
-import java.lang.reflect.Method;
-
-import javax.annotation.Resource;
-import javax.xml.ws.WebServiceContext;
-import javax.xml.ws.handler.MessageContext;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.jaxws.WebServiceContextImpl;
-
-/**
- * Inject the JAXWS WebServiceContext
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 04-Jan-2006
- */
-public class MessageContextInjector
-{
- // provide logging
- private static Logger log = Logger.getLogger(MessageContextInjector.class);
-
- public static void injectMessageContext(Object epImpl, MessageContext msgContext)
- {
- WebServiceContextImpl webServiceContext = new WebServiceContextImpl(msgContext);
-
- try
- {
- // scan fields that are marked with @Resource
- Field[] fields = epImpl.getClass().getFields();
- for (Field field : fields)
- {
- Class type = field.getType();
- if (type == WebServiceContext.class &&
field.isAnnotationPresent(Resource.class))
- {
- field.set(epImpl, webServiceContext);
- }
- }
-
- // scan methods that are marked with @Resource
- Method[] methods = epImpl.getClass().getMethods();
- for (Method method : methods)
- {
- Class[] paramTypes = method.getParameterTypes();
- if (paramTypes.length == 1 && paramTypes[0] ==
WebServiceContext.class && method.isAnnotationPresent(Resource.class))
- {
- method.invoke(epImpl, new Object[] { webServiceContext });
-
- }
- }
- }
- catch (RuntimeException rte)
- {
- throw rte;
- }
- catch (Exception ex)
- {
- log.warn("Cannot inject WebServiceContext", ex);
- }
- }
-}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/MessageContextInjector.java
(from rev 1560,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/server/MessageContextInjector.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/server/MessageContextInjector.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/MessageContextInjector.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -0,0 +1,85 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ws.core.server;
+
+// $Id$
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+
+import javax.annotation.Resource;
+import javax.xml.ws.WebServiceContext;
+import javax.xml.ws.handler.MessageContext;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.jaxws.WebServiceContextImpl;
+
+/**
+ * Inject the JAXWS WebServiceContext
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 04-Jan-2006
+ */
+public class MessageContextInjector
+{
+ // provide logging
+ private static Logger log = Logger.getLogger(MessageContextInjector.class);
+
+ public static void injectMessageContext(Object epImpl, MessageContext msgContext)
+ {
+ WebServiceContextImpl webServiceContext = new WebServiceContextImpl(msgContext);
+
+ try
+ {
+ // scan fields that are marked with @Resource
+ Field[] fields = epImpl.getClass().getFields();
+ for (Field field : fields)
+ {
+ Class type = field.getType();
+ if (type == WebServiceContext.class &&
field.isAnnotationPresent(Resource.class))
+ {
+ field.set(epImpl, webServiceContext);
+ }
+ }
+
+ // scan methods that are marked with @Resource
+ Method[] methods = epImpl.getClass().getMethods();
+ for (Method method : methods)
+ {
+ Class[] paramTypes = method.getParameterTypes();
+ if (paramTypes.length == 1 && paramTypes[0] ==
WebServiceContext.class && method.isAnnotationPresent(Resource.class))
+ {
+ method.invoke(epImpl, new Object[] { webServiceContext });
+
+ }
+ }
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (Exception ex)
+ {
+ log.warn("Cannot inject WebServiceContext", ex);
+ }
+ }
+}
Deleted: branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/ServerConfig.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/server/ServerConfig.java 2006-12-05
23:29:55 UTC (rev 1557)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/ServerConfig.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -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: ServiceEndpointManagerFactory.java 293 2006-05-08 16:31:50Z
thomas.diesler(a)jboss.com $
-
-import java.io.File;
-
-/**
- * Interface to container independent config
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 08-May-2006
- */
-public interface ServerConfig
-{
- static final String BEAN_NAME = "ServerConfig";
-
- File getServerTempDir();
-
- File getServerDataDir();
-}
Copied: branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/ServerConfig.java
(from rev 1560,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/server/ServerConfig.java)
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/server/ServerConfig.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/ServerConfig.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -0,0 +1,41 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ws.core.server;
+
+// $Id: ServiceEndpointManagerFactory.java 293 2006-05-08 16:31:50Z
thomas.diesler(a)jboss.com $
+
+import java.io.File;
+
+/**
+ * Interface to container independent config
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 08-May-2006
+ */
+public interface ServerConfig
+{
+ static final String BEAN_NAME = "ServerConfig";
+
+ File getServerTempDir();
+
+ File getServerDataDir();
+}
Deleted:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/ServerConfigFactory.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/server/ServerConfigFactory.java 2006-12-05
23:29:55 UTC (rev 1557)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/ServerConfigFactory.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -1,57 +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;
-
-import org.jboss.kernel.spi.registry.KernelRegistry;
-import org.jboss.logging.Logger;
-
-// $Id: ServiceEndpointManagerFactory.java 293 2006-05-08 16:31:50Z
thomas.diesler(a)jboss.com $
-
-/**
- * Factory to container independent config
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 08-May-2006
- */
-public class ServerConfigFactory
-{
- // provide logging
- private static final Logger log = Logger.getLogger(ServerConfigFactory.class);
-
- private static ServerConfigFactory instance = new ServerConfigFactory();
-
- // Hide ctor
- protected ServerConfigFactory()
- {
- }
-
- public static ServerConfigFactory getInstance()
- {
- return instance;
- }
-
- public ServerConfig getServerConfig()
- {
- KernelRegistry registry = KernelLocator.getKernel().getRegistry();
- return (ServerConfig)registry.getEntry(ServerConfig.BEAN_NAME).getTarget();
- }
-}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/ServerConfigFactory.java
(from rev 1560,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/server/ServerConfigFactory.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/server/ServerConfigFactory.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/ServerConfigFactory.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -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 org.jboss.ws.core.server;
+
+import org.jboss.kernel.spi.registry.KernelRegistry;
+import org.jboss.logging.Logger;
+
+// $Id: ServiceEndpointManagerFactory.java 293 2006-05-08 16:31:50Z
thomas.diesler(a)jboss.com $
+
+/**
+ * Factory to container independent config
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 08-May-2006
+ */
+public class ServerConfigFactory
+{
+ // provide logging
+ private static final Logger log = Logger.getLogger(ServerConfigFactory.class);
+
+ private static ServerConfigFactory instance = new ServerConfigFactory();
+
+ // Hide ctor
+ protected ServerConfigFactory()
+ {
+ }
+
+ public static ServerConfigFactory getInstance()
+ {
+ return instance;
+ }
+
+ public ServerConfig getServerConfig()
+ {
+ KernelRegistry registry = KernelLocator.getKernel().getRegistry();
+ return (ServerConfig)registry.getEntry(ServerConfig.BEAN_NAME).getTarget();
+ }
+}
Deleted:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/ServiceEndpoint.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/server/ServiceEndpoint.java 2006-12-05
23:29:55 UTC (rev 1557)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/ServiceEndpoint.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -1,301 +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.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-import java.net.URL;
-
-import javax.xml.namespace.QName;
-import javax.xml.rpc.JAXRPCException;
-import javax.xml.rpc.soap.SOAPFaultException;
-import javax.xml.soap.MimeHeaders;
-import javax.xml.soap.SOAPEnvelope;
-import javax.xml.soap.SOAPMessage;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.Constants;
-import org.jboss.ws.xop.XOPContext;
-import org.jboss.ws.binding.BindingException;
-import org.jboss.ws.common.CommonBindingProvider;
-import org.jboss.ws.common.CommonMessageContext;
-import org.jboss.ws.common.CommonSOAPBinding;
-import org.jboss.ws.metadata.EndpointMetaData;
-import org.jboss.ws.metadata.ServerEndpointMetaData;
-import org.jboss.ws.metadata.UnifiedMetaData;
-import org.jboss.ws.soap.MessageContextAssociation;
-import org.jboss.ws.soap.MessageFactoryImpl;
-import org.jboss.ws.soap.SOAPElementImpl;
-import org.jboss.ws.soap.SOAPElementWriter;
-import org.jboss.ws.soap.SOAPMessageImpl;
-import org.jboss.ws.utils.DOMWriter;
-import org.w3c.dom.Document;
-
-/**
- * This object registered with the ServiceEndpointManager service.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 16-Jan-2005
- */
-public class ServiceEndpoint
-{
- // provide logging
- private static Logger log = Logger.getLogger(ServiceEndpoint.class);
- private static Logger msgLog = Logger.getLogger("jbossws.SOAPMessage");
-
- /** Endpoint type enum */
- public enum State
- {
- CREATED, STARTED, STOPED, DESTROYED
- }
-
- // The deployment info for this endpoint
- protected ServiceEndpointInfo seInfo;
- // Some metrics for this endpoint
- protected ServiceEndpointMetrics seMetrics;
-
- public ServiceEndpoint(ServiceEndpointInfo seInfo)
- {
- this.seInfo = seInfo;
- this.seInfo.setState(State.CREATED);
- this.seMetrics = new ServiceEndpointMetrics(seInfo.getServiceEndpointID());
- }
-
- public State getState()
- {
- return seInfo.getState();
- }
-
- public ServiceEndpointInfo getServiceEndpointInfo()
- {
- return seInfo;
- }
-
- public ServiceEndpointMetrics getServiceEndpointMetrics()
- {
- return seMetrics;
- }
-
- public void create() throws Exception
- {
- seInfo.setState(State.CREATED);
- }
-
- public void start() throws Exception
- {
- // eagerly initialize the UMDM
- ServerEndpointMetaData epMetaData = seInfo.getServerEndpointMetaData();
- UnifiedMetaData wsMetaData = epMetaData.getServiceMetaData().getUnifiedMetaData();
- wsMetaData.eagerInitialize();
-
- seMetrics.start();
- seInfo.setState(State.STARTED);
- }
-
- public void stop()
- {
- seMetrics.stop();
- seInfo.setState(State.STOPED);
- log.debug("Stop Endpoint" + seMetrics);
- }
-
- public void destroy()
- {
- seInfo.setState(State.DESTROYED);
- }
-
- /** Handle a WSDL request or a request for an included resource
- */
- public void handleWSDLRequest(OutputStream outStream, URL reqURL, String resPath)
throws IOException
- {
- ServiceEndpointInfo sepInfo = getServiceEndpointInfo();
- EndpointMetaData epMetaData = sepInfo.getServerEndpointMetaData();
-
- String wsdlHost = reqURL.getHost();
-
- ServiceEndpointManagerFactory factory =
ServiceEndpointManagerFactory.getInstance();
- ServiceEndpointManager epManager = factory.getServiceEndpointManager();
- if (epManager.getWebServiceHost().equals(ServiceEndpointManager.UNDEFINED_HOSTNAME)
== false)
- {
- wsdlHost = epManager.getWebServiceHost();
- }
- log.debug("WSDL request, using host: " + wsdlHost);
-
- WSDLRequestHandler wsdlRequestHandler = new WSDLRequestHandler(epMetaData);
- Document document = wsdlRequestHandler.getDocumentForPath(reqURL, wsdlHost,
resPath);
-
- OutputStreamWriter writer = new OutputStreamWriter(outStream);
- new DOMWriter(writer).setPrettyprint(true).print(document.getDocumentElement());
- outStream.flush();
- outStream.close();
- }
-
- /**
- * Handle a request to this web service endpoint
- */
- public SOAPMessage handleRequest(HeaderSource headerSource, EndpointContext context,
InputStream inputStream) throws BindingException
- {
- CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
- ServerEndpointMetaData epMetaData = seInfo.getServerEndpointMetaData();
-
- long beginProcessing = 0;
- ClassLoader ctxClassLoader = Thread.currentThread().getContextClassLoader();
- try
- {
- State state = seInfo.getState();
- if (state != State.STARTED)
- {
- QName faultCode = Constants.SOAP11_FAULT_CODE_SERVER;
- String faultString = "Endpoint cannot handle requests in state: " +
state;
- throw new SOAPFaultException(faultCode, faultString, null, null);
- }
-
- log.debug("BEGIN handleRequest: " + seInfo.getServiceEndpointID());
- beginProcessing = seMetrics.processRequestMessage();
-
- MessageFactoryImpl msgFactory = new MessageFactoryImpl();
- msgFactory.setServiceMode(epMetaData.getServiceMode());
- msgFactory.setStyle(epMetaData.getStyle());
-
- MimeHeaders headers = (headerSource != null ? headerSource.getMimeHeaders() :
null);
- SOAPMessageImpl reqMessage = (SOAPMessageImpl)msgFactory.createMessage(headers,
inputStream);
-
- // Associate current message with message context
- msgContext.setSOAPMessage(reqMessage);
-
- // debug the incomming message
- if (msgLog.isTraceEnabled())
- {
- SOAPEnvelope soapEnv = reqMessage.getSOAPPart().getEnvelope();
- String envStr = SOAPElementWriter.writeElement((SOAPElementImpl)soapEnv,
true);
- msgLog.trace("Incomming SOAPMessage\n" + envStr);
- }
-
- // Set the thread context class loader
- ClassLoader classLoader = epMetaData.getClassLoader();
- Thread.currentThread().setContextClassLoader(classLoader);
-
- // Invoke the service endpoint
- ServiceEndpointInvoker seInvoker = seInfo.getInvoker();
- SOAPMessage resMessage = seInvoker.invoke(seInfo, context);
-
- postProcessResponse(headerSource, resMessage);
-
- return resMessage;
- }
- catch (Exception ex)
- {
- SOAPMessage resMessage = msgContext.getSOAPMessage();
-
- // In case we have an exception before the invoker is called
- // we create the fault message here.
- if (resMessage == null || ((SOAPMessageImpl)resMessage).isFaultMessage() ==
false)
- {
- CommonBindingProvider bindingProvider = getCommonBindingProvider();
- CommonSOAPBinding soapBinding =
(CommonSOAPBinding)bindingProvider.getCommonBinding();
-
- resMessage = soapBinding.exceptionToFaultMessage(ex);
- msgContext.setSOAPMessage(resMessage);
- }
-
- postProcessResponse(headerSource, resMessage);
- return resMessage;
- }
- finally
- {
- try
- {
- SOAPMessage soapMessage = msgContext.getSOAPMessage();
- if (soapMessage != null && soapMessage.getSOAPPart().getEnvelope() !=
null)
- {
- if (soapMessage.getSOAPPart().getEnvelope().getBody().getFault() != null)
- {
- seMetrics.processFaultMessage(beginProcessing);
- }
- else
- {
- seMetrics.processResponseMessage(beginProcessing);
- }
- }
- }
- catch (Exception ex)
- {
- log.error("Cannot process metrics", ex);
- }
-
- // Reset the thread context class loader
- Thread.currentThread().setContextClassLoader(ctxClassLoader);
- log.debug("END handleRequest: " + seInfo.getServiceEndpointID());
- }
- }
-
- /** Set response mime headers
- */
- private void postProcessResponse(HeaderSource headerSource, SOAPMessage resMessage)
- {
- try
- {
- // Set the outbound headers
- if (headerSource != null)
- {
- XOPContext.eagerlyCreateAttachments();
- resMessage.saveChanges();
- headerSource.setMimeHeaders(resMessage.getMimeHeaders());
- }
-
- // debug the outgoing message
- if (msgLog.isTraceEnabled())
- {
- resMessage.saveChanges();
- SOAPEnvelope soapEnv = resMessage.getSOAPPart().getEnvelope();
- if (soapEnv != null)
- {
- String envStr = SOAPElementWriter.writeElement((SOAPElementImpl)soapEnv,
true);
- msgLog.trace("Outgoing SOAPMessage\n" + envStr);
- }
- }
- }
- catch (Exception ex)
- {
- throw new JAXRPCException("Cannot create or send response message",
ex);
- }
- }
-
- private CommonBindingProvider getCommonBindingProvider()
- {
- return new CommonBindingProvider(seInfo.getServerEndpointMetaData());
- }
-
- /**
- * Returns a string representation of the object.
- */
- public String toString()
- {
- StringBuilder buffer = new StringBuilder(seInfo.toString());
- buffer.append("\n state=" + seInfo.getState());
- return buffer.toString();
- }
-}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/ServiceEndpoint.java (from
rev 1560, branches/tdiesler/trunk/src/main/java/org/jboss/ws/server/ServiceEndpoint.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/server/ServiceEndpoint.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/ServiceEndpoint.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -0,0 +1,301 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ws.core.server;
+
+// $Id$
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.net.URL;
+
+import javax.xml.namespace.QName;
+import javax.xml.rpc.JAXRPCException;
+import javax.xml.rpc.soap.SOAPFaultException;
+import javax.xml.soap.MimeHeaders;
+import javax.xml.soap.SOAPEnvelope;
+import javax.xml.soap.SOAPMessage;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.Constants;
+import org.jboss.ws.core.CommonBindingProvider;
+import org.jboss.ws.core.CommonMessageContext;
+import org.jboss.ws.core.CommonSOAPBinding;
+import org.jboss.ws.core.binding.BindingException;
+import org.jboss.ws.core.soap.MessageContextAssociation;
+import org.jboss.ws.core.soap.MessageFactoryImpl;
+import org.jboss.ws.core.soap.SOAPElementImpl;
+import org.jboss.ws.core.soap.SOAPElementWriter;
+import org.jboss.ws.core.soap.SOAPMessageImpl;
+import org.jboss.ws.extras.xop.XOPContext;
+import org.jboss.ws.metadata.umdm.EndpointMetaData;
+import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
+import org.jboss.ws.metadata.umdm.UnifiedMetaData;
+import org.jboss.ws.utils.DOMWriter;
+import org.w3c.dom.Document;
+
+/**
+ * This object registered with the ServiceEndpointManager service.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 16-Jan-2005
+ */
+public class ServiceEndpoint
+{
+ // provide logging
+ private static Logger log = Logger.getLogger(ServiceEndpoint.class);
+ private static Logger msgLog = Logger.getLogger("jbossws.SOAPMessage");
+
+ /** Endpoint type enum */
+ public enum State
+ {
+ CREATED, STARTED, STOPED, DESTROYED
+ }
+
+ // The deployment info for this endpoint
+ protected ServiceEndpointInfo seInfo;
+ // Some metrics for this endpoint
+ protected ServiceEndpointMetrics seMetrics;
+
+ public ServiceEndpoint(ServiceEndpointInfo seInfo)
+ {
+ this.seInfo = seInfo;
+ this.seInfo.setState(State.CREATED);
+ this.seMetrics = new ServiceEndpointMetrics(seInfo.getServiceEndpointID());
+ }
+
+ public State getState()
+ {
+ return seInfo.getState();
+ }
+
+ public ServiceEndpointInfo getServiceEndpointInfo()
+ {
+ return seInfo;
+ }
+
+ public ServiceEndpointMetrics getServiceEndpointMetrics()
+ {
+ return seMetrics;
+ }
+
+ public void create() throws Exception
+ {
+ seInfo.setState(State.CREATED);
+ }
+
+ public void start() throws Exception
+ {
+ // eagerly initialize the UMDM
+ ServerEndpointMetaData epMetaData = seInfo.getServerEndpointMetaData();
+ UnifiedMetaData wsMetaData = epMetaData.getServiceMetaData().getUnifiedMetaData();
+ wsMetaData.eagerInitialize();
+
+ seMetrics.start();
+ seInfo.setState(State.STARTED);
+ }
+
+ public void stop()
+ {
+ seMetrics.stop();
+ seInfo.setState(State.STOPED);
+ log.debug("Stop Endpoint" + seMetrics);
+ }
+
+ public void destroy()
+ {
+ seInfo.setState(State.DESTROYED);
+ }
+
+ /** Handle a WSDL request or a request for an included resource
+ */
+ public void handleWSDLRequest(OutputStream outStream, URL reqURL, String resPath)
throws IOException
+ {
+ ServiceEndpointInfo sepInfo = getServiceEndpointInfo();
+ EndpointMetaData epMetaData = sepInfo.getServerEndpointMetaData();
+
+ String wsdlHost = reqURL.getHost();
+
+ ServiceEndpointManagerFactory factory =
ServiceEndpointManagerFactory.getInstance();
+ ServiceEndpointManager epManager = factory.getServiceEndpointManager();
+ if (epManager.getWebServiceHost().equals(ServiceEndpointManager.UNDEFINED_HOSTNAME)
== false)
+ {
+ wsdlHost = epManager.getWebServiceHost();
+ }
+ log.debug("WSDL request, using host: " + wsdlHost);
+
+ WSDLRequestHandler wsdlRequestHandler = new WSDLRequestHandler(epMetaData);
+ Document document = wsdlRequestHandler.getDocumentForPath(reqURL, wsdlHost,
resPath);
+
+ OutputStreamWriter writer = new OutputStreamWriter(outStream);
+ new DOMWriter(writer).setPrettyprint(true).print(document.getDocumentElement());
+ outStream.flush();
+ outStream.close();
+ }
+
+ /**
+ * Handle a request to this web service endpoint
+ */
+ public SOAPMessage handleRequest(HeaderSource headerSource, EndpointContext context,
InputStream inputStream) throws BindingException
+ {
+ CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
+ ServerEndpointMetaData epMetaData = seInfo.getServerEndpointMetaData();
+
+ long beginProcessing = 0;
+ ClassLoader ctxClassLoader = Thread.currentThread().getContextClassLoader();
+ try
+ {
+ State state = seInfo.getState();
+ if (state != State.STARTED)
+ {
+ QName faultCode = Constants.SOAP11_FAULT_CODE_SERVER;
+ String faultString = "Endpoint cannot handle requests in state: " +
state;
+ throw new SOAPFaultException(faultCode, faultString, null, null);
+ }
+
+ log.debug("BEGIN handleRequest: " + seInfo.getServiceEndpointID());
+ beginProcessing = seMetrics.processRequestMessage();
+
+ MessageFactoryImpl msgFactory = new MessageFactoryImpl();
+ msgFactory.setServiceMode(epMetaData.getServiceMode());
+ msgFactory.setStyle(epMetaData.getStyle());
+
+ MimeHeaders headers = (headerSource != null ? headerSource.getMimeHeaders() :
null);
+ SOAPMessageImpl reqMessage = (SOAPMessageImpl)msgFactory.createMessage(headers,
inputStream);
+
+ // Associate current message with message context
+ msgContext.setSOAPMessage(reqMessage);
+
+ // debug the incomming message
+ if (msgLog.isTraceEnabled())
+ {
+ SOAPEnvelope soapEnv = reqMessage.getSOAPPart().getEnvelope();
+ String envStr = SOAPElementWriter.writeElement((SOAPElementImpl)soapEnv,
true);
+ msgLog.trace("Incomming SOAPMessage\n" + envStr);
+ }
+
+ // Set the thread context class loader
+ ClassLoader classLoader = epMetaData.getClassLoader();
+ Thread.currentThread().setContextClassLoader(classLoader);
+
+ // Invoke the service endpoint
+ ServiceEndpointInvoker seInvoker = seInfo.getInvoker();
+ SOAPMessage resMessage = seInvoker.invoke(seInfo, context);
+
+ postProcessResponse(headerSource, resMessage);
+
+ return resMessage;
+ }
+ catch (Exception ex)
+ {
+ SOAPMessage resMessage = msgContext.getSOAPMessage();
+
+ // In case we have an exception before the invoker is called
+ // we create the fault message here.
+ if (resMessage == null || ((SOAPMessageImpl)resMessage).isFaultMessage() ==
false)
+ {
+ CommonBindingProvider bindingProvider = getCommonBindingProvider();
+ CommonSOAPBinding soapBinding =
(CommonSOAPBinding)bindingProvider.getCommonBinding();
+
+ resMessage = soapBinding.exceptionToFaultMessage(ex);
+ msgContext.setSOAPMessage(resMessage);
+ }
+
+ postProcessResponse(headerSource, resMessage);
+ return resMessage;
+ }
+ finally
+ {
+ try
+ {
+ SOAPMessage soapMessage = msgContext.getSOAPMessage();
+ if (soapMessage != null && soapMessage.getSOAPPart().getEnvelope() !=
null)
+ {
+ if (soapMessage.getSOAPPart().getEnvelope().getBody().getFault() != null)
+ {
+ seMetrics.processFaultMessage(beginProcessing);
+ }
+ else
+ {
+ seMetrics.processResponseMessage(beginProcessing);
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ log.error("Cannot process metrics", ex);
+ }
+
+ // Reset the thread context class loader
+ Thread.currentThread().setContextClassLoader(ctxClassLoader);
+ log.debug("END handleRequest: " + seInfo.getServiceEndpointID());
+ }
+ }
+
+ /** Set response mime headers
+ */
+ private void postProcessResponse(HeaderSource headerSource, SOAPMessage resMessage)
+ {
+ try
+ {
+ // Set the outbound headers
+ if (headerSource != null)
+ {
+ XOPContext.eagerlyCreateAttachments();
+ resMessage.saveChanges();
+ headerSource.setMimeHeaders(resMessage.getMimeHeaders());
+ }
+
+ // debug the outgoing message
+ if (msgLog.isTraceEnabled())
+ {
+ resMessage.saveChanges();
+ SOAPEnvelope soapEnv = resMessage.getSOAPPart().getEnvelope();
+ if (soapEnv != null)
+ {
+ String envStr = SOAPElementWriter.writeElement((SOAPElementImpl)soapEnv,
true);
+ msgLog.trace("Outgoing SOAPMessage\n" + envStr);
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ throw new JAXRPCException("Cannot create or send response message",
ex);
+ }
+ }
+
+ private CommonBindingProvider getCommonBindingProvider()
+ {
+ return new CommonBindingProvider(seInfo.getServerEndpointMetaData());
+ }
+
+ /**
+ * Returns a string representation of the object.
+ */
+ public String toString()
+ {
+ StringBuilder buffer = new StringBuilder(seInfo.toString());
+ buffer.append("\n state=" + seInfo.getState());
+ return buffer.toString();
+ }
+}
Deleted:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/ServiceEndpointInfo.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/server/ServiceEndpointInfo.java 2006-12-05
23:29:55 UTC (rev 1557)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/ServiceEndpointInfo.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -1,149 +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 javax.management.ObjectName;
-
-import org.jboss.ws.WSException;
-import org.jboss.ws.deployment.UnifiedDeploymentInfo;
-import org.jboss.ws.deployment.UnifiedDeploymentInfo.DeploymentType;
-import org.jboss.ws.metadata.ServerEndpointMetaData;
-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.UnifiedSessionMetaData;
-
-/**
- * This object registered with the EndpointManager service.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 16-Jan-2005
- */
-public class ServiceEndpointInfo
-{
- /** Endpoint type enum */
- public enum EndpointType
- {
- JSE, SLSB21, SLSB30, MDB21
- }
-
- // The deployment info for this endpoint
- private UnifiedDeploymentInfo udi;
- // The endpoint type
- private EndpointType type;
- // The endpoint meta data
- private ServerEndpointMetaData sepMetaData;
- // The service endpoint invoker
- private ServiceEndpointInvoker seInvoker;
- // The current state of the endpoint
- private ServiceEndpoint.State state;
-
- public ServiceEndpointInfo(UnifiedDeploymentInfo udi, ServerEndpointMetaData
sepMetaData)
- {
- this.udi = udi;
- this.sepMetaData = sepMetaData;
-
- // Set the endpoint type
- if (udi.type == DeploymentType.JAXRPC_JSE || udi.type == DeploymentType.JAXWS_JSE)
- {
- this.type = EndpointType.JSE;
- }
- else if (udi.type == DeploymentType.JAXRPC_EJB21 || udi.type ==
DeploymentType.JAXWS_EJB21)
- {
- 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 UnifiedSessionMetaData)
- {
- this.type = EndpointType.SLSB21;
- }
- else if (beanMetaData instanceof UnifiedMessageDrivenMetaData)
- {
- this.type = EndpointType.MDB21;
- }
- }
- else if (udi.type == DeploymentType.JAXRPC_EJB3 || udi.type ==
DeploymentType.JAXWS_EJB3)
- {
- this.type = EndpointType.SLSB30;
- }
-
- if (type == null)
- throw new WSException("Unsupported endpoint type: " + type);
- }
-
- public ServerEndpointMetaData getServerEndpointMetaData()
- {
- return sepMetaData;
- }
-
- public ObjectName getServiceEndpointID()
- {
- return sepMetaData.getServiceEndpointID();
- }
-
- public UnifiedDeploymentInfo getUnifiedDeploymentInfo()
- {
- return udi;
- }
-
- public EndpointType getType()
- {
- return type;
- }
-
- public ServiceEndpointInvoker getInvoker()
- {
- return seInvoker;
- }
-
- public void setInvoker(ServiceEndpointInvoker seInvoker)
- {
- this.seInvoker = seInvoker;
- }
-
- public ServiceEndpoint.State getState()
- {
- return state;
- }
-
- public void setState(ServiceEndpoint.State state)
- {
- this.state = state;
- }
-
- /**
- * Returns a string representation of the object.
- */
- public String toString()
- {
- StringBuilder buffer = new StringBuilder("[id=" + getServiceEndpointID()
+ "state=" + state + "]");
- return buffer.toString();
- }
-}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/ServiceEndpointInfo.java
(from rev 1560,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/server/ServiceEndpointInfo.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/server/ServiceEndpointInfo.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/ServiceEndpointInfo.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -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.core.server;
+
+// $Id$
+
+import javax.management.ObjectName;
+
+import org.jboss.ws.WSException;
+import org.jboss.ws.deployment.UnifiedDeploymentInfo;
+import org.jboss.ws.deployment.UnifiedDeploymentInfo.DeploymentType;
+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.UnifiedSessionMetaData;
+import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
+
+/**
+ * This object registered with the EndpointManager service.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 16-Jan-2005
+ */
+public class ServiceEndpointInfo
+{
+ /** Endpoint type enum */
+ public enum EndpointType
+ {
+ JSE, SLSB21, SLSB30, MDB21
+ }
+
+ // The deployment info for this endpoint
+ private UnifiedDeploymentInfo udi;
+ // The endpoint type
+ private EndpointType type;
+ // The endpoint meta data
+ private ServerEndpointMetaData sepMetaData;
+ // The service endpoint invoker
+ private ServiceEndpointInvoker seInvoker;
+ // The current state of the endpoint
+ private ServiceEndpoint.State state;
+
+ public ServiceEndpointInfo(UnifiedDeploymentInfo udi, ServerEndpointMetaData
sepMetaData)
+ {
+ this.udi = udi;
+ this.sepMetaData = sepMetaData;
+
+ // Set the endpoint type
+ if (udi.type == DeploymentType.JAXRPC_JSE || udi.type == DeploymentType.JAXWS_JSE)
+ {
+ this.type = EndpointType.JSE;
+ }
+ else if (udi.type == DeploymentType.JAXRPC_EJB21 || udi.type ==
DeploymentType.JAXWS_EJB21)
+ {
+ 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 UnifiedSessionMetaData)
+ {
+ this.type = EndpointType.SLSB21;
+ }
+ else if (beanMetaData instanceof UnifiedMessageDrivenMetaData)
+ {
+ this.type = EndpointType.MDB21;
+ }
+ }
+ else if (udi.type == DeploymentType.JAXRPC_EJB3 || udi.type ==
DeploymentType.JAXWS_EJB3)
+ {
+ this.type = EndpointType.SLSB30;
+ }
+
+ if (type == null)
+ throw new WSException("Unsupported endpoint type: " + type);
+ }
+
+ public ServerEndpointMetaData getServerEndpointMetaData()
+ {
+ return sepMetaData;
+ }
+
+ public ObjectName getServiceEndpointID()
+ {
+ return sepMetaData.getServiceEndpointID();
+ }
+
+ public UnifiedDeploymentInfo getUnifiedDeploymentInfo()
+ {
+ return udi;
+ }
+
+ public EndpointType getType()
+ {
+ return type;
+ }
+
+ public ServiceEndpointInvoker getInvoker()
+ {
+ return seInvoker;
+ }
+
+ public void setInvoker(ServiceEndpointInvoker seInvoker)
+ {
+ this.seInvoker = seInvoker;
+ }
+
+ public ServiceEndpoint.State getState()
+ {
+ return state;
+ }
+
+ public void setState(ServiceEndpoint.State state)
+ {
+ this.state = state;
+ }
+
+ /**
+ * Returns a string representation of the object.
+ */
+ public String toString()
+ {
+ StringBuilder buffer = new StringBuilder("[id=" + getServiceEndpointID()
+ "state=" + state + "]");
+ return buffer.toString();
+ }
+}
Deleted:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/ServiceEndpointInvoker.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/server/ServiceEndpointInvoker.java 2006-12-05
23:29:55 UTC (rev 1557)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/ServiceEndpointInvoker.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -1,40 +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 javax.xml.soap.SOAPMessage;
-
-/** An implementation handles invocations on the endpoint
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 19-Jan-2005
- */
-public interface ServiceEndpointInvoker
-{
- /** Initialize the service endpoint */
- public void initServiceEndpoint(ServiceEndpointInfo seInfo);
-
- /** Invoke the the service endpoint */
- public SOAPMessage invoke(ServiceEndpointInfo seInfo, Object endpointContext) throws
Exception;
-}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/ServiceEndpointInvoker.java
(from rev 1560,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/server/ServiceEndpointInvoker.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/server/ServiceEndpointInvoker.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/ServiceEndpointInvoker.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -0,0 +1,40 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ws.core.server;
+
+// $Id$
+
+import javax.xml.soap.SOAPMessage;
+
+/** An implementation handles invocations on the endpoint
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 19-Jan-2005
+ */
+public interface ServiceEndpointInvoker
+{
+ /** Initialize the service endpoint */
+ public void initServiceEndpoint(ServiceEndpointInfo seInfo);
+
+ /** Invoke the the service endpoint */
+ public SOAPMessage invoke(ServiceEndpointInfo seInfo, Object endpointContext) throws
Exception;
+}
Deleted:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/ServiceEndpointInvokerJSE.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/server/ServiceEndpointInvokerJSE.java 2006-12-05
23:29:55 UTC (rev 1557)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/ServiceEndpointInvokerJSE.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -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.ws.server;
-
-// $Id: $
-
-import java.lang.reflect.Method;
-
-import javax.xml.rpc.ServiceException;
-import javax.xml.rpc.server.ServiceLifecycle;
-import javax.xml.rpc.server.ServletEndpointContext;
-import javax.xml.rpc.soap.SOAPFaultException;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.WSException;
-import org.jboss.ws.binding.EndpointInvocation;
-import org.jboss.ws.common.CommonMessageContext;
-import org.jboss.ws.jaxrpc.ServletEndpointContextImpl;
-import org.jboss.ws.jaxws.handler.SOAPMessageContextJAXWS;
-import org.jboss.ws.metadata.ServerEndpointMetaData;
-import org.jboss.ws.soap.MessageContextAssociation;
-
-/**
- * Handles invocations on JSE endpoints.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 19-Jan-2005
- */
-public class ServiceEndpointInvokerJSE extends AbstractServiceEndpointInvoker implements
ServiceEndpointInvoker
-{
- // provide logging
- private Logger log = Logger.getLogger(ServiceEndpointInvokerJSE.class);
-
- /** Load the SEI implementation bean if necessary */
- public Class loadServiceEndpoint(ServiceEndpointInfo seInfo) throws
ClassNotFoundException
- {
- ServerEndpointMetaData epMetaData = seInfo.getServerEndpointMetaData();
- ClassLoader cl = epMetaData.getClassLoader();
- String seiImplName = epMetaData.getServiceEndpointImplName();
- Class seiImplClass = cl.loadClass(seiImplName);
- return seiImplClass;
- }
-
- /** Create an instance of the SEI implementation bean if necessary */
- public Object createServiceEndpoint(ServiceEndpointInfo seInfo, Object context, Class
seiImplClass) throws IllegalAccessException, InstantiationException
- {
- Object seiImpl = seiImplClass.newInstance();
- if (seiImpl instanceof ServiceLifecycle && context != null)
- {
- try
- {
- ServiceLifecycle serviceLifecycle = ((ServiceLifecycle)seiImpl);
- ServletEndpointContext servletEndpointContext = new
ServletEndpointContextImpl((EndpointContext)context);
- serviceLifecycle.init(servletEndpointContext);
- }
- catch (ServiceException ex)
- {
- throw new WSException(ex);
- }
- }
- return seiImpl;
- }
-
- /** Invoke an instance of the SEI implementation bean */
- public void invokeServiceEndpoint(ServiceEndpointInfo seInfo, Object seiImpl,
EndpointInvocation epInv) throws SOAPFaultException, Exception
- {
- log.debug("invokeServiceEndpoint: " + epInv.getJavaMethod().getName());
- try
- {
- CommonMessageContext msgContext =
MessageContextAssociation.peekMessageContext();
- if (msgContext instanceof SOAPMessageContextJAXWS)
- MessageContextInjector.injectMessageContext(seiImpl,
(SOAPMessageContextJAXWS)msgContext);
-
- Class implClass = seiImpl.getClass();
- Method seiMethod = epInv.getJavaMethod();
- Method implMethod = getImplMethod(implClass, seiMethod);
-
- Object[] args = epInv.getRequestPayload();
- Object retObj = implMethod.invoke(seiImpl, args);
- epInv.setReturnValue(retObj);
- }
- catch (Exception e)
- {
- handleInvocationException(e);
- }
- }
-
- /** Destroy an instance of the SEI implementation bean if necessary */
- public void destroyServiceEndpoint(ServiceEndpointInfo seInfo, Object seiImpl)
- {
- if (seiImpl instanceof ServiceLifecycle)
- {
- ((ServiceLifecycle)seiImpl).destroy();
- }
- }
-}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/ServiceEndpointInvokerJSE.java
(from rev 1560,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/server/ServiceEndpointInvokerJSE.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/server/ServiceEndpointInvokerJSE.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/ServiceEndpointInvokerJSE.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -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.core.server;
+
+// $Id: $
+
+import java.lang.reflect.Method;
+
+import javax.xml.rpc.ServiceException;
+import javax.xml.rpc.server.ServiceLifecycle;
+import javax.xml.rpc.server.ServletEndpointContext;
+import javax.xml.rpc.soap.SOAPFaultException;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.WSException;
+import org.jboss.ws.core.CommonMessageContext;
+import org.jboss.ws.core.binding.EndpointInvocation;
+import org.jboss.ws.core.soap.MessageContextAssociation;
+import org.jboss.ws.jaxrpc.ServletEndpointContextImpl;
+import org.jboss.ws.jaxws.handler.SOAPMessageContextJAXWS;
+import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
+
+/**
+ * Handles invocations on JSE endpoints.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 19-Jan-2005
+ */
+public class ServiceEndpointInvokerJSE extends AbstractServiceEndpointInvoker implements
ServiceEndpointInvoker
+{
+ // provide logging
+ private Logger log = Logger.getLogger(ServiceEndpointInvokerJSE.class);
+
+ /** Load the SEI implementation bean if necessary */
+ public Class loadServiceEndpoint(ServiceEndpointInfo seInfo) throws
ClassNotFoundException
+ {
+ ServerEndpointMetaData epMetaData = seInfo.getServerEndpointMetaData();
+ ClassLoader cl = epMetaData.getClassLoader();
+ String seiImplName = epMetaData.getServiceEndpointImplName();
+ Class seiImplClass = cl.loadClass(seiImplName);
+ return seiImplClass;
+ }
+
+ /** Create an instance of the SEI implementation bean if necessary */
+ public Object createServiceEndpoint(ServiceEndpointInfo seInfo, Object context, Class
seiImplClass) throws IllegalAccessException, InstantiationException
+ {
+ Object seiImpl = seiImplClass.newInstance();
+ if (seiImpl instanceof ServiceLifecycle && context != null)
+ {
+ try
+ {
+ ServiceLifecycle serviceLifecycle = ((ServiceLifecycle)seiImpl);
+ ServletEndpointContext servletEndpointContext = new
ServletEndpointContextImpl((EndpointContext)context);
+ serviceLifecycle.init(servletEndpointContext);
+ }
+ catch (ServiceException ex)
+ {
+ throw new WSException(ex);
+ }
+ }
+ return seiImpl;
+ }
+
+ /** Invoke an instance of the SEI implementation bean */
+ public void invokeServiceEndpoint(ServiceEndpointInfo seInfo, Object seiImpl,
EndpointInvocation epInv) throws SOAPFaultException, Exception
+ {
+ log.debug("invokeServiceEndpoint: " + epInv.getJavaMethod().getName());
+ try
+ {
+ CommonMessageContext msgContext =
MessageContextAssociation.peekMessageContext();
+ if (msgContext instanceof SOAPMessageContextJAXWS)
+ MessageContextInjector.injectMessageContext(seiImpl,
(SOAPMessageContextJAXWS)msgContext);
+
+ Class implClass = seiImpl.getClass();
+ Method seiMethod = epInv.getJavaMethod();
+ Method implMethod = getImplMethod(implClass, seiMethod);
+
+ Object[] args = epInv.getRequestPayload();
+ Object retObj = implMethod.invoke(seiImpl, args);
+ epInv.setReturnValue(retObj);
+ }
+ catch (Exception e)
+ {
+ handleInvocationException(e);
+ }
+ }
+
+ /** Destroy an instance of the SEI implementation bean if necessary */
+ public void destroyServiceEndpoint(ServiceEndpointInfo seInfo, Object seiImpl)
+ {
+ if (seiImpl instanceof ServiceLifecycle)
+ {
+ ((ServiceLifecycle)seiImpl).destroy();
+ }
+ }
+}
Deleted:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/ServiceEndpointManager.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/server/ServiceEndpointManager.java 2006-12-05
23:29:55 UTC (rev 1557)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/ServiceEndpointManager.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -1,659 +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.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.lang.reflect.Constructor;
-import java.net.InetAddress;
-import java.net.URL;
-import java.net.UnknownHostException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-import javax.activation.DataHandler;
-import javax.management.MBeanServer;
-import javax.management.MBeanServerFactory;
-import javax.management.ObjectName;
-import javax.servlet.ServletContext;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.xml.soap.SOAPEnvelope;
-import javax.xml.soap.SOAPException;
-import javax.xml.soap.SOAPMessage;
-import javax.xml.soap.SOAPPart;
-import javax.xml.ws.addressing.AddressingProperties;
-import javax.xml.ws.addressing.JAXWSAConstants;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.WSException;
-import org.jboss.ws.addressing.AddressingConstantsImpl;
-import org.jboss.ws.common.CommonMessageContext;
-import org.jboss.ws.common.MessageContextPropertyHelper;
-import org.jboss.ws.jaxrpc.handler.MessageContextJAXRPC;
-import org.jboss.ws.jaxrpc.handler.SOAPMessageContextJAXRPC;
-import org.jboss.ws.jaxws.handler.MessageContextJAXWS;
-import org.jboss.ws.jaxws.handler.SOAPMessageContextJAXWS;
-import org.jboss.ws.metadata.EndpointMetaData;
-import org.jboss.ws.metadata.HandlerMetaData;
-import org.jboss.ws.metadata.ServerEndpointMetaData;
-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.MessageContextAssociation;
-import org.jboss.ws.soap.SOAPConnectionImpl;
-import org.jboss.ws.utils.ThreadLocalAssociation;
-
-/**
- * A service that manages JBossWS endpoints.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 15-Jan-2005
- */
-public class ServiceEndpointManager implements ServiceEndpointManagerMBean
-{
- // provide logging
- private static final Logger log = Logger.getLogger(ServiceEndpointManager.class);
-
- // Default bean name
- public static final String BEAN_NAME = "ServiceEndpointManager";
- // The host name that is returned if there is no other defined
- public static String UNDEFINED_HOSTNAME = "jbossws.undefined.host";
-
- // maps serviceID to EndpointInfo
- private Map<ObjectName, ServiceEndpoint> registry = new
ConcurrentHashMap<ObjectName, ServiceEndpoint>();
-
- // The webservice host name that will be used when updating the wsdl
- private String webServiceHost = UNDEFINED_HOSTNAME;
- // The webservice port that will be used when updating the wsdl
- private int webServicePort;
- // The webservice port that will be used when updating the wsdl
- private int webServiceSecurePort;
- // Whether we should always modify the soap address to the deployed endpoing location
- private boolean alwaysModifySOAPAddress;
- // The name of the invoker that handles invocations on JSE endpoints
- private String serviceEndpointInvokerJSE;
- // The name of the invoker that handles invocations on EJB2.1 endpoints
- private String serviceEndpointInvokerEJB21;
- // The name of the invoker that handles invocations on EJB3 endpoints
- private String serviceEndpointInvokerEJB3;
- // The name of the invoker that handles invocations on MDB endpoints
- private String serviceEndpointInvokerMDB;
-
- public String getWebServiceHost()
- {
- return webServiceHost;
- }
-
- public int getWebServicePort()
- {
- return webServicePort;
- }
-
- public int getWebServiceSecurePort()
- {
- return webServiceSecurePort;
- }
-
- public boolean isAlwaysModifySOAPAddress()
- {
- return alwaysModifySOAPAddress;
- }
-
- public void setWebServiceHost(String host) throws UnknownHostException
- {
- if (host == null || host.trim().length() == 0)
- {
- log.debug("Using undefined host: " + UNDEFINED_HOSTNAME);
- host = UNDEFINED_HOSTNAME;
- }
- if ("0.0.0.0".equals(host))
- {
- InetAddress localHost = InetAddress.getLocalHost();
- log.debug("Using local host: " + localHost.getHostName());
- host = localHost.getHostName();
- }
- this.webServiceHost = host;
- }
-
- public void setWebServicePort(int port)
- {
- this.webServicePort = port;
- }
-
- public void setWebServiceSecurePort(int port)
- {
- this.webServiceSecurePort = port;
- }
-
- public void setAlwaysModifySOAPAddress(boolean modify)
- {
- this.alwaysModifySOAPAddress = modify;
- }
-
- public String getServiceEndpointInvokerEJB21()
- {
- return serviceEndpointInvokerEJB21;
- }
-
- public void setServiceEndpointInvokerEJB21(String invoker)
- {
- this.serviceEndpointInvokerEJB21 = invoker;
- }
-
- public String getServiceEndpointInvokerEJB3()
- {
- return serviceEndpointInvokerEJB3;
- }
-
- public void setServiceEndpointInvokerEJB3(String invoker)
- {
- this.serviceEndpointInvokerEJB3 = invoker;
- }
-
- public String getServiceEndpointInvokerMDB()
- {
- return serviceEndpointInvokerMDB;
- }
-
- public void setServiceEndpointInvokerMDB(String invoker)
- {
- this.serviceEndpointInvokerMDB = invoker;
- }
-
- public String getServiceEndpointInvokerJSE()
- {
- return serviceEndpointInvokerJSE;
- }
-
- public void setServiceEndpointInvokerJSE(String invoker)
- {
- this.serviceEndpointInvokerJSE = invoker;
- }
-
- public List<ObjectName> getServiceEndpoints()
- {
- ArrayList<ObjectName> list = new ArrayList<ObjectName>();
- list.addAll(registry.keySet());
- return list;
- }
-
- /** Get service endpoint for a given serviceID
- *
- * The keys into the registry are:
- *
- * [deploment.ear]/[deployment.war]#WsdlService/PortName
- * [deploment.ear]/[deployment.jar]#ServiceName/PortName
- *
- */
- public ServiceEndpoint getServiceEndpointByID(ObjectName sepID)
- {
- ServiceEndpoint wsEndpoint = (ServiceEndpoint)registry.get(sepID);
- if (wsEndpoint == null)
- log.warn("No ServiceEndpoint found for serviceID: " + sepID);
-
- return wsEndpoint;
- }
-
- /** Resolve a port-component-link, like:
- *
- * [deployment.war]#PortComponentName
- * [deployment.jar]#PortComponentName
- *
- */
- public ServiceEndpoint resolvePortComponentLink(String pcLink)
- {
- String pcName = pcLink;
- int hashIndex = pcLink.indexOf("#");
- if (hashIndex > 0)
- {
- pcName = pcLink.substring(hashIndex + 1);
- }
-
- ServiceEndpoint serviceEndpoint = null;
- for (ObjectName sepID : registry.keySet())
- {
- ServiceEndpoint auxEndpoint = registry.get(sepID);
- ServiceEndpointInfo sepInfo = auxEndpoint.getServiceEndpointInfo();
- if (pcName.equals(sepInfo.getServerEndpointMetaData().getPortComponentName()))
- {
- if (serviceEndpoint != null)
- {
- log.warn("Multiple service endoints found for: " + pcLink);
- serviceEndpoint = null;
- break;
- }
- serviceEndpoint = auxEndpoint;
- }
- }
-
- if (serviceEndpoint == null)
- log.warn("No ServiceEndpoint found for pcLink: " + pcLink);
-
- return serviceEndpoint;
- }
-
- /** Show the registered webservices
- */
- public String showServiceEndpointTable()
- {
- StringWriter sw = new StringWriter();
- PrintWriter pw = new PrintWriter(sw);
-
- pw.println("<h3>Registered Service Endpoints</h3>");
-
- pw.println("<table>");
-
pw.println("<tr><td>ServiceEndpointID</td><td>ServiceEndpointAddress</td><td> </td></tr>");
- Iterator it = registry.entrySet().iterator();
- while (it.hasNext())
- {
- Map.Entry entry = (Map.Entry)it.next();
- ObjectName sepID = (ObjectName)entry.getKey();
- ServiceEndpoint wsEndpoint = (ServiceEndpoint)entry.getValue();
- ServiceEndpointInfo seInfo = wsEndpoint.getServiceEndpointInfo();
- String endpointAddress =
seInfo.getServerEndpointMetaData().getEndpointAddress();
- pw.println("<tr><td>" + sepID.getCanonicalName() +
"</td><td><a href='" + endpointAddress +
"?wsdl'>" + endpointAddress +
"?wsdl</a></td></tr>");
- }
- pw.println("</table>");
- pw.close();
-
- return sw.toString();
- }
-
- /** Get the endpoint metrics
- */
- public ServiceEndpointMetrics getServiceEndpointMetrics(ObjectName sepID)
- {
- ServiceEndpoint wsEndpoint = getServiceEndpointByID(sepID);
- return (wsEndpoint != null ? wsEndpoint.getServiceEndpointMetrics() : null);
- }
-
- /** Show endpoint metrics
- */
- public String showServiceEndpointMetrics(ObjectName sepID)
- {
- StringWriter sw = new StringWriter();
- PrintWriter pw = new PrintWriter(sw);
-
- ServiceEndpointMetrics seMetrics = getServiceEndpointMetrics(sepID);
- if (seMetrics != null)
- {
- pw.println("<h3>Service Endpoint Metrics</h3>");
-
- pw.println("<table>");
- pw.println("<tr><td>EndpointID</td><td>" +
seMetrics.getEndpointID() + "</td></tr>");
- pw.println("<tr><td>Start Time</td><td>" +
seMetrics.getStartTime() + "</td></tr>");
- pw.println("<tr><td>Stop Time</td><td>" +
seMetrics.getStopTime() + "</td></tr>");
- pw.println("<tr><td>Request Count</td><td>" +
seMetrics.getRequestCount() + "</td></tr>");
- pw.println("<tr><td>Response Count</td><td>" +
seMetrics.getRequestCount() + "</td></tr>");
- pw.println("<tr><td>Fault Count</td><td>" +
seMetrics.getResponseCount() + "</td></tr>");
- pw.println("<tr><td>Max Processing
Time</td><td>" + seMetrics.getMaxProcessingTime() +
"</td></tr>");
- pw.println("<tr><td>Min Processing
Time</td><td>" + seMetrics.getMinProcessingTime() +
"</td></tr>");
- pw.println("<tr><td>Avg Processing
Time</td><td>" + seMetrics.getAverageProcessingTime() +
"</td></tr>");
- pw.println("<tr><td>Total Processing
Time</td><td>" + seMetrics.getTotalProcessingTime() +
"</td></tr>");
- pw.println("</table>");
- pw.close();
- }
- return sw.toString();
- }
-
- public void processWSDLRequest(ObjectName sepID, OutputStream outStream, URL
requestURL, String resourcePath) throws Exception
- {
- ServiceEndpoint wsEndpoint = getServiceEndpointByID(sepID);
- if (wsEndpoint == null)
- throw new WSException("Cannot obtain endpoint for: " + sepID);
-
- wsEndpoint.handleWSDLRequest(outStream, requestURL, resourcePath);
- }
-
- public void processSOAPRequest(ObjectName sepID, InputStream inStream, OutputStream
outStream, EndpointContext context) throws Exception
- {
- ServiceEndpoint wsEndpoint = getServiceEndpointByID(sepID);
- if (wsEndpoint == null)
- throw new WSException("Cannot obtain endpoint for: " + sepID);
-
- // Get the type of the endpoint
- ServerEndpointMetaData sepMetaData =
wsEndpoint.getServiceEndpointInfo().getServerEndpointMetaData();
- Type type = sepMetaData.getType();
-
- MessageContextPropertyHelper httpSession = new HttpSessionPropertyHelper(context);
- ServletContext servletContext = context.getServletContext();
- HttpServletRequest httpRequest = context.getHttpServletRequest();
- HttpServletResponse httpResponse = context.getHttpServletResponse();
- ServletHeaderSource headerSource = new ServletHeaderSource(httpRequest,
httpResponse);
-
- // Associate a message context with the current thread
- CommonMessageContext msgContext;
- if (type == EndpointMetaData.Type.JAXRPC)
- {
- msgContext = new SOAPMessageContextJAXRPC();
- msgContext.setProperty(MessageContextJAXRPC.SERVLET_CONTEXT, servletContext);
- msgContext.setProperty(MessageContextJAXRPC.SERVLET_REQUEST, httpRequest);
- msgContext.setProperty(MessageContextJAXRPC.SERVLET_RESPONSE, httpResponse);
- msgContext.setProperty(MessageContextJAXRPC.SERVLET_SESSION, httpSession);
- }
- else
- {
- msgContext = new SOAPMessageContextJAXWS();
- msgContext.setProperty(MessageContextJAXWS.MESSAGE_OUTBOUND_PROPERTY, new
Boolean(false));
- msgContext.setProperty(MessageContextJAXWS.INBOUND_MESSAGE_ATTACHMENTS, new
HashMap<String, DataHandler>());
- msgContext.setProperty(MessageContextJAXWS.HTTP_REQUEST_HEADERS,
headerSource.getHeaderMap());
- msgContext.setProperty(MessageContextJAXWS.HTTP_REQUEST_METHOD,
httpRequest.getMethod());
- msgContext.setProperty(MessageContextJAXWS.QUERY_STRING,
httpRequest.getQueryString());
- msgContext.setProperty(MessageContextJAXWS.PATH_INFO,
httpRequest.getPathInfo());
- msgContext.setProperty(MessageContextJAXWS.SERVLET_CONTEXT, servletContext);
- msgContext.setProperty(MessageContextJAXWS.SERVLET_REQUEST, httpRequest);
- msgContext.setProperty(MessageContextJAXWS.SERVLET_RESPONSE, httpResponse);
-
- }
- msgContext.setEndpointMetaData(sepMetaData);
-
- MessageContextAssociation.pushMessageContext(msgContext);
- try
- {
- SOAPMessage resMessage = wsEndpoint.handleRequest(headerSource, context,
inStream);
-
- Map<String, List<String>> headers = (Map<String,
List<String>>)msgContext.getProperty(MessageContextJAXWS.HTTP_RESPONSE_HEADERS);
- if (headers != null)
- headerSource.setHeaderMap(headers);
-
- Integer code =
(Integer)msgContext.getProperty(MessageContextJAXWS.HTTP_RESPONSE_CODE);
- if (code != null)
- httpResponse.setStatus(code.intValue());
-
- SOAPPart part = resMessage.getSOAPPart();
- if (part == null)
- throw new SOAPException("Cannot obtain SOAPPart from response
message");
-
- // R1126 An INSTANCE MUST return a "500 Internal Server Error" HTTP
status code
- // if the response envelope is a Fault.
- //
- // Also, a one-way operation must show up as empty content, and can be detected
- // by a null envelope.
- SOAPEnvelope soapEnv = part.getEnvelope();
- boolean isFault = soapEnv != null && soapEnv.getBody().getFault() !=
null;
- if (isFault && httpResponse != null)
- {
- httpResponse.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
- }
-
- sendResponse(outStream, msgContext, isFault);
- }
- finally
- {
- outStream.flush();
- outStream.close();
-
- // Reset the message context association
- MessageContextAssociation.popMessageContext();
-
- // clear thread local storage
- ThreadLocalAssociation.clear();
- }
- }
-
- private void sendResponse(OutputStream outputStream, CommonMessageContext msgContext,
boolean isFault) throws SOAPException, IOException
- {
- SOAPMessage soapMessage = msgContext.getSOAPMessage();
- String wsaTo = null;
-
- // Get the destination from the AddressingProperties
- AddressingProperties outProps =
(AddressingProperties)msgContext.getProperty(JAXWSAConstants.SERVER_ADDRESSING_PROPERTIES_OUTBOUND);
- if (outProps != null && outProps.getTo() != null)
- {
- AddressingConstantsImpl ADDR = new AddressingConstantsImpl();
- wsaTo = outProps.getTo().getURI().toString();
- if (wsaTo.equals(ADDR.getAnonymousURI()))
- wsaTo = null;
- }
- if (wsaTo != null)
- {
- log.debug("Sending response to addressing destination: " + wsaTo);
- new SOAPConnectionImpl().callOneWay(soapMessage, wsaTo);
- }
- else
- {
- soapMessage.writeTo(outputStream);
- }
- }
-
- /** Process the given SOAPRequest and return the corresponding SOAPResponse
- */
- public String processSOAPRequest(ObjectName sepID, String inMessage) throws Exception
- {
- log.debug("processSOAPRequest: " + sepID);
-
- ByteArrayInputStream inputStream = new
ByteArrayInputStream(inMessage.getBytes("UTF-8"));
- ByteArrayOutputStream outputStream = new ByteArrayOutputStream(512);
-
- processSOAPRequest(sepID, inputStream, outputStream, null);
-
- String outMsg = new String(outputStream.toByteArray());
- return outMsg;
- }
-
- /** Get the ServiceEndpointInvoker for this type of service endpoint
- */
- private ServiceEndpointInvoker getServiceEndpointInvoker(ServiceEndpointInfo seInfo)
throws ClassNotFoundException, InstantiationException, IllegalAccessException
- {
- ServiceEndpointInvoker seInvoker = null;
-
- ClassLoader cl = Thread.currentThread().getContextClassLoader();
- if (seInfo.getType() == ServiceEndpointInfo.EndpointType.JSE)
- {
- Class seInvokerClass = cl.loadClass(serviceEndpointInvokerJSE);
- seInvoker = (ServiceEndpointInvoker)seInvokerClass.newInstance();
- }
- else if (seInfo.getType() == ServiceEndpointInfo.EndpointType.SLSB21)
- {
- Class seInvokerClass = cl.loadClass(serviceEndpointInvokerEJB21);
- seInvoker = (ServiceEndpointInvoker)seInvokerClass.newInstance();
- }
- else if (seInfo.getType() == ServiceEndpointInfo.EndpointType.SLSB30)
- {
- Class seInvokerClass = cl.loadClass(serviceEndpointInvokerEJB3);
- seInvoker = (ServiceEndpointInvoker)seInvokerClass.newInstance();
- }
- else if (seInfo.getType() == ServiceEndpointInfo.EndpointType.MDB21)
- {
- Class seInvokerClass = cl.loadClass(serviceEndpointInvokerMDB);
- seInvoker = (ServiceEndpointInvoker)seInvokerClass.newInstance();
- }
-
- if (seInvoker == null)
- throw new WSException("Cannot obtain service endpoint invoker");
-
- return seInvoker;
- }
-
- /** Get the list of HandlerInfos associated with a given service endpoint
- */
- public List<HandlerMetaData> getHandlerMetaData(ObjectName sepID)
- {
- ServiceEndpoint wsEndpoint = getServiceEndpointByID(sepID);
- if (wsEndpoint == null)
- throw new WSException("Cannot find service endpoint: " + sepID);
-
- List<HandlerMetaData> handlers = null;
- if (wsEndpoint != null)
- {
- ServerEndpointMetaData sepMetaData =
wsEndpoint.getServiceEndpointInfo().getServerEndpointMetaData();
- handlers = sepMetaData.getHandlerMetaData(HandlerType.ALL);
- }
- return handlers;
- }
-
- /**
- * Dynamically change the list of handlers associated with a given service endpoint
- * The endpoint is expected to be in STOPED state
- */
- public void setHandlerMetaData(ObjectName sepID, List<HandlerMetaData>
handlers)
- {
- ServiceEndpoint wsEndpoint = getServiceEndpointByID(sepID);
- if (wsEndpoint == null)
- throw new WSException("Cannot find service endpoint: " + sepID);
-
- ServiceEndpointInfo sepInfo = wsEndpoint.getServiceEndpointInfo();
- if (sepInfo.getState() != ServiceEndpoint.State.STOPED)
- throw new WSException("Endpoint expected to be in STOPED state");
-
- ServerEndpointMetaData sepMetaData =
wsEndpoint.getServiceEndpointInfo().getServerEndpointMetaData();
- sepMetaData.clearHandlers();
-
- for (HandlerMetaData handlerMetaData : handlers)
- {
- handlerMetaData.setEndpointMetaData(sepMetaData);
- sepMetaData.addHandler(handlerMetaData);
- }
- }
-
- /** Create a service endpoint
- */
- public void createServiceEndpoint(ServiceEndpointInfo seInfo) throws Exception
- {
- ObjectName sepID = seInfo.getServiceEndpointID();
- if (registry.get(sepID) != null)
- throw new WSException("Service already registerd: " + sepID);
-
- ServiceEndpointInvoker seInvoker = getServiceEndpointInvoker(seInfo);
- seInvoker.initServiceEndpoint(seInfo);
- seInfo.setInvoker(seInvoker);
-
- // Load/Create the service endpoint impl
- ClassLoader ctxLoader = Thread.currentThread().getContextClassLoader();
- ServerEndpointMetaData epMetaData = seInfo.getServerEndpointMetaData();
- String managedEndpointBean = epMetaData.getManagedEndpointBean();
- Class seClass = ctxLoader.loadClass(managedEndpointBean);
- Constructor ctor = seClass.getConstructor(new Class[] { ServiceEndpointInfo.class
});
- ServiceEndpoint wsEndpoint = (ServiceEndpoint)ctor.newInstance(new Object[] {
seInfo });
- wsEndpoint.create();
-
- // Register the endpoint with the MBeanServer
- registry.put(sepID, wsEndpoint);
-
- log.debug("WebService created: " + sepID);
- }
-
- /** Start a service endpoint
- */
- public void startServiceEndpoint(ObjectName sepID) throws Exception
- {
- ServiceEndpoint wsEndpoint = getServiceEndpointByID(sepID);
- if (wsEndpoint == null)
- throw new WSException("Cannot find service endpoint: " + sepID);
-
- wsEndpoint.start();
-
- ServiceEndpointInfo seInfo = wsEndpoint.getServiceEndpointInfo();
- log.info("WebService started: " +
seInfo.getServerEndpointMetaData().getEndpointAddress());
- }
-
- /** Stop a service endpoint
- */
- public void stopServiceEndpoint(ObjectName sepID) throws Exception
- {
- ServiceEndpoint wsEndpoint = getServiceEndpointByID(sepID);
- if (wsEndpoint == null)
- throw new WSException("Cannot find service endpoint: " + sepID);
-
- wsEndpoint.stop();
-
- ServiceEndpointInfo seInfo = wsEndpoint.getServiceEndpointInfo();
- log.info("WebService stopped: " +
seInfo.getServerEndpointMetaData().getEndpointAddress());
- }
-
- /** Destroy a service endpoint
- */
- public void destroyServiceEndpoint(ObjectName sepID) throws Exception
- {
- ServiceEndpoint wsEndpoint = getServiceEndpointByID(sepID);
- if (wsEndpoint == null)
- throw new WSException("Cannot find service endpoint: " + sepID);
-
- wsEndpoint.destroy();
-
- // Remove the endpoint from the MBeanServer
- registry.remove(sepID);
-
- ServiceEndpointInfo seInfo = wsEndpoint.getServiceEndpointInfo();
- log.debug("WebService destroyed: " +
seInfo.getServerEndpointMetaData().getEndpointAddress());
- }
-
- public void create() throws Exception
- {
- log.info(UnifiedMetaData.getImplementationVersion());
- MBeanServer server = getJMXServer();
- if (server != null)
- {
- server.registerMBean(this, OBJECT_NAME);
- }
- }
-
- public void destroy() throws Exception
- {
- log.debug("Destroy service endpoint manager");
- MBeanServer server = getJMXServer();
- if (server != null)
- {
- server.unregisterMBean(OBJECT_NAME);
- }
- }
-
- private MBeanServer getJMXServer()
- {
- MBeanServer server = null;
- ArrayList servers = MBeanServerFactory.findMBeanServer(null);
- if (servers.size() > 0)
- {
- server = (MBeanServer)servers.get(0);
- }
- return server;
- }
-
- public static class HttpSessionPropertyHelper implements MessageContextPropertyHelper
- {
-
- private EndpointContext context;
-
- public HttpSessionPropertyHelper(final EndpointContext context)
- {
- this.context = context;
- }
-
- public Object get()
- {
- return context.getHttpSession();
- }
-
- }
-}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/ServiceEndpointManager.java
(from rev 1560,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/server/ServiceEndpointManager.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/server/ServiceEndpointManager.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/ServiceEndpointManager.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -0,0 +1,659 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ws.core.server;
+
+// $Id$
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.lang.reflect.Constructor;
+import java.net.InetAddress;
+import java.net.URL;
+import java.net.UnknownHostException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import javax.activation.DataHandler;
+import javax.management.MBeanServer;
+import javax.management.MBeanServerFactory;
+import javax.management.ObjectName;
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.xml.soap.SOAPEnvelope;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.soap.SOAPPart;
+import javax.xml.ws.addressing.AddressingProperties;
+import javax.xml.ws.addressing.JAXWSAConstants;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.WSException;
+import org.jboss.ws.core.CommonMessageContext;
+import org.jboss.ws.core.MessageContextPropertyHelper;
+import org.jboss.ws.core.soap.MessageContextAssociation;
+import org.jboss.ws.core.soap.SOAPConnectionImpl;
+import org.jboss.ws.extras.addressing.AddressingConstantsImpl;
+import org.jboss.ws.jaxrpc.handler.MessageContextJAXRPC;
+import org.jboss.ws.jaxrpc.handler.SOAPMessageContextJAXRPC;
+import org.jboss.ws.jaxws.handler.MessageContextJAXWS;
+import org.jboss.ws.jaxws.handler.SOAPMessageContextJAXWS;
+import org.jboss.ws.metadata.umdm.EndpointMetaData;
+import org.jboss.ws.metadata.umdm.HandlerMetaData;
+import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
+import org.jboss.ws.metadata.umdm.UnifiedMetaData;
+import org.jboss.ws.metadata.umdm.EndpointMetaData.Type;
+import org.jboss.ws.metadata.umdm.HandlerMetaData.HandlerType;
+import org.jboss.ws.utils.ThreadLocalAssociation;
+
+/**
+ * A service that manages JBossWS endpoints.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 15-Jan-2005
+ */
+public class ServiceEndpointManager implements ServiceEndpointManagerMBean
+{
+ // provide logging
+ private static final Logger log = Logger.getLogger(ServiceEndpointManager.class);
+
+ // Default bean name
+ public static final String BEAN_NAME = "ServiceEndpointManager";
+ // The host name that is returned if there is no other defined
+ public static String UNDEFINED_HOSTNAME = "jbossws.undefined.host";
+
+ // maps serviceID to EndpointInfo
+ private Map<ObjectName, ServiceEndpoint> registry = new
ConcurrentHashMap<ObjectName, ServiceEndpoint>();
+
+ // The webservice host name that will be used when updating the wsdl
+ private String webServiceHost = UNDEFINED_HOSTNAME;
+ // The webservice port that will be used when updating the wsdl
+ private int webServicePort;
+ // The webservice port that will be used when updating the wsdl
+ private int webServiceSecurePort;
+ // Whether we should always modify the soap address to the deployed endpoing location
+ private boolean alwaysModifySOAPAddress;
+ // The name of the invoker that handles invocations on JSE endpoints
+ private String serviceEndpointInvokerJSE;
+ // The name of the invoker that handles invocations on EJB2.1 endpoints
+ private String serviceEndpointInvokerEJB21;
+ // The name of the invoker that handles invocations on EJB3 endpoints
+ private String serviceEndpointInvokerEJB3;
+ // The name of the invoker that handles invocations on MDB endpoints
+ private String serviceEndpointInvokerMDB;
+
+ public String getWebServiceHost()
+ {
+ return webServiceHost;
+ }
+
+ public int getWebServicePort()
+ {
+ return webServicePort;
+ }
+
+ public int getWebServiceSecurePort()
+ {
+ return webServiceSecurePort;
+ }
+
+ public boolean isAlwaysModifySOAPAddress()
+ {
+ return alwaysModifySOAPAddress;
+ }
+
+ public void setWebServiceHost(String host) throws UnknownHostException
+ {
+ if (host == null || host.trim().length() == 0)
+ {
+ log.debug("Using undefined host: " + UNDEFINED_HOSTNAME);
+ host = UNDEFINED_HOSTNAME;
+ }
+ if ("0.0.0.0".equals(host))
+ {
+ InetAddress localHost = InetAddress.getLocalHost();
+ log.debug("Using local host: " + localHost.getHostName());
+ host = localHost.getHostName();
+ }
+ this.webServiceHost = host;
+ }
+
+ public void setWebServicePort(int port)
+ {
+ this.webServicePort = port;
+ }
+
+ public void setWebServiceSecurePort(int port)
+ {
+ this.webServiceSecurePort = port;
+ }
+
+ public void setAlwaysModifySOAPAddress(boolean modify)
+ {
+ this.alwaysModifySOAPAddress = modify;
+ }
+
+ public String getServiceEndpointInvokerEJB21()
+ {
+ return serviceEndpointInvokerEJB21;
+ }
+
+ public void setServiceEndpointInvokerEJB21(String invoker)
+ {
+ this.serviceEndpointInvokerEJB21 = invoker;
+ }
+
+ public String getServiceEndpointInvokerEJB3()
+ {
+ return serviceEndpointInvokerEJB3;
+ }
+
+ public void setServiceEndpointInvokerEJB3(String invoker)
+ {
+ this.serviceEndpointInvokerEJB3 = invoker;
+ }
+
+ public String getServiceEndpointInvokerMDB()
+ {
+ return serviceEndpointInvokerMDB;
+ }
+
+ public void setServiceEndpointInvokerMDB(String invoker)
+ {
+ this.serviceEndpointInvokerMDB = invoker;
+ }
+
+ public String getServiceEndpointInvokerJSE()
+ {
+ return serviceEndpointInvokerJSE;
+ }
+
+ public void setServiceEndpointInvokerJSE(String invoker)
+ {
+ this.serviceEndpointInvokerJSE = invoker;
+ }
+
+ public List<ObjectName> getServiceEndpoints()
+ {
+ ArrayList<ObjectName> list = new ArrayList<ObjectName>();
+ list.addAll(registry.keySet());
+ return list;
+ }
+
+ /** Get service endpoint for a given serviceID
+ *
+ * The keys into the registry are:
+ *
+ * [deploment.ear]/[deployment.war]#WsdlService/PortName
+ * [deploment.ear]/[deployment.jar]#ServiceName/PortName
+ *
+ */
+ public ServiceEndpoint getServiceEndpointByID(ObjectName sepID)
+ {
+ ServiceEndpoint wsEndpoint = (ServiceEndpoint)registry.get(sepID);
+ if (wsEndpoint == null)
+ log.warn("No ServiceEndpoint found for serviceID: " + sepID);
+
+ return wsEndpoint;
+ }
+
+ /** Resolve a port-component-link, like:
+ *
+ * [deployment.war]#PortComponentName
+ * [deployment.jar]#PortComponentName
+ *
+ */
+ public ServiceEndpoint resolvePortComponentLink(String pcLink)
+ {
+ String pcName = pcLink;
+ int hashIndex = pcLink.indexOf("#");
+ if (hashIndex > 0)
+ {
+ pcName = pcLink.substring(hashIndex + 1);
+ }
+
+ ServiceEndpoint serviceEndpoint = null;
+ for (ObjectName sepID : registry.keySet())
+ {
+ ServiceEndpoint auxEndpoint = registry.get(sepID);
+ ServiceEndpointInfo sepInfo = auxEndpoint.getServiceEndpointInfo();
+ if (pcName.equals(sepInfo.getServerEndpointMetaData().getPortComponentName()))
+ {
+ if (serviceEndpoint != null)
+ {
+ log.warn("Multiple service endoints found for: " + pcLink);
+ serviceEndpoint = null;
+ break;
+ }
+ serviceEndpoint = auxEndpoint;
+ }
+ }
+
+ if (serviceEndpoint == null)
+ log.warn("No ServiceEndpoint found for pcLink: " + pcLink);
+
+ return serviceEndpoint;
+ }
+
+ /** Show the registered webservices
+ */
+ public String showServiceEndpointTable()
+ {
+ StringWriter sw = new StringWriter();
+ PrintWriter pw = new PrintWriter(sw);
+
+ pw.println("<h3>Registered Service Endpoints</h3>");
+
+ pw.println("<table>");
+
pw.println("<tr><td>ServiceEndpointID</td><td>ServiceEndpointAddress</td><td> </td></tr>");
+ Iterator it = registry.entrySet().iterator();
+ while (it.hasNext())
+ {
+ Map.Entry entry = (Map.Entry)it.next();
+ ObjectName sepID = (ObjectName)entry.getKey();
+ ServiceEndpoint wsEndpoint = (ServiceEndpoint)entry.getValue();
+ ServiceEndpointInfo seInfo = wsEndpoint.getServiceEndpointInfo();
+ String endpointAddress =
seInfo.getServerEndpointMetaData().getEndpointAddress();
+ pw.println("<tr><td>" + sepID.getCanonicalName() +
"</td><td><a href='" + endpointAddress +
"?wsdl'>" + endpointAddress +
"?wsdl</a></td></tr>");
+ }
+ pw.println("</table>");
+ pw.close();
+
+ return sw.toString();
+ }
+
+ /** Get the endpoint metrics
+ */
+ public ServiceEndpointMetrics getServiceEndpointMetrics(ObjectName sepID)
+ {
+ ServiceEndpoint wsEndpoint = getServiceEndpointByID(sepID);
+ return (wsEndpoint != null ? wsEndpoint.getServiceEndpointMetrics() : null);
+ }
+
+ /** Show endpoint metrics
+ */
+ public String showServiceEndpointMetrics(ObjectName sepID)
+ {
+ StringWriter sw = new StringWriter();
+ PrintWriter pw = new PrintWriter(sw);
+
+ ServiceEndpointMetrics seMetrics = getServiceEndpointMetrics(sepID);
+ if (seMetrics != null)
+ {
+ pw.println("<h3>Service Endpoint Metrics</h3>");
+
+ pw.println("<table>");
+ pw.println("<tr><td>EndpointID</td><td>" +
seMetrics.getEndpointID() + "</td></tr>");
+ pw.println("<tr><td>Start Time</td><td>" +
seMetrics.getStartTime() + "</td></tr>");
+ pw.println("<tr><td>Stop Time</td><td>" +
seMetrics.getStopTime() + "</td></tr>");
+ pw.println("<tr><td>Request Count</td><td>" +
seMetrics.getRequestCount() + "</td></tr>");
+ pw.println("<tr><td>Response Count</td><td>" +
seMetrics.getRequestCount() + "</td></tr>");
+ pw.println("<tr><td>Fault Count</td><td>" +
seMetrics.getResponseCount() + "</td></tr>");
+ pw.println("<tr><td>Max Processing
Time</td><td>" + seMetrics.getMaxProcessingTime() +
"</td></tr>");
+ pw.println("<tr><td>Min Processing
Time</td><td>" + seMetrics.getMinProcessingTime() +
"</td></tr>");
+ pw.println("<tr><td>Avg Processing
Time</td><td>" + seMetrics.getAverageProcessingTime() +
"</td></tr>");
+ pw.println("<tr><td>Total Processing
Time</td><td>" + seMetrics.getTotalProcessingTime() +
"</td></tr>");
+ pw.println("</table>");
+ pw.close();
+ }
+ return sw.toString();
+ }
+
+ public void processWSDLRequest(ObjectName sepID, OutputStream outStream, URL
requestURL, String resourcePath) throws Exception
+ {
+ ServiceEndpoint wsEndpoint = getServiceEndpointByID(sepID);
+ if (wsEndpoint == null)
+ throw new WSException("Cannot obtain endpoint for: " + sepID);
+
+ wsEndpoint.handleWSDLRequest(outStream, requestURL, resourcePath);
+ }
+
+ public void processSOAPRequest(ObjectName sepID, InputStream inStream, OutputStream
outStream, EndpointContext context) throws Exception
+ {
+ ServiceEndpoint wsEndpoint = getServiceEndpointByID(sepID);
+ if (wsEndpoint == null)
+ throw new WSException("Cannot obtain endpoint for: " + sepID);
+
+ // Get the type of the endpoint
+ ServerEndpointMetaData sepMetaData =
wsEndpoint.getServiceEndpointInfo().getServerEndpointMetaData();
+ Type type = sepMetaData.getType();
+
+ MessageContextPropertyHelper httpSession = new HttpSessionPropertyHelper(context);
+ ServletContext servletContext = context.getServletContext();
+ HttpServletRequest httpRequest = context.getHttpServletRequest();
+ HttpServletResponse httpResponse = context.getHttpServletResponse();
+ ServletHeaderSource headerSource = new ServletHeaderSource(httpRequest,
httpResponse);
+
+ // Associate a message context with the current thread
+ CommonMessageContext msgContext;
+ if (type == EndpointMetaData.Type.JAXRPC)
+ {
+ msgContext = new SOAPMessageContextJAXRPC();
+ msgContext.setProperty(MessageContextJAXRPC.SERVLET_CONTEXT, servletContext);
+ msgContext.setProperty(MessageContextJAXRPC.SERVLET_REQUEST, httpRequest);
+ msgContext.setProperty(MessageContextJAXRPC.SERVLET_RESPONSE, httpResponse);
+ msgContext.setProperty(MessageContextJAXRPC.SERVLET_SESSION, httpSession);
+ }
+ else
+ {
+ msgContext = new SOAPMessageContextJAXWS();
+ msgContext.setProperty(MessageContextJAXWS.MESSAGE_OUTBOUND_PROPERTY, new
Boolean(false));
+ msgContext.setProperty(MessageContextJAXWS.INBOUND_MESSAGE_ATTACHMENTS, new
HashMap<String, DataHandler>());
+ msgContext.setProperty(MessageContextJAXWS.HTTP_REQUEST_HEADERS,
headerSource.getHeaderMap());
+ msgContext.setProperty(MessageContextJAXWS.HTTP_REQUEST_METHOD,
httpRequest.getMethod());
+ msgContext.setProperty(MessageContextJAXWS.QUERY_STRING,
httpRequest.getQueryString());
+ msgContext.setProperty(MessageContextJAXWS.PATH_INFO,
httpRequest.getPathInfo());
+ msgContext.setProperty(MessageContextJAXWS.SERVLET_CONTEXT, servletContext);
+ msgContext.setProperty(MessageContextJAXWS.SERVLET_REQUEST, httpRequest);
+ msgContext.setProperty(MessageContextJAXWS.SERVLET_RESPONSE, httpResponse);
+
+ }
+ msgContext.setEndpointMetaData(sepMetaData);
+
+ MessageContextAssociation.pushMessageContext(msgContext);
+ try
+ {
+ SOAPMessage resMessage = wsEndpoint.handleRequest(headerSource, context,
inStream);
+
+ Map<String, List<String>> headers = (Map<String,
List<String>>)msgContext.getProperty(MessageContextJAXWS.HTTP_RESPONSE_HEADERS);
+ if (headers != null)
+ headerSource.setHeaderMap(headers);
+
+ Integer code =
(Integer)msgContext.getProperty(MessageContextJAXWS.HTTP_RESPONSE_CODE);
+ if (code != null)
+ httpResponse.setStatus(code.intValue());
+
+ SOAPPart part = resMessage.getSOAPPart();
+ if (part == null)
+ throw new SOAPException("Cannot obtain SOAPPart from response
message");
+
+ // R1126 An INSTANCE MUST return a "500 Internal Server Error" HTTP
status code
+ // if the response envelope is a Fault.
+ //
+ // Also, a one-way operation must show up as empty content, and can be detected
+ // by a null envelope.
+ SOAPEnvelope soapEnv = part.getEnvelope();
+ boolean isFault = soapEnv != null && soapEnv.getBody().getFault() !=
null;
+ if (isFault && httpResponse != null)
+ {
+ httpResponse.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+ }
+
+ sendResponse(outStream, msgContext, isFault);
+ }
+ finally
+ {
+ outStream.flush();
+ outStream.close();
+
+ // Reset the message context association
+ MessageContextAssociation.popMessageContext();
+
+ // clear thread local storage
+ ThreadLocalAssociation.clear();
+ }
+ }
+
+ private void sendResponse(OutputStream outputStream, CommonMessageContext msgContext,
boolean isFault) throws SOAPException, IOException
+ {
+ SOAPMessage soapMessage = msgContext.getSOAPMessage();
+ String wsaTo = null;
+
+ // Get the destination from the AddressingProperties
+ AddressingProperties outProps =
(AddressingProperties)msgContext.getProperty(JAXWSAConstants.SERVER_ADDRESSING_PROPERTIES_OUTBOUND);
+ if (outProps != null && outProps.getTo() != null)
+ {
+ AddressingConstantsImpl ADDR = new AddressingConstantsImpl();
+ wsaTo = outProps.getTo().getURI().toString();
+ if (wsaTo.equals(ADDR.getAnonymousURI()))
+ wsaTo = null;
+ }
+ if (wsaTo != null)
+ {
+ log.debug("Sending response to addressing destination: " + wsaTo);
+ new SOAPConnectionImpl().callOneWay(soapMessage, wsaTo);
+ }
+ else
+ {
+ soapMessage.writeTo(outputStream);
+ }
+ }
+
+ /** Process the given SOAPRequest and return the corresponding SOAPResponse
+ */
+ public String processSOAPRequest(ObjectName sepID, String inMessage) throws Exception
+ {
+ log.debug("processSOAPRequest: " + sepID);
+
+ ByteArrayInputStream inputStream = new
ByteArrayInputStream(inMessage.getBytes("UTF-8"));
+ ByteArrayOutputStream outputStream = new ByteArrayOutputStream(512);
+
+ processSOAPRequest(sepID, inputStream, outputStream, null);
+
+ String outMsg = new String(outputStream.toByteArray());
+ return outMsg;
+ }
+
+ /** Get the ServiceEndpointInvoker for this type of service endpoint
+ */
+ private ServiceEndpointInvoker getServiceEndpointInvoker(ServiceEndpointInfo seInfo)
throws ClassNotFoundException, InstantiationException, IllegalAccessException
+ {
+ ServiceEndpointInvoker seInvoker = null;
+
+ ClassLoader cl = Thread.currentThread().getContextClassLoader();
+ if (seInfo.getType() == ServiceEndpointInfo.EndpointType.JSE)
+ {
+ Class seInvokerClass = cl.loadClass(serviceEndpointInvokerJSE);
+ seInvoker = (ServiceEndpointInvoker)seInvokerClass.newInstance();
+ }
+ else if (seInfo.getType() == ServiceEndpointInfo.EndpointType.SLSB21)
+ {
+ Class seInvokerClass = cl.loadClass(serviceEndpointInvokerEJB21);
+ seInvoker = (ServiceEndpointInvoker)seInvokerClass.newInstance();
+ }
+ else if (seInfo.getType() == ServiceEndpointInfo.EndpointType.SLSB30)
+ {
+ Class seInvokerClass = cl.loadClass(serviceEndpointInvokerEJB3);
+ seInvoker = (ServiceEndpointInvoker)seInvokerClass.newInstance();
+ }
+ else if (seInfo.getType() == ServiceEndpointInfo.EndpointType.MDB21)
+ {
+ Class seInvokerClass = cl.loadClass(serviceEndpointInvokerMDB);
+ seInvoker = (ServiceEndpointInvoker)seInvokerClass.newInstance();
+ }
+
+ if (seInvoker == null)
+ throw new WSException("Cannot obtain service endpoint invoker");
+
+ return seInvoker;
+ }
+
+ /** Get the list of HandlerInfos associated with a given service endpoint
+ */
+ public List<HandlerMetaData> getHandlerMetaData(ObjectName sepID)
+ {
+ ServiceEndpoint wsEndpoint = getServiceEndpointByID(sepID);
+ if (wsEndpoint == null)
+ throw new WSException("Cannot find service endpoint: " + sepID);
+
+ List<HandlerMetaData> handlers = null;
+ if (wsEndpoint != null)
+ {
+ ServerEndpointMetaData sepMetaData =
wsEndpoint.getServiceEndpointInfo().getServerEndpointMetaData();
+ handlers = sepMetaData.getHandlerMetaData(HandlerType.ALL);
+ }
+ return handlers;
+ }
+
+ /**
+ * Dynamically change the list of handlers associated with a given service endpoint
+ * The endpoint is expected to be in STOPED state
+ */
+ public void setHandlerMetaData(ObjectName sepID, List<HandlerMetaData>
handlers)
+ {
+ ServiceEndpoint wsEndpoint = getServiceEndpointByID(sepID);
+ if (wsEndpoint == null)
+ throw new WSException("Cannot find service endpoint: " + sepID);
+
+ ServiceEndpointInfo sepInfo = wsEndpoint.getServiceEndpointInfo();
+ if (sepInfo.getState() != ServiceEndpoint.State.STOPED)
+ throw new WSException("Endpoint expected to be in STOPED state");
+
+ ServerEndpointMetaData sepMetaData =
wsEndpoint.getServiceEndpointInfo().getServerEndpointMetaData();
+ sepMetaData.clearHandlers();
+
+ for (HandlerMetaData handlerMetaData : handlers)
+ {
+ handlerMetaData.setEndpointMetaData(sepMetaData);
+ sepMetaData.addHandler(handlerMetaData);
+ }
+ }
+
+ /** Create a service endpoint
+ */
+ public void createServiceEndpoint(ServiceEndpointInfo seInfo) throws Exception
+ {
+ ObjectName sepID = seInfo.getServiceEndpointID();
+ if (registry.get(sepID) != null)
+ throw new WSException("Service already registerd: " + sepID);
+
+ ServiceEndpointInvoker seInvoker = getServiceEndpointInvoker(seInfo);
+ seInvoker.initServiceEndpoint(seInfo);
+ seInfo.setInvoker(seInvoker);
+
+ // Load/Create the service endpoint impl
+ ClassLoader ctxLoader = Thread.currentThread().getContextClassLoader();
+ ServerEndpointMetaData epMetaData = seInfo.getServerEndpointMetaData();
+ String managedEndpointBean = epMetaData.getManagedEndpointBean();
+ Class seClass = ctxLoader.loadClass(managedEndpointBean);
+ Constructor ctor = seClass.getConstructor(new Class[] { ServiceEndpointInfo.class
});
+ ServiceEndpoint wsEndpoint = (ServiceEndpoint)ctor.newInstance(new Object[] {
seInfo });
+ wsEndpoint.create();
+
+ // Register the endpoint with the MBeanServer
+ registry.put(sepID, wsEndpoint);
+
+ log.debug("WebService created: " + sepID);
+ }
+
+ /** Start a service endpoint
+ */
+ public void startServiceEndpoint(ObjectName sepID) throws Exception
+ {
+ ServiceEndpoint wsEndpoint = getServiceEndpointByID(sepID);
+ if (wsEndpoint == null)
+ throw new WSException("Cannot find service endpoint: " + sepID);
+
+ wsEndpoint.start();
+
+ ServiceEndpointInfo seInfo = wsEndpoint.getServiceEndpointInfo();
+ log.info("WebService started: " +
seInfo.getServerEndpointMetaData().getEndpointAddress());
+ }
+
+ /** Stop a service endpoint
+ */
+ public void stopServiceEndpoint(ObjectName sepID) throws Exception
+ {
+ ServiceEndpoint wsEndpoint = getServiceEndpointByID(sepID);
+ if (wsEndpoint == null)
+ throw new WSException("Cannot find service endpoint: " + sepID);
+
+ wsEndpoint.stop();
+
+ ServiceEndpointInfo seInfo = wsEndpoint.getServiceEndpointInfo();
+ log.info("WebService stopped: " +
seInfo.getServerEndpointMetaData().getEndpointAddress());
+ }
+
+ /** Destroy a service endpoint
+ */
+ public void destroyServiceEndpoint(ObjectName sepID) throws Exception
+ {
+ ServiceEndpoint wsEndpoint = getServiceEndpointByID(sepID);
+ if (wsEndpoint == null)
+ throw new WSException("Cannot find service endpoint: " + sepID);
+
+ wsEndpoint.destroy();
+
+ // Remove the endpoint from the MBeanServer
+ registry.remove(sepID);
+
+ ServiceEndpointInfo seInfo = wsEndpoint.getServiceEndpointInfo();
+ log.debug("WebService destroyed: " +
seInfo.getServerEndpointMetaData().getEndpointAddress());
+ }
+
+ public void create() throws Exception
+ {
+ log.info(UnifiedMetaData.getImplementationVersion());
+ MBeanServer server = getJMXServer();
+ if (server != null)
+ {
+ server.registerMBean(this, OBJECT_NAME);
+ }
+ }
+
+ public void destroy() throws Exception
+ {
+ log.debug("Destroy service endpoint manager");
+ MBeanServer server = getJMXServer();
+ if (server != null)
+ {
+ server.unregisterMBean(OBJECT_NAME);
+ }
+ }
+
+ private MBeanServer getJMXServer()
+ {
+ MBeanServer server = null;
+ ArrayList servers = MBeanServerFactory.findMBeanServer(null);
+ if (servers.size() > 0)
+ {
+ server = (MBeanServer)servers.get(0);
+ }
+ return server;
+ }
+
+ public static class HttpSessionPropertyHelper implements MessageContextPropertyHelper
+ {
+
+ private EndpointContext context;
+
+ public HttpSessionPropertyHelper(final EndpointContext context)
+ {
+ this.context = context;
+ }
+
+ public Object get()
+ {
+ return context.getHttpSession();
+ }
+
+ }
+}
Deleted:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/ServiceEndpointManagerFactory.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/server/ServiceEndpointManagerFactory.java 2006-12-05
23:29:55 UTC (rev 1557)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/ServiceEndpointManagerFactory.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -1,55 +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;
-
-import org.jboss.kernel.spi.registry.KernelRegistry;
-import org.jboss.kernel.spi.registry.KernelRegistryEntry;
-
-// $Id$
-
-/**
- * Factory to the singleton instance of the ServiceEndpointManager
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 08-May-2006
- */
-public class ServiceEndpointManagerFactory
-{
- private static ServiceEndpointManagerFactory instance = new
ServiceEndpointManagerFactory();
-
- // Hide ctor
- private ServiceEndpointManagerFactory()
- {
- }
-
- public static ServiceEndpointManagerFactory getInstance()
- {
- return instance;
- }
-
- public ServiceEndpointManager getServiceEndpointManager()
- {
- KernelRegistry registry = KernelLocator.getKernel().getRegistry();
- KernelRegistryEntry entry = registry.getEntry(ServiceEndpointManager.BEAN_NAME);
- return (ServiceEndpointManager)entry.getTarget();
- }
-}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/ServiceEndpointManagerFactory.java
(from rev 1560,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/server/ServiceEndpointManagerFactory.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/server/ServiceEndpointManagerFactory.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/ServiceEndpointManagerFactory.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -0,0 +1,55 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ws.core.server;
+
+import org.jboss.kernel.spi.registry.KernelRegistry;
+import org.jboss.kernel.spi.registry.KernelRegistryEntry;
+
+// $Id$
+
+/**
+ * Factory to the singleton instance of the ServiceEndpointManager
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 08-May-2006
+ */
+public class ServiceEndpointManagerFactory
+{
+ private static ServiceEndpointManagerFactory instance = new
ServiceEndpointManagerFactory();
+
+ // Hide ctor
+ private ServiceEndpointManagerFactory()
+ {
+ }
+
+ public static ServiceEndpointManagerFactory getInstance()
+ {
+ return instance;
+ }
+
+ public ServiceEndpointManager getServiceEndpointManager()
+ {
+ KernelRegistry registry = KernelLocator.getKernel().getRegistry();
+ KernelRegistryEntry entry = registry.getEntry(ServiceEndpointManager.BEAN_NAME);
+ return (ServiceEndpointManager)entry.getTarget();
+ }
+}
Deleted:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/ServiceEndpointManagerMBean.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/server/ServiceEndpointManagerMBean.java 2006-12-05
23:29:55 UTC (rev 1557)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/ServiceEndpointManagerMBean.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -1,58 +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;
-
-import java.net.UnknownHostException;
-import java.util.List;
-
-import javax.management.ObjectName;
-
-import org.jboss.ws.metadata.HandlerMetaData;
-import org.jboss.ws.utils.ObjectNameFactory;
-
-/**
- * MBean interface.
- * @since 15-April-2004
- */
-public interface ServiceEndpointManagerMBean
-{
- // default object name
- static final ObjectName OBJECT_NAME =
ObjectNameFactory.create("jboss.ws:service=ServiceEndpointManager");
-
- String getWebServiceHost();
- void setWebServiceHost(String host) throws UnknownHostException;
-
- int getWebServicePort();
- void setWebServicePort(int port);
-
- int getWebServiceSecurePort();
- void setWebServiceSecurePort(int port);
-
- boolean isAlwaysModifySOAPAddress();
- void setAlwaysModifySOAPAddress(boolean modify);
-
- public List<HandlerMetaData> getHandlerMetaData(ObjectName sepID);
- public void setHandlerMetaData(ObjectName sepID, List<HandlerMetaData>
handlers);
-
- void startServiceEndpoint(ObjectName sepID) throws Exception;
- void stopServiceEndpoint(ObjectName sepID) throws Exception;
-}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/ServiceEndpointManagerMBean.java
(from rev 1560,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/server/ServiceEndpointManagerMBean.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/server/ServiceEndpointManagerMBean.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/ServiceEndpointManagerMBean.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -0,0 +1,58 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ws.core.server;
+
+import java.net.UnknownHostException;
+import java.util.List;
+
+import javax.management.ObjectName;
+
+import org.jboss.ws.metadata.umdm.HandlerMetaData;
+import org.jboss.ws.utils.ObjectNameFactory;
+
+/**
+ * MBean interface.
+ * @since 15-April-2004
+ */
+public interface ServiceEndpointManagerMBean
+{
+ // default object name
+ static final ObjectName OBJECT_NAME =
ObjectNameFactory.create("jboss.ws:service=ServiceEndpointManager");
+
+ String getWebServiceHost();
+ void setWebServiceHost(String host) throws UnknownHostException;
+
+ int getWebServicePort();
+ void setWebServicePort(int port);
+
+ int getWebServiceSecurePort();
+ void setWebServiceSecurePort(int port);
+
+ boolean isAlwaysModifySOAPAddress();
+ void setAlwaysModifySOAPAddress(boolean modify);
+
+ public List<HandlerMetaData> getHandlerMetaData(ObjectName sepID);
+ public void setHandlerMetaData(ObjectName sepID, List<HandlerMetaData>
handlers);
+
+ void startServiceEndpoint(ObjectName sepID) throws Exception;
+ void stopServiceEndpoint(ObjectName sepID) throws Exception;
+}
Deleted:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/ServiceEndpointMetrics.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/server/ServiceEndpointMetrics.java 2006-12-05
23:29:55 UTC (rev 1557)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/ServiceEndpointMetrics.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -1,175 +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.io.Serializable;
-import java.util.Date;
-
-import javax.management.ObjectName;
-
-/**
- * Service Endpoint Metrics
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 14-Dec-2005
- */
-public class ServiceEndpointMetrics implements Serializable
-{
- private static final long serialVersionUID = -7730514070812711512L;
-
- // The unique service endpointID
- private ObjectName endpointID;
-
- private Date startTime;
- private Date stopTime;
- private long requestCount;
- private long responseCount;
- private long faultCount;
- private long maxProcessingTime;
- private long minProcessingTime;
- private long avgProcessingTime;
- private long totalProcessingTime;
-
- public ServiceEndpointMetrics(ObjectName endpointID)
- {
- this.endpointID = endpointID;
- }
-
- public void start()
- {
- startTime = new Date();
- stopTime = null;
- requestCount = 0;
- responseCount = 0;
- faultCount = 0;
- maxProcessingTime = 0;
- minProcessingTime = 0;
- avgProcessingTime = 0;
- totalProcessingTime = 0;
- }
-
- public void stop()
- {
- stopTime = new Date();
- }
-
- public long processRequestMessage()
- {
- requestCount++;
- return System.currentTimeMillis();
- }
-
- public void processResponseMessage(long beginTime)
- {
- responseCount++;
- processAnyMessage(beginTime);
- }
-
- public void processFaultMessage(long beginTime)
- {
- faultCount++;
- processAnyMessage(beginTime);
- }
-
- private void processAnyMessage(long beginTime)
- {
- if (beginTime > 0)
- {
- long procTime = System.currentTimeMillis() - beginTime;
-
- if (minProcessingTime == 0)
- minProcessingTime = procTime;
-
- maxProcessingTime = Math.max(maxProcessingTime, procTime);
- minProcessingTime = Math.min(minProcessingTime, procTime);
- totalProcessingTime = totalProcessingTime + procTime;
- avgProcessingTime = totalProcessingTime / (responseCount + faultCount);
- }
- }
-
- public ObjectName getEndpointID()
- {
- return endpointID;
- }
-
- public Date getStartTime()
- {
- return startTime;
- }
-
- public Date getStopTime()
- {
- return stopTime;
- }
-
- public long getMinProcessingTime()
- {
- return minProcessingTime;
- }
-
- public long getMaxProcessingTime()
- {
- return maxProcessingTime;
- }
-
- public long getAverageProcessingTime()
- {
- return avgProcessingTime;
- }
-
- public long getTotalProcessingTime()
- {
- return totalProcessingTime;
- }
-
- public long getRequestCount()
- {
- return requestCount;
- }
-
- public long getFaultCount()
- {
- return faultCount;
- }
-
- public long getResponseCount()
- {
- return responseCount;
- }
-
- public String toString()
- {
- StringBuilder buffer = new StringBuilder("\nEndpoint Metrics: " +
endpointID);
- buffer.append("\n startTime=" + startTime);
- buffer.append("\n stopTime=" + stopTime);
- buffer.append("\n requestCount=" + requestCount);
- buffer.append("\n responseCount=" + responseCount);
- buffer.append("\n faultCount=" + faultCount);
- buffer.append("\n maxProcessingTime=" + maxProcessingTime);
- buffer.append("\n minProcessingTime=" + minProcessingTime);
- buffer.append("\n avgProcessingTime=" + avgProcessingTime);
- buffer.append("\n totalProcessingTime=" + totalProcessingTime);
- return buffer.toString();
- }
-}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/ServiceEndpointMetrics.java
(from rev 1560,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/server/ServiceEndpointMetrics.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/server/ServiceEndpointMetrics.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/ServiceEndpointMetrics.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -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.ws.core.server;
+
+// $Id$
+
+import java.io.Serializable;
+import java.util.Date;
+
+import javax.management.ObjectName;
+
+/**
+ * Service Endpoint Metrics
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 14-Dec-2005
+ */
+public class ServiceEndpointMetrics implements Serializable
+{
+ private static final long serialVersionUID = -7730514070812711512L;
+
+ // The unique service endpointID
+ private ObjectName endpointID;
+
+ private Date startTime;
+ private Date stopTime;
+ private long requestCount;
+ private long responseCount;
+ private long faultCount;
+ private long maxProcessingTime;
+ private long minProcessingTime;
+ private long avgProcessingTime;
+ private long totalProcessingTime;
+
+ public ServiceEndpointMetrics(ObjectName endpointID)
+ {
+ this.endpointID = endpointID;
+ }
+
+ public void start()
+ {
+ startTime = new Date();
+ stopTime = null;
+ requestCount = 0;
+ responseCount = 0;
+ faultCount = 0;
+ maxProcessingTime = 0;
+ minProcessingTime = 0;
+ avgProcessingTime = 0;
+ totalProcessingTime = 0;
+ }
+
+ public void stop()
+ {
+ stopTime = new Date();
+ }
+
+ public long processRequestMessage()
+ {
+ requestCount++;
+ return System.currentTimeMillis();
+ }
+
+ public void processResponseMessage(long beginTime)
+ {
+ responseCount++;
+ processAnyMessage(beginTime);
+ }
+
+ public void processFaultMessage(long beginTime)
+ {
+ faultCount++;
+ processAnyMessage(beginTime);
+ }
+
+ private void processAnyMessage(long beginTime)
+ {
+ if (beginTime > 0)
+ {
+ long procTime = System.currentTimeMillis() - beginTime;
+
+ if (minProcessingTime == 0)
+ minProcessingTime = procTime;
+
+ maxProcessingTime = Math.max(maxProcessingTime, procTime);
+ minProcessingTime = Math.min(minProcessingTime, procTime);
+ totalProcessingTime = totalProcessingTime + procTime;
+ avgProcessingTime = totalProcessingTime / (responseCount + faultCount);
+ }
+ }
+
+ public ObjectName getEndpointID()
+ {
+ return endpointID;
+ }
+
+ public Date getStartTime()
+ {
+ return startTime;
+ }
+
+ public Date getStopTime()
+ {
+ return stopTime;
+ }
+
+ public long getMinProcessingTime()
+ {
+ return minProcessingTime;
+ }
+
+ public long getMaxProcessingTime()
+ {
+ return maxProcessingTime;
+ }
+
+ public long getAverageProcessingTime()
+ {
+ return avgProcessingTime;
+ }
+
+ public long getTotalProcessingTime()
+ {
+ return totalProcessingTime;
+ }
+
+ public long getRequestCount()
+ {
+ return requestCount;
+ }
+
+ public long getFaultCount()
+ {
+ return faultCount;
+ }
+
+ public long getResponseCount()
+ {
+ return responseCount;
+ }
+
+ public String toString()
+ {
+ StringBuilder buffer = new StringBuilder("\nEndpoint Metrics: " +
endpointID);
+ buffer.append("\n startTime=" + startTime);
+ buffer.append("\n stopTime=" + stopTime);
+ buffer.append("\n requestCount=" + requestCount);
+ buffer.append("\n responseCount=" + responseCount);
+ buffer.append("\n faultCount=" + faultCount);
+ buffer.append("\n maxProcessingTime=" + maxProcessingTime);
+ buffer.append("\n minProcessingTime=" + minProcessingTime);
+ buffer.append("\n avgProcessingTime=" + avgProcessingTime);
+ buffer.append("\n totalProcessingTime=" + totalProcessingTime);
+ return buffer.toString();
+ }
+}
Deleted:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/ServletHeaderSource.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/server/ServletHeaderSource.java 2006-12-05
23:29:55 UTC (rev 1557)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/ServletHeaderSource.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -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.ws.server;
-
-// $Id$
-
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.xml.soap.MimeHeader;
-import javax.xml.soap.MimeHeaders;
-
-/**
- * Implementation of <code>HeaderSource</code> that pulls header
- * information from an HttpServlet.
- *
- * @author <a href="mailto:jason@stacksmash.com">Jason T.
Greene</a>
- * @author Thomas.Diesler(a)jboss.org
- */
-public class ServletHeaderSource implements HeaderSource
-{
- private HttpServletRequest req;
- private HttpServletResponse res;
-
- public ServletHeaderSource(HttpServletRequest req, HttpServletResponse res)
- {
- this.req = req;
- this.res = res;
- }
-
- public MimeHeaders getMimeHeaders()
- {
- Enumeration e = req.getHeaderNames();
- if (e == null)
- return null;
-
- MimeHeaders headers = new MimeHeaders();
-
- while (e.hasMoreElements())
- {
- String name = (String)e.nextElement();
- headers.addHeader(name, req.getHeader(name));
- }
-
- return headers;
- }
-
- public Map<String, List<String>> getHeaderMap()
- {
- Map<String, List<String>> headerMap = new HashMap<String,
List<String>>();
-
- Enumeration e = req.getHeaderNames();
- if (e != null)
- {
- while (e.hasMoreElements())
- {
- String name = (String)e.nextElement();
- List<String> values = new ArrayList<String>();
- values.add(req.getHeader(name));
- headerMap.put(name, values);
- }
- }
-
- return headerMap;
- }
-
- public void setMimeHeaders(MimeHeaders headers)
- {
- Iterator i = headers.getAllHeaders();
- while (i.hasNext())
- {
- MimeHeader header = (MimeHeader)i.next();
- res.addHeader(header.getName(), header.getValue());
- }
- }
-
- public void setHeaderMap(Map<String, List<String>> headers)
- {
- Iterator<String> it = headers.keySet().iterator();
- while (it.hasNext())
- {
- String name = it.next();
- List<String> values = headers.get(name);
- for (String value : values)
- {
- res.addHeader(name, value);
- }
- }
- }
-}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/ServletHeaderSource.java
(from rev 1560,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/server/ServletHeaderSource.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/server/ServletHeaderSource.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/ServletHeaderSource.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -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.core.server;
+
+// $Id$
+
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.xml.soap.MimeHeader;
+import javax.xml.soap.MimeHeaders;
+
+/**
+ * Implementation of <code>HeaderSource</code> that pulls header
+ * information from an HttpServlet.
+ *
+ * @author <a href="mailto:jason@stacksmash.com">Jason T.
Greene</a>
+ * @author Thomas.Diesler(a)jboss.org
+ */
+public class ServletHeaderSource implements HeaderSource
+{
+ private HttpServletRequest req;
+ private HttpServletResponse res;
+
+ public ServletHeaderSource(HttpServletRequest req, HttpServletResponse res)
+ {
+ this.req = req;
+ this.res = res;
+ }
+
+ public MimeHeaders getMimeHeaders()
+ {
+ Enumeration e = req.getHeaderNames();
+ if (e == null)
+ return null;
+
+ MimeHeaders headers = new MimeHeaders();
+
+ while (e.hasMoreElements())
+ {
+ String name = (String)e.nextElement();
+ headers.addHeader(name, req.getHeader(name));
+ }
+
+ return headers;
+ }
+
+ public Map<String, List<String>> getHeaderMap()
+ {
+ Map<String, List<String>> headerMap = new HashMap<String,
List<String>>();
+
+ Enumeration e = req.getHeaderNames();
+ if (e != null)
+ {
+ while (e.hasMoreElements())
+ {
+ String name = (String)e.nextElement();
+ List<String> values = new ArrayList<String>();
+ values.add(req.getHeader(name));
+ headerMap.put(name, values);
+ }
+ }
+
+ return headerMap;
+ }
+
+ public void setMimeHeaders(MimeHeaders headers)
+ {
+ Iterator i = headers.getAllHeaders();
+ while (i.hasNext())
+ {
+ MimeHeader header = (MimeHeader)i.next();
+ res.addHeader(header.getName(), header.getValue());
+ }
+ }
+
+ public void setHeaderMap(Map<String, List<String>> headers)
+ {
+ Iterator<String> it = headers.keySet().iterator();
+ while (it.hasNext())
+ {
+ String name = it.next();
+ List<String> values = headers.get(name);
+ for (String value : values)
+ {
+ res.addHeader(name, value);
+ }
+ }
+ }
+}
Deleted:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/WSDLFilePublisher.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/server/WSDLFilePublisher.java 2006-12-05
23:29:55 UTC (rev 1557)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/WSDLFilePublisher.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -1,328 +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.io.File;
-import java.io.FileOutputStream;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.Writer;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.Iterator;
-import java.util.List;
-
-import javax.wsdl.Definition;
-import javax.wsdl.Import;
-import javax.wsdl.factory.WSDLFactory;
-import javax.wsdl.xml.WSDLWriter;
-
-import org.jboss.logging.Logger;
-import org.jboss.util.NotImplementedException;
-import org.jboss.ws.utils.DOMUtils;
-import org.jboss.ws.Constants;
-import org.jboss.ws.WSException;
-import org.jboss.ws.deployment.UnifiedDeploymentInfo;
-import org.jboss.ws.metadata.ServiceMetaData;
-import org.jboss.ws.metadata.UnifiedMetaData;
-import org.jboss.ws.metadata.wsdl.WSDLDefinitions;
-import org.jboss.ws.utils.IOUtils;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-
-/** A helper class that publishes the wsdl files and their imports to the
server/data/wsdl directory.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 02-June-2004
- */
-public class WSDLFilePublisher
-{
- // provide logging
- private static final Logger log = Logger.getLogger(WSDLFilePublisher.class);
-
- // The deployment info for the web service archive
- private UnifiedDeploymentInfo udi;
- // The expected wsdl location in the deployment
- private String expLocation;
-
- public WSDLFilePublisher(UnifiedDeploymentInfo udi)
- {
- this.udi = udi;
-
- String archiveName = udi.shortName;
- if (archiveName.endsWith(".jar") ||
archiveName.endsWith(".ejb3"))
- expLocation = "META-INF/wsdl/";
- else if (archiveName.endsWith(".war"))
- expLocation = "WEB-INF/wsdl/";
- else throw new WSException("Can only publish wsdl from WAR or JAR
deployment");
- }
-
- /** Publish the deployed wsdl file to the data directory
- */
- public void publishWsdlFiles(UnifiedMetaData wsMetaData) throws IOException
- {
- String deploymentName = udi.getCanonicalName();
-
- // For each service
- for (ServiceMetaData serviceMetaData : wsMetaData.getServices())
- {
- String wsdlFile = serviceMetaData.getWsdlFile();
- log.debug("Publish WSDL file: " + wsdlFile);
-
- if (wsdlFile != null)
- {
- File targetFile = getPublishLocation(deploymentName, serviceMetaData);
- targetFile.getParentFile().mkdirs();
-
- // Get the wsdl definition and write it to the wsdl publish location
- try
- {
- Writer fWriter = IOUtils.getCharsetFileWriter(targetFile,
Constants.DEFAULT_XML_CHARSET);
- WSDLDefinitions wsdlDefinitions = serviceMetaData.getWsdlDefinitions();
- wsdlDefinitions.write(fWriter, Constants.DEFAULT_XML_CHARSET);
-
- URL wsdlPublishURL = targetFile.toURL();
- log.info("WSDL published to: " + wsdlPublishURL);
-
- // delete wsdl temp file
- ServerConfigFactory factory = ServerConfigFactory.getInstance();
- ServerConfig config = factory.getServerConfig();
- if
(wsdlFile.startsWith(config.getServerTempDir().toURL().toExternalForm()))
- {
- new File(wsdlFile).delete();
- }
-
- // udpate the wsdl file location
- serviceMetaData.setWsdlFile(wsdlPublishURL.toExternalForm());
-
- // Process the wsdl imports
- Definition wsdl11Definition = wsdlDefinitions.getWsdlOneOneDefinition();
- if (wsdl11Definition != null)
- {
- publishWsdlImports(targetFile.toURL(), wsdl11Definition);
-
- // Publish XMLSchema imports
- Document document = wsdlDefinitions.getWsdlDocument();
- publishSchemaImports(targetFile.toURL(),
document.getDocumentElement());
- }
- else
- {
- throw new NotImplementedException("WSDL-2.0 imports");
- }
- }
- catch (RuntimeException rte)
- {
- throw rte;
- }
- catch (Exception e)
- {
- throw new WSException("Cannot publish wsdl to: " + targetFile,
e);
- }
- }
- }
- }
-
- /** Publish the wsdl imports for a given wsdl definition
- */
- private void publishWsdlImports(URL parentURL, Definition parentDefinition) throws
Exception
- {
- String baseURI = parentURL.toExternalForm();
-
- Iterator it = parentDefinition.getImports().values().iterator();
- while (it.hasNext())
- {
- for (Import wsdlImport : (List<Import>)it.next())
- {
- String locationURI = wsdlImport.getLocationURI();
- Definition subdef = wsdlImport.getDefinition();
-
- // its an external import, don't publish locally
- if (locationURI.startsWith("http://") == false)
- {
- URL targetURL = new URL(baseURI.substring(0,
baseURI.lastIndexOf("/") + 1) + locationURI);
- File targetFile = new File(targetURL.getPath());
- targetFile.getParentFile().mkdirs();
-
- WSDLFactory wsdlFactory = WSDLFactory.newInstance();
- WSDLWriter wsdlWriter = wsdlFactory.newWSDLWriter();
- FileWriter fw = new FileWriter(targetFile);
- wsdlWriter.writeWSDL(subdef, fw);
- fw.close();
-
- log.debug("WSDL import published to: " + targetURL);
-
- // recursivly publish imports
- publishWsdlImports(targetURL, subdef);
-
- // Publish XMLSchema imports
- Element subdoc = DOMUtils.parse(targetURL.openStream());
- publishSchemaImports(targetURL, subdoc);
- }
- }
- }
- }
-
- /** Publish the schema imports for a given wsdl definition
- */
- private void publishSchemaImports(URL parentURL, Element element) throws Exception
- {
- String baseURI = parentURL.toExternalForm();
-
- Iterator it = DOMUtils.getChildElements(element);
- while (it.hasNext())
- {
- Element childElement = (Element)it.next();
- if ("import".equals(childElement.getLocalName()) ||
"include".equals(childElement.getLocalName()))
- {
- String schemaLocation =
childElement.getAttribute("schemaLocation");
- if (schemaLocation.length() > 0)
- {
- if (schemaLocation.startsWith("http://") == false)
- {
- URL xsdURL = new URL(baseURI.substring(0,
baseURI.lastIndexOf("/") + 1) + schemaLocation);
- File targetFile = new File(xsdURL.getPath());
- targetFile.getParentFile().mkdirs();
-
- String deploymentName = udi.getCanonicalName();
-
- // get the resource path
- int index = baseURI.indexOf(deploymentName);
- String resourcePath = baseURI.substring(index +
deploymentName.length());
- resourcePath = resourcePath.substring(0,
resourcePath.lastIndexOf("/"));
- if (resourcePath.length() > 0)
- resourcePath = resourcePath + "/";
-
- resourcePath = expLocation + resourcePath + schemaLocation;
- InputStream is = udi.classLoader.getResourceAsStream(resourcePath);
- if (is == null)
- throw new IllegalArgumentException("Cannot find schema import
in deployment: " + resourcePath);
-
- FileOutputStream fos = new FileOutputStream(targetFile);
- IOUtils.copyStream(fos, is);
- fos.close();
- is.close();
-
- log.debug("XMLSchema import published to: " + xsdURL);
-
- // recursivly publish imports
- Element subdoc = DOMUtils.parse(xsdURL.openStream());
- publishSchemaImports(xsdURL, subdoc);
- }
- }
- }
- else
- {
- publishSchemaImports(parentURL, childElement);
- }
- }
- }
-
- /**
- * Delete the published wsdl
- */
- public void unpublishWsdlFiles() throws IOException
- {
- String deploymentDir = (udi.parent != null ? udi.parent.shortName :
udi.shortName);
- ServerConfig config = ServerConfigFactory.getInstance().getServerConfig();
- File serviceDir = new File(config.getServerDataDir().getCanonicalPath() +
"/wsdl/" + deploymentDir);
- deleteWsdlPublishDirectory(serviceDir);
- }
-
- /**
- * Delete the published wsdl document, traversing down the dir structure
- */
- private void deleteWsdlPublishDirectory(File dir) throws IOException
- {
- String[] files = dir.list();
- for (int i = 0; files != null && i < files.length; i++)
- {
- String fileName = files[i];
- File file = new File(dir + "/" + fileName);
- if (file.isDirectory())
- {
- deleteWsdlPublishDirectory(file);
- }
- else
- {
- if (file.delete() == false)
- log.warn("Cannot delete published wsdl document: " +
file.toURL());
- }
- }
-
- // delete the directory as well
- dir.delete();
- }
-
- /**
- * Get the file publish location
- */
- private File getPublishLocation(String archiveName, ServiceMetaData serviceMetaData)
throws IOException
- {
- // Only file URLs are supported in <wsdl-publish-location>
- String publishLocation = serviceMetaData.getWsdlPublishLocation();
- boolean predefinedLocation = publishLocation != null &&
publishLocation.startsWith("file:");
-
- File locationFile = null;
- if (predefinedLocation == false)
- {
- ServerConfig config = ServerConfigFactory.getInstance().getServerConfig();
- locationFile = new File(config.getServerDataDir().getCanonicalPath() +
"/wsdl/" + archiveName);
- }
- else
- {
- try
- {
- locationFile = new File(new URL(publishLocation).getPath());
- }
- catch (MalformedURLException e)
- {
- throw new IllegalArgumentException("Invalid publish location: " +
e.getMessage());
- }
- }
-
- // make sure we don't have a leadig '/'
- String wsdlFile = serviceMetaData.getWsdlFile();
- if (wsdlFile.startsWith("/"))
- wsdlFile = wsdlFile.substring(1);
-
- File wsdlLocation;
- if (wsdlFile.startsWith(expLocation))
- {
- wsdlFile = wsdlFile.substring(expLocation.length());
- wsdlLocation = new File(locationFile + "/" + wsdlFile);
- }
- else if (wsdlFile.startsWith("file:/"))
- {
- wsdlFile = wsdlFile.substring(wsdlFile.lastIndexOf("/") + 1);
- wsdlLocation = new File(locationFile + "/" + wsdlFile);
- }
- else
- {
- throw new WSException("Invalid wsdlFile '" + wsdlFile +
"', expected in: " + expLocation);
- }
-
- return wsdlLocation;
- }
-}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/WSDLFilePublisher.java
(from rev 1560,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/server/WSDLFilePublisher.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/server/WSDLFilePublisher.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/WSDLFilePublisher.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -0,0 +1,328 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ws.core.server;
+
+// $Id$
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.Writer;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.wsdl.Definition;
+import javax.wsdl.Import;
+import javax.wsdl.factory.WSDLFactory;
+import javax.wsdl.xml.WSDLWriter;
+
+import org.jboss.logging.Logger;
+import org.jboss.util.NotImplementedException;
+import org.jboss.ws.utils.DOMUtils;
+import org.jboss.ws.Constants;
+import org.jboss.ws.WSException;
+import org.jboss.ws.deployment.UnifiedDeploymentInfo;
+import org.jboss.ws.metadata.umdm.ServiceMetaData;
+import org.jboss.ws.metadata.umdm.UnifiedMetaData;
+import org.jboss.ws.metadata.wsdl.WSDLDefinitions;
+import org.jboss.ws.utils.IOUtils;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+/** A helper class that publishes the wsdl files and their imports to the
server/data/wsdl directory.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 02-June-2004
+ */
+public class WSDLFilePublisher
+{
+ // provide logging
+ private static final Logger log = Logger.getLogger(WSDLFilePublisher.class);
+
+ // The deployment info for the web service archive
+ private UnifiedDeploymentInfo udi;
+ // The expected wsdl location in the deployment
+ private String expLocation;
+
+ public WSDLFilePublisher(UnifiedDeploymentInfo udi)
+ {
+ this.udi = udi;
+
+ String archiveName = udi.shortName;
+ if (archiveName.endsWith(".jar") ||
archiveName.endsWith(".ejb3"))
+ expLocation = "META-INF/wsdl/";
+ else if (archiveName.endsWith(".war"))
+ expLocation = "WEB-INF/wsdl/";
+ else throw new WSException("Can only publish wsdl from WAR or JAR
deployment");
+ }
+
+ /** Publish the deployed wsdl file to the data directory
+ */
+ public void publishWsdlFiles(UnifiedMetaData wsMetaData) throws IOException
+ {
+ String deploymentName = udi.getCanonicalName();
+
+ // For each service
+ for (ServiceMetaData serviceMetaData : wsMetaData.getServices())
+ {
+ String wsdlFile = serviceMetaData.getWsdlFile();
+ log.debug("Publish WSDL file: " + wsdlFile);
+
+ if (wsdlFile != null)
+ {
+ File targetFile = getPublishLocation(deploymentName, serviceMetaData);
+ targetFile.getParentFile().mkdirs();
+
+ // Get the wsdl definition and write it to the wsdl publish location
+ try
+ {
+ Writer fWriter = IOUtils.getCharsetFileWriter(targetFile,
Constants.DEFAULT_XML_CHARSET);
+ WSDLDefinitions wsdlDefinitions = serviceMetaData.getWsdlDefinitions();
+ wsdlDefinitions.write(fWriter, Constants.DEFAULT_XML_CHARSET);
+
+ URL wsdlPublishURL = targetFile.toURL();
+ log.info("WSDL published to: " + wsdlPublishURL);
+
+ // delete wsdl temp file
+ ServerConfigFactory factory = ServerConfigFactory.getInstance();
+ ServerConfig config = factory.getServerConfig();
+ if
(wsdlFile.startsWith(config.getServerTempDir().toURL().toExternalForm()))
+ {
+ new File(wsdlFile).delete();
+ }
+
+ // udpate the wsdl file location
+ serviceMetaData.setWsdlFile(wsdlPublishURL.toExternalForm());
+
+ // Process the wsdl imports
+ Definition wsdl11Definition = wsdlDefinitions.getWsdlOneOneDefinition();
+ if (wsdl11Definition != null)
+ {
+ publishWsdlImports(targetFile.toURL(), wsdl11Definition);
+
+ // Publish XMLSchema imports
+ Document document = wsdlDefinitions.getWsdlDocument();
+ publishSchemaImports(targetFile.toURL(),
document.getDocumentElement());
+ }
+ else
+ {
+ throw new NotImplementedException("WSDL-2.0 imports");
+ }
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (Exception e)
+ {
+ throw new WSException("Cannot publish wsdl to: " + targetFile,
e);
+ }
+ }
+ }
+ }
+
+ /** Publish the wsdl imports for a given wsdl definition
+ */
+ private void publishWsdlImports(URL parentURL, Definition parentDefinition) throws
Exception
+ {
+ String baseURI = parentURL.toExternalForm();
+
+ Iterator it = parentDefinition.getImports().values().iterator();
+ while (it.hasNext())
+ {
+ for (Import wsdlImport : (List<Import>)it.next())
+ {
+ String locationURI = wsdlImport.getLocationURI();
+ Definition subdef = wsdlImport.getDefinition();
+
+ // its an external import, don't publish locally
+ if (locationURI.startsWith("http://") == false)
+ {
+ URL targetURL = new URL(baseURI.substring(0,
baseURI.lastIndexOf("/") + 1) + locationURI);
+ File targetFile = new File(targetURL.getPath());
+ targetFile.getParentFile().mkdirs();
+
+ WSDLFactory wsdlFactory = WSDLFactory.newInstance();
+ WSDLWriter wsdlWriter = wsdlFactory.newWSDLWriter();
+ FileWriter fw = new FileWriter(targetFile);
+ wsdlWriter.writeWSDL(subdef, fw);
+ fw.close();
+
+ log.debug("WSDL import published to: " + targetURL);
+
+ // recursivly publish imports
+ publishWsdlImports(targetURL, subdef);
+
+ // Publish XMLSchema imports
+ Element subdoc = DOMUtils.parse(targetURL.openStream());
+ publishSchemaImports(targetURL, subdoc);
+ }
+ }
+ }
+ }
+
+ /** Publish the schema imports for a given wsdl definition
+ */
+ private void publishSchemaImports(URL parentURL, Element element) throws Exception
+ {
+ String baseURI = parentURL.toExternalForm();
+
+ Iterator it = DOMUtils.getChildElements(element);
+ while (it.hasNext())
+ {
+ Element childElement = (Element)it.next();
+ if ("import".equals(childElement.getLocalName()) ||
"include".equals(childElement.getLocalName()))
+ {
+ String schemaLocation =
childElement.getAttribute("schemaLocation");
+ if (schemaLocation.length() > 0)
+ {
+ if (schemaLocation.startsWith("http://") == false)
+ {
+ URL xsdURL = new URL(baseURI.substring(0,
baseURI.lastIndexOf("/") + 1) + schemaLocation);
+ File targetFile = new File(xsdURL.getPath());
+ targetFile.getParentFile().mkdirs();
+
+ String deploymentName = udi.getCanonicalName();
+
+ // get the resource path
+ int index = baseURI.indexOf(deploymentName);
+ String resourcePath = baseURI.substring(index +
deploymentName.length());
+ resourcePath = resourcePath.substring(0,
resourcePath.lastIndexOf("/"));
+ if (resourcePath.length() > 0)
+ resourcePath = resourcePath + "/";
+
+ resourcePath = expLocation + resourcePath + schemaLocation;
+ InputStream is = udi.classLoader.getResourceAsStream(resourcePath);
+ if (is == null)
+ throw new IllegalArgumentException("Cannot find schema import
in deployment: " + resourcePath);
+
+ FileOutputStream fos = new FileOutputStream(targetFile);
+ IOUtils.copyStream(fos, is);
+ fos.close();
+ is.close();
+
+ log.debug("XMLSchema import published to: " + xsdURL);
+
+ // recursivly publish imports
+ Element subdoc = DOMUtils.parse(xsdURL.openStream());
+ publishSchemaImports(xsdURL, subdoc);
+ }
+ }
+ }
+ else
+ {
+ publishSchemaImports(parentURL, childElement);
+ }
+ }
+ }
+
+ /**
+ * Delete the published wsdl
+ */
+ public void unpublishWsdlFiles() throws IOException
+ {
+ String deploymentDir = (udi.parent != null ? udi.parent.shortName :
udi.shortName);
+ ServerConfig config = ServerConfigFactory.getInstance().getServerConfig();
+ File serviceDir = new File(config.getServerDataDir().getCanonicalPath() +
"/wsdl/" + deploymentDir);
+ deleteWsdlPublishDirectory(serviceDir);
+ }
+
+ /**
+ * Delete the published wsdl document, traversing down the dir structure
+ */
+ private void deleteWsdlPublishDirectory(File dir) throws IOException
+ {
+ String[] files = dir.list();
+ for (int i = 0; files != null && i < files.length; i++)
+ {
+ String fileName = files[i];
+ File file = new File(dir + "/" + fileName);
+ if (file.isDirectory())
+ {
+ deleteWsdlPublishDirectory(file);
+ }
+ else
+ {
+ if (file.delete() == false)
+ log.warn("Cannot delete published wsdl document: " +
file.toURL());
+ }
+ }
+
+ // delete the directory as well
+ dir.delete();
+ }
+
+ /**
+ * Get the file publish location
+ */
+ private File getPublishLocation(String archiveName, ServiceMetaData serviceMetaData)
throws IOException
+ {
+ // Only file URLs are supported in <wsdl-publish-location>
+ String publishLocation = serviceMetaData.getWsdlPublishLocation();
+ boolean predefinedLocation = publishLocation != null &&
publishLocation.startsWith("file:");
+
+ File locationFile = null;
+ if (predefinedLocation == false)
+ {
+ ServerConfig config = ServerConfigFactory.getInstance().getServerConfig();
+ locationFile = new File(config.getServerDataDir().getCanonicalPath() +
"/wsdl/" + archiveName);
+ }
+ else
+ {
+ try
+ {
+ locationFile = new File(new URL(publishLocation).getPath());
+ }
+ catch (MalformedURLException e)
+ {
+ throw new IllegalArgumentException("Invalid publish location: " +
e.getMessage());
+ }
+ }
+
+ // make sure we don't have a leadig '/'
+ String wsdlFile = serviceMetaData.getWsdlFile();
+ if (wsdlFile.startsWith("/"))
+ wsdlFile = wsdlFile.substring(1);
+
+ File wsdlLocation;
+ if (wsdlFile.startsWith(expLocation))
+ {
+ wsdlFile = wsdlFile.substring(expLocation.length());
+ wsdlLocation = new File(locationFile + "/" + wsdlFile);
+ }
+ else if (wsdlFile.startsWith("file:/"))
+ {
+ wsdlFile = wsdlFile.substring(wsdlFile.lastIndexOf("/") + 1);
+ wsdlLocation = new File(locationFile + "/" + wsdlFile);
+ }
+ else
+ {
+ throw new WSException("Invalid wsdlFile '" + wsdlFile +
"', expected in: " + expLocation);
+ }
+
+ return wsdlLocation;
+ }
+}
Deleted:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/WSDLRequestHandler.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/server/WSDLRequestHandler.java 2006-12-05
23:29:55 UTC (rev 1557)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/WSDLRequestHandler.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -1,176 +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.io.File;
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.URL;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.metadata.EndpointMetaData;
-import org.jboss.ws.utils.DOMUtils;
-import org.w3c.dom.Attr;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-/**
- * Handles the delivery of the WSDL and its included artifacts.
- * It rewrites the include URL's.
- *
- *
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3871263#...
- *
- * For a discussion of this topic.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 23-Mar-2005
- */
-public class WSDLRequestHandler
-{
- // provide logging
- private Logger log = Logger.getLogger(WSDLRequestHandler.class);
-
- private EndpointMetaData epMetaData;
-
- public WSDLRequestHandler(EndpointMetaData epMetaData)
- {
- this.epMetaData = epMetaData;
- }
-
- /**
- * Get the WSDL resource for a given resource path
- * <p/>
- * Use path value of null to get the root document
- *
- * @param resPath The wsdl resource to get, can be null for the top level wsdl
- * @return A wsdl document, or null if it cannot be found
- */
- public Document getDocumentForPath(URL reqURL, String wsdlHost, String resPath) throws
IOException
- {
- String wsdlLocation = epMetaData.getServiceMetaData().getWsdlFile();
- if (wsdlLocation == null)
- throw new IllegalStateException("Cannot obtain wsdlFile from endpoint meta
data");
-
- Document wsdlDoc;
-
- // The WSDLFilePublisher should set the location to an URL
- URL wsdlURL = new URL(wsdlLocation);
-
- // get the root wsdl
- if (resPath == null)
- {
- Element wsdlElement = DOMUtils.parse(wsdlURL.openStream());
- wsdlDoc = wsdlElement.getOwnerDocument();
- }
-
- // get some imported resource
- else
- {
- String impResourcePath = new File(wsdlURL.getPath()).getParent() +
File.separatorChar + resPath;
- File impResourceFile = new File(impResourcePath);
-
- Element wsdlElement = DOMUtils.parse(impResourceFile.toURL().openStream());
- wsdlDoc = wsdlElement.getOwnerDocument();
- }
-
- modifyAddressReferences(reqURL, wsdlHost, resPath, wsdlDoc.getDocumentElement());
- return wsdlDoc;
- }
-
- /**
- * Modify the location of wsdl and schema imports
- */
- private void modifyAddressReferences(URL reqURL, String wsdlHost, String resPath,
Element element) throws MalformedURLException
- {
- // map wsdl definition imports
- NodeList nlist = element.getChildNodes();
- for (int i = 0; i < nlist.getLength(); i++)
- {
- Node childNode = nlist.item(i);
- if (childNode.getNodeType() == Node.ELEMENT_NODE)
- {
- Element childElement = (Element)childNode;
- String nodeName = childElement.getLocalName();
- if ("import".equals(nodeName) ||
"include".equals(nodeName))
- {
- Attr locationAttr =
childElement.getAttributeNode("schemaLocation");
- if (locationAttr == null)
- locationAttr = childElement.getAttributeNode("location");
-
- if (locationAttr != null)
- {
- String orgLocation = locationAttr.getNodeValue();
- boolean isAbsolute = orgLocation.startsWith("http://") ||
orgLocation.startsWith("https://");
- if (isAbsolute == false &&
orgLocation.startsWith(reqURL.getPath()) == false)
- {
- String newResourcePath = orgLocation;
-
- if (resPath != null && resPath.indexOf("/") >
0)
- newResourcePath = resPath.substring(0,
resPath.lastIndexOf("/") + 1) + orgLocation;
-
- String reqProtocol = reqURL.getProtocol();
- int reqPort = reqURL.getPort();
- String hostAndPort = wsdlHost + (reqPort > 0 ? ":" +
reqPort : "");
- String reqPath = reqURL.getPath();
-
- String newLocation = reqProtocol + "://" + hostAndPort +
reqPath + "?wsdl&resource=" + newResourcePath;
- locationAttr.setNodeValue(newLocation);
-
- log.debug("Mapping import from '" + orgLocation +
"' to '" + newLocation + "'");
- }
- }
- }
- else if ("address".equals(nodeName))
- {
- Attr locationAttr = childElement.getAttributeNode("location");
- if (locationAttr != null)
- {
- String orgLocation = locationAttr.getNodeValue();
-
- URL locURL = new URL(orgLocation);
- String locProtocol = locURL.getProtocol();
- String locPath = locURL.getPath();
- if (reqURL.getProtocol().equals(locProtocol) &&
reqURL.getPath().equals(locPath))
- {
- int locPort = locURL.getPort();
- String hostAndPort = wsdlHost + (locPort > 0 ? ":" +
locPort : "");
-
- String newLocation = locProtocol + "://" + hostAndPort +
locPath;
- locationAttr.setNodeValue(newLocation);
-
- log.debug("Mapping address from '" + orgLocation +
"' to '" + newLocation + "'");
- }
- }
- }
- else
- {
- modifyAddressReferences(reqURL, wsdlHost, resPath, childElement);
- }
- }
- }
- }
-
-}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/WSDLRequestHandler.java
(from rev 1560,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/server/WSDLRequestHandler.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/server/WSDLRequestHandler.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/WSDLRequestHandler.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -0,0 +1,176 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ws.core.server;
+
+// $Id$
+
+import java.io.File;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.metadata.umdm.EndpointMetaData;
+import org.jboss.ws.utils.DOMUtils;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+/**
+ * Handles the delivery of the WSDL and its included artifacts.
+ * It rewrites the include URL's.
+ *
+ *
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3871263#...
+ *
+ * For a discussion of this topic.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 23-Mar-2005
+ */
+public class WSDLRequestHandler
+{
+ // provide logging
+ private Logger log = Logger.getLogger(WSDLRequestHandler.class);
+
+ private EndpointMetaData epMetaData;
+
+ public WSDLRequestHandler(EndpointMetaData epMetaData)
+ {
+ this.epMetaData = epMetaData;
+ }
+
+ /**
+ * Get the WSDL resource for a given resource path
+ * <p/>
+ * Use path value of null to get the root document
+ *
+ * @param resPath The wsdl resource to get, can be null for the top level wsdl
+ * @return A wsdl document, or null if it cannot be found
+ */
+ public Document getDocumentForPath(URL reqURL, String wsdlHost, String resPath) throws
IOException
+ {
+ String wsdlLocation = epMetaData.getServiceMetaData().getWsdlFile();
+ if (wsdlLocation == null)
+ throw new IllegalStateException("Cannot obtain wsdlFile from endpoint meta
data");
+
+ Document wsdlDoc;
+
+ // The WSDLFilePublisher should set the location to an URL
+ URL wsdlURL = new URL(wsdlLocation);
+
+ // get the root wsdl
+ if (resPath == null)
+ {
+ Element wsdlElement = DOMUtils.parse(wsdlURL.openStream());
+ wsdlDoc = wsdlElement.getOwnerDocument();
+ }
+
+ // get some imported resource
+ else
+ {
+ String impResourcePath = new File(wsdlURL.getPath()).getParent() +
File.separatorChar + resPath;
+ File impResourceFile = new File(impResourcePath);
+
+ Element wsdlElement = DOMUtils.parse(impResourceFile.toURL().openStream());
+ wsdlDoc = wsdlElement.getOwnerDocument();
+ }
+
+ modifyAddressReferences(reqURL, wsdlHost, resPath, wsdlDoc.getDocumentElement());
+ return wsdlDoc;
+ }
+
+ /**
+ * Modify the location of wsdl and schema imports
+ */
+ private void modifyAddressReferences(URL reqURL, String wsdlHost, String resPath,
Element element) throws MalformedURLException
+ {
+ // map wsdl definition imports
+ NodeList nlist = element.getChildNodes();
+ for (int i = 0; i < nlist.getLength(); i++)
+ {
+ Node childNode = nlist.item(i);
+ if (childNode.getNodeType() == Node.ELEMENT_NODE)
+ {
+ Element childElement = (Element)childNode;
+ String nodeName = childElement.getLocalName();
+ if ("import".equals(nodeName) ||
"include".equals(nodeName))
+ {
+ Attr locationAttr =
childElement.getAttributeNode("schemaLocation");
+ if (locationAttr == null)
+ locationAttr = childElement.getAttributeNode("location");
+
+ if (locationAttr != null)
+ {
+ String orgLocation = locationAttr.getNodeValue();
+ boolean isAbsolute = orgLocation.startsWith("http://") ||
orgLocation.startsWith("https://");
+ if (isAbsolute == false &&
orgLocation.startsWith(reqURL.getPath()) == false)
+ {
+ String newResourcePath = orgLocation;
+
+ if (resPath != null && resPath.indexOf("/") >
0)
+ newResourcePath = resPath.substring(0,
resPath.lastIndexOf("/") + 1) + orgLocation;
+
+ String reqProtocol = reqURL.getProtocol();
+ int reqPort = reqURL.getPort();
+ String hostAndPort = wsdlHost + (reqPort > 0 ? ":" +
reqPort : "");
+ String reqPath = reqURL.getPath();
+
+ String newLocation = reqProtocol + "://" + hostAndPort +
reqPath + "?wsdl&resource=" + newResourcePath;
+ locationAttr.setNodeValue(newLocation);
+
+ log.debug("Mapping import from '" + orgLocation +
"' to '" + newLocation + "'");
+ }
+ }
+ }
+ else if ("address".equals(nodeName))
+ {
+ Attr locationAttr = childElement.getAttributeNode("location");
+ if (locationAttr != null)
+ {
+ String orgLocation = locationAttr.getNodeValue();
+
+ URL locURL = new URL(orgLocation);
+ String locProtocol = locURL.getProtocol();
+ String locPath = locURL.getPath();
+ if (reqURL.getProtocol().equals(locProtocol) &&
reqURL.getPath().equals(locPath))
+ {
+ int locPort = locURL.getPort();
+ String hostAndPort = wsdlHost + (locPort > 0 ? ":" +
locPort : "");
+
+ String newLocation = locProtocol + "://" + hostAndPort +
locPath;
+ locationAttr.setNodeValue(newLocation);
+
+ log.debug("Mapping address from '" + orgLocation +
"' to '" + newLocation + "'");
+ }
+ }
+ }
+ else
+ {
+ modifyAddressReferences(reqURL, wsdlHost, resPath, childElement);
+ }
+ }
+ }
+ }
+
+}
Copied: branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/AttrImpl.java (from
rev 1557, branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/AttrImpl.java)
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/AttrImpl.java 2006-12-05
23:29:55 UTC (rev 1557)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/AttrImpl.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -0,0 +1,85 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+package org.jboss.ws.core.soap;
+
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.TypeInfo;
+
+/**
+ * Facade for DOM Attr. Helps ensure that the propper SAAJ entities are returned
+ * after DOM calls are made.
+ *
+ * @author <a href="mailto:jason.greene@jboss.com">Jason T.
Greene</a>
+ * @version $Revision$
+ */
+public class AttrImpl extends NodeImpl implements Attr
+{
+ private SOAPElementImpl element;
+
+ private Attr attr;
+
+ public AttrImpl(SOAPElementImpl element, Attr attr)
+ {
+ super(attr);
+ this.attr = attr;
+ this.element = element;
+ }
+
+ public String getName()
+ {
+ return attr.getName();
+ }
+
+ public Element getOwnerElement()
+ {
+ return element;
+ }
+
+ public Document getOwnerDocument()
+ {
+ return element.getOwnerDocument();
+ }
+
+ public boolean getSpecified()
+ {
+ return attr.getSpecified();
+ }
+
+ public String getValue()
+ {
+ return attr.getValue();
+ }
+
+ public TypeInfo getSchemaTypeInfo()
+ {
+ // TODO Implement DOM3
+ return null;
+ }
+
+ public boolean isId()
+ {
+ // TODO Implement DOM3
+ return false;
+ }
+}
\ No newline at end of file
Copied: branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/DetailEntryImpl.java
(from rev 1557,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/DetailEntryImpl.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/DetailEntryImpl.java 2006-12-05
23:29:55 UTC (rev 1557)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/DetailEntryImpl.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -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.ws.core.soap;
+
+import javax.xml.soap.DetailEntry;
+import javax.xml.soap.Name;
+
+/**
+ * The content for a Detail object, giving details for a SOAPFault object.
+ * A DetailEntry object, which carries information about errors related to the SOAPBody
object that contains it,
+ * is application-specific.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ */
+public class DetailEntryImpl extends SOAPElementImpl implements DetailEntry
+{
+ public DetailEntryImpl(Name name)
+ {
+ super(name);
+ }
+
+ public DetailEntryImpl(SOAPElementImpl soapElement)
+ {
+ super(soapElement);
+ }
+}
Copied: branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/DetailImpl.java (from
rev 1557, branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/DetailImpl.java)
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/DetailImpl.java 2006-12-05
23:29:55 UTC (rev 1557)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/DetailImpl.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -0,0 +1,60 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+package org.jboss.ws.core.soap;
+
+import java.util.Iterator;
+
+import javax.xml.soap.Detail;
+import javax.xml.soap.DetailEntry;
+import javax.xml.soap.Name;
+import javax.xml.soap.SOAPException;
+
+/**
+ * A container for DetailEntry objects. DetailEntry objects give detailed error
information that is application-specific
+ * and related to the SOAPBody object that contains it.
+ *
+ * A Detail object, which is part of a SOAPFault object, can be retrieved using the
method SOAPFault.getDetail.
+ *
+ * The Detail interface provides two methods. One creates a new DetailEntry object and
also automatically adds
+ * it to the Detail object. The second method gets a list of the DetailEntry objects
contained in a Detail object.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ */
+public class DetailImpl extends SOAPFaultElementImpl implements Detail
+{
+ public DetailImpl()
+ {
+ super("detail");
+ }
+
+ public DetailEntry addDetailEntry(Name name) throws SOAPException
+ {
+ DetailEntryImpl detailEntry = new DetailEntryImpl(name);
+ addChildElement(detailEntry);
+ return detailEntry;
+ }
+
+ public Iterator getDetailEntries()
+ {
+ return getChildElements();
+ }
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/DocumentFragmentImpl.java
(from rev 1557,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/DocumentFragmentImpl.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/DocumentFragmentImpl.java 2006-12-05
23:29:55 UTC (rev 1557)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/DocumentFragmentImpl.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -0,0 +1,231 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+package org.jboss.ws.core.soap;
+
+import org.w3c.dom.DOMException;
+import org.w3c.dom.Document;
+import org.w3c.dom.DocumentFragment;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.w3c.dom.UserDataHandler;
+
+/**
+ * An implementation of a DOM Document fragment. This just delegates to
+ *
+ * @author <a href="mailto:jason.greene@jboss.com">Jason T.
Greene</a>
+ * @version $Revision$
+ */
+public class DocumentFragmentImpl implements DocumentFragment
+{
+ private DocumentFragment delegate;
+
+ public DocumentFragmentImpl(DocumentFragment fragment)
+ {
+ this.delegate = fragment;
+ }
+
+ public Node appendChild(Node arg0) throws DOMException
+ {
+ return delegate.appendChild(arg0);
+ }
+
+ public Node cloneNode(boolean arg0)
+ {
+ return delegate.cloneNode(arg0);
+ }
+
+ public short compareDocumentPosition(Node arg0) throws DOMException
+ {
+ return delegate.compareDocumentPosition(arg0);
+ }
+
+ public NamedNodeMap getAttributes()
+ {
+ return delegate.getAttributes();
+ }
+
+ public String getBaseURI()
+ {
+ return delegate.getBaseURI();
+ }
+
+ public NodeList getChildNodes()
+ {
+ return delegate.getChildNodes();
+ }
+
+ public Object getFeature(String arg0, String arg1)
+ {
+ return delegate.getFeature(arg0, arg1);
+ }
+
+ public Node getFirstChild()
+ {
+ return delegate.getFirstChild();
+ }
+
+ public Node getLastChild()
+ {
+ return delegate.getLastChild();
+ }
+
+ public String getLocalName()
+ {
+ return delegate.getLocalName();
+ }
+
+ public String getNamespaceURI()
+ {
+ return delegate.getNamespaceURI();
+ }
+
+ public Node getNextSibling()
+ {
+ return delegate.getNextSibling();
+ }
+
+ public String getNodeName()
+ {
+ return delegate.getNodeName();
+ }
+
+ public short getNodeType()
+ {
+ return delegate.getNodeType();
+ }
+
+ public String getNodeValue() throws DOMException
+ {
+ return delegate.getNodeValue();
+ }
+
+ public Document getOwnerDocument()
+ {
+ return delegate.getOwnerDocument();
+ }
+
+ public Node getParentNode()
+ {
+ return delegate.getParentNode();
+ }
+
+ public String getPrefix()
+ {
+ return delegate.getPrefix();
+ }
+
+ public Node getPreviousSibling()
+ {
+ return delegate.getPreviousSibling();
+ }
+
+ public String getTextContent() throws DOMException
+ {
+ return delegate.getTextContent();
+ }
+
+ public Object getUserData(String arg0)
+ {
+ return delegate.getUserData(arg0);
+ }
+
+ public boolean hasAttributes()
+ {
+ return delegate.hasAttributes();
+ }
+
+ public boolean hasChildNodes()
+ {
+ return delegate.hasChildNodes();
+ }
+
+ public Node insertBefore(Node arg0, Node arg1) throws DOMException
+ {
+ return delegate.insertBefore(arg0, arg1);
+ }
+
+ public boolean isDefaultNamespace(String arg0)
+ {
+ return delegate.isDefaultNamespace(arg0);
+ }
+
+ public boolean isEqualNode(Node arg0)
+ {
+ return delegate.isEqualNode(arg0);
+ }
+
+ public boolean isSameNode(Node arg0)
+ {
+ return delegate.isSameNode(arg0);
+ }
+
+ public boolean isSupported(String arg0, String arg1)
+ {
+ return delegate.isSupported(arg0, arg1);
+ }
+
+ public String lookupNamespaceURI(String arg0)
+ {
+ return delegate.lookupNamespaceURI(arg0);
+ }
+
+ public String lookupPrefix(String arg0)
+ {
+ return delegate.lookupPrefix(arg0);
+ }
+
+ public void normalize()
+ {
+ delegate.normalize();
+ }
+
+ public Node removeChild(Node arg0) throws DOMException
+ {
+ return delegate.removeChild(arg0);
+ }
+
+ public Node replaceChild(Node arg0, Node arg1) throws DOMException
+ {
+ return delegate.replaceChild(arg0, arg1);
+ }
+
+ public void setNodeValue(String arg0) throws DOMException
+ {
+ delegate.setNodeValue(arg0);
+ }
+
+ public void setPrefix(String arg0) throws DOMException
+ {
+ delegate.setPrefix(arg0);
+ }
+
+ public void setTextContent(String arg0) throws DOMException
+ {
+ delegate.setTextContent(arg0);
+ }
+
+ public Object setUserData(String arg0, Object arg1, UserDataHandler arg2)
+ {
+ return delegate.setUserData(arg0, arg1, arg2);
+ }
+}
Copied: branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/EndpointInfo.java
(from rev 1559,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/EndpointInfo.java)
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/EndpointInfo.java 2006-12-06
00:29:48 UTC (rev 1559)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/EndpointInfo.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -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.ws.core.soap;
+
+// $Id$
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Properties;
+
+import org.jboss.ws.metadata.umdm.EndpointMetaData;
+
+/** A wrapper object that associates the target address with some metadata
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 20-Jul-2005
+ */
+public class EndpointInfo
+{
+ private String targetAddress;
+ private Map<String, Object> properties;
+
+ public EndpointInfo(EndpointMetaData epMetaData, String targetAddress, Map<String,
Object> callProps)
+ {
+ this.targetAddress = targetAddress;
+ this.properties = new HashMap<String, Object>();
+
+ // Add the service properties
+ Properties serviceProps = epMetaData.getServiceMetaData().getProperties();
+ if (serviceProps != null)
+ {
+ Iterator it = serviceProps.entrySet().iterator();
+ while (it.hasNext())
+ {
+ Map.Entry entry = (Map.Entry)it.next();
+ String key = (String)entry.getKey();
+ Object val = entry.getValue();
+ properties.put(key, val);
+ }
+ }
+
+ // Add the endpoint properties
+ Properties epProps = epMetaData.getProperties();
+ if (epProps != null)
+ {
+ Iterator it = epProps.entrySet().iterator();
+ while (it.hasNext())
+ {
+ Map.Entry entry = (Map.Entry)it.next();
+ String key = (String)entry.getKey();
+ Object val = entry.getValue();
+ properties.put(key, val);
+ }
+ }
+
+ // Add the call properties
+ if (callProps != null)
+ {
+ properties.putAll(callProps);
+ }
+ }
+
+ public Map<String, Object> getProperties()
+ {
+ return properties;
+ }
+
+ public String getTargetAddress()
+ {
+ return targetAddress;
+ }
+
+ public boolean equals(Object obj)
+ {
+ if (!(obj instanceof EndpointInfo))
+ return false;
+ return toString().equals(obj.toString());
+ }
+
+ public int hashCode()
+ {
+ return toString().hashCode();
+ }
+
+ public String toString()
+ {
+ return "[addr=" + targetAddress + ",props=" + properties +
"]";
+ }
+}
\ No newline at end of file
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/JAXWSPayloadBuilder.java
(from rev 1557,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/JAXWSPayloadBuilder.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/JAXWSPayloadBuilder.java 2006-12-05
23:29:55 UTC (rev 1557)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/JAXWSPayloadBuilder.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -0,0 +1,113 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ws.core.soap;
+
+//$Id$
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Iterator;
+
+import javax.xml.namespace.QName;
+import javax.xml.soap.Name;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPHeader;
+import javax.xml.transform.stream.StreamSource;
+
+import org.jboss.ws.utils.DOMUtils;
+import org.jboss.ws.utils.DOMWriter;
+import org.w3c.dom.Element;
+
+/**
+ * A SOAPEnvelope builder for JAXWS in service mode PAYLOAD
+ *
+ * @author Thomas.Diesler(a)jboss.com
+ * @since 30-Jun-2006
+ */
+public class JAXWSPayloadBuilder implements PayloadBuilder
+{
+ 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();
+ 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"));
+ SOAPBodyImpl soapBody = (SOAPBodyImpl)soapEnv.getBody();
+
+ DOMUtils.copyAttributes(soapBody, domBody);
+
+ Iterator itBody = DOMUtils.getChildElements(domBody);
+ if (itBody.hasNext())
+ {
+ Element domBodyElement = (Element)itBody.next();
+ String xmlStr = DOMWriter.printNode(domBodyElement, false);
+ soapBody.setPayload(new StreamSource(new
ByteArrayInputStream(xmlStr.getBytes())));
+ }
+ }
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/MessageContextAssociation.java
(from rev 1559,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/MessageContextAssociation.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/MessageContextAssociation.java 2006-12-06
00:29:48 UTC (rev 1559)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/MessageContextAssociation.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -0,0 +1,78 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+package org.jboss.ws.core.soap;
+
+// $Id$
+
+import java.util.Stack;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.core.CommonMessageContext;
+import org.jboss.ws.utils.ThreadLocalAssociation;
+
+/**
+ * A thread local association with the current message context
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 14-Dec-2004
+ */
+public class MessageContextAssociation
+{
+ // provide logging
+ private static Logger log = Logger.getLogger(MessageContextAssociation.class);
+
+
+ public static void pushMessageContext(CommonMessageContext msgContext)
+ {
+ log.debug("pushMessageContext: " + msgContext + " (Thread "
+Thread.currentThread().getName()+ ")");
+ Stack<CommonMessageContext> stack =
ThreadLocalAssociation.localMsgContextAssoc().get();
+ if (stack == null)
+ {
+ stack = new Stack<CommonMessageContext>();
+ ThreadLocalAssociation.localMsgContextAssoc().set(stack);
+ }
+ stack.push(msgContext);
+ }
+
+ public static CommonMessageContext peekMessageContext()
+ {
+ CommonMessageContext msgContext = null;
+ Stack<CommonMessageContext> stack =
ThreadLocalAssociation.localMsgContextAssoc().get();
+ if (stack != null && stack.isEmpty() == false)
+ {
+ msgContext = stack.peek();
+ }
+ return msgContext;
+ }
+
+ public static CommonMessageContext popMessageContext()
+ {
+ CommonMessageContext msgContext = null;
+ Stack<CommonMessageContext> stack =
ThreadLocalAssociation.localMsgContextAssoc().get();
+ if (stack != null && stack.isEmpty() == false)
+ {
+ msgContext = stack.pop();
+ }
+ log.debug("popMessageContext: " + msgContext +" (Thread "
+Thread.currentThread().getName()+ ")");
+ return msgContext;
+ }
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/MessageFactoryImpl.java (from
rev 1559,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/MessageFactoryImpl.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/MessageFactoryImpl.java 2006-12-06
00:29:48 UTC (rev 1559)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/MessageFactoryImpl.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -0,0 +1,279 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ws.core.soap;
+
+// $Id$
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Collection;
+import java.util.Iterator;
+
+import javax.mail.internet.ContentType;
+import javax.mail.internet.ParseException;
+import javax.xml.soap.AttachmentPart;
+import javax.xml.soap.MessageFactory;
+import javax.xml.soap.MimeHeader;
+import javax.xml.soap.MimeHeaders;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.ws.Service.Mode;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.Constants;
+import org.jboss.ws.core.CommonMessageContext;
+import org.jboss.ws.core.soap.attachment.MimeConstants;
+import org.jboss.ws.core.soap.attachment.MultipartRelatedDecoder;
+import org.jboss.ws.jaxrpc.Style;
+import org.jboss.ws.utils.IOUtils;
+
+/**
+ * MessageFactory implementation
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ */
+public class MessageFactoryImpl extends MessageFactory
+{
+ private static Logger log = Logger.getLogger(MessageFactoryImpl.class);
+
+ // The envelope URI used by the MessageFactory
+ private String envelopeURI = Constants.NS_SOAP11_ENV;
+
+ // The JAXWS ServiceMode
+ private Mode serviceMode;
+ // The style used by this MessageFactory
+ private Style style;
+
+ /**
+ * Get the SOAP envelope URI this factory will use when creating envelopes.
+ */
+ public String getEnvelopeURI()
+ {
+ return envelopeURI;
+ }
+
+ /**
+ * Set the SOAP envelope URI this factory will use when creating envelopes.
+ */
+ public void setEnvelopeURI(String envelopeURI)
+ {
+ this.envelopeURI = envelopeURI;
+ }
+
+ /**
+ * Get the Style this message factory will use
+ */
+ public Style getStyle()
+ {
+ if (style == null)
+ {
+ CommonMessageContext msgContext =
MessageContextAssociation.peekMessageContext();
+ if (msgContext != null && msgContext.getOperationMetaData() != null)
+ {
+ style = msgContext.getOperationMetaData().getStyle();
+ }
+ log.trace("Using style: " + style);
+ }
+ return style;
+ }
+
+ public void setStyle(Style style)
+ {
+ this.style = style;
+ }
+
+ public Mode getServiceMode()
+ {
+ return serviceMode;
+ }
+
+ public void setServiceMode(Mode serviceMode)
+ {
+ this.serviceMode = serviceMode;
+ }
+
+ /**
+ * Creates a new SOAPMessage object with the default SOAPPart, SOAPEnvelope,
+ * SOAPBody, and SOAPHeader objects. Profile-specific message factories can
+ * choose to prepopulate the SOAPMessage object with profile-specific
+ * headers.
+ *
+ * Content can be added to this message's SOAPPart object, and the message
+ * can be sent "as is" when a message containing only a SOAP part is
+ * sufficient. Otherwise, the SOAPMessage object needs to create one or more
+ * AttachmentPart objects and add them to itself. Any content that is not in
+ * XML format must be in an AttachmentPart object.
+ *
+ * @return a new SOAPMessage object
+ * @throws javax.xml.soap.SOAPException
+ * if a SOAP error occurs
+ */
+ public SOAPMessage createMessage() throws SOAPException
+ {
+ SOAPMessageImpl soapMessage = new SOAPMessageImpl();
+ SOAPPartImpl soapPart = (SOAPPartImpl)soapMessage.getSOAPPart();
+ new SOAPEnvelopeImpl(soapPart, envelopeURI);
+ return soapMessage;
+ }
+
+ /**
+ * Internalizes the contents of the given InputStream object into a new
+ * SOAPMessage object and returns the SOAPMessage object.
+ *
+ * @param mimeHeaders
+ * the transport-specific headers passed to the message in a
+ * transport-independent fashion for creation of the message
+ * @param ins
+ * the InputStream object that contains the data for a message
+ * @return a new SOAPMessage object containing the data from the given
+ * InputStream object
+ * @throws java.io.IOException
+ * if there is a problem in reading data from the input stream
+ * @throws javax.xml.soap.SOAPException
+ * if the message is invalid
+ */
+ public SOAPMessage createMessage(MimeHeaders mimeHeaders, InputStream ins) throws
IOException, SOAPException
+ {
+ return createMessageInternal(mimeHeaders, ins, false);
+ }
+
+ public SOAPMessage createMessageInternal(MimeHeaders mimeHeaders, InputStream ins,
boolean ignoreParseError) throws IOException, SOAPException
+ {
+ if (mimeHeaders == null)
+ {
+ mimeHeaders = new MimeHeaders();
+ }
+ else if (log.isTraceEnabled())
+ {
+ Iterator<MimeHeader> itMimeHeaders = mimeHeaders.getAllHeaders();
+ while (itMimeHeaders.hasNext())
+ {
+ MimeHeader mh = itMimeHeaders.next();
+ log.trace(mh);
+ }
+ }
+
+ ContentType contentType = getContentType(mimeHeaders);
+ log.debug("createMessage: [contentType=" + contentType + "]");
+
+ // Debug the incoming message
+ if (log.isTraceEnabled())
+ {
+ ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);
+ IOUtils.copyStream(baos, ins);
+ byte[] bytes = baos.toByteArray();
+
+ log.trace("createMessage\n" + new String(bytes));
+ ins = new ByteArrayInputStream(bytes);
+ }
+
+ Collection<AttachmentPart> attachments = null;
+ if (isMultipartRelatedContent(contentType))
+ {
+ MultipartRelatedDecoder decoder;
+ try
+ {
+ decoder = new MultipartRelatedDecoder(contentType);
+ decoder.decodeMultipartRelatedMessage(ins);
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (IOException ex)
+ {
+ throw ex;
+ }
+ catch (Exception ex)
+ {
+ throw new SOAPException("Cannot decode multipart related message",
ex);
+ }
+
+ ins = decoder.getRootPart().getDataHandler().getInputStream();
+ attachments = decoder.getRelatedParts();
+ }
+ else if (isSoapContent(contentType) == false)
+ {
+ throw new SOAPException("Unsupported content type: " + contentType);
+ }
+
+ SOAPMessageImpl soapMessage = new SOAPMessageImpl();
+ if (mimeHeaders != null)
+ soapMessage.setMimeHeaders(mimeHeaders);
+
+ if (attachments != null)
+ soapMessage.setAttachments(attachments);
+
+ // Get the SOAPEnvelope builder
+ PayloadBuilder payloadBuilder;
+ if (serviceMode == Mode.PAYLOAD)
+ {
+ payloadBuilder = new JAXWSPayloadBuilder();
+ }
+ else
+ {
+ SAAJPayloadBuilderDOM jaxrpcBuilder = new SAAJPayloadBuilderDOM(getStyle());
+ payloadBuilder = jaxrpcBuilder;
+ }
+
+ // Build the payload
+ payloadBuilder.build(soapMessage, ins, ignoreParseError);
+
+ return soapMessage;
+ }
+
+ private static ContentType getContentType(MimeHeaders headers) throws SOAPException
+ {
+ ContentType contentType = null;
+ try
+ {
+ String[] type = headers.getHeader(MimeConstants.CONTENT_TYPE);
+ if (type != null)
+ {
+ contentType = new ContentType(type[0]);
+ }
+ else
+ {
+ contentType = new ContentType(MimeConstants.TYPE_SOAP11);
+ }
+ return contentType;
+ }
+ catch (ParseException e)
+ {
+ throw new SOAPException("Could not parse content type:" + e);
+ }
+ }
+
+ private boolean isSoapContent(ContentType type)
+ {
+ String baseType = type.getBaseType();
+ return MimeConstants.TYPE_SOAP11.equals(baseType) ||
MimeConstants.TYPE_SOAP12.equals(baseType);
+ }
+
+ private boolean isMultipartRelatedContent(ContentType type)
+ {
+ String baseType = type.getBaseType();
+ return MimeConstants.TYPE_MULTIPART_RELATED.equals(baseType);
+ }
+}
Copied: branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/NameImpl.java (from
rev 1557, branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/NameImpl.java)
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/NameImpl.java 2006-12-05
23:29:55 UTC (rev 1557)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/NameImpl.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -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.core.soap;
+
+// $Id$
+
+import javax.xml.namespace.QName;
+import javax.xml.soap.Name;
+
+/**
+ * An implementation of a Name
+ * <p/>
+ * At this time of writing, the spec does not say anything about null values.
+ * We assume emty string for any null value.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 01-June-2004
+ */
+public class NameImpl implements Name
+{
+ private QName qname;
+
+ public NameImpl(QName qname)
+ {
+ this.qname = qname;
+ }
+
+ public NameImpl(String local)
+ {
+ qname = new QName(local);
+ }
+
+ public NameImpl(String local, String prefix, String uri)
+ {
+ if (prefix != null)
+ qname = new QName(uri, local, prefix);
+ else
+ qname = new QName(uri, local);
+ }
+
+ /**
+ * Gets the local name part of the XML name that this Name object represents.
+ *
+ * @return a string giving the local name
+ */
+ public String getLocalName()
+ {
+ return qname.getLocalPart();
+ }
+
+ /**
+ * Returns the prefix that was specified when this Name object was initialized.
+ * This prefix is associated with the namespace for the XML name that this Name object
represents.
+ *
+ * @return the prefix as a string
+ */
+ public String getPrefix()
+ {
+ return qname.getPrefix();
+ }
+
+ /**
+ * Gets the namespace-qualified name of the XML name that this Name object
represents.
+ *
+ * @return the namespace-qualified name as a string
+ */
+ public String getQualifiedName()
+ {
+ String prefix = getPrefix();
+ if (prefix.length() > 0)
+ return prefix + ":" + qname.getLocalPart();
+ else
+ return qname.getLocalPart();
+ }
+
+ /**
+ * Returns the URI of the namespace for the XML name that this Name object
represents.
+ *
+ * @return the URI as a string
+ */
+ public String getURI()
+ {
+ return qname.getNamespaceURI();
+ }
+
+ public int hashCode()
+ {
+ return qname.hashCode();
+ }
+
+ public boolean equals(Object obj)
+ {
+ if (!(obj instanceof NameImpl)) return false;
+ if (obj == this) return true;
+ NameImpl other = (NameImpl)obj;
+ return qname.equals(other.qname);
+ }
+
+ public QName toQName()
+ {
+ return qname;
+ }
+
+ public String toString()
+ {
+ return qname.toString();
+ }
+}
Copied: branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/NodeImpl.java (from
rev 1557, branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/NodeImpl.java)
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/NodeImpl.java 2006-12-05
23:29:55 UTC (rev 1557)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/NodeImpl.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -0,0 +1,674 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ws.core.soap;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+import javax.xml.soap.SOAPElement;
+import javax.xml.soap.SOAPException;
+
+import org.jboss.logging.Logger;
+import org.jboss.util.NotImplementedException;
+import org.jboss.ws.utils.DOMUtils;
+import org.jboss.ws.utils.DOMWriter;
+import org.jboss.ws.WSException;
+import org.w3c.dom.DOMException;
+import org.w3c.dom.Document;
+import org.w3c.dom.DocumentFragment;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.w3c.dom.UserDataHandler;
+
+/**
+ * A representation of a node (element) in an XML document.
+ * This interface extnends the standard DOM Node interface with methods for getting and
setting the value of a node,
+ * for getting and setting the parent of a node, and for removing a node.
+ *
+ * When creating a DOM2 tree the objects maintained by the tree are
<code>org.w3c.dom.Node</code> objects
+ * and not <code>javax.xml.soap.Node</code> objects.
+ * <p/>
+ * This implementation schields the client from the the underlying DOM2 tree, returning
<code>javax.xml.soap.Node</code>
+ * objects.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ */
+public class NodeImpl implements javax.xml.soap.Node
+{
+ // provide logging
+ private static Logger log = Logger.getLogger(NodeImpl.class);
+
+ // The parent of this Node
+ protected SOAPElementImpl soapParent;
+ // This org.w3c.dom.Node
+ protected org.w3c.dom.Node domNode;
+ // A list of soap children
+ private List<NodeImpl> soapChildren = new ArrayList<NodeImpl>();
+
+ /** Construct the Node for a given org.w3c.dom.Node
+ *
+ * This constructor is used:
+ *
+ * 1) SOAPElement construction
+ * 2) Text construction
+ */
+ NodeImpl(org.w3c.dom.Node node)
+ {
+ // Method selection in Java is done at compile time
+ // Late binding does not work in this case
+ if (node instanceof NodeImpl)
+ throw new IllegalArgumentException("Copy constructor should be
used");
+
+ domNode = node;
+
+ // SOAP child elements should be constructed externally
+ if (DOMUtils.hasChildElements(node))
+ throw new IllegalArgumentException("Node cannot have child
elements");
+ }
+
+ /** The copy constructor used when converting types (i.e. SOAPElement ->
SOAPHeaderElement)
+ */
+ NodeImpl(NodeImpl node)
+ {
+ soapParent = node.soapParent;
+ domNode = node.domNode;
+ Iterator i = node.soapChildren.iterator();
+ while (i.hasNext())
+ {
+ NodeImpl childNode = (NodeImpl)i.next();
+ childNode.soapParent = (SOAPElementImpl)this;
+ soapChildren.add(childNode);
+ }
+ }
+
+ /** Get the QName of this Node */
+ protected QName getQName()
+ {
+ String nsURI = getNamespaceURI();
+ String localPart = getLocalName();
+ String prefix = getPrefix();
+
+ QName qname;
+ if (nsURI != null && prefix != null)
+ {
+ qname = new QName(nsURI, localPart, prefix);
+ }
+ else if (nsURI != null)
+ {
+ qname = new QName(nsURI, localPart);
+ }
+ else
+ {
+ qname = new QName(localPart);
+ }
+
+ return qname;
+ }
+
+ // javax.xml.soap.Node
*********************************************************************************************
+
+ /**
+ * Removes this Node object from the tree.
+ */
+ public void detachNode()
+ {
+ org.w3c.dom.Node domParent = domNode.getParentNode();
+ if (domParent != null)
+ domParent.removeChild(domNode);
+
+ if (soapParent != null)
+ ((NodeImpl)soapParent).soapChildren.remove(this);
+
+ soapParent = null;
+ }
+
+ /**
+ * Returns the parent node of this Node object.
+ * This method can throw an UnsupportedOperationException if the tree is not kept in
memory.
+ *
+ * @return the SOAPElement object that is the parent of this Node object or null if
this Node object is root
+ */
+ public SOAPElement getParentElement()
+ {
+ return soapParent;
+ }
+
+ /**
+ * Sets the parent of this Node object to the given SOAPElement object.
+ *
+ * @param parent the SOAPElement object to be set as the parent of this Node object
+ * @throws javax.xml.soap.SOAPException if there is a problem in setting the parent to
the given node
+ */
+ public void setParentElement(SOAPElement parent) throws SOAPException
+ {
+ // detach from the old parent
+ if (soapParent != null)
+ detachNode();
+
+ soapParent = (SOAPElementImpl)parent;
+ }
+
+ /**
+ * Returns the value of this node if this is a Text node or the value of the immediate
child of this node otherwise.
+ * <p/>
+ * If there is an immediate child of this Node that it is a Text node then it's
value will be returned.
+ * If there is more than one Text node then the value of the first Text Node will be
returned.
+ * Otherwise null is returned.
+ *
+ * @return a String with the text of this node if this is a Text node or the text
contained by the first immediate
+ * child of this Node object that is a Text object if such a child exists;
null otherwise.
+ */
+ public String getValue()
+ {
+ // The Text node should overwrite getValue
+ if (this instanceof javax.xml.soap.Text)
+ throw new WSException("javax.xml.soap.Text should take care of
this");
+
+ String nodeValue = null;
+ org.w3c.dom.Node child = (org.w3c.dom.Node)getFirstChild();
+ if (child instanceof org.w3c.dom.Text)
+ nodeValue = ((org.w3c.dom.Text)child).getNodeValue();
+
+ return nodeValue;
+ }
+
+ /**
+ * If this is a Text node then this method will set its value, otherwise it sets the
value of the immediate (Text) child of this node.
+ * <p/>
+ * The value of the immediate child of this node can be set only if, there is one
child node and
+ * that node is a Text node, or if there are no children in which case a child Text
node will be created.
+ *
+ * @param value A value string
+ * @throws IllegalStateException if the node is not a Text node and either has more
than one child node or has a child node that is not a Text node.
+ */
+ public void setValue(String value)
+ {
+ // The Text node should overwrite setValue
+ if (this instanceof javax.xml.soap.Text)
+ throw new WSException("javax.xml.soap.Text should take care of
this");
+
+ org.w3c.dom.Node child = (org.w3c.dom.Node)getFirstChild();
+ if (child instanceof org.w3c.dom.Text)
+ ((org.w3c.dom.Text)child).setNodeValue(value);
+
+ if (child == null)
+ {
+ child = domNode.getOwnerDocument().createTextNode(value);
+ appendChild(new TextImpl(child));
+ }
+ }
+
+ /**
+ * Notifies the implementation that this Node object is no longer being used by the
application and that the
+ * implementation is free to reuse this object for nodes that may be created later.
+ * Calling the method recycleNode implies that the method detachNode has been called
previously.
+ */
+ public void recycleNode()
+ {
+
+ }
+
+ private List<NodeImpl> convertDocumentFragment(DocumentFragment docFragment)
throws DOMException
+ {
+ List<NodeImpl> list = new ArrayList<NodeImpl>();
+ try
+ {
+ SOAPFactoryImpl soapFactory = new SOAPFactoryImpl();
+ for (Node node = docFragment.getFirstChild(); node != null; node =
node.getNextSibling())
+ {
+ switch (node.getNodeType())
+ {
+ case Node.ELEMENT_NODE:
+ {
+ SOAPElementImpl soapChild = soapFactory.createElement((Element)node,
true);
+ list.add(soapChild);
+ break;
+ }
+ case Node.TEXT_NODE:
+ {
+ TextImpl text = new TextImpl(node);
+ list.add(text);
+ break;
+ }
+ case Node.CDATA_SECTION_NODE:
+ {
+ TextImpl text = new TextImpl(node);
+ list.add(text);
+ break;
+ }
+ }
+ }
+ }
+ catch (SOAPException ex)
+ {
+ throw new DOMException(DOMException.INVALID_STATE_ERR, "Could not convert a
document fragment to a node");
+ }
+ return list;
+ }
+
+ // BEGIN org.w3c.dom.Node
*******************************************************************************************
+
+ public String getNodeName()
+ {
+ return domNode.getNodeName();
+ }
+
+ public String getNodeValue() throws DOMException
+ {
+ return domNode.getNodeValue();
+ }
+
+ public void setNodeValue(String nodeValue) throws DOMException
+ {
+ domNode.setNodeValue(nodeValue);
+ }
+
+ public short getNodeType()
+ {
+ return domNode.getNodeType();
+ }
+
+ public org.w3c.dom.Node getParentNode()
+ {
+ assertSOAPParent();
+ return soapParent;
+ }
+
+ public NodeList getChildNodes()
+ {
+ return new NodeListImpl(soapChildren);
+ }
+
+ public org.w3c.dom.Node getFirstChild()
+ {
+ NodeImpl child = null;
+ org.w3c.dom.Node domChild = domNode.getFirstChild();
+ if (domChild != null)
+ {
+ child = (NodeImpl)soapChildren.get(0);
+ if (domChild != child.domNode)
+ throw new WSException("Inconsistent node, child lists not
synchronized");
+ }
+ return child;
+ }
+
+ public org.w3c.dom.Node getLastChild()
+ {
+ NodeImpl child = null;
+ org.w3c.dom.Node domChild = domNode.getLastChild();
+ if (domChild != null)
+ {
+ child = (NodeImpl)soapChildren.get(soapChildren.size() - 1);
+ if (domChild != child.domNode)
+ throw new WSException("Inconsistent node, child lists not
synchronized");
+ }
+ return child;
+ }
+
+ public org.w3c.dom.Node getPreviousSibling()
+ {
+ assertSOAPParent();
+
+ NodeImpl sibling = null;
+ if (soapParent != null)
+ {
+ List children = ((NodeImpl)soapParent).soapChildren;
+ for (int i = 0; i < children.size(); i++)
+ {
+ NodeImpl node = (NodeImpl)children.get(i);
+ if (node == this && i > 0)
+ {
+ sibling = (NodeImpl)children.get(i - 1);
+ break;
+ }
+ }
+
+ if (sibling != null && sibling.domNode != domNode.getPreviousSibling())
+ throw new WSException("Inconsistent node, child lists not
synchronized");
+ }
+
+ return sibling;
+ }
+
+ public org.w3c.dom.Node getNextSibling()
+ {
+ assertSOAPParent();
+
+ NodeImpl sibling = null;
+ if (soapParent != null)
+ {
+ List children = ((NodeImpl)soapParent).soapChildren;
+ for (int i = 0; i < children.size(); i++)
+ {
+ NodeImpl node = (NodeImpl)children.get(i);
+ if (node == this && (i + 1) < children.size())
+ {
+ sibling = (NodeImpl)children.get(i + 1);
+ break;
+ }
+ }
+
+ if (sibling != null && sibling.domNode != domNode.getNextSibling())
+ throw new WSException("Inconsistent node, child lists not
synchronized");
+ }
+
+ return sibling;
+ }
+
+ public NamedNodeMap getAttributes()
+ {
+ return domNode.getAttributes();
+ }
+
+ public Document getOwnerDocument()
+ {
+ // Climb the tree in hopes of finding the soap envelope.
+ // If it's not there (a detached subtree), then we return a non-associated
document
+ if (soapParent == null)
+ return new SOAPDocument();
+
+ return soapParent.getOwnerDocument();
+ }
+
+ public org.w3c.dom.Node insertBefore(org.w3c.dom.Node newChild, org.w3c.dom.Node
refChild) throws DOMException
+ {
+ // DOM says that if refChild is null, an append is performed
+ if (refChild == null)
+ return appendChild(newChild);
+
+ newChild = convertDOMNode(newChild);
+ refChild = convertDOMNode(refChild);
+
+ if (newChild instanceof DocumentFragment)
+ {
+ List<NodeImpl> list =
convertDocumentFragment((DocumentFragment)newChild);
+ for (NodeImpl node : list)
+ {
+ insertBefore(node, refChild);
+ }
+ return newChild;
+ }
+
+ int index = soapChildren.indexOf(refChild);
+ if (index < 0)
+ throw new IllegalArgumentException("Cannot find refChild in list of
javax.xml.soap.Node children");
+
+ NodeImpl soapNewNode = (NodeImpl)newChild;
+ soapNewNode.detachNode();
+
+ NodeImpl soapRefNode = (NodeImpl)refChild;
+ domNode.insertBefore(soapNewNode.domNode, soapRefNode.domNode);
+ soapChildren.add(index, soapNewNode);
+
+ soapNewNode.soapParent = (SOAPElementImpl)this;
+
+ return newChild;
+ }
+
+ public org.w3c.dom.Node replaceChild(org.w3c.dom.Node newChild, org.w3c.dom.Node
oldChild) throws DOMException
+ {
+ newChild = convertDOMNode(newChild);
+ oldChild = convertDOMNode(oldChild);
+
+ if (newChild instanceof DocumentFragment)
+ {
+ insertBefore(newChild, oldChild);
+ ((NodeImpl)oldChild).detachNode();
+ return newChild;
+ }
+
+ int index = soapChildren.indexOf(oldChild);
+ if (index < 0)
+ throw new DOMException(DOMException.NOT_FOUND_ERR, "Cannot find oldChild in
list of javax.xml.soap.Node children");
+
+ NodeImpl soapNewNode = (NodeImpl)newChild;
+ NodeImpl soapOldNode = (NodeImpl)oldChild;
+
+ soapNewNode.detachNode();
+
+ if (soapNewNode.domNode != soapOldNode.domNode)
+ domNode.replaceChild(soapNewNode.domNode, soapOldNode.domNode);
+
+ soapChildren.remove(index);
+ soapChildren.add(index, soapNewNode);
+
+ soapNewNode.soapParent = soapOldNode.soapParent;
+ soapOldNode.soapParent = null;
+
+ return newChild;
+ }
+
+ public org.w3c.dom.Node removeChild(org.w3c.dom.Node oldChild) throws DOMException
+ {
+ oldChild = convertDOMNode(oldChild);
+
+ int index = soapChildren.indexOf(oldChild);
+ if (index < 0)
+ throw new DOMException(DOMException.NOT_FOUND_ERR, "Cannot find oldChild in
list of javax.xml.soap.Node children");
+
+ NodeImpl soapOldNode = (NodeImpl)oldChild;
+ domNode.removeChild(soapOldNode.domNode);
+ soapChildren.remove(index);
+
+ soapOldNode.soapParent = null;
+
+ return oldChild;
+ }
+
+ public org.w3c.dom.Node appendChild(org.w3c.dom.Node newChild) throws DOMException
+ {
+ newChild = convertDOMNode(newChild);
+
+ if (newChild instanceof DocumentFragment)
+ {
+ List<NodeImpl> list =
convertDocumentFragment((DocumentFragment)newChild);
+ for (NodeImpl node : list)
+ {
+ appendChild(node);
+ }
+ return newChild;
+ }
+
+ if ((this instanceof SOAPElementImpl) == false)
+ throw new DOMException(DOMException.INVALID_ACCESS_ERR, "Cannot append
child to this node: " + this);
+
+ NodeImpl soapNode = (NodeImpl)newChild;
+ soapNode.detachNode();
+
+ domNode.appendChild(soapNode.domNode);
+ soapNode.soapParent = (SOAPElementImpl)this;
+
+ soapChildren.add(soapNode);
+
+ return newChild;
+ }
+
+ public boolean hasChildNodes()
+ {
+ return domNode.hasChildNodes();
+ }
+
+ public org.w3c.dom.Node cloneNode(boolean deep)
+ {
+ return domNode.cloneNode(deep);
+ }
+
+ public void normalize()
+ {
+ domNode.normalize();
+ }
+
+ public boolean isSupported(String feature, String version)
+ {
+ return domNode.isSupported(feature, version);
+ }
+
+ public String getNamespaceURI()
+ {
+ return domNode.getNamespaceURI();
+ }
+
+ public String getPrefix()
+ {
+ return domNode.getPrefix();
+ }
+
+ public void setPrefix(String prefix) throws DOMException
+ {
+ domNode.setPrefix(prefix);
+ }
+
+ public String getLocalName()
+ {
+ return domNode.getLocalName();
+ }
+
+ public boolean hasAttributes()
+ {
+ return domNode.hasAttributes();
+ }
+
+ public int hashCode()
+ {
+ return domNode.hashCode();
+ }
+
+ public String toString()
+ {
+ return super.toString() + "[" + domNode.toString() + "]";
+ }
+
+ private Node convertDOMNode(org.w3c.dom.Node node)
+ {
+ Node retNode;
+ if (node instanceof NodeImpl)
+ {
+ retNode = node;
+ }
+ else if (node instanceof DocumentFragment)
+ {
+ retNode = new DocumentFragmentImpl((DocumentFragment)node);
+ }
+ else if (node instanceof org.w3c.dom.Text)
+ {
+ retNode = new TextImpl(node);
+ }
+ else
+ {
+ throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Operation only
supported for javax.xml.soap.Node, this is a " + node);
+ }
+ return retNode;
+ }
+
+ private void assertSOAPParent()
+ {
+ org.w3c.dom.Node domParent = domNode.getParentNode();
+ if (domParent != null && soapParent == null)
+ throw new WSException("Inconsistent node, has a DOM parent but no SOAP
parent [" + this + "] " + DOMWriter.printNode(this, false));
+ if (domParent == null && soapParent != null)
+ throw new WSException("Inconsistent node, has a SOAP parent but no DOM
parent [" + this + "] " + DOMWriter.printNode(this, false));
+ if (soapParent != null && domParent != soapParent.domNode)
+ throw new WSException("Inconsistent node, SOAP parent is not identical with
DOM parent [" + this + "] " + DOMWriter.printNode(this, false));
+ }
+
+ // END org.w3c.dom.Node
*******************************************************************************************
+
+ // BEGIN org.w3c.dom.Node DOM Level 3
*****************************************************************************
+
+ public short compareDocumentPosition(Node other) throws DOMException
+ {
+ // FIXME compareDocumentPosition
+ throw new NotImplementedException("compareDocumentPosition");
+ }
+
+ public String getBaseURI()
+ {
+ // FIXME getBaseURI
+ throw new NotImplementedException("getBaseURI");
+ }
+
+ public Object getFeature(String feature, String version)
+ {
+ // FIXME getFeature
+ throw new NotImplementedException("getFeature");
+ }
+
+ public String getTextContent() throws DOMException
+ {
+ // FIXME getTextContent
+ throw new NotImplementedException("getTextContent");
+ }
+
+ public Object getUserData(String key)
+ {
+ // FIXME getUserData
+ throw new NotImplementedException("getUserData");
+ }
+
+ public boolean isDefaultNamespace(String namespaceURI)
+ {
+ // FIXME isDefaultNamespace
+ throw new NotImplementedException("isDefaultNamespace");
+ }
+
+ public boolean isEqualNode(Node arg)
+ {
+ // FIXME isEqualNode
+ throw new NotImplementedException("isEqualNode");
+ }
+
+ public boolean isSameNode(Node other)
+ {
+ // FIXME isSameNode
+ throw new NotImplementedException("isSameNode");
+ }
+
+ public String lookupNamespaceURI(String prefix)
+ {
+ // FIXME lookupNamespaceURI
+ throw new NotImplementedException("lookupNamespaceURI");
+ }
+
+ public String lookupPrefix(String namespaceURI)
+ {
+ // FIXME lookupPrefix
+ throw new NotImplementedException("lookupPrefix");
+ }
+
+ public void setTextContent(String textContent) throws DOMException
+ {
+ // FIXME setTextContent
+ throw new NotImplementedException("setTextContent");
+ }
+
+ public Object setUserData(String key, Object data, UserDataHandler handler)
+ {
+ // FIXME setUserData
+ throw new NotImplementedException("setUserData");
+ }
+
+ // END org.w3c.dom.Node DOM Level 3
*****************************************************************************
+}
Copied: branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/NodeListImpl.java
(from rev 1557,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/NodeListImpl.java)
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/NodeListImpl.java 2006-12-05
23:29:55 UTC (rev 1557)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/NodeListImpl.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -0,0 +1,67 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+package org.jboss.ws.core.soap;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+/**
+ * The NodeList interface provides the abstraction of an ordered collection of nodes,
without defining or constraining
+ * how this collection is implemented. NodeList objects in the DOM are live.
+ *
+ * The items in the NodeList are accessible via an integral index, starting from 0.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ */
+class NodeListImpl implements NodeList
+{
+ private List<NodeImpl> nodeList = new ArrayList<NodeImpl>();
+
+ NodeListImpl(List<NodeImpl> nodes)
+ {
+ nodeList = new ArrayList<NodeImpl>(nodes);
+ }
+
+ NodeListImpl(Iterator<NodeImpl> nodes)
+ {
+ nodeList = new ArrayList<NodeImpl>();
+ while (nodes.hasNext())
+ nodeList.add(nodes.next());
+ }
+
+ public Node item(int index)
+ {
+ if (nodeList.size() > index)
+ return nodeList.get(index);
+ else
+ return null;
+ }
+
+ public int getLength()
+ {
+ return nodeList.size();
+ }
+}
Copied: branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/PayloadBuilder.java
(from rev 1557,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/PayloadBuilder.java)
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/PayloadBuilder.java 2006-12-05
23:29:55 UTC (rev 1557)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/PayloadBuilder.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -0,0 +1,39 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ws.core.soap;
+
+// $Id$
+
+import java.io.IOException;
+import java.io.InputStream;
+
+import javax.xml.soap.SOAPException;
+
+/**
+ * @author Heiko Braun, <heiko.braun(a)jboss.com>
+ * @author Thomas.Diesler(a)jboss.com
+ * @since 19-Apr-2006
+ */
+public interface PayloadBuilder
+{
+ void build(SOAPMessageImpl soapMessage, InputStream in, boolean ignoreParseError)
throws IOException, SOAPException;
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/SAAJPayloadBuilderDOM.java
(from rev 1557,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SAAJPayloadBuilderDOM.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SAAJPayloadBuilderDOM.java 2006-12-05
23:29:55 UTC (rev 1557)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/SAAJPayloadBuilderDOM.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -0,0 +1,268 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ws.core.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.WSException;
+import org.jboss.ws.jaxrpc.Style;
+import org.jboss.ws.utils.DOMUtils;
+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(a)jboss.com>
+ * @author Thomas.Diesler(a)jboss.com
+ * @since 19-Apr-2006
+ */
+public class SAAJPayloadBuilderDOM implements PayloadBuilder
+{
+ // provide logging
+ private static Logger log = Logger.getLogger(SAAJPayloadBuilderDOM.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());
+ }
+ }
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/SAAJPayloadBuilderStax.java
(from rev 1557,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SAAJPayloadBuilderStax.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SAAJPayloadBuilderStax.java 2006-12-05
23:29:55 UTC (rev 1557)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/SAAJPayloadBuilderStax.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -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.core.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(a)jboss.com>
+ * @author Thomas.Diesler(a)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();
+ }
+}
Copied: branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/SAAJVisitable.java
(from rev 1557,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SAAJVisitable.java)
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SAAJVisitable.java 2006-12-05
23:29:55 UTC (rev 1557)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/SAAJVisitable.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -0,0 +1,31 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+package org.jboss.ws.core.soap;
+
+/**
+ * @author Heiko Braun <heiko.braun(a)jboss.com>
+ * @version $Id$
+ * @since Sep 26, 2006
+ */
+public interface SAAJVisitable {
+ public void accept(SAAJVisitor visitor);
+}
Copied: branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/SAAJVisitor.java
(from rev 1557, branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SAAJVisitor.java)
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SAAJVisitor.java 2006-12-05
23:29:55 UTC (rev 1557)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/SAAJVisitor.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -0,0 +1,34 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+package org.jboss.ws.core.soap;
+
+import javax.xml.soap.SOAPElement;
+
+/**
+ * @author Heiko Braun <heiko.braun(a)jboss.com>
+ * @version $Id$
+ * @since Sep 26, 2006
+ */
+public interface SAAJVisitor {
+ void visitSOAPElement(SOAPElementImpl soapElement);
+ void visitSOAPContentElement(SOAPContentElement scElement);
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/SOAPBodyElementDoc.java (from
rev 1557,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPBodyElementDoc.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPBodyElementDoc.java 2006-12-05
23:29:55 UTC (rev 1557)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/SOAPBodyElementDoc.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -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.core.soap;
+
+import javax.xml.soap.Name;
+import javax.xml.soap.SOAPBodyElement;
+
+/**
+ * An abstract implemenation of the SOAPBodyElement
+ * <p/>
+ * This class should not expose functionality that is not part of
+ * {@link javax.xml.soap.SOAPBodyElement}. Client code should use
<code>SOAPBodyElement</code>.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ */
+public class SOAPBodyElementDoc extends SOAPContentElement implements SOAPBodyElement
+{
+ public SOAPBodyElementDoc(Name name)
+ {
+ super(name);
+ }
+
+ public SOAPBodyElementDoc(SOAPElementImpl element)
+ {
+ super(element);
+ }
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/SOAPBodyElementMessage.java
(from rev 1557,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPBodyElementMessage.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPBodyElementMessage.java 2006-12-05
23:29:55 UTC (rev 1557)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/SOAPBodyElementMessage.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -0,0 +1,61 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+package org.jboss.ws.core.soap;
+
+import org.jboss.ws.utils.DOMWriter;
+import javax.xml.soap.Name;
+import javax.xml.soap.SOAPBodyElement;
+import javax.xml.rpc.JAXRPCException;
+import java.io.Writer;
+
+/**
+ * An abstract implemenation of the SOAPBodyElement
+ * <p/>
+ * This class should not expose functionality that is not part of
+ * {@link javax.xml.soap.SOAPBodyElement}. Client code should use
<code>SOAPBodyElement</code>.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ */
+public class SOAPBodyElementMessage extends SOAPElementImpl implements SOAPBodyElement
+{
+ public SOAPBodyElementMessage(Name name)
+ {
+ super(name);
+ }
+
+ public SOAPBodyElementMessage(SOAPElementImpl element)
+ {
+ super(element);
+ }
+
+ public void writeElement(Writer writer) {
+ try
+ {
+ DOMWriter domWriter = new DOMWriter(writer);
+ domWriter.print(this);
+ }
+ catch (Exception e)
+ {
+ throw new JAXRPCException(e);
+ }
+ }
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/SOAPBodyElementRpc.java (from
rev 1557,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPBodyElementRpc.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPBodyElementRpc.java 2006-12-05
23:29:55 UTC (rev 1557)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/SOAPBodyElementRpc.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -0,0 +1,53 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+package org.jboss.ws.core.soap;
+
+import org.jboss.ws.utils.DOMWriter;
+import org.jboss.ws.WSException;
+import org.w3c.dom.Element;
+import javax.xml.soap.Name;
+import javax.xml.soap.SOAPBodyElement;
+import javax.xml.rpc.JAXRPCException;
+import java.io.IOException;
+import java.io.Writer;
+import java.util.Iterator;
+
+/**
+ * An abstract implemenation of the SOAPBodyElement
+ * <p/>
+ * This class should not expose functionality that is not part of
+ * {@link javax.xml.soap.SOAPBodyElement}. Client code should use
<code>SOAPBodyElement</code>.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ */
+public class SOAPBodyElementRpc extends SOAPElementImpl implements SOAPBodyElement
+{
+ public SOAPBodyElementRpc(Name name)
+ {
+ super(name);
+ }
+
+ public SOAPBodyElementRpc(SOAPElementImpl element)
+ {
+ super(element);
+ }
+}
Copied: branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/SOAPBodyImpl.java
(from rev 1559,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPBodyImpl.java)
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPBodyImpl.java 2006-12-06
00:29:48 UTC (rev 1559)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/SOAPBodyImpl.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -0,0 +1,406 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ws.core.soap;
+
+// $Id$
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.Reader;
+import java.io.Writer;
+import java.util.Iterator;
+import java.util.Locale;
+
+import javax.xml.soap.Name;
+import javax.xml.soap.SOAPBody;
+import javax.xml.soap.SOAPBodyElement;
+import javax.xml.soap.SOAPElement;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPFault;
+import javax.xml.transform.Source;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.sax.SAXSource;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.Constants;
+import org.jboss.ws.WSException;
+import org.jboss.ws.core.CommonMessageContext;
+import org.jboss.ws.metadata.umdm.UnifiedMetaData;
+import org.jboss.ws.utils.DOMUtils;
+import org.jboss.ws.utils.DOMWriter;
+import org.w3c.dom.DOMException;
+import org.w3c.dom.Document;
+import org.w3c.dom.DocumentFragment;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.xml.sax.InputSource;
+
+/**
+ * An object that represents the contents of the SOAP body element in a SOAP message.
+ * A SOAP body element consists of XML data that affects the way the application-specific
content is processed.
+ *
+ * A SOAPBody object contains SOAPBodyElement objects, which have the content for the
SOAP body.
+ * A SOAPFault object, which carries status and/or error information, is an example of a
SOAPBodyElement object.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ */
+public class SOAPBodyImpl extends SOAPElementImpl implements SOAPBody
+{
+ // provide logging
+ private static Logger log = Logger.getLogger(SOAPBodyImpl.class);
+
+ // Generic JAXWS payload
+ private Source payload;
+ private boolean isDOMValid = true;
+ private boolean isModifiedFromSource;
+
+ public SOAPBodyImpl(String prefix, String namespace)
+ {
+ super("Body", prefix, namespace);
+ }
+
+ public boolean isDOMValid()
+ {
+ return isDOMValid;
+ }
+
+ public boolean isModifiedFromSource()
+ {
+ return isModifiedFromSource;
+ }
+
+ public Source getPayload()
+ {
+ return payload;
+ }
+
+ public void setPayload(Source payload)
+ {
+ log.debug("setPayload: " + payload.getClass().getName());
+ removeContents();
+ this.payload = payload;
+ this.isDOMValid = false;
+ }
+
+ /** Convert the child into a SOAPBodyElement */
+ public SOAPElement addChildElement(SOAPElement child) throws SOAPException
+ {
+ log.trace("addChildElement: " + child.getElementName());
+ expandToDOM();
+ if ((child instanceof SOAPBodyElement) == false)
+ child = convertToBodyElement(child);
+
+ child = super.addChildElement(child);
+ return child;
+ }
+
+ public SOAPBodyElement addBodyElement(Name name) throws SOAPException
+ {
+ log.trace("addBodyElement: " + name);
+ expandToDOM();
+ SOAPBodyElement child = new SOAPBodyElementDoc(name);
+ return (SOAPBodyElement)addChildElement(child);
+ }
+
+ public SOAPBodyElement addDocument(Document doc) throws SOAPException
+ {
+ log.trace("addDocument");
+ expandToDOM();
+ Element rootElement = doc.getDocumentElement();
+ SOAPFactoryImpl soapFactory = new SOAPFactoryImpl();
+ SOAPElementImpl soapElement = soapFactory.createElement(rootElement, true);
+ return (SOAPBodyElement)addChildElement(soapElement);
+ }
+
+ public SOAPFault addFault() throws SOAPException
+ {
+ log.trace("addFault");
+ expandToDOM();
+ if (hasFault())
+ throw new SOAPException("A SOAPBody may contain at most one SOAPFault child
element");
+
+ return addFault(new NameImpl(Constants.SOAP11_FAULT_CODE_SERVER), "Generic
server fault");
+ }
+
+ public SOAPFault addFault(Name faultCode, String faultString) throws SOAPException
+ {
+ log.trace("addFault");
+ expandToDOM();
+ if (hasFault())
+ throw new SOAPException("A SOAPBody may contain at most one SOAPFault child
element");
+
+ SOAPFaultImpl soapFault = new SOAPFaultImpl(getNamespaceURI());
+ soapFault = (SOAPFaultImpl)addChildElement(soapFault);
+ soapFault.setFaultCode(faultCode);
+ soapFault.setFaultString(faultString);
+ return soapFault;
+ }
+
+ public SOAPFault addFault(Name faultCode, String faultString, Locale locale) throws
SOAPException
+ {
+ log.trace("addFault");
+ expandToDOM();
+ if (hasFault())
+ throw new SOAPException("A SOAPBody may contain at most one SOAPFault child
element");
+
+ SOAPFaultImpl soapFault = new SOAPFaultImpl(getNamespaceURI());
+ soapFault.setFaultCode(faultCode);
+ soapFault.setFaultString(faultString, locale);
+ addChildElement(soapFault);
+ return soapFault;
+ }
+
+ public SOAPFault getFault()
+ {
+ log.trace("getFault");
+ expandToDOM();
+ Iterator it = getChildElements(new NameImpl("Fault",
Constants.PREFIX_ENV, getSOAPEnvelope().getNamespaceURI()));
+ return (it.hasNext() ? (SOAPFault)it.next() : null);
+ }
+
+ public boolean hasFault()
+ {
+ log.trace("hasFault");
+ expandToDOM();
+ return getChildElements(Constants.SOAP11_FAULT).hasNext();
+ }
+
+ public Node appendChild(Node newChild) throws DOMException
+ {
+ log.trace("appendChild: " + newChild.getNodeName());
+ expandToDOM();
+ Node retNode;
+ if (!(newChild instanceof SOAPBodyElement || newChild instanceof
DocumentFragment))
+ {
+ newChild = convertToBodyElement(newChild);
+ }
+ retNode = super.appendChild(newChild);
+ return retNode;
+ }
+
+ public Node insertBefore(Node newChild, Node refChild) throws DOMException
+ {
+ log.trace("insertBefore: " + newChild.getNodeName());
+ expandToDOM();
+ if (!(newChild instanceof SOAPBodyElement || newChild instanceof
DocumentFragment))
+ newChild = convertToBodyElement(newChild);
+
+ return super.insertBefore(newChild, refChild);
+ }
+
+ public Node replaceChild(Node newChild, Node oldChild) throws DOMException
+ {
+ log.trace("replaceChild: " + newChild.getNodeName());
+ expandToDOM();
+ if (!(newChild instanceof SOAPBodyElement || newChild instanceof
DocumentFragment))
+ {
+ newChild = convertToBodyElement(newChild);
+ }
+
+ return super.replaceChild(newChild, oldChild);
+ }
+
+ public Iterator getChildElements()
+ {
+ log.trace("getChildElements");
+ expandToDOM();
+ return super.getChildElements();
+ }
+
+ public Iterator getChildElements(Name name)
+ {
+ log.trace("getChildElements: " + name);
+ expandToDOM();
+ return super.getChildElements(name);
+ }
+
+ public NodeList getChildNodes()
+ {
+ log.trace("getChildNodes");
+ expandToDOM();
+ return super.getChildNodes();
+ }
+
+ public Node getFirstChild()
+ {
+ log.trace("getFirstChild");
+ expandToDOM();
+ return super.getFirstChild();
+ }
+
+ public Node getLastChild()
+ {
+ log.trace("getLastChild");
+ expandToDOM();
+ return super.getLastChild();
+ }
+
+ public boolean hasChildNodes()
+ {
+ log.trace("hasChildNodes");
+ expandToDOM();
+ return super.hasChildNodes();
+ }
+
+ private SOAPBodyElementDoc convertToBodyElement(Node node)
+ {
+ if (!(node instanceof SOAPElementImpl))
+ throw new IllegalArgumentException("SOAPElement expected");
+
+ SOAPElementImpl element = (SOAPElementImpl)node;
+ element.detachNode();
+ return new SOAPBodyElementDoc(element);
+ }
+
+ private void expandToDOM()
+ {
+ if (isDOMValid == false)
+ {
+ // DOM expansion should only happen when a handler accesses the DOM API.
+ // We do not allow DOM expansion on a dev release.
+ CommonMessageContext msgContext =
MessageContextAssociation.peekMessageContext();
+ if (msgContext != null && UnifiedMetaData.isFinalRelease() == false)
+ {
+ Boolean allowExpand =
(Boolean)msgContext.getProperty(CommonMessageContext.ALLOW_EXPAND_TO_DOM);
+ if (Boolean.TRUE.equals(allowExpand) == false)
+ throw new WSException("Expanding content element to DOM");
+ }
+
+ log.trace("BEGIN expandToDOM");
+
+ isDOMValid = true;
+ try
+ {
+ Element child = getBodyElementFromSource();
+ SOAPFactoryImpl soapFactory = new SOAPFactoryImpl();
+ addChildElement(soapFactory.createElement(child, true));
+ payload = null;
+ }
+ catch (RuntimeException rte)
+ {
+ isDOMValid = false;
+ throw rte;
+ }
+ catch (Exception ex)
+ {
+ isDOMValid = false;
+ throw new WSException("Cannot expand to DOM" + ex);
+ }
+ finally
+ {
+ isModifiedFromSource = true;
+ log.trace("END expandToDOM");
+ }
+ }
+ }
+
+ private Element getBodyElementFromSource()
+ {
+ Element child = null;
+ try
+ {
+ if (payload instanceof StreamSource)
+ {
+ StreamSource streamSource = (StreamSource)payload;
+
+ InputStream ins = streamSource.getInputStream();
+ if (ins != null)
+ {
+ child = DOMUtils.parse(ins);
+ }
+ else
+ {
+ Reader reader = streamSource.getReader();
+ child = DOMUtils.parse(new InputSource(reader));
+ }
+
+ // reset the excausted input stream
+ String xmlStr = DOMWriter.printNode(child, false);
+ payload = new StreamSource(new ByteArrayInputStream(xmlStr.getBytes()));
+ }
+ else if (payload instanceof DOMSource)
+ {
+ DOMSource domSource = (DOMSource)payload;
+ Node node = domSource.getNode();
+ if (node instanceof Element)
+ {
+ child = (Element)node;
+ }
+ else if (node instanceof Document)
+ {
+ child = ((Document)node).getDocumentElement();
+ }
+ else
+ {
+ throw new WSException("Unsupported Node type: " +
node.getClass().getName());
+ }
+ }
+ else if (payload instanceof SAXSource)
+ {
+ // The fact that JAXBSource derives from SAXSource is an implementation
detail.
+ // Thus in general applications are strongly discouraged from accessing
methods defined on SAXSource.
+ // The XMLReader object obtained by the getXMLReader method shall be used
only for parsing the InputSource object returned by the getInputSource method.
+
+ TransformerFactory tf = TransformerFactory.newInstance();
+ ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);
+ tf.newTransformer().transform(payload, new StreamResult(baos));
+
+ child = DOMUtils.parse(new ByteArrayInputStream(baos.toByteArray()));
+ }
+ else
+ {
+ throw new WSException("Source type not implemented: " +
payload.getClass().getName());
+ }
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (Exception ex)
+ {
+ throw new WSException("Cannot get root element from Source" + ex);
+ }
+ return child;
+ }
+
+ @Override
+ public void writeElementContent(Writer writer) throws IOException
+ {
+ if (payload != null)
+ {
+ Element child = getBodyElementFromSource();
+ String xmlPayload = DOMWriter.printNode(child, false);
+ log.debug("Content from payload: " + xmlPayload);
+ writer.write(xmlPayload);
+ }
+ else
+ {
+ super.writeElementContent(writer);
+ }
+ }
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/SOAPConnectionFactoryImpl.java
(from rev 1557,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPConnectionFactoryImpl.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPConnectionFactoryImpl.java 2006-12-05
23:29:55 UTC (rev 1557)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/SOAPConnectionFactoryImpl.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -0,0 +1,80 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ *
+ * Copyright (c) 2002-2003 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution,
+ * if any, must include the following acknowledgment:
+ * "This product includes software developed by the
+ * Apache Software Foundation (
http://www.apache.org/)."
+ * Alternately, this acknowledgment may appear in the software itself,
+ * if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The names "Axis" and "Apache Software Foundation" must
+ * not be used to endorse or promote products derived from this
+ * software without prior written permission. For written
+ * permission, please contact apache(a)apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache",
+ * nor may "Apache" appear in their name, without prior written
+ * permission of the Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * <
http://www.apache.org/>.
+ */
+package org.jboss.ws.core.soap;
+
+// $Id$
+
+import javax.xml.soap.SOAPConnection;
+import javax.xml.soap.SOAPConnectionFactory;
+import javax.xml.soap.SOAPException;
+
+/**
+ * SOAP Connection Factory implementation
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 02-Feb-2005
+ */
+public class SOAPConnectionFactoryImpl extends SOAPConnectionFactory
+{
+ /** Create a new SOAPConnection.
+ *
+ * @return the new SOAPConnection object.
+ * @throws javax.xml.soap.SOAPException if there was an exception creating
theSOAPConnection object.
+ */
+ public SOAPConnection createConnection() throws SOAPException
+ {
+ return new SOAPConnectionImpl();
+ }
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/SOAPConnectionImpl.java (from
rev 1559,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPConnectionImpl.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPConnectionImpl.java 2006-12-06
00:29:48 UTC (rev 1559)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/SOAPConnectionImpl.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -0,0 +1,358 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ws.core.soap;
+
+// $Id$
+
+import java.net.MalformedURLException;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Properties;
+
+import javax.xml.rpc.Stub;
+import javax.xml.soap.MimeHeader;
+import javax.xml.soap.MimeHeaders;
+import javax.xml.soap.SOAPConnection;
+import javax.xml.soap.SOAPEnvelope;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.ws.BindingProvider;
+import javax.xml.ws.addressing.EndpointReference;
+
+import org.jboss.logging.Logger;
+import org.jboss.remoting.Client;
+import org.jboss.remoting.InvokerLocator;
+import org.jboss.remoting.security.SSLSocketBuilder;
+import org.jboss.remoting.transport.http.HTTPMetadataConstants;
+import org.jboss.ws.core.binding.soap.SOAPMessageMarshaller;
+import org.jboss.ws.core.binding.soap.SOAPMessageUnMarshaller;
+import org.jboss.ws.extras.xop.XOPContext;
+import org.jboss.ws.jaxrpc.StubExt;
+
+/**
+ * SOAPConnection implementation
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @author <a href="mailto:jason@stacksmash.com">Jason T.
Greene</a>
+ *
+ * @since 02-Feb-2005
+ */
+public class SOAPConnectionImpl extends SOAPConnection
+{
+ // provide logging
+ private static Logger log = Logger.getLogger(SOAPConnectionImpl.class);
+ private static Logger msgLog = Logger.getLogger("jbossws.SOAPMessage");
+
+ private Map<String, Object> config = new HashMap<String, Object>();
+
+ private static Map<String, String> metadataMap = new HashMap<String,
String>();
+ static
+ {
+ metadataMap.put(Stub.USERNAME_PROPERTY, "http.basic.username");
+ metadataMap.put(Stub.PASSWORD_PROPERTY, "http.basic.password");
+ metadataMap.put(BindingProvider.USERNAME_PROPERTY,
"http.basic.username");
+ metadataMap.put(BindingProvider.PASSWORD_PROPERTY,
"http.basic.password");
+ }
+ private static Map<String, String> configMap = new HashMap<String,
String>();
+ static
+ {
+ configMap.put(StubExt.PROPERTY_KEY_STORE,
SSLSocketBuilder.REMOTING_KEY_STORE_FILE_PATH);
+ configMap.put(StubExt.PROPERTY_KEY_STORE_PASSWORD,
SSLSocketBuilder.REMOTING_KEY_STORE_PASSWORD);
+ configMap.put(StubExt.PROPERTY_KEY_STORE_TYPE,
SSLSocketBuilder.REMOTING_KEY_STORE_TYPE);
+ configMap.put(StubExt.PROPERTY_TRUST_STORE,
SSLSocketBuilder.REMOTING_TRUST_STORE_FILE_PATH);
+ configMap.put(StubExt.PROPERTY_TRUST_STORE_PASSWORD,
SSLSocketBuilder.REMOTING_TRUST_STORE_PASSWORD);
+ configMap.put(StubExt.PROPERTY_TRUST_STORE_TYPE,
SSLSocketBuilder.REMOTING_TRUST_STORE_TYPE);
+ }
+
+ private boolean closed;
+
+ public SOAPConnectionImpl()
+ {
+ // HTTPClientInvoker conect sends gratuitous POST
+ //
http://jira.jboss.com/jira/browse/JBWS-711
+ config.put(Client.ENABLE_LEASE, false);
+ }
+
+ /**
+ * Sends the given message to the specified endpoint and blocks until it has
+ * returned the response.
+ */
+ public SOAPMessage call(SOAPMessage reqMessage, Object endpoint) throws SOAPException
+ {
+ return callInternal(reqMessage, endpoint, false);
+ }
+
+ /**
+ * Sends the given message to the specified endpoint. This method is logically
+ * non blocking.
+ */
+ public SOAPMessage callOneWay(SOAPMessage reqMessage, Object endpoint) throws
SOAPException
+ {
+ return callInternal(reqMessage, endpoint, true);
+ }
+
+ /** Sends the given message to the specified endpoint. */
+ private SOAPMessage callInternal(SOAPMessage reqMessage, Object endpoint, boolean
oneway) throws SOAPException
+ {
+ if (reqMessage == null)
+ throw new IllegalArgumentException("Given SOAPMessage cannot be
null");
+ if (endpoint == null)
+ throw new IllegalArgumentException("Given endpoint cannot be null");
+
+ if (closed)
+ throw new SOAPException("SOAPConnection is already closed");
+
+ InvokerLocator locator;
+ Client remotingClient;
+ String targetAddress;
+ Map callProps;
+
+ if (endpoint instanceof EndpointInfo)
+ {
+ EndpointInfo epInfo = (EndpointInfo)endpoint;
+ targetAddress = epInfo.getTargetAddress();
+ callProps = epInfo.getProperties();
+
+ if (callProps.containsKey(StubExt.PROPERTY_CLIENT_TIMEOUT))
+ {
+ Object timeout = callProps.get(StubExt.PROPERTY_CLIENT_TIMEOUT);
+ int qmIndex = targetAddress.indexOf("?");
+ targetAddress += (qmIndex < 0 ? "?" : "&") +
"timeout=" + timeout;
+ }
+ }
+ else if (endpoint instanceof EndpointReference)
+ {
+ EndpointReference epr = (EndpointReference)endpoint;
+ targetAddress = epr.getAddress().toString();
+ callProps = null;
+ }
+ else
+ {
+ targetAddress = endpoint.toString();
+ callProps = null;
+ }
+
+ // enforce xop transitions
+ // TODO: there should be a clear transition to an immutable object model
+ XOPContext.eagerlyCreateAttachments();
+
+ // save object model changes
+ if (reqMessage.saveRequired()) reqMessage.saveChanges();
+
+ try
+ {
+ // Get the invoker from Remoting for a given endpoint address
+ log.debug("Get locator for: " + endpoint);
+ locator = new InvokerLocator(targetAddress);
+ }
+ catch (MalformedURLException e)
+ {
+ throw new SOAPException("Malformed endpoint address", e);
+ }
+
+ Map metadata = getRemotingMetaData(reqMessage, targetAddress, callProps);
+
+ try
+ {
+ remotingClient = new Client(locator, "saaj", config);
+ remotingClient.connect();
+ remotingClient.setMarshaller(new SOAPMessageMarshaller());
+ if (oneway == false)
+ remotingClient.setUnMarshaller(new SOAPMessageUnMarshaller());
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (Exception e)
+ {
+ throw new SOAPException("Could not setup remoting client", e);
+ }
+
+ try
+ {
+ // debug the outgoing message
+ if(msgLog.isTraceEnabled())
+ {
+ SOAPEnvelope soapReqEnv = reqMessage.getSOAPPart().getEnvelope();
+ String envStr = SOAPElementWriter.writeElement((SOAPElementImpl)soapReqEnv,
true);
+ msgLog.trace("Remoting meta data: " + metadata);
+ msgLog.trace("Outgoing SOAPMessage\n" + envStr);
+ }
+
+ SOAPMessage resMessage = null;
+ if (oneway == true)
+ {
+ remotingClient.invokeOneway(reqMessage, metadata, false);
+ }
+ else
+ {
+ resMessage = (SOAPMessage)remotingClient.invoke(reqMessage, metadata);
+ }
+
+ // disconnect the rmoting client
+ remotingClient.disconnect();
+
+ // debug the incomming response message
+ if (resMessage != null && msgLog.isTraceEnabled())
+ {
+ SOAPEnvelope soapResEnv = resMessage.getSOAPPart().getEnvelope();
+ String envStr = SOAPElementWriter.writeElement((SOAPElementImpl)soapResEnv,
true);
+ msgLog.trace("Incoming Response SOAPMessage\n" + envStr);
+ }
+
+ return resMessage;
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (Throwable t)
+ {
+ throw new SOAPException("Could not transmit message", t);
+ }
+ }
+
+ /** Closes this SOAPConnection
+ */
+ public void close() throws SOAPException
+ {
+ if (closed)
+ throw new SOAPException("SOAPConnection is already closed");
+
+ closed = true;
+ }
+
+ private Map getRemotingMetaData(SOAPMessage reqMessage, String targetAddress, Map
callProps) throws SOAPException
+ {
+ // 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.
+
+ MimeHeaders mimeHeaders = reqMessage.getMimeHeaders();
+ String[] action = mimeHeaders.getHeader("SOAPAction");
+ if (action != null && action.length > 0)
+ {
+ String soapAction = action[0];
+
+ // R1109 The value of the SOAPAction HTTP header field in a HTTP request MESSAGE
MUST be a quoted string.
+ if (soapAction.startsWith("\"") == false ||
soapAction.endsWith("\"") == false)
+ soapAction = "\"" + soapAction + "\"";
+
+ mimeHeaders.setHeader("SOAPAction", soapAction);
+ }
+ else
+ {
+ mimeHeaders.setHeader("SOAPAction", "\"\"");
+ }
+
+ Map<String, Object> metadata = new HashMap<String, Object>();
+
+ // We need to unmarshall faults (HTTP 500)
+ metadata.put(HTTPMetadataConstants.NO_THROW_ON_ERROR, "true");
+
+ Properties props = new Properties();
+ metadata.put("HEADER", props);
+
+ Iterator i = mimeHeaders.getAllHeaders();
+ while (i.hasNext())
+ {
+ MimeHeader header = (MimeHeader)i.next();
+ String currentValue = props.getProperty(header.getName());
+
+ /*
+ * Coalesce multiple headers into one
+ *
+ * From HTTP/1.1 RFC 2616:
+ *
+ * Multiple message-header fields with the same field-name MAY be
+ * present in a message if and only if the entire field-value for that
+ * header field is defined as a comma-separated list [i.e., #(values)].
+ * It MUST be possible to combine the multiple header fields into one
+ * "field-name: field-value" pair, without changing the semantics of
+ * the message, by appending each subsequent field-value to the first,
+ * each separated by a comma.
+ */
+ if (currentValue != null)
+ {
+ props.put(header.getName(), currentValue + "," +
header.getValue());
+ }
+ else
+ {
+ props.put(header.getName(), header.getValue());
+ }
+ }
+
+ if (callProps != null)
+ {
+ Iterator it = callProps.entrySet().iterator();
+
+ // Get authentication type, default to BASIC authetication
+ String authType = (String)callProps.get(StubExt.PROPERTY_AUTH_TYPE);
+ if (authType == null)
+ authType = StubExt.PROPERTY_AUTH_TYPE_BASIC;
+
+ while (it.hasNext())
+ {
+ Map.Entry entry = (Map.Entry)it.next();
+ String key = (String)entry.getKey();
+ Object val = entry.getValue();
+
+ // pass properties to remoting meta data
+ if (metadataMap.containsKey(key))
+ {
+ String remotingKey = metadataMap.get(key);
+ if (key.equals(Stub.USERNAME_PROPERTY) ||
key.equals(Stub.PASSWORD_PROPERTY))
+ {
+ if (authType.equals(StubExt.PROPERTY_AUTH_TYPE_BASIC))
+ {
+ metadata.put(remotingKey, val);
+ }
+ else
+ {
+ log.warn("Ignore '" + key + "' with auth
typy: " + authType);
+ }
+ }
+ else
+ {
+ metadata.put(remotingKey, val);
+ }
+ }
+
+ // pass properties to remoting client config
+ if (configMap.containsKey(key))
+ {
+ String remotingKey = configMap.get(key);
+ config.put(remotingKey, val);
+ }
+ }
+ }
+
+ return metadata;
+ }
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/SOAPContentElement.java (from
rev 1559,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPContentElement.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPContentElement.java 2006-12-06
00:29:48 UTC (rev 1559)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/SOAPContentElement.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -0,0 +1,1040 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ws.core.soap;
+
+// $Id$
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.Constants;
+import org.jboss.ws.WSException;
+import org.jboss.ws.core.CommonMessageContext;
+import org.jboss.ws.core.binding.BindingException;
+import org.jboss.ws.core.binding.DeserializerSupport;
+import org.jboss.ws.core.binding.SerializationContext;
+import org.jboss.ws.core.binding.SerializerSupport;
+import org.jboss.ws.core.soap.attachment.SwapableMemoryDataSource;
+import org.jboss.ws.extras.xop.XOPContext;
+import org.jboss.ws.jaxrpc.TypeMappingImpl;
+import org.jboss.ws.jaxrpc.encoding.DeserializerFactoryBase;
+import org.jboss.ws.jaxrpc.encoding.NullValueSerializer;
+import org.jboss.ws.jaxrpc.encoding.SerializerFactoryBase;
+import org.jboss.ws.metadata.umdm.ParameterMetaData;
+import org.jboss.ws.metadata.umdm.UnifiedMetaData;
+import org.jboss.ws.utils.DOMUtils;
+import org.jboss.ws.utils.DOMWriter;
+import org.jboss.ws.utils.JavaUtils;
+import org.jboss.ws.utils.MimeUtils;
+import org.w3c.dom.*;
+
+import javax.xml.namespace.QName;
+import javax.xml.soap.Name;
+import javax.xml.soap.SOAPElement;
+import javax.xml.soap.SOAPException;
+import javax.activation.DataHandler;
+import javax.activation.DataSource;
+import java.io.IOException;
+import java.io.Writer;
+import java.io.InputStream;
+import java.io.ByteArrayOutputStream;
+import java.lang.reflect.Array;
+import java.lang.reflect.Method;
+import java.util.Iterator;
+
+/**
+ * A SOAPElement that gives access to its content as XML fragment or Java object.
+ *
+ * The SOAPContentElement has three content representations, which may exist in
parallel.
+ * The getter and setter of the content properties perform the conversions.
+ * It is the responsibility of this objects to keep the representations in sync.
+ *
+ * +---------+ +-------------+ +-------------+
+ * | Object | <-----> | XMLFragment | <-----> | DOMTree |
+ * +---------+ +-------------+ +-------------+
+ *
+ * The idea is, that jaxrpc handlers can work with both the object and the dom view of
this SOAPElement.
+ * Note, that state transitions may be expensive.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 13-Dec-2004
+ */
+public class SOAPContentElement extends SOAPElementImpl
+{
+ // provide logging
+ private static Logger log = Logger.getLogger(SOAPContentElement.class);
+
+ // The well formed XML content of this element.
+ private String xmlFragment;
+ // The java object content of this element.
+ private Object objectValue;
+ // True if the current DOM tree is valid
+ private boolean isDOMValid;
+ // True if the current content object is valid
+ private boolean isObjectValid;
+ // True while expanding to DOM
+ private boolean expandingToDOM;
+
+ // The associated parameter
+ private ParameterMetaData paramMetaData;
+
+ /** Construct a SOAPContentElement
+ */
+ public SOAPContentElement(Name name)
+ {
+ super(name);
+ isDOMValid = true;
+ }
+
+ public SOAPContentElement(SOAPElementImpl element)
+ {
+ super(element);
+ isDOMValid = true;
+ }
+
+ public ParameterMetaData getParamMetaData()
+ {
+ if (paramMetaData == null)
+ throw new IllegalStateException("Parameter meta data not available");
+
+ return paramMetaData;
+ }
+
+ public void setParamMetaData(ParameterMetaData paramMetaData)
+ {
+ this.paramMetaData = paramMetaData;
+ }
+
+ public QName getXmlType()
+ {
+ return getParamMetaData().getXmlType();
+ }
+
+ public Class getJavaType()
+ {
+ return getParamMetaData().getJavaType();
+ }
+
+ public boolean isDOMValid()
+ {
+ return isDOMValid;
+ }
+
+ public boolean isObjectValid()
+ {
+ return isObjectValid;
+ }
+
+ public boolean isFragmentValid()
+ {
+ return xmlFragment != null;
+ }
+
+ public String getXMLFragment()
+ {
+ // Serialize the valueContent
+ if (xmlFragment == null && isObjectValid)
+ {
+ assertContentMapping();
+
+ QName xmlType = getXmlType();
+ Class javaType = getJavaType();
+ log.debug("getXMLFragment from Object [xmlType=" + xmlType +
",javaType=" + javaType + "]");
+
+ CommonMessageContext msgContext =
MessageContextAssociation.peekMessageContext();
+ if (msgContext == null)
+ throw new WSException("MessageContext not available");
+
+ SerializationContext serContext = msgContext.getSerializationContext();
+ serContext.setProperty(ParameterMetaData.class.getName(), getParamMetaData());
+
+ TypeMappingImpl typeMapping = serContext.getTypeMapping();
+
+ QName xmlName = getQName();
+ try
+ {
+ SerializerSupport ser;
+ if (objectValue != null)
+ {
+ SerializerFactoryBase serializerFactory =
getSerializerFactory(typeMapping, javaType, xmlType);
+ ser = (SerializerSupport)serializerFactory.getSerializer();
+ }
+ else
+ {
+ ser = new NullValueSerializer();
+ }
+
+ xmlFragment = ser.serialize(xmlName, xmlType, getObjectValue(), serContext,
null);
+ log.debug("xmlFragment: " + xmlFragment);
+ invalidateObjectContent();
+ }
+ catch (BindingException e)
+ {
+ throw new WSException(e);
+ }
+ }
+
+ // Generate the xmlFragment from the DOM tree
+ else if (xmlFragment == null && isDOMValid)
+ {
+ log.debug("getXMLFragment from DOM");
+ xmlFragment = DOMWriter.printNode(this, false);
+ log.debug("xmlFragment: " + xmlFragment);
+ invalidateDOMContent();
+ }
+
+ if (xmlFragment == null || xmlFragment.startsWith("<") == false)
+ throw new WSException("Invalid XMLFragment: " + xmlFragment);
+
+ return xmlFragment;
+ }
+
+ public void setXMLFragment(String xmlFragment)
+ {
+ log.debug("setXMLFragment: " + xmlFragment);
+
+ if (xmlFragment == null || xmlFragment.startsWith("<") == false)
+ throw new WSException("Invalid XMLFragment: " + xmlFragment);
+
+ removeContentsAsIs();
+ resetElementContent();
+
+ this.xmlFragment = xmlFragment;
+ invalidateDOMContent();
+ invalidateObjectContent();
+ }
+
+ public Object getObjectValue()
+ {
+ if (isObjectValid == false)
+ {
+ QName xmlType = getXmlType();
+ Class javaType = getJavaType();
+
+ log.debug("getObjectValue [xmlType=" + xmlType +
",javaType=" + javaType + "]");
+ assertContentMapping();
+
+ CommonMessageContext msgContext =
MessageContextAssociation.peekMessageContext();
+ if (msgContext == null)
+ throw new WSException("MessageContext not available");
+
+ SerializationContext serContext = msgContext.getSerializationContext();
+ serContext.setProperty(ParameterMetaData.class.getName(), getParamMetaData());
+
+ try
+ {
+ // Get the deserializer from the type mapping
+ TypeMappingImpl typeMapping = serContext.getTypeMapping();
+ DeserializerFactoryBase deserializerFactory =
getDeserializerFactory(typeMapping, javaType, xmlType);
+ DeserializerSupport des =
(DeserializerSupport)deserializerFactory.getDeserializer();
+
+ String strContent = getXMLFragment();
+
+ Object obj = des.deserialize(getQName(), xmlType, strContent, serContext);
+ if (obj != null)
+ {
+ Class objType = obj.getClass();
+ boolean isAssignable = JavaUtils.isAssignableFrom(javaType, objType);
+ if (isAssignable == false && javaType.isArray())
+ {
+ try
+ {
+ Method toArrayMethod = objType.getMethod("toArray", new
Class[] {});
+ Class returnType = toArrayMethod.getReturnType();
+ if (JavaUtils.isAssignableFrom(javaType, returnType))
+ {
+ Method getValueMethod = objType.getMethod("getValue",
new Class[] {});
+ Object value = getValueMethod.invoke(obj, new Object[] {});
+ if (value != null)
+ {
+ // Do not invoke toArray if getValue returns null
+ obj = toArrayMethod.invoke(obj, new Object[] {});
+ }
+ else
+ {
+ // if the fragment did not indicate a null return
+ // by an xsi:nil we return an empty array
+ Class componentType = javaType.getComponentType();
+ obj = Array.newInstance(componentType, 0);
+ }
+ isAssignable = true;
+ }
+ }
+ catch (Exception e)
+ {
+ // ignore
+ }
+ }
+
+ if (isAssignable == false)
+ {
+ // handle XOP simple types, i.e. in RPC/LIT
+ try
+ {
+ String contentType = MimeUtils.resolveMimeType(javaType);
+ log.debug("Adopt DataHandler to " + javaType +",
contentType "+ contentType);
+
+ DataSource ds = new
SwapableMemoryDataSource(((DataHandler)obj).getInputStream(), contentType);
+ DataHandler dh = new DataHandler(ds);
+ obj = dh.getContent();
+
+ // 'application/octet-stream' will return a byte[] instead
fo the stream
+ if(obj instanceof InputStream)
+ {
+ ByteArrayOutputStream bout = new ByteArrayOutputStream();
+ dh.writeTo(bout);
+ obj = bout.toByteArray();
+ }
+ }
+ catch (IOException e)
+ {
+ throw new WSException("Failed to adopt XOP content type",
e);
+ }
+
+ if(!JavaUtils.isAssignableFrom(javaType, obj.getClass()))
+ {
+ throw new WSException("Java type '" + javaType +
"' is not assignable from: " + objType.getName());
+ }
+ }
+ }
+
+ this.objectValue = obj;
+ this.isObjectValid = true;
+ }
+ catch (BindingException e)
+ {
+ throw new WSException(e);
+ }
+
+ log.debug("objectValue: " + (objectValue != null ?
objectValue.getClass().getName() : null));
+ }
+
+ return objectValue;
+ }
+
+ public void setObjectValue(Object objValue)
+ {
+ log.debug("setObjectValue: " + objValue);
+ removeContentsAsIs();
+ resetElementContent();
+ this.objectValue = objValue;
+ this.isObjectValid = true;
+ }
+
+ private void removeContentsAsIs()
+ {
+ log.trace("removeContentsAsIs");
+ boolean cachedFlag = isDOMValid;
+ try
+ {
+ this.isDOMValid = true;
+ super.removeContents();
+ }
+ finally
+ {
+ this.isDOMValid = cachedFlag;
+ }
+ }
+
+ // Get the serializer factory for a given javaType and xmlType
+ private SerializerFactoryBase getSerializerFactory(TypeMappingImpl typeMapping, Class
javaType, QName xmlType)
+ {
+ SerializerFactoryBase serializerFactory =
(SerializerFactoryBase)typeMapping.getSerializer(javaType, xmlType);
+
+ // The type mapping might contain a mapping for the array wrapper bean
+ if (serializerFactory == null && javaType.isArray())
+ {
+ Class arrayWrapperType = typeMapping.getJavaType(xmlType);
+ if (arrayWrapperType != null)
+ {
+ try
+ {
+ Method toArrayMethod = arrayWrapperType.getMethod("toArray", new
Class[] {});
+ Class returnType = toArrayMethod.getReturnType();
+ if (JavaUtils.isAssignableFrom(javaType, returnType))
+ {
+ serializerFactory =
(SerializerFactoryBase)typeMapping.getSerializer(arrayWrapperType, xmlType);
+ }
+ }
+ catch (NoSuchMethodException e)
+ {
+ // ignore
+ }
+ }
+ }
+
+ if (serializerFactory == null)
+ throw new WSException("Cannot obtain serializer factory for:
[xmlType=" + xmlType + ",javaType=" + javaType + "]");
+
+ return serializerFactory;
+ }
+
+ // Get the deserializer factory for a given javaType and xmlType
+ private DeserializerFactoryBase getDeserializerFactory(TypeMappingImpl typeMapping,
Class javaType, QName xmlType)
+ {
+ DeserializerFactoryBase deserializerFactory =
(DeserializerFactoryBase)typeMapping.getDeserializer(javaType, xmlType);
+
+ // The type mapping might contain a mapping for the array wrapper bean
+ if (deserializerFactory == null && javaType.isArray())
+ {
+ Class arrayWrapperType = typeMapping.getJavaType(xmlType);
+ if (arrayWrapperType != null)
+ {
+ try
+ {
+ Method toArrayMethod = arrayWrapperType.getMethod("toArray", new
Class[] {});
+ Class returnType = toArrayMethod.getReturnType();
+ if (JavaUtils.isAssignableFrom(javaType, returnType))
+ {
+ deserializerFactory =
(DeserializerFactoryBase)typeMapping.getDeserializer(arrayWrapperType, xmlType);
+ }
+ }
+ catch (NoSuchMethodException e)
+ {
+ // ignore
+ }
+ }
+ }
+
+ if (deserializerFactory == null)
+ throw new WSException("Cannot obtain deserializer factory for:
[xmlType=" + xmlType + ",javaType=" + javaType + "]");
+
+ return deserializerFactory;
+ }
+
+ /** Assert the notNull state of the xmlType and javaType
+ */
+ private void assertContentMapping()
+ {
+ if (getJavaType() == null)
+ throw new WSException("javaType cannot be null");
+ if (getXmlType() == null)
+ throw new WSException("xmlType cannot be null");
+ }
+
+ // SOAPElement interface
********************************************************************************************
+
+ public SOAPElement addChildElement(SOAPElement child) throws SOAPException
+ {
+ log.trace("addChildElement: " + child);
+ expandToDOM();
+ SOAPElement soapElement = super.addChildElement(child);
+ invalidateObjectContent();
+ invalidateXMLContent();
+ return soapElement;
+ }
+
+ public SOAPElement addChildElement(String localName, String prefix) throws
SOAPException
+ {
+ log.trace("addChildElement: [localName=" + localName +
",prefix=" + prefix + "]");
+ expandToDOM();
+ SOAPElement soapElement = super.addChildElement(localName, prefix);
+ invalidateObjectContent();
+ invalidateXMLContent();
+ return soapElement;
+ }
+
+ public SOAPElement addChildElement(String localName, String prefix, String uri) throws
SOAPException
+ {
+ log.trace("addChildElement: [localName=" + localName +
",prefix=" + prefix + ",uri=" + uri + "]");
+ expandToDOM();
+ SOAPElement soapElement = super.addChildElement(localName, prefix, uri);
+ invalidateObjectContent();
+ invalidateXMLContent();
+ return soapElement;
+ }
+
+ public SOAPElement addChildElement(Name name) throws SOAPException
+ {
+ log.trace("addChildElement: [name=" + name + "]");
+ expandToDOM();
+ SOAPElement soapElement = super.addChildElement(name);
+ invalidateObjectContent();
+ invalidateXMLContent();
+ return soapElement;
+ }
+
+ public SOAPElement addChildElement(String name) throws SOAPException
+ {
+ log.trace("addChildElement: [name=" + name + "]");
+ expandToDOM();
+ SOAPElement soapElement = super.addChildElement(name);
+ invalidateObjectContent();
+ invalidateXMLContent();
+ return soapElement;
+ }
+
+ public SOAPElement addTextNode(String value) throws SOAPException
+ {
+ log.trace("addTextNode: [value=" + value + "]");
+ expandToDOM();
+ SOAPElement soapElement = super.addTextNode(value);
+ invalidateObjectContent();
+ invalidateXMLContent();
+ return soapElement;
+ }
+
+ public Iterator getChildElements()
+ {
+ log.trace("getChildElements");
+ expandToDOM();
+ return super.getChildElements();
+ }
+
+ public Iterator getChildElements(Name name)
+ {
+ log.trace("getChildElements: [name=" + name + "]");
+ expandToDOM();
+ return super.getChildElements(name);
+ }
+
+ public void removeContents()
+ {
+ log.trace("removeContents");
+ expandToDOM();
+ super.removeContents();
+ invalidateObjectContent();
+ invalidateXMLContent();
+ }
+
+ public Iterator getAllAttributes()
+ {
+ return super.getAllAttributes();
+ }
+
+ public String getAttribute(String name)
+ {
+ return super.getAttribute(name);
+ }
+
+ public Attr getAttributeNode(String name)
+ {
+ return super.getAttributeNode(name);
+ }
+
+ public Attr getAttributeNodeNS(String namespaceURI, String localName)
+ {
+ return super.getAttributeNodeNS(namespaceURI, localName);
+ }
+
+ public String getAttributeNS(String namespaceURI, String localName)
+ {
+ return super.getAttributeNS(namespaceURI, localName);
+ }
+
+ public String getAttributeValue(Name name)
+ {
+ return super.getAttributeValue(name);
+ }
+
+ public SOAPElement addAttribute(Name name, String value) throws SOAPException
+ {
+ log.trace("addAttribute: [name=" + name + ",value=" + value +
"]");
+ expandToDOM();
+ return super.addAttribute(name, value);
+ }
+
+ public SOAPElement addNamespaceDeclaration(String prefix, String nsURI)
+ {
+ log.trace("addNamespaceDeclaration: [prefix=" + prefix +
",nsURI=" + nsURI + "]");
+ expandToDOM();
+ return super.addNamespaceDeclaration(prefix, nsURI);
+ }
+
+ public Name getElementName()
+ {
+ return super.getElementName();
+ }
+
+ public NodeList getElementsByTagName(String name)
+ {
+ log.trace("getElementsByTagName: [name=" + name + "]");
+ expandToDOM();
+ return super.getElementsByTagName(name);
+ }
+
+ public NodeList getElementsByTagNameNS(String namespaceURI, String localName)
+ {
+ log.trace("getElementsByTagName: [nsURI=" + namespaceURI +
",localName=" + localName + "]");
+ expandToDOM();
+ return super.getElementsByTagNameNS(namespaceURI, localName);
+ }
+
+ public String getEncodingStyle()
+ {
+ return super.getEncodingStyle();
+ }
+
+ public Iterator getNamespacePrefixes()
+ {
+ return super.getNamespacePrefixes();
+ }
+
+ public String getNamespaceURI(String prefix)
+ {
+ return super.getNamespaceURI(prefix);
+ }
+
+ public TypeInfo getSchemaTypeInfo()
+ {
+ return super.getSchemaTypeInfo();
+ }
+
+ public String getTagName()
+ {
+ return super.getTagName();
+ }
+
+ public Iterator getVisibleNamespacePrefixes()
+ {
+ return super.getVisibleNamespacePrefixes();
+ }
+
+ public boolean hasAttribute(String name)
+ {
+ return super.hasAttribute(name);
+ }
+
+ public boolean hasAttributeNS(String namespaceURI, String localName)
+ {
+ return super.hasAttributeNS(namespaceURI, localName);
+ }
+
+ public boolean removeAttribute(Name name)
+ {
+ log.trace("removeAttribute: " + name.getQualifiedName());
+ expandToDOM();
+ return super.removeAttribute(name);
+ }
+
+ public void removeAttribute(String name) throws DOMException
+ {
+ log.trace("removeAttribute: " + name);
+ expandToDOM();
+ super.removeAttribute(name);
+ }
+
+ public Attr removeAttributeNode(Attr oldAttr) throws DOMException
+ {
+ log.trace("removeAttribute: " + oldAttr.getNodeName());
+ expandToDOM();
+ return super.removeAttributeNode(oldAttr);
+ }
+
+ public void removeAttributeNS(String namespaceURI, String localName) throws
DOMException
+ {
+ log.trace("removeAttributeNS: {" + namespaceURI + "}" +
localName);
+ expandToDOM();
+ super.removeAttributeNS(namespaceURI, localName);
+ }
+
+ public boolean removeNamespaceDeclaration(String prefix)
+ {
+ log.trace("removeNamespaceDeclaration: " + prefix);
+ expandToDOM();
+ return super.removeNamespaceDeclaration(prefix);
+ }
+
+ public void setAttribute(String name, String value) throws DOMException
+ {
+ log.trace("setAttribute: [name=" + name + ",value=" + value +
"]");
+ expandToDOM();
+ super.setAttribute(name, value);
+ }
+
+ public Attr setAttributeNode(Attr newAttr) throws DOMException
+ {
+ log.trace("setAttributeNode: " + newAttr);
+ expandToDOM();
+ return super.setAttributeNode(newAttr);
+ }
+
+ public Attr setAttributeNodeNS(Attr newAttr) throws DOMException
+ {
+ log.trace("setAttributeNodeNS: " + newAttr);
+ expandToDOM();
+ return super.setAttributeNodeNS(newAttr);
+ }
+
+ public void setAttributeNS(String namespaceURI, String qualifiedName, String value)
throws DOMException
+ {
+ log.trace("setAttribute: [nsURI=" + namespaceURI + ",name=" +
qualifiedName + ",value=" + value + "]");
+ expandToDOM();
+ super.setAttributeNS(namespaceURI, qualifiedName, value);
+ }
+
+ public void setEncodingStyle(String encodingStyle) throws SOAPException
+ {
+ super.setEncodingStyle(encodingStyle);
+ }
+
+ public void setIdAttribute(String name, boolean isId) throws DOMException
+ {
+ log.trace("setIdAttribute: [name=" + name + ",value=" + isId +
"]");
+ expandToDOM();
+ super.setIdAttribute(name, isId);
+ }
+
+ public void setIdAttributeNode(Attr idAttr, boolean isId) throws DOMException
+ {
+ log.trace("setIdAttributeNode: [idAttr=" + idAttr + ",value=" +
isId + "]");
+ expandToDOM();
+ super.setIdAttributeNode(idAttr, isId);
+ }
+
+ public void setIdAttributeNS(String namespaceURI, String localName, boolean isId)
throws DOMException
+ {
+ log.trace("setIdAttributeNS: [nsURI=" + namespaceURI + ",name="
+ localName + ",value=" + isId + "]");
+ expandToDOM();
+ super.setIdAttributeNS(namespaceURI, localName, isId);
+ }
+
+ // Node interface
**************************************************************************************************
+
+ public Node appendChild(Node newChild) throws DOMException
+ {
+ log.trace("appendChild: " + newChild);
+ expandToDOM();
+ Node node = super.appendChild(newChild);
+ invalidateObjectContent();
+ invalidateXMLContent();
+ return node;
+ }
+
+ public Node cloneNode(boolean deep)
+ {
+ log.trace("cloneNode: deep=" + deep);
+ expandToDOM();
+ return super.cloneNode(deep);
+ }
+
+ public NodeList getChildNodes()
+ {
+ log.trace("getChildNodes");
+ expandToDOM();
+ return super.getChildNodes();
+ }
+
+ public Node getFirstChild()
+ {
+ log.trace("getFirstChild");
+ expandToDOM();
+ return super.getFirstChild();
+ }
+
+ public Node getLastChild()
+ {
+ log.trace("getLastChild");
+ expandToDOM();
+ return super.getLastChild();
+ }
+
+ public String getValue()
+ {
+ log.trace("getValue");
+ expandToDOM();
+ return super.getValue();
+ }
+
+ public boolean hasChildNodes()
+ {
+ log.trace("hasChildNodes");
+ expandToDOM();
+ return super.hasChildNodes();
+ }
+
+ public Node removeChild(Node oldChild) throws DOMException
+ {
+ log.trace("removeChild: " + oldChild);
+ expandToDOM();
+ Node node = super.removeChild(oldChild);
+ invalidateObjectContent();
+ invalidateXMLContent();
+ return node;
+ }
+
+ public Node replaceChild(Node newChild, Node oldChild) throws DOMException
+ {
+ log.trace("replaceChild: [new=" + newChild + ",old=" + oldChild
+ "]");
+ expandToDOM();
+ Node node = super.replaceChild(newChild, oldChild);
+ invalidateObjectContent();
+ invalidateXMLContent();
+ return node;
+ }
+
+ public void setValue(String value)
+ {
+ log.trace("setValue: " + value);
+ expandToDOM();
+ super.setValue(value);
+ invalidateObjectContent();
+ invalidateXMLContent();
+ }
+
+ public NamedNodeMap getAttributes()
+ {
+ return super.getAttributes();
+ }
+
+ public boolean hasAttributes()
+ {
+ return super.hasAttributes();
+ }
+
+ // END Node interface
***********************************************************************************************
+
+ /** Expand the content, generating appropriate child nodes
+ */
+ private void expandToDOM()
+ {
+ // SOAPContentElements should only be expanded when handlers do require it.
+ if (isDOMValid == false && expandingToDOM == false)
+ {
+ log.trace("BEGIN: expandToDOM " + getElementName());
+ expandingToDOM = true;
+
+ // DOM expansion should only happen when a handler accesses the DOM API.
+ CommonMessageContext msgContext =
MessageContextAssociation.peekMessageContext();
+ if (msgContext != null && !UnifiedMetaData.isFinalRelease())
+ {
+ Boolean allowExpand =
(Boolean)msgContext.getProperty(CommonMessageContext.ALLOW_EXPAND_TO_DOM);
+ if (Boolean.TRUE.equals(allowExpand) == false)
+ throw new WSException("Expanding content element to DOM");
+ }
+
+ try
+ {
+ if (xmlFragment == null && isObjectValid)
+ xmlFragment = getXMLFragment();
+
+ if (xmlFragment == null && isObjectValid == false)
+ throw new IllegalStateException("Neither DOM, nor XML, nor Object
valid");
+
+ if (xmlFragment != null)
+ {
+ String wrappedXMLFragment =
insertNamespaceDeclarations("<wrapper>" + xmlFragment +
"</wrapper>");
+ Element contentRoot = DOMUtils.parse(wrappedXMLFragment);
+ contentRoot = DOMUtils.getFirstChildElement(contentRoot);
+
+ String rootLocalName = contentRoot.getLocalName();
+ String rootPrefix = contentRoot.getPrefix();
+ String rootNS = contentRoot.getNamespaceURI();
+ Name contentRootName = new NameImpl(rootLocalName, rootPrefix, rootNS);
+
+ // Make sure the content root element name matches this element name
+ Name name = getElementName();
+ if (contentRootName.equals(name) == false)
+ throw new WSException("Content root name does not match element
name: " + contentRootName + " != " + name);
+
+ // Copy attributes
+ DOMUtils.copyAttributes(this, contentRoot);
+
+ SOAPFactoryImpl soapFactory = new SOAPFactoryImpl();
+
+ NodeList nlist = contentRoot.getChildNodes();
+ for (int i = 0; i < nlist.getLength(); i++)
+ {
+ Node child = nlist.item(i);
+ short childType = child.getNodeType();
+ if (childType == Node.ELEMENT_NODE)
+ {
+ SOAPElementImpl soapElement =
soapFactory.createElement((Element)child, true);
+ super.addChildElement(soapElement);
+ if (Constants.NAME_XOP_INCLUDE.equals(name) || isXOPParameter())
+ XOPContext.inlineXOPData(soapElement);
+ }
+ else if (childType == Node.TEXT_NODE)
+ {
+ String nodeValue = child.getNodeValue();
+ super.addTextNode(nodeValue);
+ }
+ else if (childType == Node.CDATA_SECTION_NODE)
+ {
+ String nodeValue = child.getNodeValue();
+ super.addTextNode(nodeValue);
+ }
+ else
+ {
+ log.trace("Ignore child type: " + childType);
+ }
+ }
+ }
+
+ isDOMValid = true;
+ }
+ catch (RuntimeException e)
+ {
+ invalidateDOMContent();
+ throw e;
+ }
+ catch (Exception e)
+ {
+ invalidateDOMContent();
+ throw new WSException(e);
+ }
+ finally
+ {
+ expandingToDOM = false;
+ log.trace("END: expandToDOM " + getElementName());
+ }
+
+ invalidateXMLContent();
+ invalidateObjectContent();
+ }
+ }
+
+ public String insertNamespaceDeclarations(String xmlfragment)
+ {
+ StringBuilder xmlBuffer = new StringBuilder(xmlfragment);
+
+ int endIndex = xmlfragment.indexOf(">");
+ int insIndex = endIndex;
+ if (xmlfragment.charAt(insIndex - 1) == '/')
+ insIndex = insIndex - 1;
+
+ SOAPElement soapElement = this;
+ while (soapElement != null)
+ {
+ Iterator it = soapElement.getNamespacePrefixes();
+ while (it.hasNext())
+ {
+ String prefix = (String)it.next();
+ String nsURI = soapElement.getNamespaceURI(prefix);
+ String nsDecl = " xmlns:" + prefix + "='" + nsURI +
"'";
+
+ // Make sure there is not a duplicate on just the wrapper tag
+ int nsIndex = xmlBuffer.indexOf("xmlns:" + prefix);
+ if (nsIndex < 0 || nsIndex > endIndex)
+ {
+ xmlBuffer.insert(insIndex, nsDecl);
+ endIndex += nsDecl.length();
+ }
+ }
+ soapElement = soapElement.getParentElement();
+ }
+
+ log.trace("insertNamespaceDeclarations: " + xmlBuffer);
+ return xmlBuffer.toString();
+ }
+
+ private void invalidateDOMContent()
+ {
+ if (expandingToDOM == false)
+ {
+ log.trace("invalidateDOMContent");
+ this.isDOMValid = false;
+ }
+ }
+
+ private void invalidateObjectContent()
+ {
+ if (expandingToDOM == false)
+ {
+ log.trace("invalidateObjectContent");
+ this.isObjectValid = false;
+ this.objectValue = null;
+ }
+ }
+
+ private void invalidateXMLContent()
+ {
+ if (expandingToDOM == false)
+ {
+ log.trace("invalidateXMLContent");
+ this.xmlFragment = null;
+ }
+ }
+
+ private void resetElementContent()
+ {
+ if (expandingToDOM == false)
+ {
+ log.trace("resetElementContent");
+ invalidateDOMContent();
+ invalidateObjectContent();
+ invalidateXMLContent();
+ }
+ }
+
+ public void writeElement(Writer writer) throws IOException
+ {
+ handleMTOMTransitions();
+
+ if (isDOMValid)
+ {
+ new DOMWriter(writer).print(this);
+ }
+ else
+ {
+ writer.write(getXMLFragment());
+ }
+ }
+
+ /**
+ * When a SOAPContentElement transitions between dom-valid and xml-valid
+ * the XOP elements need to transition from XOP optimized to base64 and
reverse.<p>
+ *
+ * If MTOM is disabled through a message context property we always enforce the
+ * base64 representation by expanding to DOM, the same happens when a JAXRPC handler
+ * accesses the SOAPContentElement.<p>
+ *
+ * If the element is in dom-valid state (because a handlers accessed it), upon
marshalling
+ * it's needs to be decided wether or not the <code>xop:Include</code>
should be restored.
+ * This as well depends upon the message context property.
+ */
+ public void handleMTOMTransitions()
+ {
+ // MTOM processing is only required on XOP parameters
+ if( isXOPParameter() == false)
+ return;
+
+ if ( !XOPContext.isMTOMEnabled() )
+ {
+ // If MTOM is disabled, we force dom expansion on XOP parameters.
+ // This will inline any XOP include element and remove the attachment part.
+ // See SOAPFactoryImpl for details.
+
+ log.debug("MTOM disabled: Force inline XOP data");
+ CommonMessageContext msgContext =
MessageContextAssociation.peekMessageContext();
+ msgContext.setProperty(CommonMessageContext.ALLOW_EXPAND_TO_DOM, Boolean.TRUE);
+ expandToDOM();
+ }
+ else if ( isDOMValid && XOPContext.isMTOMEnabled() )
+ {
+ // When the DOM representation is valid,
+ // but MTOM is enabled we need to convert the inlined
+ // element back to an xop:Include element and create the attachment part
+
+ log.debug("MTOM enabled: Restore XOP data");
+ XOPContext.restoreXOPDataDOM(this);
+ }
+ }
+
+ private boolean isXOPParameter()
+ {
+ return paramMetaData != null && paramMetaData.isXOP();
+ }
+
+ public void accept(SAAJVisitor visitor)
+ {
+ visitor.visitSOAPContentElement(this);
+ }
+}
Copied: branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/SOAPDocument.java
(from rev 1557,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPDocument.java)
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPDocument.java 2006-12-05
23:29:55 UTC (rev 1557)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/SOAPDocument.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -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.core.soap;
+
+import org.jboss.ws.utils.DOMUtils;
+import org.w3c.dom.Attr;
+import org.w3c.dom.CDATASection;
+import org.w3c.dom.Comment;
+import org.w3c.dom.DOMConfiguration;
+import org.w3c.dom.DOMException;
+import org.w3c.dom.DOMImplementation;
+import org.w3c.dom.Document;
+import org.w3c.dom.DocumentFragment;
+import org.w3c.dom.DocumentType;
+import org.w3c.dom.Element;
+import org.w3c.dom.EntityReference;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.w3c.dom.ProcessingInstruction;
+import org.w3c.dom.Text;
+import org.w3c.dom.UserDataHandler;
+
+/**
+ * <code>SOAPDocument</code> ensures that the propper SAAJ elements are
+ * returned when Document calls are made from a DOM client. This implementation
+ * enscapsulates a single ThreadLocal Document object.
+ *
+ * @author <a href="mailto:jason.greene@jboss.com">Jason T.
Greene</a>
+ * @version $Revision$
+ */
+public class SOAPDocument implements Document
+{
+ // TODO Revisit methods that are restricted or not implemented.
+
+ private Document doc = DOMUtils.getOwnerDocument();
+
+ // Document methods
+
+ public DocumentType getDoctype()
+ {
+ return doc.getDoctype();
+ }
+
+ public DOMImplementation getImplementation()
+ {
+ // Should this be allowed?
+ return doc.getImplementation();
+ }
+
+ public Element getDocumentElement()
+ {
+ // The base SOAPDocument does not have an element, only SOAPPart will
+ return null;
+ }
+
+ public Element createElement(String tagName) throws DOMException
+ {
+ return new SOAPElementImpl(tagName);
+ }
+
+ public DocumentFragment createDocumentFragment()
+ {
+ return doc.createDocumentFragment();
+ }
+
+ public Text createTextNode(String data)
+ {
+ return doc.createTextNode(data);
+ }
+
+ public Comment createComment(String data)
+ {
+ return doc.createComment(data);
+ }
+
+ public CDATASection createCDATASection(String data) throws DOMException
+ {
+ return createCDATASection(data);
+ }
+
+ public ProcessingInstruction createProcessingInstruction(String target, String data)
throws DOMException
+ {
+ return createProcessingInstruction(target, data);
+ }
+
+ public Attr createAttribute(String name) throws DOMException
+ {
+ return doc.createAttribute(name);
+ }
+
+ public EntityReference createEntityReference(String name) throws DOMException
+ {
+ // Not allowed
+ return null;
+ }
+
+ public NodeList getElementsByTagName(String tagname)
+ {
+ // The base SOAPDocument does not have an element, only SOAPPart will
+ return null;
+ }
+
+ public Node importNode(Node importedNode, boolean deep) throws DOMException
+ {
+ // This should never be needed
+ return doc.importNode(importedNode, deep);
+ }
+
+ public Element createElementNS(String namespaceURI, String qualifiedName) throws
DOMException
+ {
+ int loc = qualifiedName.indexOf(":");
+
+ if (loc == -1)
+ return new SOAPElementImpl(qualifiedName, null, namespaceURI);
+
+ if (loc == qualifiedName.length() - 1)
+ throw new IllegalArgumentException("Invalid qualified name");
+
+ return new SOAPElementImpl(qualifiedName.substring(loc + 1),
qualifiedName.substring(0, loc), namespaceURI);
+ }
+
+ public Attr createAttributeNS(String namespaceURI, String qualifiedName) throws
DOMException
+ {
+ return doc.createAttributeNS(namespaceURI, qualifiedName);
+ }
+
+ public NodeList getElementsByTagNameNS(String namespaceURI, String localName)
+ {
+ // The base SOAPDocument does not have an element, only SOAPPart will
+ return null;
+ }
+
+ public Element getElementById(String elementId)
+ {
+ // The base SOAPDocument does not have an element, only SOAPPart will
+ return null;
+ }
+
+ // Node methods
+ public String getNodeName()
+ {
+ return doc.getNodeName();
+ }
+
+ public String getNodeValue() throws DOMException
+ {
+ throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Node operations not
allowed on SOAPDocument");
+ }
+
+ public void setNodeValue(String nodeValue) throws DOMException
+ {
+ throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Node operations not
allowed on SOAPDocument");
+ }
+
+ public short getNodeType()
+ {
+ return doc.getNodeType();
+ }
+
+ public Node getParentNode()
+ {
+ throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Node operations not
allowed on SOAPDocument");
+ }
+
+ public NodeList getChildNodes()
+ {
+ throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Node operations not
allowed on SOAPDocument");
+ }
+
+ public Node getFirstChild()
+ {
+ throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Node operations not
allowed on SOAPDocument");
+ }
+
+ public Node getLastChild()
+ {
+ throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Node operations not
allowed on SOAPDocument");
+ }
+
+ public Node getPreviousSibling()
+ {
+ throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Node operations not
allowed on SOAPDocument");
+ }
+
+ public Node getNextSibling()
+ {
+ throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Node operations not
allowed on SOAPDocument");
+ }
+
+ public NamedNodeMap getAttributes()
+ {
+ throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Node operations not
allowed on SOAPDocument");
+ }
+
+ public Document getOwnerDocument()
+ {
+ throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Node operations not
allowed on SOAPDocument");
+ }
+
+ public Node insertBefore(Node newChild, Node refChild) throws DOMException
+ {
+ throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Node operations not
allowed on SOAPDocument");
+ }
+
+ public Node replaceChild(Node newChild, Node oldChild) throws DOMException
+ {
+ throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Node operations not
allowed on SOAPDocument");
+ }
+
+ public Node removeChild(Node oldChild) throws DOMException
+ {
+ throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Node operations not
allowed on SOAPDocument");
+ }
+
+ public Node appendChild(Node newChild) throws DOMException
+ {
+ throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Node operations not
allowed on SOAPDocument");
+ }
+
+ public boolean hasChildNodes()
+ {
+ throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Node operations not
allowed on SOAPDocument");
+ }
+
+ public Node cloneNode(boolean deep)
+ {
+ throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Node operations not
allowed on SOAPDocument");
+ }
+
+ public void normalize()
+ {
+ throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Node operations not
allowed on SOAPDocument");
+ }
+
+ public boolean isSupported(String feature, String version)
+ {
+ throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Node operations not
allowed on SOAPDocument");
+ }
+
+ public String getNamespaceURI()
+ {
+ throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Node operations not
allowed on SOAPDocument");
+ }
+
+ public String getPrefix()
+ {
+ throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Node operations not
allowed on SOAPDocument");
+ }
+
+ public void setPrefix(String prefix) throws DOMException
+ {
+ throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Node operations not
allowed on SOAPDocument");
+ }
+
+ public String getLocalName()
+ {
+ throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Node operations not
allowed on SOAPDocument");
+ }
+
+ public boolean hasAttributes()
+ {
+ throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Node operations not
allowed on SOAPDocument");
+ }
+
+ // DOM3 methods
+
+ public String getInputEncoding()
+ {
+ // FIXME getInputEncoding
+ return null;
+ }
+
+ public String getXmlEncoding()
+ {
+ // FIXME getXmlEncoding
+ return null;
+ }
+
+ public boolean getXmlStandalone()
+ {
+ // FIXME getXmlStandalone
+ return false;
+ }
+
+ public void setXmlStandalone(boolean arg0) throws DOMException
+ {
+ // FIXME setXmlStandalone
+ }
+
+ public String getXmlVersion()
+ {
+ // FIXME getXmlVersion
+ return null;
+ }
+
+ public void setXmlVersion(String arg0) throws DOMException
+ {
+ // FIXME setXmlVersion
+ }
+
+ public boolean getStrictErrorChecking()
+ {
+ // FIXME getStrictErrorChecking
+ return false;
+ }
+
+ public void setStrictErrorChecking(boolean arg0)
+ {
+ // FIXME setStrictErrorChecking
+
+ }
+
+ public String getDocumentURI()
+ {
+ // FIXME getDocumentURI
+ return null;
+ }
+
+ public void setDocumentURI(String arg0)
+ {
+ // FIXME setDocumentURI
+
+ }
+
+ public Node adoptNode(Node arg0) throws DOMException
+ {
+ // FIXME adoptNode
+ return null;
+ }
+
+ public DOMConfiguration getDomConfig()
+ {
+ // FIXME getDomConfig
+ return null;
+ }
+
+ public void normalizeDocument()
+ {
+ // FIXME normalizeDocument
+
+ }
+
+ public Node renameNode(Node arg0, String arg1, String arg2) throws DOMException
+ {
+ // FIXME renameNode
+ return null;
+ }
+
+ public String getBaseURI()
+ {
+ // FIXME getBaseURI
+ return null;
+ }
+
+ public short compareDocumentPosition(Node arg0) throws DOMException
+ {
+ // FIXME compareDocumentPosition
+ return 0;
+ }
+
+ public String getTextContent() throws DOMException
+ {
+ // FIXME getTextContent
+ return null;
+ }
+
+ public void setTextContent(String arg0) throws DOMException
+ {
+ // FIXME setTextContent
+
+ }
+
+ public boolean isSameNode(Node arg0)
+ {
+ // FIXME isSameNode
+ return false;
+ }
+
+ public String lookupPrefix(String arg0)
+ {
+ // FIXME lookupPrefix
+ return null;
+ }
+
+ public boolean isDefaultNamespace(String arg0)
+ {
+ // FIXME isDefaultNamespace
+ return false;
+ }
+
+ public String lookupNamespaceURI(String arg0)
+ {
+ // FIXME lookupNamespaceURI
+ return null;
+ }
+
+ public boolean isEqualNode(Node arg0)
+ {
+ // FIXME isEqualNode
+ return false;
+ }
+
+ public Object getFeature(String arg0, String arg1)
+ {
+ // FIXME getFeature
+ return null;
+ }
+
+ public Object setUserData(String arg0, Object arg1, UserDataHandler arg2)
+ {
+ // FIXME setUserData
+ return null;
+ }
+
+ public Object getUserData(String arg0)
+ {
+ // FIXME getUserData
+ return null;
+ }
+}
\ No newline at end of file
Copied: branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/SOAPElementImpl.java
(from rev 1557,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPElementImpl.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPElementImpl.java 2006-12-05
23:29:55 UTC (rev 1557)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/SOAPElementImpl.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -0,0 +1,738 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ws.core.soap;
+
+// $Id$
+
+import java.io.IOException;
+import java.io.Writer;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+import javax.xml.soap.Name;
+import javax.xml.soap.Node;
+import javax.xml.soap.SOAPElement;
+import javax.xml.soap.SOAPEnvelope;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.Text;
+
+import org.jboss.logging.Logger;
+import org.jboss.util.NotImplementedException;
+import org.jboss.ws.utils.DOMUtils;
+import org.jboss.ws.Constants;
+import org.jboss.ws.WSException;
+import org.w3c.dom.Attr;
+import org.w3c.dom.DOMException;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.NodeList;
+import org.w3c.dom.TypeInfo;
+
+/**
+ * An object representing an element of a SOAP message that is allowed but not
specifically prescribed by a
+ * SOAP specification. This interface serves as the base interface for those objects that
are specifically
+ * prescribed by a SOAP specification.
+ *
+ * Methods in this interface that are required to return SAAJ specific objects may
"silently" replace nodes
+ * in the tree as required to successfully return objects of the correct type.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ */
+public class SOAPElementImpl extends NodeImpl implements SOAPElement, SAAJVisitable
+{
+ // provide logging
+ private static Logger log = Logger.getLogger(SOAPElementImpl.class);
+
+ // The org.w3c.dom.Element
+ private Element element;
+ // The element name
+ private Name elementName;
+ // The element's encoding style
+ private String encodingStyle = Constants.URI_LITERAL_ENC;
+
+ /** Called by SOAPFactory */
+ public SOAPElementImpl(String localPart)
+ {
+
+ super(DOMUtils.createElement(localPart, null, null));
+ this.element = (Element)domNode;
+ log.trace("new SOAPElementImpl: " + getElementName());
+ }
+
+ /** Called by SOAPFactory */
+ public SOAPElementImpl(String localPart, String prefix, String nsURI)
+ {
+ super(DOMUtils.createElement(localPart, prefix, nsURI));
+ this.element = (Element)domNode;
+ log.trace("new SOAPElementImpl: " + getElementName());
+ }
+
+ /** Called by SOAPFactory */
+ public SOAPElementImpl(Name name)
+ {
+ this(name.getLocalName(), name.getPrefix(), name.getURI());
+ }
+
+ /** Copy constructor for converting SOAPElement types
+ */
+ protected SOAPElementImpl(SOAPElementImpl element)
+ {
+ super(element);
+ this.element = (Element)domNode;
+ log.trace("new SOAPElementImpl: " + getElementName());
+ }
+
+ /** Get the SOAPEnvelope for this SOAPElement */
+ public SOAPEnvelope getSOAPEnvelope()
+ {
+ SOAPElement soapElement = this;
+ while (soapElement != null && (soapElement instanceof SOAPEnvelope) ==
false)
+ soapElement = soapElement.getParentElement();
+
+ return (SOAPEnvelope)soapElement;
+ }
+
+ // javax.xml.soap.SOAPElement
*************************************************************************************
+
+ /**
+ * Adds an attribute with the specified name and value to this SOAPElement object.
+ *
+ * @param name a Name object with the name of the attribute
+ * @param value a String giving the value of the attribute
+ * @return the SOAPElement object into which the attribute was inserted
+ * @throws javax.xml.soap.SOAPException if there is an error in creating the
Attribute
+ */
+ public SOAPElement addAttribute(Name name, String value) throws SOAPException
+ {
+ // xml:lang='en'
+ if ("xml".equals(name.getPrefix()))
+ {
+ setAttribute(name.getQualifiedName(), value);
+ }
+ else
+ {
+ setAttributeNS(name.getURI(), name.getQualifiedName(), value);
+ }
+ return this;
+ }
+
+ /**
+ * Creates a new SOAPElement object initialized with the specified local name and adds
the new element to this SOAPElement object.
+ *
+ * @param name a String giving the local name for the element
+ * @return the new SOAPElement object that was created
+ * @throws javax.xml.soap.SOAPException if there is an error in creating the
SOAPElement object
+ */
+ public SOAPElement addChildElement(String name) throws SOAPException
+ {
+ SOAPElement soapElement = new SOAPElementImpl(name);
+ soapElement = addChildElement(soapElement);
+ return soapElement;
+ }
+
+ /**
+ * Creates a new SOAPElement object initialized with the specified local name and
prefix and adds the new element to this SOAPElement object.
+ *
+ * @param localName a String giving the local name for the new element
+ * @param prefix a String giving the namespace prefix for the new element
+ * @return the new SOAPElement object that was created
+ * @throws javax.xml.soap.SOAPException if there is an error in creating the
SOAPElement object
+ */
+ public SOAPElement addChildElement(String localName, String prefix) throws
SOAPException
+ {
+ String nsURI = getNamespaceURI(prefix);
+ if (nsURI == null)
+ throw new IllegalArgumentException("Cannot obtain namespace URI for prefix:
" + prefix);
+
+ SOAPElement soapElement = new SOAPElementImpl(localName, prefix, nsURI);
+ soapElement = addChildElement(soapElement);
+ return soapElement;
+ }
+
+ /**
+ * Creates a new SOAPElement object initialized with the specified local name, prefix,
and URI and adds the new element to this SOAPElement object.
+ *
+ * @param localName a String giving the local name for the new element
+ * @param prefix a String giving the namespace prefix for the new element
+ * @param uri a String giving the URI of the namespace to which the new element
belongs
+ * @return the new SOAPElement object that was created
+ * @throws javax.xml.soap.SOAPException if there is an error in creating the
SOAPElement object
+ */
+ public SOAPElement addChildElement(String localName, String prefix, String uri) throws
SOAPException
+ {
+ SOAPElement soapElement = new SOAPElementImpl(localName, prefix, uri);
+ soapElement = addChildElement(soapElement);
+ return soapElement;
+ }
+
+ /**
+ * Creates a new SOAPElement object initialized with the given Name object and adds
the new element to this SOAPElement object.
+ *
+ * @param name a Name object with the XML name for the new element
+ * @return the new SOAPElement object that was created
+ * @throws javax.xml.soap.SOAPException if there is an error in creating the
SOAPElement object
+ */
+ public SOAPElement addChildElement(Name name) throws SOAPException
+ {
+ SOAPElement soapElement = new SOAPElementImpl(name);
+ soapElement = addChildElement(soapElement);
+ return soapElement;
+ }
+
+ /**
+ * Add a SOAPElement as a child of this SOAPElement instance. The SOAPElement is
expected to be created by a
+ * SOAPElementFactory.
+ * <p/>
+ * Callers should not rely on the element instance being added as is into the XML
tree.
+ * Implementations could end up copying the content of the SOAPElement passed into an
instance of a different SOAPElement
+ * implementation. For instance if addChildElement() is called on a SOAPHeader,
element will be copied into an instance
+ * of a SOAPHeaderElement.
+ * <p/>
+ * The fragment rooted in element is either added as a whole or not at all, if there
was an error.
+ * <p/>
+ * The fragment rooted in element cannot contain elements named "Envelope",
"Header" or "Body" and in the SOAP namespace.
+ * Any namespace prefixes present in the fragment should be fully resolved using
appropriate namespace declarations
+ * within the fragment itself.
+ *
+ * @param child the SOAPElement to be added as a new child
+ * @return an instance representing the new SOAP element that was actually added to
the tree.
+ * @throws javax.xml.soap.SOAPException if there was an error in adding this element
as a child
+ */
+ public SOAPElement addChildElement(SOAPElement child) throws SOAPException
+ {
+ log.trace("addChildElement: " + getElementName() + " -> " +
child.getElementName());
+ SOAPElementImpl soapElement = (SOAPElementImpl)child;
+ soapElement = (SOAPElementImpl)appendChild(soapElement);
+ return soapElement.completeNamespaceDeclaration();
+ }
+
+ /**
+ * Adds a namespace declaration with the specified prefix and URI to this SOAPElement
object.
+ *
+ * @param prefix a String giving the prefix of the namespace
+ * @param nsURI a String giving the uri of the namespace
+ * @return the SOAPElement object into which this namespace declaration was inserted.
+ * @throws javax.xml.soap.SOAPException if there is an error in creating the
namespace
+ */
+ public SOAPElement addNamespaceDeclaration(String prefix, String nsURI)
+ {
+ if (nsURI == null)
+ throw new IllegalArgumentException("Invalid 'null' namespace
URI");
+ if (nsURI.length() == 0)
+ throw new IllegalArgumentException("Invalid empty namespace URI");
+
+ String qualifiedName = "xmlns";
+ if (prefix != null && prefix.length() > 0)
+ qualifiedName += ":" + prefix;
+
+ log.trace("addNamespaceDeclaration: " + qualifiedName +
"='" + nsURI + "'");
+
element.setAttributeNS("http://www.w3.org/2000/xmlns/", qualifiedName,
nsURI);
+ return this;
+ }
+
+ // Add the namespace declaration if it is not visible yet
+ private SOAPElement completeNamespaceDeclaration()
+ {
+ String prefix = getPrefix();
+ String nsURI = getNamespaceURI();
+ if (prefix != null && nsURI != null)
+ {
+ String prevNS = getNamespaceURI(prefix);
+ if (nsURI.equals(prevNS) == false)
+ addNamespaceDeclaration(prefix, nsURI);
+ }
+ return this;
+ }
+
+ /**
+ * Creates a new Text object initialized with the given String and adds it to this
SOAPElement object.
+ *
+ * @param value a String object with the textual content to be added
+ * @return the SOAPElement object into which the new Text object was inserted
+ * @throws javax.xml.soap.SOAPException if there is an error in creating the new Text
object
+ */
+ public SOAPElement addTextNode(String value) throws SOAPException
+ {
+ log.trace("addTextNode: " + value);
+ org.w3c.dom.Text domText = element.getOwnerDocument().createTextNode(value);
+ javax.xml.soap.Text soapText = new TextImpl(domText);
+ appendChild(soapText);
+ return this;
+ }
+
+ /**
+ * Returns an Iterator over all of the attribute Name objects in this SOAPElement
object.
+ * <p/>
+ * The iterator can be used to get the attribute names, which can then be passed to
the method getAttributeValue to
+ * retrieve the value of each attribute.
+ *
+ * @return an iterator over the names of the attributes
+ */
+ public Iterator getAllAttributes()
+ {
+ ArrayList list = new ArrayList();
+ NamedNodeMap nnm = getAttributes();
+ for (int i = 0; i < nnm.getLength(); i++)
+ {
+ org.w3c.dom.Node node = (org.w3c.dom.Node)nnm.item(i);
+ String local = node.getLocalName();
+ String prefix = node.getPrefix();
+ String uri = node.getNamespaceURI();
+ if ("xmlns".equals(prefix) == false)
+ {
+ Name name;
+ if (uri != null && uri.length() > 0)
+ {
+ name = new NameImpl(local, prefix, uri);
+ }
+ else
+ {
+ name = new NameImpl(local);
+ }
+ list.add(name);
+ }
+ }
+ return list.iterator();
+ }
+
+ /**
+ * Returns the value of the attribute with the specified name.
+ *
+ * @param name a Name object with the name of the attribute
+ * @return a String giving the value of the specified attribute
+ */
+ public String getAttributeValue(Name name)
+ {
+ Attr attr = getAttributeNode(name);
+ return (attr != null ? attr.getValue() : null);
+ }
+
+ private Attr getAttributeNode(Name name)
+ {
+ Attr attr = null;
+ String nsURI = name.getURI();
+ if (nsURI.length() > 0)
+ attr = element.getAttributeNodeNS(nsURI, name.getLocalName());
+ else attr = element.getAttributeNode(name.getLocalName());
+
+ return attr;
+ }
+
+ /**
+ * Returns an Iterator over all the immediate child Nodes of this element.
+ * <p/>
+ * This includes javax.xml.soap.Text objects as well as SOAPElement objects.
+ * Calling this method may cause child Element, SOAPElement and org.w3c.dom.Text nodes
to be replaced by SOAPElement,
+ * SOAPHeaderElement, SOAPBodyElement or javax.xml.soap.Text nodes as appropriate for
the type of this parent node.
+ * As a result the calling application must treat any existing references to these
child nodes that have been obtained
+ * through DOM APIs as invalid and either discard them or refresh them with the values
returned by this Iterator.
+ * This behavior can be avoided by calling the equivalent DOM APIs. See javax.xml.soap
for more details.
+ *
+ * @return an iterator with the content of this SOAPElement object
+ */
+ public Iterator getChildElements()
+ {
+ List list = new ArrayList();
+ NodeList nodeList = getChildNodes();
+ for (int i = 0; i < nodeList.getLength(); i++)
+ {
+ org.w3c.dom.Node node = nodeList.item(i);
+ if (node instanceof SOAPElement)
+ {
+ list.add(node);
+ }
+ else if (node instanceof Text)
+ {
+ String value = node.getNodeValue();
+ if (value.trim().length() > 0)
+ list.add(node);
+ }
+ }
+ return list.iterator();
+ }
+
+ /**
+ * Returns an Iterator over all the immediate child Nodes of this element with the
specified name.
+ * <p/>
+ * All of these children will be SOAPElement nodes.
+ * Calling this method may cause child Element, SOAPElement and org.w3c.dom.Text nodes
to be replaced by SOAPElement,
+ * SOAPHeaderElement, SOAPBodyElement or javax.xml.soap.Text nodes as appropriate for
the type of this parent node.
+ * As a result the calling application must treat any existing references to these
child nodes that have been obtained
+ * through DOM APIs as invalid and either discard them or refresh them with the values
returned by this Iterator.
+ * This behavior can be avoided by calling the equivalent DOM APIs. See javax.xml.soap
for more details.
+ *
+ * @param name a Name object with the name of the child elements to be returned
+ * @return an Iterator object over all the elements in this SOAPElement object with
the specified name
+ */
+ public Iterator getChildElements(Name name)
+ {
+ List<SOAPElement> list = new ArrayList<SOAPElement>();
+ Iterator it = getChildElements();
+ while (it.hasNext())
+ {
+ Object elementOrTextNode = it.next();
+ if (elementOrTextNode instanceof SOAPElement)
+ {
+ SOAPElement el = (SOAPElement)elementOrTextNode;
+ if (el.getElementName().equals(name))
+ list.add(el);
+ }
+ }
+ return list.iterator();
+ }
+
+ /**
+ * Returns the name of this SOAPElement object.
+ *
+ * @return a Name object with the name of this SOAPElement object
+ */
+ public Name getElementName()
+ {
+ if (elementName == null)
+ {
+ String nsURI = element.getNamespaceURI();
+ if (nsURI != null && nsURI.length() > 0)
+ {
+ String prefix = element.getPrefix();
+ String localName = element.getLocalName();
+ elementName = new NameImpl(localName, prefix, nsURI);
+ }
+ else
+ {
+ String nodeName = element.getNodeName();
+ elementName = new NameImpl(nodeName);
+ }
+ }
+ return elementName;
+ }
+
+ /**
+ * Returns the encoding style for this SOAPElement object.
+ *
+ * @return a String giving the encoding style
+ */
+ public String getEncodingStyle()
+ {
+ return encodingStyle;
+ }
+
+ /**
+ * Returns an Iterator over the namespace prefix Strings declared by this element.
+ * <p/>
+ * The prefixes returned by this iterator can be passed to the method getNamespaceURI
to retrieve the URI of each namespace.
+ *
+ * @return an iterator over the namespace prefixes in this SOAPElement object
+ */
+ public Iterator getNamespacePrefixes()
+ {
+ ArrayList list = getNamespacePrefixList();
+ return list.iterator();
+ }
+
+ private ArrayList getNamespacePrefixList()
+ {
+ ArrayList list = new ArrayList();
+ NamedNodeMap attrMap = element.getAttributes();
+ for (int i = 0; i < attrMap.getLength(); i++)
+ {
+ Attr attr = (Attr)attrMap.item(i);
+ String attrName = attr.getNodeName();
+ if (attrName.startsWith("xmlns:"))
+ list.add(attrName.substring(6));
+ }
+ return list;
+ }
+
+ /**
+ * Returns the URI of the namespace that has the given prefix.
+ *
+ * @param prefix a String giving the prefix of the namespace for which to search
+ * @return a String with the uri of the namespace that has the given prefix
+ */
+ public String getNamespaceURI(String prefix)
+ {
+ String nsURI = element.getAttribute("xmlns:" + prefix);
+ if (nsURI.length() == 0 && getParentElement() != null)
+ return getParentElement().getNamespaceURI(prefix);
+
+ return (nsURI.length() > 0 ? nsURI : null);
+ }
+
+ /**
+ * Returns an Iterator over the namespace prefix Strings visible to this element.
+ * <p/>
+ * The prefixes returned by this iterator can be passed to the method getNamespaceURI
to retrieve the URI of each namespace.
+ *
+ * @return an iterator over the namespace prefixes are within scope of this
SOAPElement object
+ */
+ public Iterator getVisibleNamespacePrefixes()
+ {
+ ArrayList list = getNamespacePrefixList();
+ SOAPElementImpl parent = (SOAPElementImpl)getParentElement();
+ while (parent != null)
+ {
+ list.addAll(parent.getNamespacePrefixList());
+ parent = (SOAPElementImpl)parent.getParentElement();
+ }
+ return list.iterator();
+ }
+
+ /**
+ * Removes the attribute with the specified name.
+ *
+ * @param name the Name object with the name of the attribute to be removed
+ * @return true if the attribute was removed successfully; false if it was not
+ */
+ public boolean removeAttribute(Name name)
+ {
+ Attr attr = getAttributeNode(name);
+ if (attr != null)
+ {
+ element.removeAttributeNode(attr);
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Detaches all children of this SOAPElement.
+ * <p/>
+ * This method is useful for rolling back the construction of partially completed
SOAPHeaders and SOAPBodys in
+ * preparation for sending a fault when an error condition is detected.
+ * It is also useful for recycling portions of a document within a SOAP message.
+ */
+ public void removeContents()
+ {
+ log.trace("removeContents");
+ Iterator it = getChildElements();
+ while (it.hasNext())
+ {
+ SOAPElement el = (SOAPElement)it.next();
+ el.detachNode();
+ }
+ }
+
+ /**
+ * Removes the namespace declaration corresponding to the given prefix.
+ *
+ * @param prefix a String giving the prefix for which to search
+ * @return true if the namespace declaration was removed successfully; false if it was
not
+ */
+ public boolean removeNamespaceDeclaration(String prefix)
+ {
+ boolean ret = getAttributeNode("xmlns:" + prefix) != null;
+ removeAttribute("xmlns:" + prefix);
+ return ret;
+ }
+
+ /**
+ * Sets the encoding style for this SOAPElement object to one specified.
+ *
+ * @param encodingStyle a String giving the encoding style
+ * @throws javax.xml.soap.SOAPException if there was a problem in the encoding style
being set.
+ */
+ public void setEncodingStyle(String encodingStyle) throws SOAPException
+ {
+ if (!Constants.URI_LITERAL_ENC.equals(encodingStyle) &&
!Constants.URI_SOAP11_ENC.equals(encodingStyle))
+ throw new IllegalArgumentException("Unsupported encodingStyle: " +
encodingStyle);
+
+ this.encodingStyle = encodingStyle;
+ }
+
+ // org.w3c.Element
***********************************************************************************************
+
+ public String getTagName()
+ {
+ return element.getTagName();
+ }
+
+ public void removeAttribute(String name) throws DOMException
+ {
+ element.removeAttribute(name);
+ }
+
+ public boolean hasAttribute(String name)
+ {
+ return element.hasAttribute(name);
+ }
+
+ public String getAttribute(String name)
+ {
+ return element.getAttribute(name);
+ }
+
+ public void removeAttributeNS(String namespaceURI, String localName) throws
DOMException
+ {
+ element.removeAttributeNS(namespaceURI, localName);
+ }
+
+ public void setAttribute(String name, String value) throws DOMException
+ {
+ element.setAttribute(name, value);
+ }
+
+ public boolean hasAttributeNS(String namespaceURI, String localName)
+ {
+ return element.hasAttributeNS(namespaceURI, localName);
+ }
+
+ public Attr getAttributeNode(String name)
+ {
+ Attr attr = element.getAttributeNode(name);
+
+ return (attr == null) ? null : new AttrImpl(this, attr);
+ }
+
+ public Attr removeAttributeNode(Attr oldAttr) throws DOMException
+ {
+ return element.removeAttributeNode(oldAttr);
+ }
+
+ public Attr setAttributeNode(Attr newAttr) throws DOMException
+ {
+ return element.setAttributeNode(newAttr);
+ }
+
+ public Attr setAttributeNodeNS(Attr newAttr) throws DOMException
+ {
+ return element.setAttributeNodeNS(newAttr);
+ }
+
+ public NodeList getElementsByTagName(String name)
+ {
+ return new NodeListImpl(DOMUtils.getChildElements(this, name));
+ }
+
+ public String getAttributeNS(String namespaceURI, String localName)
+ {
+ return element.getAttributeNS(namespaceURI, localName);
+ }
+
+ public void setAttributeNS(String namespaceURI, String qualifiedName, String value)
throws DOMException
+ {
+ element.setAttributeNS(namespaceURI, qualifiedName, value);
+ }
+
+ public Attr getAttributeNodeNS(String namespaceURI, String localName)
+ {
+ /* FIXME We really need to do more than just return an object wrapper.
+ * All Attrs should be stored as nodes on our local tree, so that
+ * they are discovered during node traversal calls.
+ */
+ Attr attr = element.getAttributeNodeNS(namespaceURI, localName);
+
+ return (attr == null) ? null : new AttrImpl(this, attr);
+ }
+
+ public NodeList getElementsByTagNameNS(String namespaceURI, String localName)
+ {
+ return new NodeListImpl(DOMUtils.getChildElements(this, new QName(namespaceURI,
localName)));
+ }
+
+ public TypeInfo getSchemaTypeInfo()
+ {
+ throw new NotImplementedException("getSchemaTypeInfo");
+ }
+
+ public void setIdAttribute(String name, boolean isId) throws DOMException
+ {
+ throw new NotImplementedException("setIdAttribute");
+ }
+
+ public void setIdAttributeNode(Attr idAttr, boolean isId) throws DOMException
+ {
+ throw new NotImplementedException("setIdAttributeNode");
+ }
+
+ public void setIdAttributeNS(String namespaceURI, String localName, boolean isId)
throws DOMException
+ {
+ throw new NotImplementedException("setIdAttributeNS");
+ }
+
+ public void accept(SAAJVisitor visitor) {
+ visitor.visitSOAPElement(this);
+ }
+ /**
+ * The default implementation uses a DOMWriter.
+ * SOAPContentElements overwrite this to optimize DOM callbacks.
+ */
+ public void writeElement(Writer writer) throws IOException
+ {
+ String qualName = getElementName().getQualifiedName();
+ writer.write("<" + qualName);
+
+ // namespaces
+ Iterator nsPrefixes = getNamespacePrefixes();
+ while (nsPrefixes.hasNext())
+ {
+ String prefix = (String)nsPrefixes.next();
+ writer.write(" xmlns:" + prefix + "='" +
getNamespaceURI(prefix) + "'");
+ }
+
+ // attributes
+ Iterator attNames = getAllAttributes();
+ while (attNames.hasNext())
+ {
+ NameImpl name = (NameImpl)attNames.next();
+ String attPrefix = name.getPrefix() != null ? name.getPrefix() : "";
+ String attFqn = attPrefix.length() > 0 ? attPrefix + ":" +
name.getLocalName() : name.getLocalName();
+ writer.write(" " + attFqn + "='" +
getAttributeValue(name) + "'");
+ }
+ writer.write(">");
+
+ writeElementContent(writer);
+
+ writer.write("</" + qualName + ">");
+ }
+
+ protected void writeElementContent(Writer out) throws IOException
+ {
+ Iterator it = getChildElements();
+ if (it.hasNext())
+ {
+ while (it.hasNext())
+ {
+ Node node = (Node)it.next();
+ if (node instanceof SOAPElementImpl)
+ {
+ ((SOAPElementImpl)node).writeElement(out);
+ }
+ else if (node instanceof TextImpl)
+ {
+ out.write(node.getValue());
+ }
+ else
+ {
+ throw new WSException("Unhandled soap node: " +
node.getClass().getName());
+ }
+ }
+ }
+ else
+ {
+ String value = getValue();
+ if (value != null)
+ out.write(value);
+ }
+ }
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/SOAPElementWriter.java (from
rev 1557, branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPElementWriter.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPElementWriter.java 2006-12-05
23:29:55 UTC (rev 1557)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/SOAPElementWriter.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -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.core.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(a)jboss.com>
+ * @author Thomas.Diesler(a)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);
+ }
+ }
+ }
+}
Copied: branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/SOAPEnvelopeImpl.java
(from rev 1557,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPEnvelopeImpl.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPEnvelopeImpl.java 2006-12-05
23:29:55 UTC (rev 1557)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/SOAPEnvelopeImpl.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -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.ws.core.soap;
+
+// $Id$
+
+import java.io.IOException;
+import java.io.Writer;
+import java.util.Iterator;
+
+import javax.xml.namespace.QName;
+import javax.xml.rpc.JAXRPCException;
+import javax.xml.rpc.soap.SOAPFaultException;
+import javax.xml.soap.Name;
+import javax.xml.soap.Node;
+import javax.xml.soap.SOAPBody;
+import javax.xml.soap.SOAPElement;
+import javax.xml.soap.SOAPEnvelope;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPHeader;
+import javax.xml.soap.SOAPMessage;
+
+import org.jboss.ws.Constants;
+import org.w3c.dom.Document;
+
+/**
+ * The container for the SOAPHeader and SOAPBody portions of a SOAPPart object. By
default, a
+ * SOAPMessage object is created with a SOAPPart object that has a SOAPEnvelope object.
+ * The SOAPEnvelope object by default has an empty SOAPBody object and an empty
SOAPHeader object.
+ * The SOAPBody object is required, and the SOAPHeader object, though optional, is used
in the majority of cases.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ */
+public class SOAPEnvelopeImpl extends SOAPElementImpl implements SOAPEnvelope
+{
+ // Reference the enclosing SOAPPart, so that getOwnerDocument() works correctly
+ private SOAPPartImpl soapPart;
+ private boolean domExpansionEnabled = false;
+
+ /** Construct a SOAP envelope for the given SOAP version URI prefix, etc.
+ */
+ public SOAPEnvelopeImpl(SOAPPartImpl soapPart, SOAPElementImpl element) throws
SOAPException
+ {
+ super(element);
+
+ this.soapPart = soapPart;
+ soapPart.setEnvelope(this);
+
+ String prefix = getPrefix();
+ String namespaceURI = getNamespaceURI();
+
+ assertEnvelopeNamespace(namespaceURI);
+ addNamespaceDeclaration(prefix, namespaceURI);
+
+ addHeader();
+ addBody();
+ }
+
+ /** Construct a SOAP envelope for the given SOAP version URI.
+ */
+ SOAPEnvelopeImpl(SOAPPartImpl soapPart, String namespace) throws SOAPException
+ {
+ super("Envelope", Constants.PREFIX_ENV, namespace);
+
+ this.soapPart = soapPart;
+ soapPart.setEnvelope(this);
+
+ assertEnvelopeNamespace(namespace);
+ addNamespaceDeclaration(getPrefix(), namespace);
+
+ addHeader();
+ addBody();
+ }
+
+ private void assertEnvelopeNamespace(String namespaceURI)
+ {
+ if (!Constants.NS_SOAP12_ENV.equals(namespaceURI) &&
!Constants.NS_SOAP11_ENV.equals(namespaceURI))
+ {
+ QName faultCode = Constants.SOAP11_FAULT_CODE_VERSION_MISMATCH;
+ String faultString = "Invalid SOAP envelope namespace: " +
namespaceURI;
+ throw new SOAPFaultException(faultCode, faultString, null, null);
+ }
+ }
+
+ public SOAPMessage getSOAPMessage()
+ {
+ return soapPart.getSOAPMessage();
+ }
+
+ public SOAPBody addBody() throws SOAPException
+ {
+ SOAPBody body = getBody();
+ if (body != null)
+ throw new SOAPException("SOAPEnvelope already has a body element");
+
+ body = new SOAPBodyImpl(getPrefix(), getNamespaceURI());
+ addChildElement(body);
+ return body;
+ }
+
+ public SOAPHeader addHeader() throws SOAPException
+ {
+ SOAPHeader header = getHeader();
+ if (header != null)
+ throw new SOAPException("SOAPEnvelope already has a header element");
+
+ header = new SOAPHeaderImpl(getPrefix(), getNamespaceURI());
+ return (SOAPHeader)addChildElement(header);
+ }
+
+ /** Make sure the child is either a SOAPHeader or SOAPBody */
+ public SOAPElement addChildElement(SOAPElement child) throws SOAPException
+ {
+ if ((child instanceof SOAPHeader) == false && (child instanceof SOAPBody)
== false)
+ throw new IllegalArgumentException("SOAPHeader or SOAPBody
expected");
+
+ return super.addChildElement(child);
+ }
+
+ public Name createName(String localName) throws SOAPException
+ {
+ return new NameImpl(localName);
+ }
+
+ public Name createName(String localName, String prefix, String uri) throws
SOAPException
+ {
+ return new NameImpl(localName, prefix, uri);
+ }
+
+ public SOAPBody getBody() throws SOAPException
+ {
+ Iterator it = getChildElements();
+ while (it.hasNext())
+ {
+ Node node = (Node)it.next();
+ if (node.getLocalName().equals("Body"))
+ return (SOAPBody)node;
+ }
+ return null;
+ }
+
+ public SOAPHeader getHeader() throws SOAPException
+ {
+ Iterator it = getChildElements();
+ while (it.hasNext())
+ {
+ Node node = (Node)it.next();
+ if (node.getLocalName().equals("Header"))
+ return (SOAPHeader)node;
+ }
+ return null;
+ }
+
+ /**
+ * Text nodes are not supported.
+ */
+ public SOAPElement addTextNode(String value) throws SOAPException
+ {
+ throw new SOAPException("Cannot add Text node to SOAPEnvelope");
+ }
+
+ public Document getOwnerDocument()
+ {
+ return soapPart;
+ }
+}
Copied: branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/SOAPFactoryImpl.java
(from rev 1557,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPFactoryImpl.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPFactoryImpl.java 2006-12-05
23:29:55 UTC (rev 1557)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/SOAPFactoryImpl.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -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.core.soap;
+
+// $Id$
+
+import javax.xml.soap.Detail;
+import javax.xml.soap.Name;
+import javax.xml.soap.SOAPElement;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPFactory;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.utils.DOMUtils;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+/**
+ * SOAPFactory implementation.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ */
+public class SOAPFactoryImpl extends SOAPFactory
+{
+ private static Logger log = Logger.getLogger(SOAPFactoryImpl.class);
+
+ public SOAPElement createElement(Name name) throws SOAPException
+ {
+ return new SOAPElementImpl(name);
+ }
+
+ public SOAPElement createElement(String localName) throws SOAPException
+ {
+ return new SOAPElementImpl(localName);
+ }
+
+ public SOAPElement createElement(String localName, String prefix, String uri) throws
SOAPException
+ {
+ return new SOAPElementImpl(localName, prefix, uri);
+ }
+
+ /**
+ * Create a SOAPElement from a DOM Element.
+ * This method is not part of the javax.xml.soap.SOAPFactory interface.
+ */
+ public SOAPElementImpl createElement(Element domNode, boolean deep) throws
SOAPException
+ {
+ if (domNode == null)
+ throw new IllegalArgumentException("Source node cannot be null");
+
+ String localName = domNode.getLocalName();
+ String prefix = domNode.getPrefix() != null ? domNode.getPrefix() : "";
+ String nsURI = domNode.getNamespaceURI() != null ? domNode.getNamespaceURI() :
"";
+
+ SOAPElementImpl soapElement = new SOAPElementImpl(localName, prefix, nsURI);
+
+ // Add the child elements as well
+ if (deep)
+ {
+ if (domNode instanceof Element)
+ DOMUtils.copyAttributes(soapElement, (Element)domNode);
+
+ NodeList nlist = domNode.getChildNodes();
+ for (int i = 0; i < nlist.getLength(); i++)
+ {
+ Node child = nlist.item(i);
+ short nodeType = child.getNodeType();
+ if (nodeType == Node.ELEMENT_NODE)
+ {
+ SOAPElementImpl soapChild = createElement((Element)child, true);
+ soapElement.addChildElement(soapChild);
+ }
+ else if (nodeType == Node.TEXT_NODE)
+ {
+ String nodeValue = child.getNodeValue();
+ soapElement.addTextNode(nodeValue);
+ }
+ else if (nodeType == Node.CDATA_SECTION_NODE)
+ {
+ String nodeValue = child.getNodeValue();
+ soapElement.addTextNode(nodeValue);
+ }
+ else
+ {
+ log.trace("Ignore child type: " + nodeType);
+ }
+ }
+ }
+
+ return soapElement;
+ }
+
+ public Detail createDetail() throws SOAPException
+ {
+ return new DetailImpl();
+ }
+
+ public Name createName(String localName, String prefix, String uri) throws
SOAPException
+ {
+ return new NameImpl(localName, prefix, uri);
+ }
+
+ public Name createName(String localName) throws SOAPException
+ {
+ return new NameImpl(localName);
+ }
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/SOAPFaultElementImpl.java
(from rev 1557,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPFaultElementImpl.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPFaultElementImpl.java 2006-12-05
23:29:55 UTC (rev 1557)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/SOAPFaultElementImpl.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -0,0 +1,43 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+package org.jboss.ws.core.soap;
+
+import javax.xml.soap.Name;
+import javax.xml.soap.SOAPFaultElement;
+
+public class SOAPFaultElementImpl extends SOAPElementImpl implements SOAPFaultElement
+{
+ public SOAPFaultElementImpl(String localPart)
+ {
+ super(localPart);
+ }
+
+ public SOAPFaultElementImpl(String localPart, String prefix, String namespace)
+ {
+ super(localPart, prefix, namespace);
+ }
+
+ public SOAPFaultElementImpl(Name name)
+ {
+ super(name);
+ }
+}
\ No newline at end of file
Copied: branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/SOAPFaultImpl.java
(from rev 1557,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPFaultImpl.java)
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPFaultImpl.java 2006-12-05
23:29:55 UTC (rev 1557)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/SOAPFaultImpl.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -0,0 +1,242 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ws.core.soap;
+
+import java.io.IOException;
+import java.io.Writer;
+import java.util.Iterator;
+import java.util.Locale;
+
+import javax.xml.namespace.QName;
+import javax.xml.rpc.JAXRPCException;
+import javax.xml.soap.Detail;
+import javax.xml.soap.Name;
+import javax.xml.soap.SOAPElement;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPFault;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.utils.DOMUtils;
+import org.jboss.ws.utils.DOMWriter;
+import org.jboss.ws.Constants;
+import org.jboss.ws.WSException;
+import org.jboss.xb.QNameBuilder;
+import org.w3c.dom.Element;
+
+/**
+ * An element in the SOAPBody object that contains error and/or status information.
+ * This information may relate to errors in the SOAPMessage object or to problems
+ * that are not related to the content in the message itself. Problems not related
+ * to the message itself are generally errors in processing, such as the inability
+ * to communicate with an upstream server.
+ *
+ * The SOAPFault interface provides methods for retrieving the information contained
+ * in a SOAPFault object and for setting the fault code, the fault actor, and a string
+ * describing the fault. A fault code is one of the codes defined in the SOAP 1.1
specification
+ * that describe the fault. An actor is an intermediate recipient to whom a message was
routed.
+ * The message path may include one or more actors, or, if no actors are specified, the
message
+ * goes only to the default actor, which is the final intended recipient.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ */
+public class SOAPFaultImpl extends SOAPBodyElementDoc implements SOAPFault
+{
+ // provide logging
+ private static Logger log = Logger.getLogger(SOAPFaultImpl.class);
+
+ private SOAPElement faultcode;
+ private SOAPElement faultstring;
+ private SOAPElement faultactor;
+ private Locale faultStringLocale;
+
+ public SOAPFaultImpl(String namespaceURI) throws SOAPException
+ {
+ super(new NameImpl("Fault", Constants.PREFIX_ENV, namespaceURI));
+ SOAPFactoryImpl factory = new SOAPFactoryImpl();
+ addChildElement(faultcode = factory.createElement("faultcode"));
+ addChildElement(faultstring = factory.createElement("faultstring"));
+ }
+
+ /** Creates an optional Detail object and sets it as the Detail object for this
SOAPFault object.
+ */
+ public Detail addDetail() throws SOAPException
+ {
+ Detail detail = getDetail();
+ if (detail != null)
+ throw new SOAPException("SOAPFault already contains a detail node");
+
+ SOAPFactoryImpl factory = new SOAPFactoryImpl();
+ detail = (Detail)addChildElement(factory.createDetail());
+ return detail;
+ }
+
+ /** Returns the optional detail element for this SOAPFault object.
+ */
+ public Detail getDetail()
+ {
+ Detail detail = null;
+ Iterator it = getChildElements(new NameImpl("detail"));
+ while (it.hasNext())
+ {
+ Object obj = it.next();
+ if (obj instanceof Detail)
+ {
+ detail = (Detail)obj;
+ }
+ else if (obj instanceof SOAPElementImpl)
+ {
+ try
+ {
+ SOAPElementImpl soapEl = (SOAPElementImpl)obj;
+ SOAPFactoryImpl factory = new SOAPFactoryImpl();
+ detail = (Detail)addChildElement(factory.createDetail());
+
+ Iterator childIt = DOMUtils.getChildElements(soapEl);
+ while (childIt.hasNext())
+ {
+ Element domElement = (Element)childIt.next();
+ SOAPElement detailEntry = new
DetailEntryImpl(factory.createElement(domElement, true));
+ detail.addChildElement(detailEntry);
+ }
+ }
+ catch (SOAPException e)
+ {
+ throw new WSException("Unable to create fault detail: " +
e.getMessage());
+ }
+
+ }
+ }
+
+ return detail;
+ }
+
+ /** Gets the fault actor for this SOAPFault object.
+ */
+ public String getFaultActor()
+ {
+ return (faultactor != null ? faultactor.getValue() : null);
+ }
+
+ /** Gets the fault code for this SOAPFault object.
+ */
+ public String getFaultCode()
+ {
+ String value = faultcode.getValue();
+ return value;
+ }
+
+ /**
+ * Gets the mandatory SOAP 1.1 fault code for this SOAPFault object as a SAAJ Name
object.
+ */
+ public Name getFaultCodeAsName()
+ {
+ QName qname = QNameBuilder.buildQName(this, faultcode.getValue());
+ return new NameImpl(qname);
+ }
+
+ /** Gets the fault string for this SOAPFault object.
+ */
+ public String getFaultString()
+ {
+ String value = faultstring.getValue();
+ return value;
+ }
+
+ /** Gets the locale of the fault string for this SOAPFault object.
+ */
+ public Locale getFaultStringLocale()
+ {
+ return faultStringLocale;
+ }
+
+ /** Sets this SOAPFault object with the given fault actor.
+ */
+ public void setFaultActor(String faultActor) throws SOAPException
+ {
+ if (faultactor == null)
+ {
+ SOAPFactoryImpl factory = new SOAPFactoryImpl();
+ addChildElement(faultactor = factory.createElement("faultactor"));
+ }
+
+ faultactor.setValue(faultActor);
+ }
+
+ /** Sets this SOAPFault object with the give fault code.
+ */
+ public void setFaultCode(String faultCode) throws SOAPException
+ {
+ // Must be of the form "prefix:localName" where the prefix has been
defined in a namespace declaration.
+ if (faultCode == null || faultCode.indexOf(":") < 1)
+ throw new IllegalArgumentException("Invalid faultCode: " +
faultCode);
+
+ QName qname = QNameBuilder.buildQName(this, faultCode);
+ setFaultCode(new NameImpl(qname));
+ }
+
+ /** Sets this SOAPFault object with the given fault code.
+ */
+ public void setFaultCode(Name faultName) throws SOAPException
+ {
+ String nsURI = faultName.getURI();
+ String prefix = faultName.getPrefix();
+ String localName = faultName.getLocalName();
+
+ // For lazy folkes like the CTS that don't bother to give
+ // a namesapce URI, assume they use a standard code
+ if ("".equals(nsURI))
+ {
+ log.warn("Empty namespace URI with fault code '" + faultName +
"', assuming: " + Constants.NS_SOAP11_ENV);
+ nsURI = Constants.NS_SOAP11_ENV;
+ }
+
+ if ("".equals(prefix) && getNamespaceURI().equals(nsURI))
+ prefix = getPrefix();
+
+ String prevNS = getNamespaceURI(prefix);
+ if (nsURI.equals(prevNS) == false)
+ addNamespaceDeclaration(prefix, nsURI);
+
+ String faultCode = prefix + ":" + localName;
+ faultcode.setValue(faultCode);
+ }
+
+ /** Sets the fault string for this SOAPFault object to the given string.
+ */
+ public void setFaultString(String faultString) throws SOAPException
+ {
+ faultstring.setValue(faultString);
+ }
+
+ /** Sets the fault string for this SOAPFault object to the given string and localized
to the given locale.
+ */
+ public void setFaultString(String faultString, Locale locale) throws SOAPException
+ {
+ setFaultString(faultString);
+ this.faultStringLocale = locale;
+ }
+
+ public void writeElement(Writer writer)
+ {
+ new DOMWriter(writer).print(this);
+ }
+}
\ No newline at end of file
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/SOAPHeaderElementImpl.java
(from rev 1557,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPHeaderElementImpl.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPHeaderElementImpl.java 2006-12-05
23:29:55 UTC (rev 1557)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/SOAPHeaderElementImpl.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -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.core.soap;
+
+import java.io.IOException;
+import java.io.StringWriter;
+import java.io.Writer;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.xml.soap.Name;
+import javax.xml.soap.SOAPElement;
+import javax.xml.soap.SOAPEnvelope;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPHeader;
+import javax.xml.soap.SOAPHeaderElement;
+
+import org.jboss.ws.Constants;
+
+/**
+ * An object representing the contents in the SOAP header part of the SOAP envelope.
+ * The immediate children of a SOAPHeader object can be represented only as
SOAPHeaderElement objects.
+ *
+ * A SOAPHeaderElement object can have other SOAPElement objects as its children.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ */
+public class SOAPHeaderElementImpl extends SOAPContentElement implements
SOAPHeaderElement
+{
+ public SOAPHeaderElementImpl(Name name)
+ {
+ super(name);
+ }
+
+ public SOAPHeaderElementImpl(SOAPElementImpl element)
+ {
+ super(element);
+ }
+
+ public String getActor()
+ {
+ String envURI = Constants.NS_SOAP11_ENV;
+ String attr = getAttributeNS(envURI, Constants.SOAP11_ATTR_ACTOR);
+ return attr;
+ }
+
+ public boolean getMustUnderstand()
+ {
+ String envURI = Constants.NS_SOAP11_ENV;
+ String attr = getAttributeNS(envURI, Constants.SOAP11_ATTR_MUST_UNDERSTAND);
+ return "1".equals(attr);
+ }
+
+ public void setActor(String actorURI)
+ {
+ String envURI = Constants.NS_SOAP11_ENV;
+ String qualifiedName = Constants.PREFIX_ENV + ":" +
Constants.SOAP11_ATTR_ACTOR;
+ setAttributeNS(envURI, qualifiedName, actorURI);
+ }
+
+ public void setMustUnderstand(boolean mustUnderstand)
+ {
+ String envURI = Constants.NS_SOAP11_ENV;
+ String qualifiedName = Constants.PREFIX_ENV + ":" +
Constants.SOAP11_ATTR_MUST_UNDERSTAND;
+ setAttributeNS(envURI, qualifiedName, mustUnderstand ? "1" :
"0");
+ }
+
+ public void setParentElement(SOAPElement parent) throws SOAPException
+ {
+ if (parent == null)
+ throw new SOAPException("Invalid null parent element");
+
+ if ((parent instanceof SOAPHeader) == false)
+ throw new SOAPException("Invalid parent element: " +
parent.getElementName());
+
+ super.setParentElement(parent);
+ }
+
+ @Override
+ public void writeElement(Writer writer) throws IOException
+ {
+ StringWriter strwr = new StringWriter(256);
+ super.writeElement(strwr);
+
+ SOAPHeader soapHeader = (SOAPHeader)getParentElement();
+ SOAPEnvelope soapEnvelope = (SOAPEnvelope)soapHeader.getParentElement();
+
+ // Find known namespace declarations
+ List<String> knownNamespaces = new ArrayList<String>();
+ Iterator prefixes = soapEnvelope.getNamespacePrefixes();
+ while (prefixes.hasNext())
+ {
+ String prefix = (String)prefixes.next();
+ String nsURI = soapEnvelope.getNamespaceURI(prefix);
+ String xmlns = " xmlns:" + prefix + "='" + nsURI +
"'";
+ knownNamespaces.add(xmlns);
+ }
+ prefixes = soapHeader.getNamespacePrefixes();
+ while (prefixes.hasNext())
+ {
+ String prefix = (String)prefixes.next();
+ String nsURI = soapHeader.getNamespaceURI(prefix);
+ String xmlns = " xmlns:" + prefix + "='" + nsURI +
"'";
+ knownNamespaces.add(xmlns);
+ }
+
+ // Remove known namespace declarations
+ String xmlFragment = strwr.toString();
+ for (String xmlns : knownNamespaces)
+ {
+ int start = xmlFragment.indexOf(xmlns);
+ while (start > 0)
+ {
+ int end = start + xmlns.length();
+ xmlFragment = xmlFragment.substring(0, start) + xmlFragment.substring(end);
+ start = xmlFragment.indexOf(xmlns);
+ }
+ }
+
+ writer.write(xmlFragment);
+ }
+}
Copied: branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/SOAPHeaderImpl.java
(from rev 1557,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPHeaderImpl.java)
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPHeaderImpl.java 2006-12-05
23:29:55 UTC (rev 1557)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/SOAPHeaderImpl.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -0,0 +1,197 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ws.core.soap;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+
+import javax.xml.soap.Name;
+import javax.xml.soap.SOAPElement;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPHeader;
+import javax.xml.soap.SOAPHeaderElement;
+
+import org.w3c.dom.DOMException;
+import org.w3c.dom.DocumentFragment;
+import org.w3c.dom.Node;
+
+/**
+ * A representation of the SOAP header element. A SOAP header element consists of XML
data that affects the way the
+ * application-specific content is processed by the message provider. For example,
transaction semantics,
+ * authentication information, and so on, can be specified as the content of a SOAPHeader
object.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ */
+public class SOAPHeaderImpl extends SOAPElementImpl implements SOAPHeader
+{
+ public SOAPHeaderImpl(String prefix, String namespace)
+ {
+ super("Header", prefix, namespace);
+ }
+
+ private SOAPHeaderElementImpl convertToHeaderElement(Node node)
+ {
+ if (!(node instanceof SOAPElementImpl))
+ throw new IllegalArgumentException("SOAPElement expected");
+
+ SOAPElementImpl element = (SOAPElementImpl)node;
+
+ // convert to SOAPHeaderElement
+ element.detachNode();
+ return new SOAPHeaderElementImpl(element);
+ }
+
+ /*** Add a SOAPHeaderElement as a child of this SOAPHeader instance.
+ */
+ public SOAPElement addChildElement(SOAPElement child) throws SOAPException
+ {
+ // Check that we get a SOAPHeaderElement
+ if ((child instanceof SOAPHeaderElement) == false)
+ child = convertToHeaderElement(child);
+
+ return super.addChildElement(child);
+ }
+
+ /** Creates a new SOAPHeaderElement object initialized with the specified name and
adds it to this SOAPHeader object.
+ */
+ public SOAPHeaderElement addHeaderElement(Name name) throws SOAPException
+ {
+ if (name == null || name.getURI().length() == 0 || name.getPrefix().length() == 0)
+ throw new SOAPException("Invalid SOAPHeaderElement name: " + name);
+
+ SOAPHeaderElementImpl headerElement = new SOAPHeaderElementImpl(name);
+ addChildElement(headerElement);
+ return headerElement;
+ }
+
+ /** Returns an Iterator over all the SOAPHeaderElement objects in this SOAPHeader
object.
+ */
+ public Iterator examineAllHeaderElements()
+ {
+ // make a defensive copy
+ ArrayList list = new ArrayList();
+ Iterator it = getChildElements();
+ while (it.hasNext())
+ {
+ SOAPHeaderElement shElement = (SOAPHeaderElement)it.next();
+ list.add(shElement);
+ }
+ return list.iterator();
+ }
+
+ /** Returns an Iterator over all the SOAPHeaderElement objects in this SOAPHeader
object that have the specified actor.
+ */
+ public Iterator examineHeaderElements(String actor)
+ {
+ if (actor == null)
+ throw new IllegalArgumentException("Invalid actor: " + actor);
+
+ // make a defensive copy
+ ArrayList list = new ArrayList();
+ Iterator it = getChildElements();
+ while (it.hasNext())
+ {
+ SOAPHeaderElement shElement = (SOAPHeaderElement)it.next();
+ if (actor.equals(shElement.getActor()))
+ list.add(shElement);
+ }
+ return list.iterator();
+ }
+
+ /** Returns an Iterator over all the SOAPHeaderElement objects in this SOAPHeader
object that have the specified
+ * actor and that have a MustUnderstand attribute whose value is equivalent to true.
+ */
+ public Iterator examineMustUnderstandHeaderElements(String actor)
+ {
+ if (actor == null)
+ throw new IllegalArgumentException("Invalid actor: " + actor);
+
+ // make a defensive copy
+ ArrayList list = new ArrayList();
+ Iterator it = getChildElements();
+ while (it.hasNext())
+ {
+ SOAPHeaderElement shElement = (SOAPHeaderElement)it.next();
+ if (actor.equals(shElement.getActor()) &&
shElement.getMustUnderstand())
+ list.add(shElement);
+ }
+ return list.iterator();
+ }
+
+ public Iterator extractAllHeaderElements()
+ {
+ // make a defensive copy
+ ArrayList list = new ArrayList();
+ Iterator it = getChildElements();
+ while (it.hasNext())
+ {
+ SOAPHeaderElement shElement = (SOAPHeaderElement)it.next();
+ removeChild(shElement);
+ list.add(shElement);
+ }
+ return list.iterator();
+ }
+
+ public Iterator extractHeaderElements(String actor)
+ {
+ if (actor == null)
+ throw new IllegalArgumentException("Invalid actor: " + actor);
+
+ // make a defensive copy
+ ArrayList list = new ArrayList();
+ Iterator it = getChildElements();
+ while (it.hasNext())
+ {
+ SOAPHeaderElement shElement = (SOAPHeaderElement)it.next();
+ if (actor.equals(shElement.getActor()))
+ {
+ removeChild(shElement);
+ list.add(shElement);
+ }
+ }
+ return list.iterator();
+ }
+
+ public Node appendChild(Node newChild) throws DOMException
+ {
+ if (!(newChild instanceof SOAPHeaderElementImpl || newChild instanceof
DocumentFragment))
+ newChild = convertToHeaderElement(newChild);
+
+ return super.appendChild(newChild);
+ }
+
+ public Node insertBefore(Node newChild, Node refChild) throws DOMException
+ {
+ if (!(newChild instanceof SOAPHeaderElementImpl || newChild instanceof
DocumentFragment))
+ newChild = convertToHeaderElement(newChild);
+
+ return super.insertBefore(newChild, refChild);
+ }
+
+ public Node replaceChild(Node newChild, Node oldChild) throws DOMException
+ {
+ if (!(newChild instanceof SOAPHeaderElementImpl || newChild instanceof
DocumentFragment))
+ newChild = convertToHeaderElement(newChild);
+
+ return super.replaceChild(newChild, oldChild);
+ }
+}
\ No newline at end of file
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/SOAPMessageDispatcher.java
(from rev 1559,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPMessageDispatcher.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPMessageDispatcher.java 2006-12-06
00:29:48 UTC (rev 1559)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/SOAPMessageDispatcher.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -0,0 +1,135 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ws.core.soap;
+
+// $Id$
+
+import java.util.Iterator;
+
+import javax.xml.namespace.QName;
+import javax.xml.soap.Name;
+import javax.xml.soap.SOAPBody;
+import javax.xml.soap.SOAPBodyElement;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.ws.addressing.AddressingProperties;
+import javax.xml.ws.addressing.JAXWSAConstants;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.core.CommonMessageContext;
+import org.jboss.ws.jaxrpc.Style;
+import org.jboss.ws.metadata.umdm.EndpointMetaData;
+import org.jboss.ws.metadata.umdm.OperationMetaData;
+
+/**
+ * Derive the operation meta data from incomming SOAP message
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 22-Nov-2005
+ */
+public class SOAPMessageDispatcher
+{
+ // provide logging
+ private static Logger log = Logger.getLogger(SOAPMessageDispatcher.class);
+
+ /** Get the operation meta data for a given SOAP message
+ */
+ public OperationMetaData getDispatchDestination(EndpointMetaData epMetaData,
SOAPMessage soapMessage) throws SOAPException
+ {
+ OperationMetaData opMetaData = null;
+
+ // Dispatch based on wsa:Action
+ CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
+ AddressingProperties inProps =
(AddressingProperties)msgContext.getProperty(JAXWSAConstants.SERVER_ADDRESSING_PROPERTIES_INBOUND);
+ if (inProps != null && inProps.getAction() != null)
+ {
+ String wsaAction = inProps.getAction().getURI().toASCIIString();
+ for (OperationMetaData opAux : epMetaData.getOperations())
+ {
+ if (wsaAction.equals(opAux.getSOAPAction()))
+ {
+ opMetaData = opAux;
+ log.debug("Use wsa:Action dispatch: " + wsaAction);
+ break;
+ }
+ }
+ }
+
+ // Dispatch to JAXWS Provider
+ if (opMetaData == null && epMetaData.getServiceMode() != null)
+ {
+ QName xmlName = new QName(epMetaData.getQName().getNamespaceURI(),
"invoke");
+ opMetaData = epMetaData.getOperation(xmlName);
+ }
+
+ // Dispatch based on SOAPBodyElement name
+ if (opMetaData == null)
+ {
+ SOAPBody soapBody = soapMessage.getSOAPBody();
+
+ Iterator bodyChildren = soapBody.getChildElements();
+ if (bodyChildren.hasNext() == false)
+ {
+ if (epMetaData.getStyle() == Style.RPC)
+ throw new SOAPException("Empty SOAP body with no child element not
supported for RPC");
+
+ // [JBWS-1125] Support empty soap body elements
+ for (OperationMetaData opAux : epMetaData.getOperations())
+ {
+ if (opAux.getParameters().size() == 0)
+ {
+ log.debug ("Dispatching empty SOAP body");
+ opMetaData = opAux;
+ break;
+ }
+ }
+ }
+ else
+ {
+ SOAPBodyElement soapBodyElement = (SOAPBodyElement)bodyChildren.next();
+ if (bodyChildren.hasNext())
+ throw new SOAPException("SOAPBody has more than on child
element");
+
+ Name soapName = soapBodyElement.getElementName();
+ QName xmlElementName = new QName(soapName.getURI(),
soapName.getLocalName());
+ opMetaData = epMetaData.getOperation(xmlElementName);
+ }
+ }
+
+ // Dispatch to a generic operation that takes an org.w3c.dom.Element
+ if (opMetaData == null)
+ {
+ for (OperationMetaData opAux : epMetaData.getOperations())
+ {
+ if (opAux.isMessageEndpoint())
+ {
+ log.debug("Use generic message style dispatch");
+ opMetaData = opAux;
+ break;
+ }
+ }
+ }
+
+ log.debug("getDispatchDestination: " + (opMetaData != null ?
opMetaData.getQName() : null));
+ return opMetaData;
+ }
+}
\ No newline at end of file
Copied: branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/SOAPMessageImpl.java
(from rev 1559,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPMessageImpl.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPMessageImpl.java 2006-12-06
00:29:48 UTC (rev 1559)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/SOAPMessageImpl.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -0,0 +1,414 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ws.core.soap;
+
+// $Id$
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+
+import javax.mail.MessagingException;
+import javax.xml.soap.AttachmentPart;
+import javax.xml.soap.MimeHeader;
+import javax.xml.soap.MimeHeaders;
+import javax.xml.soap.SOAPEnvelope;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPFault;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.soap.SOAPPart;
+
+import org.jboss.ws.WSException;
+import org.jboss.ws.core.soap.attachment.AttachmentPartImpl;
+import org.jboss.ws.core.soap.attachment.CIDGenerator;
+import org.jboss.ws.core.soap.attachment.MimeConstants;
+import org.jboss.ws.core.soap.attachment.MultipartRelatedEncoder;
+import org.jboss.ws.core.soap.attachment.MultipartRelatedSwAEncoder;
+import org.jboss.ws.core.soap.attachment.MultipartRelatedXOPEncoder;
+import org.jboss.ws.extras.xop.XOPContext;
+import org.jboss.ws.metadata.umdm.EndpointMetaData;
+import org.jboss.ws.metadata.umdm.OperationMetaData;
+
+/**
+ * The root class for all SOAP messages. As transmitted on the "wire", a SOAP
message is an XML document or a
+ * MIME message whose first body part is an XML/SOAP document.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @author <a href="mailto:jason@stacksmash.com">Jason T.
Greene</a>
+ */
+public class SOAPMessageImpl extends SOAPMessage
+{
+ private boolean saveRequired = true;
+ private MimeHeaders mimeHeaders = new MimeHeaders();
+ private List<AttachmentPart> attachments = new
LinkedList<AttachmentPart>();
+ private CIDGenerator cidGenerator = new CIDGenerator();
+ private boolean isXOPMessage;
+ private SOAPPartImpl soapPart;
+ private MultipartRelatedEncoder multipartRelatedEncoder;
+
+ // Cache the associated operation meta data
+ private OperationMetaData opMetaData;
+
+ SOAPMessageImpl() throws SOAPException
+ {
+ soapPart = new SOAPPartImpl(this);
+ setProperty(CHARACTER_SET_ENCODING, "UTF-8");
+ setProperty(WRITE_XML_DECLARATION, false);
+ }
+
+ public CIDGenerator getCidGenerator()
+ {
+ return cidGenerator;
+ }
+
+ public boolean isXOPMessage()
+ {
+ return isXOPMessage;
+ }
+
+ public void setXOPMessage(boolean isXOPMessage)
+ {
+ this.isXOPMessage = isXOPMessage;
+ }
+
+ public void setAttachments(Collection<AttachmentPart> parts) throws
SOAPException
+ {
+ for (AttachmentPart part : parts)
+ {
+ attachments.add(part);
+ }
+ saveRequired = true;
+ }
+
+ public void addAttachmentPart(AttachmentPart part)
+ {
+ if (part == null)
+ return;
+
+ attachments.add(part);
+ saveRequired = true;
+ }
+
+ public AttachmentPart getAttachmentByContentId(String cid) throws SOAPException
+ {
+ for (AttachmentPart part : attachments)
+ {
+ String contentId = part.getContentId();
+ if (contentId.equals(cid))
+ return part;
+ }
+ return null;
+ }
+
+ public AttachmentPart removeAttachmentByContentId(String cid)
+ {
+ for (AttachmentPart part : attachments)
+ {
+ String contentId = part.getContentId();
+ if (contentId.equals(cid))
+ {
+ attachments.remove(part);
+ return part;
+ }
+ }
+
+ return null;
+ }
+ public AttachmentPart getAttachmentByPartName(String partName)
+ {
+ for (AttachmentPart part : attachments)
+ {
+ String contentId = part.getContentId();
+ if (contentId.startsWith("<" + partName + "="))
+ return part;
+ }
+ return null;
+ }
+
+ public AttachmentPart createAttachmentPart()
+ {
+ return new AttachmentPartImpl();
+ }
+
+ public String getContentDescription()
+ {
+ String[] value = mimeHeaders.getHeader(MimeConstants.CONTENT_DESCRIPTION);
+
+ return (value == null) ? null : value[0];
+ }
+
+ public void setContentDescription(String description)
+ {
+ mimeHeaders.setHeader(MimeConstants.CONTENT_DESCRIPTION, description);
+ }
+
+ public MimeHeaders getMimeHeaders()
+ {
+ return mimeHeaders;
+ }
+
+ public void setMimeHeaders(MimeHeaders headers)
+ {
+ if (headers == null)
+ throw new IllegalArgumentException("MimeHeaders cannot be null");
+ this.mimeHeaders = headers;
+ }
+
+ public SOAPPart getSOAPPart()
+ {
+ return soapPart;
+ }
+
+ public void removeAllAttachments()
+ {
+ attachments.clear();
+ saveRequired = true;
+ }
+
+ public int countAttachments()
+ {
+ return attachments.size();
+ }
+
+ public Iterator getAttachments()
+ {
+ // Someone could call remove on this iterator, affecting the attachment count
+ saveRequired = true;
+ return attachments.iterator();
+ }
+
+ public Iterator getAttachments(MimeHeaders headers)
+ {
+ if (headers == null)
+ throw new WSException("MimeHeaders can not be null");
+
+ return new MimeMatchingAttachmentsIterator(headers, attachments);
+ }
+
+ public void saveChanges() throws SOAPException
+ {
+ if (saveRequired == true)
+ {
+ try
+ {
+ boolean hasAttachments = attachments.size() > 0;
+
+ if (isXOPMessage() && !XOPContext.isMTOMEnabled() &&
hasAttachments)
+ throw new IllegalStateException("XOP parameter not properly
inlined");
+
+ // default content-type
+ String contentType = MimeConstants.TYPE_SOAP11 + "; charset=" +
getCharSetEncoding();
+
+ if (hasAttachments)
+ {
+ if (isXOPMessage() && XOPContext.isMTOMEnabled())
+ {
+ multipartRelatedEncoder = new MultipartRelatedXOPEncoder(this);
+ multipartRelatedEncoder.encodeMultipartRelatedMessage();
+ contentType = multipartRelatedEncoder.getContentType();
+ }
+ else
+ {
+ multipartRelatedEncoder = new MultipartRelatedSwAEncoder(this);
+ multipartRelatedEncoder.encodeMultipartRelatedMessage();
+ contentType = multipartRelatedEncoder.getContentType();
+ }
+ }
+
+ mimeHeaders.setHeader(MimeConstants.CONTENT_TYPE, contentType);
+
+ }
+ catch (MessagingException ex)
+ {
+ throw new SOAPException(ex);
+ }
+
+ /*
+ * We are lazily encoding our message, which means that currently
+ * Content-Length is not being calculated. This should not be a problem
+ * because HTTP/1.1 does not require that it be sent (WS Basic Profile 1.1
+ * states that implementations SHOULD send HTTP 1.1). If it is determined
+ * that it must be sent, this perhaps should be done by the transport
+ * layer. However, there could be a space optimization where length is
+ * precalulated per attachment, and that calculation would, of course,
+ * belong here.
+ */
+
+ saveRequired = false;
+ }
+ }
+
+ public boolean saveRequired()
+ {
+ return saveRequired;
+ }
+
+ public void writeTo(OutputStream outs) throws SOAPException, IOException
+ {
+ // Save all changes
+ saveChanges();
+
+ // If there are attachments then we delegate encoding to MultipartRelatedEncoder
+ if (attachments.size() > 0)
+ {
+ multipartRelatedEncoder.writeTo(outs);
+ }
+ else
+ {
+ SOAPEnvelope soapEnv = getSOAPPart().getEnvelope();
+ if (soapEnv != null)
+ {
+ boolean writeXML = isWriteXMLDeclaration();
+ String charsetEncoding = getCharSetEncoding();
+ SOAPElementWriter writer = new SOAPElementWriter(outs, charsetEncoding);
+
writer.setWriteXMLDeclaration(writeXML).writeElement((SOAPEnvelopeImpl)soapEnv);
+ }
+ }
+ }
+
+ private String getCharSetEncoding() throws SOAPException
+ {
+ String charsetName = (String)getProperty(CHARACTER_SET_ENCODING);
+ if (charsetName == null)
+ charsetName = "UTF-8";
+ return charsetName;
+ }
+
+ /** Get the operation meta data for this SOAP message
+ */
+ public OperationMetaData getOperationMetaData(EndpointMetaData epMetaData) throws
SOAPException
+ {
+ if (opMetaData == null)
+ {
+ SOAPMessageDispatcher dispatcher = new SOAPMessageDispatcher();
+ opMetaData = dispatcher.getDispatchDestination(epMetaData, this);
+ }
+ return opMetaData;
+ }
+
+ public boolean isFaultMessage()
+ {
+ SOAPFault soapFault = null;
+ try
+ {
+ soapFault = getSOAPBody().getFault();
+ }
+ catch (Exception ignore)
+ {
+ }
+ return soapFault != null;
+ }
+
+ private boolean isWriteXMLDeclaration() throws SOAPException
+ {
+ Boolean booleanValue = new Boolean(false);
+ Object propValue = getProperty(WRITE_XML_DECLARATION);
+ if (propValue instanceof Boolean)
+ booleanValue = (Boolean)propValue;
+ if (propValue instanceof String)
+ booleanValue = new Boolean((String)propValue);
+ return booleanValue.booleanValue();
+ }
+
+ public static class MimeMatchingAttachmentsIterator implements Iterator
+ {
+ private Iterator iterator;
+
+ private MimeHeaders headers = new MimeHeaders();
+
+ private AttachmentPart lastMatch;
+
+ public MimeMatchingAttachmentsIterator(MimeHeaders headers, List attachments)
+ {
+ iterator = attachments.iterator();
+
+ if (headers != null)
+ this.headers = headers;
+ }
+
+ private boolean containsAllHeaders(Iterator headerIterator, AttachmentPart part)
+ {
+ while (headerIterator.hasNext())
+ {
+ MimeHeader header = (MimeHeader)headerIterator.next();
+ String[] values = part.getMimeHeader(header.getName());
+ if (values == null)
+ return false;
+
+ boolean match = false;
+ for (int j = 0; j < values.length; j++)
+ {
+ if (values[j].equalsIgnoreCase(header.getValue()))
+ {
+ match = true;
+ break;
+ }
+ }
+
+ if (!match)
+ return false;
+ }
+
+ return true;
+ }
+
+ private void nextMatch()
+ {
+ while (iterator.hasNext())
+ {
+ AttachmentPart part = (AttachmentPart)iterator.next();
+ if (containsAllHeaders(headers.getAllHeaders(), part))
+ {
+ lastMatch = part;
+ break;
+ }
+ }
+ }
+
+ public boolean hasNext()
+ {
+ if (lastMatch == null)
+ nextMatch();
+
+ return lastMatch != null;
+ }
+
+ public Object next()
+ {
+ if (!hasNext())
+ return null;
+
+ Object retval = lastMatch;
+ lastMatch = null;
+
+ return retval;
+ }
+
+ public void remove()
+ {
+ iterator.remove();
+ }
+ }
+}
Copied: branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/SOAPPartImpl.java
(from rev 1557,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPPartImpl.java)
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPPartImpl.java 2006-12-05
23:29:55 UTC (rev 1557)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/SOAPPartImpl.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -0,0 +1,547 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+package org.jboss.ws.core.soap;
+
+// $Id$
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.xml.soap.MimeHeaders;
+import javax.xml.soap.SOAPBody;
+import javax.xml.soap.SOAPEnvelope;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.soap.SOAPPart;
+import javax.xml.transform.Source;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamSource;
+
+import org.jboss.logging.Logger;
+import org.jboss.util.NotImplementedException;
+import org.jboss.ws.utils.DOMUtils;
+import org.w3c.dom.Attr;
+import org.w3c.dom.CDATASection;
+import org.w3c.dom.Comment;
+import org.w3c.dom.DOMConfiguration;
+import org.w3c.dom.DOMException;
+import org.w3c.dom.DOMImplementation;
+import org.w3c.dom.Document;
+import org.w3c.dom.DocumentFragment;
+import org.w3c.dom.DocumentType;
+import org.w3c.dom.Element;
+import org.w3c.dom.EntityReference;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.w3c.dom.ProcessingInstruction;
+import org.w3c.dom.Text;
+import org.w3c.dom.UserDataHandler;
+
+/** An implementation of SOAPPart.
+ *
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ */
+public class SOAPPartImpl extends SOAPPart
+{
+ // provide logging
+ private static Logger log = Logger.getLogger(SOAPPartImpl.class);
+
+ private SOAPMessage soapMessage;
+ private SOAPEnvelope soapEnvelope;
+
+ private SOAPDocument doc = new SOAPDocument();
+
+ SOAPPartImpl(SOAPMessage message)
+ {
+ this.soapMessage = message;
+ }
+
+ public SOAPMessage getSOAPMessage()
+ {
+ return soapMessage;
+ }
+
+ public SOAPEnvelope getEnvelope() throws SOAPException
+ {
+ return soapEnvelope;
+ }
+
+ public void setEnvelope(SOAPEnvelope soapEnvelope)
+ {
+ this.soapEnvelope = soapEnvelope;
+ }
+
+ public void removeMimeHeader(String s)
+ {
+ MimeHeaders mimeHeaders = soapMessage.getMimeHeaders();
+ mimeHeaders.removeHeader(s);
+ }
+
+ public void removeAllMimeHeaders()
+ {
+ MimeHeaders mimeHeaders = soapMessage.getMimeHeaders();
+ mimeHeaders.removeAllHeaders();
+ }
+
+ public String[] getMimeHeader(String name)
+ {
+ MimeHeaders mimeHeaders = soapMessage.getMimeHeaders();
+ return mimeHeaders.getHeader(name);
+ }
+
+ public void setMimeHeader(String name, String value)
+ {
+ MimeHeaders mimeHeaders = soapMessage.getMimeHeaders();
+ mimeHeaders.setHeader(name, value);
+ }
+
+ public void addMimeHeader(String name, String value)
+ {
+ MimeHeaders mimeHeaders = soapMessage.getMimeHeaders();
+ mimeHeaders.addHeader(name, value);
+ }
+
+ public Iterator getAllMimeHeaders()
+ {
+ MimeHeaders mimeHeaders = soapMessage.getMimeHeaders();
+ return mimeHeaders.getAllHeaders();
+ }
+
+ public Iterator getMatchingMimeHeaders(String names[])
+ {
+ MimeHeaders mimeHeaders = soapMessage.getMimeHeaders();
+ return mimeHeaders.getMatchingHeaders(names);
+ }
+
+ public Iterator getNonMatchingMimeHeaders(String names[])
+ {
+ MimeHeaders mimeHeaders = soapMessage.getMimeHeaders();
+ return mimeHeaders.getNonMatchingHeaders(names);
+ }
+
+ public void setContent(Source source) throws SOAPException
+ {
+ // 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 (source == null)
+ {
+ log.debug("Setting content source to null removes the SOAPEnvelope");
+ soapEnvelope = null;
+ return;
+ }
+
+ Element domElement;
+ if (source instanceof DOMSource)
+ {
+ DOMSource domSource = (DOMSource)source;
+ Node node = domSource.getNode();
+ if (node instanceof Document)
+ domElement = ((Document)node).getDocumentElement();
+ else if (node instanceof Element)
+ domElement = (Element)node;
+ else
+ throw new SOAPException("Unsupported DOMSource node: " + node);
+ }
+ else if (source instanceof StreamSource)
+ {
+ try
+ {
+ StreamSource streamSource = (StreamSource)source;
+ domElement = DOMUtils.parse(streamSource.getInputStream());
+ }
+ catch (IOException e)
+ {
+ throw new SOAPException("Cannot parse stream source", e);
+ }
+ }
+ else
+ {
+ throw new SOAPException("Unsupported source parameter: " + source);
+ }
+
+ SOAPFactoryImpl factory = new SOAPFactoryImpl();
+ SOAPElementImpl soapElement = factory.createElement(domElement, true);
+
+ SOAPBody body = soapEnvelope.getBody();
+ body.removeContents();
+ body.addChildElement(soapElement);
+ }
+
+ public Source getContent() throws SOAPException
+ {
+ SOAPBody body = soapEnvelope.getBody();
+ return new DOMSource(body.getFirstChild());
+ }
+
+ // Document
*********************************************************************************************************
+
+ public DOMImplementation getImplementation()
+ {
+ return doc.getImplementation();
+ }
+
+ public DocumentFragment createDocumentFragment()
+ {
+ return doc.createDocumentFragment();
+ }
+
+ public DocumentType getDoctype()
+ {
+ return doc.getDoctype();
+ }
+
+ public Element getDocumentElement()
+ {
+ return soapEnvelope;
+ }
+
+ public Attr createAttribute(String name) throws DOMException
+ {
+ return doc.createAttribute(name);
+ }
+
+ public CDATASection createCDATASection(String data) throws DOMException
+ {
+ return doc.createCDATASection(data);
+ }
+
+ public Comment createComment(String data)
+ {
+ return doc.createComment(data);
+ }
+
+ public Element createElement(String tagName) throws DOMException
+ {
+ return doc.createElement(tagName);
+ }
+
+ public Element getElementById(String elementId)
+ {
+ return doc.getElementById(elementId);
+ }
+
+ public EntityReference createEntityReference(String name) throws DOMException
+ {
+ return doc.createEntityReference(name);
+ }
+
+ public org.w3c.dom.Node importNode(org.w3c.dom.Node importedNode, boolean deep) throws
DOMException
+ {
+ return doc.importNode(importedNode, deep);
+ }
+
+ public NodeList getElementsByTagName(String tagname)
+ {
+ return doc.getElementsByTagName(tagname);
+ }
+
+ public Text createTextNode(String data)
+ {
+ return doc.createTextNode(data);
+ }
+
+ public Attr createAttributeNS(String namespaceURI, String qualifiedName) throws
DOMException
+ {
+ return doc.createAttributeNS(namespaceURI, qualifiedName);
+ }
+
+ public Element createElementNS(String namespaceURI, String qualifiedName) throws
DOMException
+ {
+ return doc.createElementNS(namespaceURI, qualifiedName);
+ }
+
+ public NodeList getElementsByTagNameNS(String namespaceURI, String localName)
+ {
+ return doc.getElementsByTagNameNS(namespaceURI, localName);
+ }
+
+ public ProcessingInstruction createProcessingInstruction(String target, String data)
throws DOMException
+ {
+ return doc.createProcessingInstruction(target, data);
+ }
+
+ // Node
*********************************************************************************************************
+
+ public org.w3c.dom.Node appendChild(org.w3c.dom.Node node) throws DOMException
+ {
+ throw new NotImplementedException();
+ }
+
+ public org.w3c.dom.Node cloneNode(boolean b)
+ {
+ throw new NotImplementedException();
+ }
+
+ public NamedNodeMap getAttributes()
+ {
+ throw new NotImplementedException();
+ }
+
+ public NodeList getChildNodes()
+ {
+ List<NodeImpl> list = new ArrayList<NodeImpl>();
+ if (soapEnvelope != null)
+ {
+ list.add((NodeImpl)soapEnvelope);
+ }
+ return new NodeListImpl(list);
+ }
+
+ public org.w3c.dom.Node getFirstChild()
+ {
+ return soapEnvelope;
+ }
+
+ public org.w3c.dom.Node getLastChild()
+ {
+ return soapEnvelope;
+ }
+
+ public String getLocalName()
+ {
+ throw new NotImplementedException();
+ }
+
+ public String getNamespaceURI()
+ {
+ throw new NotImplementedException();
+ }
+
+ public org.w3c.dom.Node getNextSibling()
+ {
+ throw new NotImplementedException();
+ }
+
+ public String getNodeName()
+ {
+ return doc.getNodeName();
+ }
+
+ public short getNodeType()
+ {
+ return doc.getNodeType();
+ }
+
+ public String getNodeValue() throws DOMException
+ {
+ throw new NotImplementedException();
+ }
+
+ public Document getOwnerDocument()
+ {
+ throw new NotImplementedException();
+ }
+
+ public org.w3c.dom.Node getParentNode()
+ {
+ throw new NotImplementedException();
+ }
+
+ public String getPrefix()
+ {
+ throw new NotImplementedException();
+ }
+
+ public org.w3c.dom.Node getPreviousSibling()
+ {
+ throw new NotImplementedException();
+ }
+
+ public boolean hasAttributes()
+ {
+ throw new NotImplementedException();
+ }
+
+ public boolean hasChildNodes()
+ {
+ throw new NotImplementedException();
+ }
+
+ public org.w3c.dom.Node insertBefore(org.w3c.dom.Node node, org.w3c.dom.Node node1)
throws DOMException
+ {
+ throw new NotImplementedException();
+ }
+
+ public boolean isSupported(String s, String s1)
+ {
+ throw new NotImplementedException();
+ }
+
+ public void normalize()
+ {
+ throw new NotImplementedException();
+ }
+
+ public org.w3c.dom.Node removeChild(org.w3c.dom.Node node) throws DOMException
+ {
+ throw new NotImplementedException();
+ }
+
+ public org.w3c.dom.Node replaceChild(org.w3c.dom.Node node, org.w3c.dom.Node node1)
throws DOMException
+ {
+ throw new NotImplementedException();
+ }
+
+ public void setNodeValue(String s) throws DOMException
+ {
+ throw new NotImplementedException();
+ }
+
+ public void setPrefix(String s) throws DOMException
+ {
+ throw new NotImplementedException();
+ }
+
+ public Node adoptNode(Node source) throws DOMException
+ {
+ throw new NotImplementedException("adoptNode");
+ }
+
+ public String getDocumentURI()
+ {
+ throw new NotImplementedException("getDocumentURI");
+ }
+
+ public DOMConfiguration getDomConfig()
+ {
+ throw new NotImplementedException("getDomConfig");
+ }
+
+ public String getInputEncoding()
+ {
+ throw new NotImplementedException("getInputEncoding");
+ }
+
+ public boolean getStrictErrorChecking()
+ {
+ throw new NotImplementedException("getStrictErrorChecking");
+ }
+
+ public String getXmlEncoding()
+ {
+ throw new NotImplementedException("getXmlEncoding");
+ }
+
+ public boolean getXmlStandalone()
+ {
+ throw new NotImplementedException("getXmlStandalone");
+ }
+
+ public String getXmlVersion()
+ {
+ throw new NotImplementedException("getXmlVersion");
+ }
+
+ public void normalizeDocument()
+ {
+ throw new NotImplementedException("normalizeDocument");
+ }
+
+ public Node renameNode(Node n, String namespaceURI, String qualifiedName) throws
DOMException
+ {
+ throw new NotImplementedException("renameNode");
+ }
+
+ public void setDocumentURI(String documentURI)
+ {
+ throw new NotImplementedException("setDocumentURI");
+ }
+
+ public void setStrictErrorChecking(boolean strictErrorChecking)
+ {
+ throw new NotImplementedException("setStrictErrorChecking");
+ }
+
+ public void setXmlStandalone(boolean xmlStandalone) throws DOMException
+ {
+ throw new NotImplementedException("setXmlStandalone");
+ }
+
+ public void setXmlVersion(String xmlVersion) throws DOMException
+ {
+ throw new NotImplementedException("setXmlVersion");
+ }
+
+ public short compareDocumentPosition(Node other) throws DOMException
+ {
+ throw new NotImplementedException("compareDocumentPosition");
+ }
+
+ public String getBaseURI()
+ {
+ throw new NotImplementedException("getBaseURI");
+ }
+
+ public Object getFeature(String feature, String version)
+ {
+ throw new NotImplementedException("getFeature");
+ }
+
+ public String getTextContent() throws DOMException
+ {
+ throw new NotImplementedException("getTextContent");
+ }
+
+ public Object getUserData(String key)
+ {
+ throw new NotImplementedException("getUserData");
+ }
+
+ public boolean isDefaultNamespace(String namespaceURI)
+ {
+ throw new NotImplementedException("isDefaultNamespace");
+ }
+
+ public boolean isEqualNode(Node arg)
+ {
+ throw new NotImplementedException("isEqualNode");
+ }
+
+ public boolean isSameNode(Node other)
+ {
+ throw new NotImplementedException("isSameNode");
+ }
+
+ public String lookupNamespaceURI(String prefix)
+ {
+ throw new NotImplementedException("lookupNamespaceURI");
+ }
+
+ public String lookupPrefix(String namespaceURI)
+ {
+ throw new NotImplementedException("lookupPrefix");
+ }
+
+ public void setTextContent(String textContent) throws DOMException
+ {
+ throw new NotImplementedException("setTextContent");
+ }
+
+ public Object setUserData(String key, Object data, UserDataHandler handler)
+ {
+ throw new NotImplementedException("setUserData");
+ }
+}
Copied: branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/TextImpl.java (from
rev 1557, branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/TextImpl.java)
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/TextImpl.java 2006-12-05
23:29:55 UTC (rev 1557)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/TextImpl.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -0,0 +1,327 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+package org.jboss.ws.core.soap;
+
+import org.w3c.dom.DOMException;
+import org.w3c.dom.Text;
+
+/**
+ * A representation of a node whose value is text. A Text
+ * object may represent text that is content or text that is a comment.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ */
+public class TextImpl extends NodeImpl implements javax.xml.soap.Text
+{
+
+ public TextImpl(org.w3c.dom.Node node)
+ {
+ super(node);
+ }
+
+ /** Retrieves whether this object represents a comment.
+ */
+ public boolean isComment()
+ {
+ String value = getNodeValue().trim();
+ return value.startsWith("<!--") &&
value.endsWith("-->");
+ }
+
+ public String getValue()
+ {
+ return getNodeValue();
+ }
+
+ public void setValue(String value)
+ {
+ setNodeValue(value);
+ }
+
+ /**
+ * Breaks this node into two nodes at the specified <code>offset</code>,
keeping both in the tree as siblings.
+ * <p/>
+ * After being split, this node will contain all the content up to the
<code>offset</code> point. A
+ * new node of the same type, which contains all the content at and after the
<code>offset</code> point, is returned.
+ * If the original node had a parent node, the new node is inserted as the next
sibling of the original node.
+ * When the <code>offset</code> is equal to the length of this node, the
new node has no data.
+ *
+ * @param offset The 16-bit unit offset at which to split, starting from
<code>0</code>.
+ * @return The new node, of the same type as this node.
+ * @throws org.w3c.dom.DOMException INDEX_SIZE_ERR: Raised if the specified offset is
negative or greater
+ * than the number of 16-bit units in
<code>data</code>.
+ * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is
readonly.
+ */
+ public Text splitText(int offset) throws DOMException
+ {
+
+ if (offset < 0 || offset > getNodeValue().length())
+ throw new IllegalArgumentException("Invalid offset [" + offset +
"] for '" + getNodeValue() + "'");
+
+ String before = getNodeValue().substring(0, offset + 1);
+ setNodeValue(before);
+
+ String after = getNodeValue().substring(offset + 1);
+ TextImpl txtNode = new TextImpl(domNode.getOwnerDocument().createTextNode(after));
+
+ org.w3c.dom.Node parent = getParentNode();
+ if (parent != null)
+ {
+ org.w3c.dom.Node sibling = getNextSibling();
+ if (sibling == null)
+ parent.appendChild(txtNode);
+ else
+ parent.insertBefore(txtNode, sibling);
+ }
+
+ return txtNode;
+ }
+
+ // org.w3c.dom.CharacterData
***************************************************************************************
+
+ /**
+ * The number of 16-bit units that are available through
<code>data</code>
+ * and the <code>substringData</code> method below. This may have the
+ * value zero, i.e., <code>CharacterData</code> nodes may be empty.
+ */
+ public int getLength()
+ {
+ return getNodeValue().length();
+ }
+
+ /**
+ * Remove a range of 16-bit units from the node. Upon success,
+ * <code>data</code> and <code>length</code> reflect the
change.
+ *
+ * @param offset The offset from which to start removing.
+ * @param count The number of 16-bit units to delete. If the sum of
+ * <code>offset</code> and <code>count</code>
exceeds
+ * <code>length</code> then all 16-bit units from
<code>offset</code>
+ * to the end of the data are deleted.
+ * @throws org.w3c.dom.DOMException INDEX_SIZE_ERR: Raised if the specified
<code>offset</code> is
+ * negative or greater than the number of 16-bit
units in
+ * <code>data</code>, or if the specified
<code>count</code> is
+ * negative.
+ * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if
this node is readonly.
+ */
+ public void deleteData(int offset, int count) throws DOMException
+ {
+ String value = getNodeValue().substring(0, offset + 1);
+ setNodeValue(value);
+ }
+
+ /**
+ * The character data of the node that implements this interface. The DOM
+ * implementation may not put arbitrary limits on the amount of data
+ * that may be stored in a <code>CharacterData</code> node. However,
+ * implementation limits may mean that the entirety of a node's data may
+ * not fit into a single <code>DOMString</code>. In such cases, the user
+ * may call <code>substringData</code> to retrieve the data in
+ * appropriately sized pieces.
+ *
+ * @throws org.w3c.dom.DOMException NO_MODIFICATION_ALLOWED_ERR: Raised when the node
is readonly.
+ * @throws org.w3c.dom.DOMException DOMSTRING_SIZE_ERR: Raised when it would return
more characters than
+ * fit in a <code>DOMString</code>
variable on the implementation
+ * platform.
+ */
+ public String getData() throws DOMException
+ {
+ return getNodeValue();
+ }
+
+ /**
+ * Extracts a range of data from the node.
+ *
+ * @param offset Start offset of substring to extract.
+ * @param count The number of 16-bit units to extract.
+ * @return The specified substring. If the sum of <code>offset</code> and
+ * <code>count</code> exceeds the <code>length</code>,
then all 16-bit
+ * units to the end of the data are returned.
+ * @throws org.w3c.dom.DOMException INDEX_SIZE_ERR: Raised if the specified
<code>offset</code> is
+ * negative or greater than the number of 16-bit
units in
+ * <code>data</code>, or if the specified
<code>count</code> is
+ * negative.
+ * <br>DOMSTRING_SIZE_ERR: Raised if the
specified range of text does
+ * not fit into a
<code>DOMString</code>.
+ */
+ public String substringData(int offset, int count) throws DOMException
+ {
+ return getNodeValue().substring(offset, offset + count);
+ }
+
+ /**
+ * Replace the characters starting at the specified 16-bit unit offset
+ * with the specified string.
+ *
+ * @param offset The offset from which to start replacing.
+ * @param count The number of 16-bit units to replace. If the sum of
+ * <code>offset</code> and <code>count</code>
exceeds
+ * <code>length</code>, then all 16-bit units to the end of
the data
+ * are replaced; (i.e., the effect is the same as a
<code>remove</code>
+ * method call with the same range, followed by an
<code>append</code>
+ * method invocation).
+ * @param arg The <code>DOMString</code> with which the range must be
+ * replaced.
+ * @throws org.w3c.dom.DOMException INDEX_SIZE_ERR: Raised if the specified
<code>offset</code> is
+ * negative or greater than the number of 16-bit
units in
+ * <code>data</code>, or if the specified
<code>count</code> is
+ * negative.
+ * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if
this node is readonly.
+ */
+ public void replaceData(int offset, int count, String arg) throws DOMException
+ {
+ StringBuilder buffer = new StringBuilder(getNodeValue());
+ buffer.replace(offset, offset + count, arg);
+ setNodeValue(buffer.toString());
+ }
+
+ /**
+ * Insert a string at the specified 16-bit unit offset.
+ *
+ * @param offset The character offset at which to insert.
+ * @param arg The <code>DOMString</code> to insert.
+ * @throws org.w3c.dom.DOMException INDEX_SIZE_ERR: Raised if the specified
<code>offset</code> is
+ * negative or greater than the number of 16-bit
units in
+ * <code>data</code>.
+ * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if
this node is readonly.
+ */
+ public void insertData(int offset, String arg) throws DOMException
+ {
+ StringBuilder buffer = new StringBuilder(getNodeValue());
+ buffer.insert(offset, arg);
+ setNodeValue(buffer.toString());
+ }
+
+ /**
+ * Append the string to the end of the character data of the node. Upon
+ * success, <code>data</code> provides access to the concatenation of
+ * <code>data</code> and the <code>DOMString</code>
specified.
+ *
+ * @param arg The <code>DOMString</code> to append.
+ * @throws org.w3c.dom.DOMException NO_MODIFICATION_ALLOWED_ERR: Raised if this node
is readonly.
+ */
+ public void appendData(String arg) throws DOMException
+ {
+ setNodeValue(getNodeValue() + arg);
+ }
+
+ /**
+ * The character data of the node that implements this interface. The DOM
+ * implementation may not put arbitrary limits on the amount of data
+ * that may be stored in a <code>CharacterData</code> node. However,
+ * implementation limits may mean that the entirety of a node's data may
+ * not fit into a single <code>DOMString</code>. In such cases, the user
+ * may call <code>substringData</code> to retrieve the data in
+ * appropriately sized pieces.
+ *
+ * @throws org.w3c.dom.DOMException NO_MODIFICATION_ALLOWED_ERR: Raised when the node
is readonly.
+ * @throws org.w3c.dom.DOMException DOMSTRING_SIZE_ERR: Raised when it would return
more characters than
+ * fit in a <code>DOMString</code>
variable on the implementation
+ * platform.
+ */
+ public void setData(String data) throws DOMException
+ {
+ setNodeValue(data);
+ }
+
+ // Stubbed out org.w3c.dom.Text methods **************************
+
+ /**
+ * TODO - complete the implementation
+ *
+ * Returns whether this text node contains <a
href='http://www.w3.org/TR/2004/REC-xml-infoset-20040204#infoitem.cha...
+ * element content whitespace</a>, often abusively called "ignorable
whitespace". The text node is
+ * determined to contain whitespace in element content during the load
+ * of the document or if validation occurs while using
+ * <code>Document.normalizeDocument()</code>.
+ * @since DOM Level 3
+ */
+ public boolean isElementContentWhitespace()
+ {
+ return false;
+ }
+
+ /**
+ * TODO - complete the implementation
+ *
+ * Returns all text of <code>Text</code> nodes logically-adjacent text
+ * nodes to this node, concatenated in document order.
+ * <br>For instance, in the example below <code>wholeText</code> on
the
+ * <code>Text</code> node that contains "bar" returns
"barfoo", while on
+ * the <code>Text</code> node that contains "foo" it returns
"barfoo".
+ * @since DOM Level 3
+ */
+ public String getWholeText()
+ {
+ return null;
+ }
+
+ /**
+ * TODO - complete the implementation
+ *
+ * Replaces the text of the current node and all logically-adjacent text
+ * nodes with the specified text. All logically-adjacent text nodes are
+ * removed including the current node unless it was the recipient of the
+ * replacement text.
+ * <br>This method returns the node which received the replacement text.
+ * The returned node is:
+ * <ul>
+ * <li><code>null</code>, when the replacement text is
+ * the empty string;
+ * </li>
+ * <li>the current node, except when the current node is
+ * read-only;
+ * </li>
+ * <li> a new <code>Text</code> node of the same type (
+ * <code>Text</code> or <code>CDATASection</code>) as the
current node
+ * inserted at the location of the replacement.
+ * </li>
+ * </ul>
+ * <br>For instance, in the above example calling
+ * <code>replaceWholeText</code> on the <code>Text</code> node
that
+ * contains "bar" with "yo" in argument results in the following:
+ * <br>Where the nodes to be removed are read-only descendants of an
+ * <code>EntityReference</code>, the
<code>EntityReference</code> must
+ * be removed instead of the read-only nodes. If any
+ * <code>EntityReference</code> to be removed has descendants that are
+ * not <code>EntityReference</code>, <code>Text</code>, or
+ * <code>CDATASection</code> nodes, the
<code>replaceWholeText</code>
+ * method must fail before performing any modification of the document,
+ * raising a <code>DOMException</code> with the code
+ * <code>NO_MODIFICATION_ALLOWED_ERR</code>.
+ * <br>For instance, in the example below calling
+ * <code>replaceWholeText</code> on the <code>Text</code> node
that
+ * contains "bar" fails, because the
<code>EntityReference</code> node
+ * "ent" contains an <code>Element</code> node which cannot be
removed.
+ * @param content The content of the replacing <code>Text</code> node.
+ * @return The <code>Text</code> node created with the specified content.
+ * @exception org.w3c.dom.DOMException
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if one of the <code>Text</code>
+ * nodes being replaced is readonly.
+ * @since DOM Level 3
+ */
+ public Text replaceWholeText(String content)
+ throws DOMException
+ {
+ return null;
+ }
+
+}
Copied: branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/attachment (from rev
1557, branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/attachment)
Deleted:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/attachment/AttachmentPartImpl.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/attachment/AttachmentPartImpl.java 2006-12-05
23:29:55 UTC (rev 1557)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/attachment/AttachmentPartImpl.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -1,264 +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.attachment;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Iterator;
-
-import javax.activation.DataHandler;
-import javax.mail.internet.MimeMultipart;
-import javax.xml.soap.AttachmentPart;
-import javax.xml.soap.MimeHeaders;
-import javax.xml.soap.SOAPException;
-
-/**
- * Implementation of the <code>AttachmentPart</code> interface.
- * @see javax.xml.soap.AttachmentPart
- *
- * @author <a href="mailto:jason@stacksmash.com">Jason T.
Greene</a>
- * @author Thomas.Diesler(a)jboss.org
- */
-public class AttachmentPartImpl extends AttachmentPart
-{
- private MimeHeaders mimeHeaders = new MimeHeaders();
-
- private DataHandler dataHandler;
-
- private String cachedContentId;
-
- private String cachedContentType;
-
- private String cachedContentLocation;
-
- static
- {
- // Load JAF content handlers
- ContentHandlerRegistry.register();
- }
-
- public AttachmentPartImpl()
- {
- }
-
- public AttachmentPartImpl(DataHandler handler)
- {
- this.dataHandler = handler;
- }
-
- private void clearHeaderCache()
- {
- cachedContentId = null;
- cachedContentType = null;
- cachedContentLocation = null;
- }
-
- public void addMimeHeader(String name, String value)
- {
- clearHeaderCache();
- mimeHeaders.addHeader(name, value);
- }
-
- public void clearContent()
- {
- dataHandler = null;
- }
-
- public Iterator getAllMimeHeaders()
- {
- clearHeaderCache();
- return mimeHeaders.getAllHeaders();
- }
-
- public Object getContent() throws SOAPException
- {
- if (dataHandler == null)
- throw new SOAPException("No content available");
-
- try
- {
- return dataHandler.getContent();
- }
- catch (IOException e)
- {
- throw new SOAPException(e);
- }
- }
-
- public DataHandler getDataHandler() throws SOAPException
- {
- if (dataHandler == null)
- throw new SOAPException("No data handler on attachment");
-
- return dataHandler;
- }
-
- public Iterator getMatchingMimeHeaders(String[] names)
- {
- clearHeaderCache();
- return mimeHeaders.getMatchingHeaders(names);
- }
-
- public String[] getMimeHeader(String name)
- {
- return mimeHeaders.getHeader(name);
- }
-
- /**
- * Returns the first occurence of a MIME header.
- *
- * @param header the mime header
- * @return the value of the first occurence of a MIME header
- */
- public String getFirstMimeHeader(String header)
- {
- String[] values = mimeHeaders.getHeader(header.toLowerCase());
- if ((values != null) && (values.length > 0))
- {
- return values[0];
- }
- return null;
- }
-
- public Iterator getNonMatchingMimeHeaders(String[] names)
- {
- clearHeaderCache();
- return mimeHeaders.getNonMatchingHeaders(names);
- }
-
- public int getSize() throws SOAPException
- {
- if (dataHandler == null)
- return 0;
-
- // In order to be accurate this method must be somewhat inefficient
- // TODO optimize this for specific data sources
- int count = 0, ret = 0;
- byte[] buffer = new byte[256];
-
- try
- {
- InputStream stream = dataHandler.getInputStream();
-
- do
- {
- count += ret;
- ret = stream.read(buffer);
- }
- while (ret != -1);
- }
- catch (IOException e)
- {
- throw new SOAPException(e);
- }
-
- return count;
- }
-
- public void removeAllMimeHeaders()
- {
- clearHeaderCache();
- mimeHeaders.removeAllHeaders();
- }
-
- public void removeMimeHeader(String name)
- {
- clearHeaderCache();
- mimeHeaders.removeHeader(name);
- }
-
- public void setContent(Object object, String contentType)
- {
-
- // Override the content type if its a mime multipart object because we need to
preserve
- // the all of the content type parameters
- if (object instanceof MimeMultipart)
- contentType = ((MimeMultipart)object).getContentType();
-
- dataHandler = new DataHandler(object, contentType);
-
- setContentType(contentType);
- }
-
- public void setDataHandler(DataHandler dataHandler)
- {
- if (dataHandler == null)
- throw new IllegalArgumentException("Null data handler");
-
- this.dataHandler = dataHandler;
- setContentType(dataHandler.getContentType());
- }
-
- public void setMimeHeader(String name, String value)
- {
- clearHeaderCache();
- mimeHeaders.setHeader(name, value);
- }
-
- public String getContentId()
- {
- if (cachedContentId == null)
- {
- cachedContentId = getFirstMimeHeader(MimeConstants.CONTENT_ID);
- }
-
- return cachedContentId;
- }
-
- public String getContentLocation()
- {
- if (cachedContentLocation == null)
- {
- cachedContentLocation = getFirstMimeHeader(MimeConstants.CONTENT_LOCATION);
- }
-
- return cachedContentLocation;
- }
-
- public String getContentType()
- {
- if (cachedContentType == null)
- {
- cachedContentType = getFirstMimeHeader(MimeConstants.CONTENT_TYPE);
- }
-
- return cachedContentType;
- }
-
- public void setContentId(String contentId)
- {
- setMimeHeader(MimeConstants.CONTENT_ID, contentId);
- cachedContentId = contentId;
- }
-
- public void setContentLocation(String contentLocation)
- {
- setMimeHeader(MimeConstants.CONTENT_LOCATION, contentLocation);
- cachedContentLocation = contentLocation;
- }
-
- public void setContentType(String contentType)
- {
- setMimeHeader(MimeConstants.CONTENT_TYPE, contentType);
- cachedContentType = contentType;
- }
-}
\ No newline at end of file
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/attachment/AttachmentPartImpl.java
(from rev 1560,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/attachment/AttachmentPartImpl.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/attachment/AttachmentPartImpl.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/attachment/AttachmentPartImpl.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -0,0 +1,264 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+package org.jboss.ws.core.soap.attachment;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Iterator;
+
+import javax.activation.DataHandler;
+import javax.mail.internet.MimeMultipart;
+import javax.xml.soap.AttachmentPart;
+import javax.xml.soap.MimeHeaders;
+import javax.xml.soap.SOAPException;
+
+/**
+ * Implementation of the <code>AttachmentPart</code> interface.
+ * @see javax.xml.soap.AttachmentPart
+ *
+ * @author <a href="mailto:jason@stacksmash.com">Jason T.
Greene</a>
+ * @author Thomas.Diesler(a)jboss.org
+ */
+public class AttachmentPartImpl extends AttachmentPart
+{
+ private MimeHeaders mimeHeaders = new MimeHeaders();
+
+ private DataHandler dataHandler;
+
+ private String cachedContentId;
+
+ private String cachedContentType;
+
+ private String cachedContentLocation;
+
+ static
+ {
+ // Load JAF content handlers
+ ContentHandlerRegistry.register();
+ }
+
+ public AttachmentPartImpl()
+ {
+ }
+
+ public AttachmentPartImpl(DataHandler handler)
+ {
+ this.dataHandler = handler;
+ }
+
+ private void clearHeaderCache()
+ {
+ cachedContentId = null;
+ cachedContentType = null;
+ cachedContentLocation = null;
+ }
+
+ public void addMimeHeader(String name, String value)
+ {
+ clearHeaderCache();
+ mimeHeaders.addHeader(name, value);
+ }
+
+ public void clearContent()
+ {
+ dataHandler = null;
+ }
+
+ public Iterator getAllMimeHeaders()
+ {
+ clearHeaderCache();
+ return mimeHeaders.getAllHeaders();
+ }
+
+ public Object getContent() throws SOAPException
+ {
+ if (dataHandler == null)
+ throw new SOAPException("No content available");
+
+ try
+ {
+ return dataHandler.getContent();
+ }
+ catch (IOException e)
+ {
+ throw new SOAPException(e);
+ }
+ }
+
+ public DataHandler getDataHandler() throws SOAPException
+ {
+ if (dataHandler == null)
+ throw new SOAPException("No data handler on attachment");
+
+ return dataHandler;
+ }
+
+ public Iterator getMatchingMimeHeaders(String[] names)
+ {
+ clearHeaderCache();
+ return mimeHeaders.getMatchingHeaders(names);
+ }
+
+ public String[] getMimeHeader(String name)
+ {
+ return mimeHeaders.getHeader(name);
+ }
+
+ /**
+ * Returns the first occurence of a MIME header.
+ *
+ * @param header the mime header
+ * @return the value of the first occurence of a MIME header
+ */
+ public String getFirstMimeHeader(String header)
+ {
+ String[] values = mimeHeaders.getHeader(header.toLowerCase());
+ if ((values != null) && (values.length > 0))
+ {
+ return values[0];
+ }
+ return null;
+ }
+
+ public Iterator getNonMatchingMimeHeaders(String[] names)
+ {
+ clearHeaderCache();
+ return mimeHeaders.getNonMatchingHeaders(names);
+ }
+
+ public int getSize() throws SOAPException
+ {
+ if (dataHandler == null)
+ return 0;
+
+ // In order to be accurate this method must be somewhat inefficient
+ // TODO optimize this for specific data sources
+ int count = 0, ret = 0;
+ byte[] buffer = new byte[256];
+
+ try
+ {
+ InputStream stream = dataHandler.getInputStream();
+
+ do
+ {
+ count += ret;
+ ret = stream.read(buffer);
+ }
+ while (ret != -1);
+ }
+ catch (IOException e)
+ {
+ throw new SOAPException(e);
+ }
+
+ return count;
+ }
+
+ public void removeAllMimeHeaders()
+ {
+ clearHeaderCache();
+ mimeHeaders.removeAllHeaders();
+ }
+
+ public void removeMimeHeader(String name)
+ {
+ clearHeaderCache();
+ mimeHeaders.removeHeader(name);
+ }
+
+ public void setContent(Object object, String contentType)
+ {
+
+ // Override the content type if its a mime multipart object because we need to
preserve
+ // the all of the content type parameters
+ if (object instanceof MimeMultipart)
+ contentType = ((MimeMultipart)object).getContentType();
+
+ dataHandler = new DataHandler(object, contentType);
+
+ setContentType(contentType);
+ }
+
+ public void setDataHandler(DataHandler dataHandler)
+ {
+ if (dataHandler == null)
+ throw new IllegalArgumentException("Null data handler");
+
+ this.dataHandler = dataHandler;
+ setContentType(dataHandler.getContentType());
+ }
+
+ public void setMimeHeader(String name, String value)
+ {
+ clearHeaderCache();
+ mimeHeaders.setHeader(name, value);
+ }
+
+ public String getContentId()
+ {
+ if (cachedContentId == null)
+ {
+ cachedContentId = getFirstMimeHeader(MimeConstants.CONTENT_ID);
+ }
+
+ return cachedContentId;
+ }
+
+ public String getContentLocation()
+ {
+ if (cachedContentLocation == null)
+ {
+ cachedContentLocation = getFirstMimeHeader(MimeConstants.CONTENT_LOCATION);
+ }
+
+ return cachedContentLocation;
+ }
+
+ public String getContentType()
+ {
+ if (cachedContentType == null)
+ {
+ cachedContentType = getFirstMimeHeader(MimeConstants.CONTENT_TYPE);
+ }
+
+ return cachedContentType;
+ }
+
+ public void setContentId(String contentId)
+ {
+ setMimeHeader(MimeConstants.CONTENT_ID, contentId);
+ cachedContentId = contentId;
+ }
+
+ public void setContentLocation(String contentLocation)
+ {
+ setMimeHeader(MimeConstants.CONTENT_LOCATION, contentLocation);
+ cachedContentLocation = contentLocation;
+ }
+
+ public void setContentType(String contentType)
+ {
+ setMimeHeader(MimeConstants.CONTENT_TYPE, contentType);
+ cachedContentType = contentType;
+ }
+}
\ No newline at end of file
Deleted:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/attachment/BoundaryDelimitedInputStream.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/attachment/BoundaryDelimitedInputStream.java 2006-12-05
23:29:55 UTC (rev 1557)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/attachment/BoundaryDelimitedInputStream.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -1,320 +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.attachment;
-
-import java.io.FilterInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-
-/**
- * <code>BoundaryDelimitedInputStream</code> encapsulates a stream that is
- * sepearated into different sections by a common boundary, such as a MIME
- * multipart message. The full stream is referred to as the outer stream. Each
- * boundary separated section in the outer stream is referred to as an inner
- * stream.
- *
- * All read() methods will start from the first inner stream, returning -1 when
- * a boundary is reached. Subsequent calls will then advance to the next stream,
- * skipping the boundary.
- *
- * @author <a href="mailto:jason@stacksmash.com">Jason T.
Greene</a>
- */
-public class BoundaryDelimitedInputStream extends FilterInputStream
-{
- private static final int BOUNDARY_NOT_FOUND = SimpleBoyerMoore.PATTERN_NOT_FOUND;
-
- private byte[] boundary;
-
- private SimpleBoyerMoore boyerMoore;
-
- private byte[] leftOvers;
-
- private int leftOverPosition;
-
- private InputStream source;
-
- private boolean simulateEof;
-
- private boolean realEof;
-
- private boolean bufferingCompleted;
-
- /**
- * Constructs a <code>BoundaryDelimitedInputStream</code> using the
passed
- * <code>InputStream</code> as the source for the outer stream.
- *
- * @param in the source input stream
- * @param boundary the byte boundary separating sections of this stream
- */
- public BoundaryDelimitedInputStream(InputStream in, byte[] boundary)
- {
- super(in);
- source = in;
- this.boundary = (byte[]) boundary.clone();
- boyerMoore = new SimpleBoyerMoore(this.boundary);
- }
-
- /*
- * Buffers read-ahead data for future read calls.
- */
- private void createLeftOvers(byte[] buffer, int start, int end)
- {
- int length = end - start;
-
- if (length <= 0)
- return;
-
- // If we are no longer buffering, we no longer have to expand the buffer, so we
- // can reuse it (if its still there, which may not be the case if a boundary was
found
- // after the left over buffer was consumed) by just moving the position back.
- if (bufferingCompleted && leftOvers != null)
- {
- leftOverPosition -= length;
- return;
- }
-
- int leftOverLength = (leftOvers == null) ? 0 : leftOvers.length -
leftOverPosition;
-
- byte[] newLeftOvers = new byte[length + leftOverLength];
-
- System.arraycopy(buffer, start, newLeftOvers, 0, length);
-
- if (leftOvers != null)
- System.arraycopy(leftOvers, leftOverPosition, newLeftOvers, length,
leftOverLength);
-
- leftOvers = newLeftOvers;
- leftOverPosition = 0;
- }
-
- /*
- * Reads from previous buffered read-ahead data
- */
- private int consumeLeftOvers(byte[] buffer, int offset, int length)
- {
- if (leftOvers == null) return 0;
-
- int i = 0;
- while (i < length && leftOverPosition < leftOvers.length)
- {
- buffer[offset + i++] = leftOvers[leftOverPosition++];
- }
-
- if (leftOverPosition >= leftOvers.length)
- {
- leftOvers = null;
- leftOverPosition = 0;
- }
-
- return i;
- }
-
- /*
- * Repeatably reaads from the source stream until the desired number of bytes
- * are returned.
- */
- private int fullRead(byte[] buffer, int offset, int length) throws IOException
- {
- int count = 0;
- int read = 0;
-
- do
- {
- read = source.read(buffer, offset + count, length - count);
- if (read > 0)
- count += read;
- }
- while (read > 0 && count < length);
-
- if (read < 0)
- realEof = true;
-
- return count;
- }
-
- private int findBoundary(byte[] buffer, int length)
- {
- return boyerMoore.patternSearch(buffer, 0, length);
- }
-
- private int read(byte[] b, int off, int len, boolean skip) throws IOException
- {
- if (len == 0) return 0;
-
- if (simulateEof)
- {
- simulateEof = false;
- return -1;
- }
-
- if (realEof)
- {
- if (leftOvers == null)
- return -1;
- if (bufferingCompleted == false)
- {
- bufferingCompleted = true;
- }
- }
-
- // Our buffer must always contain room for 2 boundary string occurences,
- // and one of those boundary string size chunks must extend past the length
- // of the requested read size to insure the returned byte chunk contains
- // no potion of the boundary.
- int bufferLength = Math.max(boundary.length * 2, len + boundary.length);
-
- byte[] buffer = new byte[bufferLength];
-
- int position = consumeLeftOvers(buffer, 0, bufferLength);
- if (position < bufferLength)
- position += fullRead(buffer, position, bufferLength - position);
-
- // This should only occur when the source stream is already closed at start
- if (realEof && position == 0)
- return -1;
-
- int returnLength;
-
- int boundaryPosition = findBoundary(buffer, position);
- if (boundaryPosition == BOUNDARY_NOT_FOUND || boundaryPosition >= len)
- {
- returnLength = Math.min(len, position);
- createLeftOvers(buffer, returnLength, position);
- }
- else
- {
- returnLength = boundaryPosition;
- createLeftOvers(buffer, returnLength + boundary.length, position);
-
- // If there is no data to return, send the eof immediately
- if (returnLength == 0)
- return -1;
-
- // Notify the client that this inner stream has ended by returning -1 on the
- // next read request.
- simulateEof = true;
- }
-
- if (! skip)
- System.arraycopy(buffer, 0, b, off, returnLength);
-
- return returnLength;
- }
-
-
- /**
- * This method will always return 0 because this input stream must
- * always read ahead to determine the location of the boundary.
- */
- public int available() throws IOException
- {
- return 0;
- }
-
- /**
- * Close this input stream, and its source input stream. Once this
- * is called, no further data can be read.
- */
- public void close() throws IOException
- {
- source.close();
- leftOvers = null;
- leftOverPosition = 0;
- realEof = true;
- }
-
- /**
- * Returns false. Mark is not support by this input stream.
- */
- public boolean markSupported()
- {
- return false;
- }
-
- /**
- * Reads a single byte from the inner input stream. See the general contract
- * of the read method of <code>InputStream</code>.
- *
- * @return a signle byte value from the stream in the range of 0-255 or -1
- * on eof of the inner stream.
- */
- public int read() throws IOException
- {
- byte[] b = new byte[1];
- if (read(b) == -1)
- return -1;
- return b[0] & 0xff;
- }
-
- /**
- * Reads from the inner input stream, attempting to fill the passed byte array.
- * See the general contract of the read method of
<code>InputStream</code>.
- *
- * @param b the byte array to populate
- * @return number of bytes returned in <code>b</code>, -1 on EOF
- */
- public int read(byte[] b) throws IOException
- {
- return read(b, 0, b.length);
- }
-
- /**
- * Skips the specified number of bytes from the inner input stream. See the
- * general contract of the read method of <code>InputStream</code>.
- *
- * @param n the number of bytes to skip
- * @return the number of bytes actually skipped, -1 on EOF
- */
- public long skip(long n) throws IOException
- {
- return read(null, 0, (int) n, true);
- }
-
- /**
- * Reads the specified number of bytes starting from the specified offset
- * into the specified buffer from the inner input stream. See the
- * general contract of the read method of <code>InputStream</code>.
- *
- * @param b the byte array to populate
- * @param off the offset in the array to start at
- * @param len the number of bytes to read, -1 on EOF
- */
- public int read(byte[] b, int off, int len) throws IOException
- {
- return read(b, off, len, false);
- }
-
- /**
- * Returns whether the outer stream is closed.
- *
- * @return boolean indicating whether the outer stream is closed
- */
- public boolean isOuterStreamClosed()
- {
- return realEof && leftOvers == null;
- }
-
-
- public void printLeftOvers()
- {
- if (leftOvers != null) System.out.println("LEFT = " + new
String(leftOvers, leftOverPosition, leftOvers.length - leftOverPosition));
- }
-}
\ No newline at end of file
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/attachment/BoundaryDelimitedInputStream.java
(from rev 1560,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/attachment/BoundaryDelimitedInputStream.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/attachment/BoundaryDelimitedInputStream.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/attachment/BoundaryDelimitedInputStream.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -0,0 +1,320 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+package org.jboss.ws.core.soap.attachment;
+
+import java.io.FilterInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+
+/**
+ * <code>BoundaryDelimitedInputStream</code> encapsulates a stream that is
+ * sepearated into different sections by a common boundary, such as a MIME
+ * multipart message. The full stream is referred to as the outer stream. Each
+ * boundary separated section in the outer stream is referred to as an inner
+ * stream.
+ *
+ * All read() methods will start from the first inner stream, returning -1 when
+ * a boundary is reached. Subsequent calls will then advance to the next stream,
+ * skipping the boundary.
+ *
+ * @author <a href="mailto:jason@stacksmash.com">Jason T.
Greene</a>
+ */
+public class BoundaryDelimitedInputStream extends FilterInputStream
+{
+ private static final int BOUNDARY_NOT_FOUND = SimpleBoyerMoore.PATTERN_NOT_FOUND;
+
+ private byte[] boundary;
+
+ private SimpleBoyerMoore boyerMoore;
+
+ private byte[] leftOvers;
+
+ private int leftOverPosition;
+
+ private InputStream source;
+
+ private boolean simulateEof;
+
+ private boolean realEof;
+
+ private boolean bufferingCompleted;
+
+ /**
+ * Constructs a <code>BoundaryDelimitedInputStream</code> using the
passed
+ * <code>InputStream</code> as the source for the outer stream.
+ *
+ * @param in the source input stream
+ * @param boundary the byte boundary separating sections of this stream
+ */
+ public BoundaryDelimitedInputStream(InputStream in, byte[] boundary)
+ {
+ super(in);
+ source = in;
+ this.boundary = (byte[]) boundary.clone();
+ boyerMoore = new SimpleBoyerMoore(this.boundary);
+ }
+
+ /*
+ * Buffers read-ahead data for future read calls.
+ */
+ private void createLeftOvers(byte[] buffer, int start, int end)
+ {
+ int length = end - start;
+
+ if (length <= 0)
+ return;
+
+ // If we are no longer buffering, we no longer have to expand the buffer, so we
+ // can reuse it (if its still there, which may not be the case if a boundary was
found
+ // after the left over buffer was consumed) by just moving the position back.
+ if (bufferingCompleted && leftOvers != null)
+ {
+ leftOverPosition -= length;
+ return;
+ }
+
+ int leftOverLength = (leftOvers == null) ? 0 : leftOvers.length -
leftOverPosition;
+
+ byte[] newLeftOvers = new byte[length + leftOverLength];
+
+ System.arraycopy(buffer, start, newLeftOvers, 0, length);
+
+ if (leftOvers != null)
+ System.arraycopy(leftOvers, leftOverPosition, newLeftOvers, length,
leftOverLength);
+
+ leftOvers = newLeftOvers;
+ leftOverPosition = 0;
+ }
+
+ /*
+ * Reads from previous buffered read-ahead data
+ */
+ private int consumeLeftOvers(byte[] buffer, int offset, int length)
+ {
+ if (leftOvers == null) return 0;
+
+ int i = 0;
+ while (i < length && leftOverPosition < leftOvers.length)
+ {
+ buffer[offset + i++] = leftOvers[leftOverPosition++];
+ }
+
+ if (leftOverPosition >= leftOvers.length)
+ {
+ leftOvers = null;
+ leftOverPosition = 0;
+ }
+
+ return i;
+ }
+
+ /*
+ * Repeatably reaads from the source stream until the desired number of bytes
+ * are returned.
+ */
+ private int fullRead(byte[] buffer, int offset, int length) throws IOException
+ {
+ int count = 0;
+ int read = 0;
+
+ do
+ {
+ read = source.read(buffer, offset + count, length - count);
+ if (read > 0)
+ count += read;
+ }
+ while (read > 0 && count < length);
+
+ if (read < 0)
+ realEof = true;
+
+ return count;
+ }
+
+ private int findBoundary(byte[] buffer, int length)
+ {
+ return boyerMoore.patternSearch(buffer, 0, length);
+ }
+
+ private int read(byte[] b, int off, int len, boolean skip) throws IOException
+ {
+ if (len == 0) return 0;
+
+ if (simulateEof)
+ {
+ simulateEof = false;
+ return -1;
+ }
+
+ if (realEof)
+ {
+ if (leftOvers == null)
+ return -1;
+ if (bufferingCompleted == false)
+ {
+ bufferingCompleted = true;
+ }
+ }
+
+ // Our buffer must always contain room for 2 boundary string occurences,
+ // and one of those boundary string size chunks must extend past the length
+ // of the requested read size to insure the returned byte chunk contains
+ // no potion of the boundary.
+ int bufferLength = Math.max(boundary.length * 2, len + boundary.length);
+
+ byte[] buffer = new byte[bufferLength];
+
+ int position = consumeLeftOvers(buffer, 0, bufferLength);
+ if (position < bufferLength)
+ position += fullRead(buffer, position, bufferLength - position);
+
+ // This should only occur when the source stream is already closed at start
+ if (realEof && position == 0)
+ return -1;
+
+ int returnLength;
+
+ int boundaryPosition = findBoundary(buffer, position);
+ if (boundaryPosition == BOUNDARY_NOT_FOUND || boundaryPosition >= len)
+ {
+ returnLength = Math.min(len, position);
+ createLeftOvers(buffer, returnLength, position);
+ }
+ else
+ {
+ returnLength = boundaryPosition;
+ createLeftOvers(buffer, returnLength + boundary.length, position);
+
+ // If there is no data to return, send the eof immediately
+ if (returnLength == 0)
+ return -1;
+
+ // Notify the client that this inner stream has ended by returning -1 on the
+ // next read request.
+ simulateEof = true;
+ }
+
+ if (! skip)
+ System.arraycopy(buffer, 0, b, off, returnLength);
+
+ return returnLength;
+ }
+
+
+ /**
+ * This method will always return 0 because this input stream must
+ * always read ahead to determine the location of the boundary.
+ */
+ public int available() throws IOException
+ {
+ return 0;
+ }
+
+ /**
+ * Close this input stream, and its source input stream. Once this
+ * is called, no further data can be read.
+ */
+ public void close() throws IOException
+ {
+ source.close();
+ leftOvers = null;
+ leftOverPosition = 0;
+ realEof = true;
+ }
+
+ /**
+ * Returns false. Mark is not support by this input stream.
+ */
+ public boolean markSupported()
+ {
+ return false;
+ }
+
+ /**
+ * Reads a single byte from the inner input stream. See the general contract
+ * of the read method of <code>InputStream</code>.
+ *
+ * @return a signle byte value from the stream in the range of 0-255 or -1
+ * on eof of the inner stream.
+ */
+ public int read() throws IOException
+ {
+ byte[] b = new byte[1];
+ if (read(b) == -1)
+ return -1;
+ return b[0] & 0xff;
+ }
+
+ /**
+ * Reads from the inner input stream, attempting to fill the passed byte array.
+ * See the general contract of the read method of
<code>InputStream</code>.
+ *
+ * @param b the byte array to populate
+ * @return number of bytes returned in <code>b</code>, -1 on EOF
+ */
+ public int read(byte[] b) throws IOException
+ {
+ return read(b, 0, b.length);
+ }
+
+ /**
+ * Skips the specified number of bytes from the inner input stream. See the
+ * general contract of the read method of <code>InputStream</code>.
+ *
+ * @param n the number of bytes to skip
+ * @return the number of bytes actually skipped, -1 on EOF
+ */
+ public long skip(long n) throws IOException
+ {
+ return read(null, 0, (int) n, true);
+ }
+
+ /**
+ * Reads the specified number of bytes starting from the specified offset
+ * into the specified buffer from the inner input stream. See the
+ * general contract of the read method of <code>InputStream</code>.
+ *
+ * @param b the byte array to populate
+ * @param off the offset in the array to start at
+ * @param len the number of bytes to read, -1 on EOF
+ */
+ public int read(byte[] b, int off, int len) throws IOException
+ {
+ return read(b, off, len, false);
+ }
+
+ /**
+ * Returns whether the outer stream is closed.
+ *
+ * @return boolean indicating whether the outer stream is closed
+ */
+ public boolean isOuterStreamClosed()
+ {
+ return realEof && leftOvers == null;
+ }
+
+
+ public void printLeftOvers()
+ {
+ if (leftOvers != null) System.out.println("LEFT = " + new
String(leftOvers, leftOverPosition, leftOvers.length - leftOverPosition));
+ }
+}
\ No newline at end of file
Deleted:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/attachment/ByteArrayContentHandler.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/attachment/ByteArrayContentHandler.java 2006-12-05
23:29:55 UTC (rev 1557)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/attachment/ByteArrayContentHandler.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -1,77 +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.attachment;
-
-import org.jboss.ws.utils.MimeUtils;
-import org.jboss.ws.utils.IOUtils;
-
-import javax.activation.ActivationDataFlavor;
-import javax.activation.DataContentHandler;
-import javax.activation.DataSource;
-import javax.activation.DataHandler;
-import java.awt.datatransfer.DataFlavor;
-import java.awt.datatransfer.UnsupportedFlavorException;
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-
-/**
- * @author Heiko Braun <heiko.braun(a)jboss.com>
- * @version $Id$
- * @since Jul 31, 2006
- */
-public class ByteArrayContentHandler implements DataContentHandler {
-
- private DataFlavor[] flavors = new ActivationDataFlavor[]
- {
- new ActivationDataFlavor(ByteArrayInputStream.class,
"application/octet-stream", "OCTETS"),
- };
-
- public Object getContent(DataSource dataSource) throws IOException {
- return dataSource.getInputStream();
- }
-
- public Object getTransferData(DataFlavor dataFlavor, DataSource dataSource) throws
UnsupportedFlavorException, IOException {
- return getContent(dataSource);
- }
-
- public DataFlavor[] getTransferDataFlavors() {
- return flavors;
- }
-
- public void writeTo(Object object, String string, OutputStream outputStream) throws
IOException {
-
- if(object instanceof byte[])
- {
- outputStream.write((byte[])object);
- }
- else if(object instanceof DataHandler)
- {
- IOUtils.copyStream(outputStream, ((DataHandler)object).getInputStream());
- }
- else
- {
- MimeUtils.ByteArrayConverter converter =
MimeUtils.getConverterForJavaType(object.getClass());
- converter.writeTo(object, outputStream);
- }
- }
-}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/attachment/ByteArrayContentHandler.java
(from rev 1560,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/attachment/ByteArrayContentHandler.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/attachment/ByteArrayContentHandler.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/attachment/ByteArrayContentHandler.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -0,0 +1,77 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+package org.jboss.ws.core.soap.attachment;
+
+import org.jboss.ws.utils.MimeUtils;
+import org.jboss.ws.utils.IOUtils;
+
+import javax.activation.ActivationDataFlavor;
+import javax.activation.DataContentHandler;
+import javax.activation.DataSource;
+import javax.activation.DataHandler;
+import java.awt.datatransfer.DataFlavor;
+import java.awt.datatransfer.UnsupportedFlavorException;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+
+/**
+ * @author Heiko Braun <heiko.braun(a)jboss.com>
+ * @version $Id$
+ * @since Jul 31, 2006
+ */
+public class ByteArrayContentHandler implements DataContentHandler {
+
+ private DataFlavor[] flavors = new ActivationDataFlavor[]
+ {
+ new ActivationDataFlavor(ByteArrayInputStream.class,
"application/octet-stream", "OCTETS"),
+ };
+
+ public Object getContent(DataSource dataSource) throws IOException {
+ return dataSource.getInputStream();
+ }
+
+ public Object getTransferData(DataFlavor dataFlavor, DataSource dataSource) throws
UnsupportedFlavorException, IOException {
+ return getContent(dataSource);
+ }
+
+ public DataFlavor[] getTransferDataFlavors() {
+ return flavors;
+ }
+
+ public void writeTo(Object object, String string, OutputStream outputStream) throws
IOException {
+
+ if(object instanceof byte[])
+ {
+ outputStream.write((byte[])object);
+ }
+ else if(object instanceof DataHandler)
+ {
+ IOUtils.copyStream(outputStream, ((DataHandler)object).getInputStream());
+ }
+ else
+ {
+ MimeUtils.ByteArrayConverter converter =
MimeUtils.getConverterForJavaType(object.getClass());
+ converter.writeTo(object, outputStream);
+ }
+ }
+}
Deleted:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/attachment/CIDGenerator.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/attachment/CIDGenerator.java 2006-12-05
23:29:55 UTC (rev 1557)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/attachment/CIDGenerator.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -1,75 +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.attachment;
-
-//$Id$
-
-import java.io.UnsupportedEncodingException;
-import java.net.URLEncoder;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.utils.UUIDGenerator;
-
-/**
- * A common CID generator
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 17-Jan-2006
- */
-public class CIDGenerator
-{
- // provide logging
- private static Logger log = Logger.getLogger(CIDGenerator.class);
-
- private int count = 0;
-
- public String generateFromCount()
- {
- StringBuilder cid = new StringBuilder();
- long time = System.currentTimeMillis();
-
-
cid.append("cid:").append(count++).append("-").append(time).append("-")
- .append(cid.hashCode()).append("(a)").append(MimeConstants.CID_DOMAIN);
-
- log.debug("generateFromCount: " + cid);
- return cid.toString();
- }
-
- public String generateFromName(String name)
- {
-
- // See
http://www.ietf.org/rfc/rfc2392.txt on rules howto create cid's
- // TODO: URL decode when cid's are received
- try
- {
- name = URLEncoder.encode(name, "UTF-8");
- }
- catch (UnsupportedEncodingException ex)
- {
- log.error("Cannot encode name for cid: " + ex);
- }
-
- String cid = name + "-" + UUIDGenerator.generateRandomUUIDString() +
"@" + MimeConstants.CID_DOMAIN;
- log.debug("generateFromName: " + cid);
- return cid;
- }
-}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/attachment/CIDGenerator.java
(from rev 1560,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/attachment/CIDGenerator.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/attachment/CIDGenerator.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/attachment/CIDGenerator.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -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.core.soap.attachment;
+
+//$Id$
+
+import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.utils.UUIDGenerator;
+
+/**
+ * A common CID generator
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 17-Jan-2006
+ */
+public class CIDGenerator
+{
+ // provide logging
+ private static Logger log = Logger.getLogger(CIDGenerator.class);
+
+ private int count = 0;
+
+ public String generateFromCount()
+ {
+ StringBuilder cid = new StringBuilder();
+ long time = System.currentTimeMillis();
+
+
cid.append("cid:").append(count++).append("-").append(time).append("-")
+ .append(cid.hashCode()).append("(a)").append(MimeConstants.CID_DOMAIN);
+
+ log.debug("generateFromCount: " + cid);
+ return cid.toString();
+ }
+
+ public String generateFromName(String name)
+ {
+
+ // See
http://www.ietf.org/rfc/rfc2392.txt on rules howto create cid's
+ // TODO: URL decode when cid's are received
+ try
+ {
+ name = URLEncoder.encode(name, "UTF-8");
+ }
+ catch (UnsupportedEncodingException ex)
+ {
+ log.error("Cannot encode name for cid: " + ex);
+ }
+
+ String cid = name + "-" + UUIDGenerator.generateRandomUUIDString() +
"@" + MimeConstants.CID_DOMAIN;
+ log.debug("generateFromName: " + cid);
+ return cid;
+ }
+}
Deleted:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/attachment/ContentHandlerRegistry.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/attachment/ContentHandlerRegistry.java 2006-12-05
23:29:55 UTC (rev 1557)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/attachment/ContentHandlerRegistry.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -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.ws.soap.attachment;
-
-import java.awt.datatransfer.DataFlavor;
-import java.util.HashSet;
-import java.util.Iterator;
-
-import javax.activation.CommandMap;
-import javax.activation.DataContentHandler;
-import javax.activation.MailcapCommandMap;
-
-import com.sun.mail.handlers.multipart_mixed;
-import com.sun.mail.handlers.text_html;
-import com.sun.mail.handlers.text_plain;
-
-/**
- * <code>ContentHandlerRegistry</code> is responsible for registering
- * JBossWS data content handlers in JAF.
- *
- * @author <a href="mailto:jason@stacksmash.com">Jason T.
Greene</a>
- */
-public class ContentHandlerRegistry
-{
- private static final String JAF_CONTENT_HANDLER = "x-java-content-handler";
-
- private static HashSet handlerRegistry = new HashSet();
-
- static
- {
- addRegistryEntry(XmlDataContentHandler.class);
- addRegistryEntry(ImageDataContentHandler.class);
- addRegistryEntry(ByteArrayContentHandler.class);
- addRegistryEntry(text_plain.class);
- addRegistryEntry(text_html.class);
- addRegistryEntry(multipart_mixed.class);
- }
-
- private static void addRegistryEntry(Class contentHandler)
- {
- handlerRegistry.add(contentHandler);
- }
-
- private static void registerContentHandler(Class contentHandler)
- {
- DataContentHandler handler;
- MailcapCommandMap mailcap;
-
- try
- {
- mailcap = (MailcapCommandMap) CommandMap.getDefaultCommandMap();
- handler = (DataContentHandler) contentHandler.newInstance();
- }
- catch (Exception e)
- {
- throw new RuntimeException("Can not register content handler:" +
e.getMessage());
- }
-
- DataFlavor[] flavors = handler.getTransferDataFlavors();
- if (flavors == null)
- return;
-
- for (int i = 0; i < flavors.length; i++)
- {
- DataFlavor flavor = flavors[i];
- String entry = flavor.getMimeType() + ";;" + JAF_CONTENT_HANDLER +
"=" + contentHandler.getName();
- mailcap.addMailcap(entry);
- }
- }
-
- /**
- * Loads all JBossWS content handlers.
- */
- public static void register()
- {
- Iterator i = handlerRegistry.iterator();
- while (i.hasNext())
- registerContentHandler((Class) i.next());
- }
-}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/attachment/ContentHandlerRegistry.java
(from rev 1560,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/attachment/ContentHandlerRegistry.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/attachment/ContentHandlerRegistry.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/attachment/ContentHandlerRegistry.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -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.ws.core.soap.attachment;
+
+import java.awt.datatransfer.DataFlavor;
+import java.util.HashSet;
+import java.util.Iterator;
+
+import javax.activation.CommandMap;
+import javax.activation.DataContentHandler;
+import javax.activation.MailcapCommandMap;
+
+import com.sun.mail.handlers.multipart_mixed;
+import com.sun.mail.handlers.text_html;
+import com.sun.mail.handlers.text_plain;
+
+/**
+ * <code>ContentHandlerRegistry</code> is responsible for registering
+ * JBossWS data content handlers in JAF.
+ *
+ * @author <a href="mailto:jason@stacksmash.com">Jason T.
Greene</a>
+ */
+public class ContentHandlerRegistry
+{
+ private static final String JAF_CONTENT_HANDLER = "x-java-content-handler";
+
+ private static HashSet handlerRegistry = new HashSet();
+
+ static
+ {
+ addRegistryEntry(XmlDataContentHandler.class);
+ addRegistryEntry(ImageDataContentHandler.class);
+ addRegistryEntry(ByteArrayContentHandler.class);
+ addRegistryEntry(text_plain.class);
+ addRegistryEntry(text_html.class);
+ addRegistryEntry(multipart_mixed.class);
+ }
+
+ private static void addRegistryEntry(Class contentHandler)
+ {
+ handlerRegistry.add(contentHandler);
+ }
+
+ private static void registerContentHandler(Class contentHandler)
+ {
+ DataContentHandler handler;
+ MailcapCommandMap mailcap;
+
+ try
+ {
+ mailcap = (MailcapCommandMap) CommandMap.getDefaultCommandMap();
+ handler = (DataContentHandler) contentHandler.newInstance();
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException("Can not register content handler:" +
e.getMessage());
+ }
+
+ DataFlavor[] flavors = handler.getTransferDataFlavors();
+ if (flavors == null)
+ return;
+
+ for (int i = 0; i < flavors.length; i++)
+ {
+ DataFlavor flavor = flavors[i];
+ String entry = flavor.getMimeType() + ";;" + JAF_CONTENT_HANDLER +
"=" + contentHandler.getName();
+ mailcap.addMailcap(entry);
+ }
+ }
+
+ /**
+ * Loads all JBossWS content handlers.
+ */
+ public static void register()
+ {
+ Iterator i = handlerRegistry.iterator();
+ while (i.hasNext())
+ registerContentHandler((Class) i.next());
+ }
+}
Deleted:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/attachment/ImageDataContentHandler.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/attachment/ImageDataContentHandler.java 2006-12-05
23:29:55 UTC (rev 1557)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/attachment/ImageDataContentHandler.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -1,203 +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.attachment;
-
-import java.awt.Component;
-import java.awt.Graphics2D;
-import java.awt.Image;
-import java.awt.MediaTracker;
-import java.awt.datatransfer.DataFlavor;
-import java.awt.datatransfer.UnsupportedFlavorException;
-import java.awt.image.BufferedImage;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.util.ArrayList;
-import java.util.Iterator;
-
-import javax.activation.ActivationDataFlavor;
-import javax.activation.DataContentHandler;
-import javax.activation.DataSource;
-import javax.imageio.ImageIO;
-import javax.imageio.ImageWriter;
-import javax.imageio.stream.ImageOutputStream;
-
-import org.jboss.logging.Logger;
-
-/**
- * <code>ImageDataContentHandler</code> is a JAF content handler that
handles
- * marshalling/unmarshalling between <code>Image</code> objects and a
stream.
- *
- * This handler provides support for all mime types handled by the ImageIO
- * implementation on the virtual machine that this class is ran under. These
- * are dynamically registered, so any custom ImageIO plugins are discovered and
- * used.
- *
- * It's important to note that some mime types (for example image/gif) may not
- * have encoding support provided by the ImageIO implementation. If this happens
- * an exception will be thrown indicating the lack of encoding support.
- *
- * @author <a href="mailto:jason@stacksmash.com">Jason T.
Greene</a>
- * @author <a href="mailto:mageshbk@jboss.com">Magesh Kumar B</a>
- */
-public class ImageDataContentHandler extends Component implements DataContentHandler
-{
- // provide logging
- private static Logger log = Logger.getLogger(ImageDataContentHandler.class);
-
- private static DataFlavor[] flavors;
-
- static
- {
- buildFlavors();
-
- // Don't write back to disk since the images are in memory anyways
- ImageIO.setUseCache(false);
- }
-
- private static void buildFlavors()
- {
- String[] mimeTypes = ImageIO.getReaderMIMETypes();
- if (mimeTypes == null)
- return;
- ArrayList flavs = new ArrayList ();
- DataFlavor flavor;
- //flavors = new DataFlavor[mimeTypes.length];
- for (int i = 0; i < mimeTypes.length; i++)
- {
- try
- {
- flavor = new ActivationDataFlavor(Image.class, mimeTypes[i],
"Image");
- flavs.add(flavor);
- }
- catch (IllegalArgumentException iae)
- {
- //This mime type is not supported
- log.warn("Unsupported MIME Type '" + mimeTypes[i]
+"'");
- }
- }
- int size = flavs.size();
- flavors = new DataFlavor[size];
- for (int i = 0; i < size; i++)
- {
- flavors[i] = (ActivationDataFlavor)flavs.get(i);
- }
- }
-
- private static ImageWriter getImageWriter(String mimeType) {
- Iterator i = ImageIO.getImageWritersByMIMEType(mimeType);
- if (! i.hasNext())
- return null;
-
- return (ImageWriter) i.next();
- }
-
- private BufferedImage getBufferedImage(Image image) throws IOException
- {
- if (image instanceof BufferedImage)
- return (BufferedImage) image;
-
- try
- {
- BufferedImage buffered;
-
- MediaTracker tracker = new MediaTracker(this);
- tracker.addImage(image, 0);
- tracker.waitForAll();
- buffered = new BufferedImage(image.getHeight(null), image.getWidth(null),
BufferedImage.TYPE_INT_RGB);
- Graphics2D gfx = buffered.createGraphics();
- gfx.drawImage(image, 0, 0, null);
- return buffered;
- }
- catch (InterruptedException e)
- {
- throw new IOException("Could not convert image " + e.getMessage());
- }
- }
-
- /**
- * Returns a {@link Image} from the specified
- * data source.
- *
- * @param ds the activation datasource
- * @return an AWT image object
- */
- public Object getContent(DataSource ds) throws IOException
- {
- return ImageIO.read(ds.getInputStream());
- }
-
- /**
- * Returns a {@link Image}from the specified data source. This method is
- * useless for this content handler because the image format is dynamically
- * discovered.
- *
- * @param df the flavor specifiying the mime type of ds
- * @param ds the activation data source
- * @return an AWT image object
- */
- public Object getTransferData(DataFlavor df, DataSource ds) throws
UnsupportedFlavorException, IOException
- {
- return getContent(ds);
- }
-
- /**
- * Returns the acceptable data flavors that this content handler supports.
- *
- * @return array of <code>ActivationDataHandlers</code>
- */
- public DataFlavor[] getTransferDataFlavors()
- {
- return flavors;
- }
-
- /**
- * Writes the passed in {@link Image} object using the specified
- * mime type to the specified output stream.
- *
- * @param obj an AWT image object
- * @param mimeType the mime type of the image format to use
- * @param os the output stream to write this image to
- */
- public void writeTo(Object obj, String mimeType, OutputStream os) throws IOException
- {
- if (obj == null)
- throw new IOException("Cannot write null source object");
-
- if (!(obj instanceof Image))
- throw new IOException("Requires the source object to be a java.awt.Image
but is: " + obj.getClass().getName());
-
- ImageWriter writer = getImageWriter(mimeType);
- if (writer == null)
- throw new IOException("Image encoding not available for mime type " +
mimeType + " on this vm");
-
- BufferedImage buffered = getBufferedImage((Image) obj);
- ImageOutputStream stream = ImageIO.createImageOutputStream(os);
-
- writer.setOutput(stream);
- writer.write(buffered);
-
- // We must close the stream now because if we are wrapping a ServletOutputStream,
- // a future gc can commit a stream that used in another thread (very very bad)
- stream.flush();
- stream.close();
- }
-}
\ No newline at end of file
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/attachment/ImageDataContentHandler.java
(from rev 1560,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/attachment/ImageDataContentHandler.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/attachment/ImageDataContentHandler.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/attachment/ImageDataContentHandler.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -0,0 +1,203 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+package org.jboss.ws.core.soap.attachment;
+
+import java.awt.Component;
+import java.awt.Graphics2D;
+import java.awt.Image;
+import java.awt.MediaTracker;
+import java.awt.datatransfer.DataFlavor;
+import java.awt.datatransfer.UnsupportedFlavorException;
+import java.awt.image.BufferedImage;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.Iterator;
+
+import javax.activation.ActivationDataFlavor;
+import javax.activation.DataContentHandler;
+import javax.activation.DataSource;
+import javax.imageio.ImageIO;
+import javax.imageio.ImageWriter;
+import javax.imageio.stream.ImageOutputStream;
+
+import org.jboss.logging.Logger;
+
+/**
+ * <code>ImageDataContentHandler</code> is a JAF content handler that
handles
+ * marshalling/unmarshalling between <code>Image</code> objects and a
stream.
+ *
+ * This handler provides support for all mime types handled by the ImageIO
+ * implementation on the virtual machine that this class is ran under. These
+ * are dynamically registered, so any custom ImageIO plugins are discovered and
+ * used.
+ *
+ * It's important to note that some mime types (for example image/gif) may not
+ * have encoding support provided by the ImageIO implementation. If this happens
+ * an exception will be thrown indicating the lack of encoding support.
+ *
+ * @author <a href="mailto:jason@stacksmash.com">Jason T.
Greene</a>
+ * @author <a href="mailto:mageshbk@jboss.com">Magesh Kumar B</a>
+ */
+public class ImageDataContentHandler extends Component implements DataContentHandler
+{
+ // provide logging
+ private static Logger log = Logger.getLogger(ImageDataContentHandler.class);
+
+ private static DataFlavor[] flavors;
+
+ static
+ {
+ buildFlavors();
+
+ // Don't write back to disk since the images are in memory anyways
+ ImageIO.setUseCache(false);
+ }
+
+ private static void buildFlavors()
+ {
+ String[] mimeTypes = ImageIO.getReaderMIMETypes();
+ if (mimeTypes == null)
+ return;
+ ArrayList flavs = new ArrayList ();
+ DataFlavor flavor;
+ //flavors = new DataFlavor[mimeTypes.length];
+ for (int i = 0; i < mimeTypes.length; i++)
+ {
+ try
+ {
+ flavor = new ActivationDataFlavor(Image.class, mimeTypes[i],
"Image");
+ flavs.add(flavor);
+ }
+ catch (IllegalArgumentException iae)
+ {
+ //This mime type is not supported
+ log.warn("Unsupported MIME Type '" + mimeTypes[i]
+"'");
+ }
+ }
+ int size = flavs.size();
+ flavors = new DataFlavor[size];
+ for (int i = 0; i < size; i++)
+ {
+ flavors[i] = (ActivationDataFlavor)flavs.get(i);
+ }
+ }
+
+ private static ImageWriter getImageWriter(String mimeType) {
+ Iterator i = ImageIO.getImageWritersByMIMEType(mimeType);
+ if (! i.hasNext())
+ return null;
+
+ return (ImageWriter) i.next();
+ }
+
+ private BufferedImage getBufferedImage(Image image) throws IOException
+ {
+ if (image instanceof BufferedImage)
+ return (BufferedImage) image;
+
+ try
+ {
+ BufferedImage buffered;
+
+ MediaTracker tracker = new MediaTracker(this);
+ tracker.addImage(image, 0);
+ tracker.waitForAll();
+ buffered = new BufferedImage(image.getHeight(null), image.getWidth(null),
BufferedImage.TYPE_INT_RGB);
+ Graphics2D gfx = buffered.createGraphics();
+ gfx.drawImage(image, 0, 0, null);
+ return buffered;
+ }
+ catch (InterruptedException e)
+ {
+ throw new IOException("Could not convert image " + e.getMessage());
+ }
+ }
+
+ /**
+ * Returns a {@link Image} from the specified
+ * data source.
+ *
+ * @param ds the activation datasource
+ * @return an AWT image object
+ */
+ public Object getContent(DataSource ds) throws IOException
+ {
+ return ImageIO.read(ds.getInputStream());
+ }
+
+ /**
+ * Returns a {@link Image}from the specified data source. This method is
+ * useless for this content handler because the image format is dynamically
+ * discovered.
+ *
+ * @param df the flavor specifiying the mime type of ds
+ * @param ds the activation data source
+ * @return an AWT image object
+ */
+ public Object getTransferData(DataFlavor df, DataSource ds) throws
UnsupportedFlavorException, IOException
+ {
+ return getContent(ds);
+ }
+
+ /**
+ * Returns the acceptable data flavors that this content handler supports.
+ *
+ * @return array of <code>ActivationDataHandlers</code>
+ */
+ public DataFlavor[] getTransferDataFlavors()
+ {
+ return flavors;
+ }
+
+ /**
+ * Writes the passed in {@link Image} object using the specified
+ * mime type to the specified output stream.
+ *
+ * @param obj an AWT image object
+ * @param mimeType the mime type of the image format to use
+ * @param os the output stream to write this image to
+ */
+ public void writeTo(Object obj, String mimeType, OutputStream os) throws IOException
+ {
+ if (obj == null)
+ throw new IOException("Cannot write null source object");
+
+ if (!(obj instanceof Image))
+ throw new IOException("Requires the source object to be a java.awt.Image
but is: " + obj.getClass().getName());
+
+ ImageWriter writer = getImageWriter(mimeType);
+ if (writer == null)
+ throw new IOException("Image encoding not available for mime type " +
mimeType + " on this vm");
+
+ BufferedImage buffered = getBufferedImage((Image) obj);
+ ImageOutputStream stream = ImageIO.createImageOutputStream(os);
+
+ writer.setOutput(stream);
+ writer.write(buffered);
+
+ // We must close the stream now because if we are wrapping a ServletOutputStream,
+ // a future gc can commit a stream that used in another thread (very very bad)
+ stream.flush();
+ stream.close();
+ }
+}
\ No newline at end of file
Deleted:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/attachment/MimeConstants.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/attachment/MimeConstants.java 2006-12-05
23:29:55 UTC (rev 1557)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/attachment/MimeConstants.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -1,58 +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.attachment;
-
-/**
- * Generic mime related constants.
- *
- * @author <a href="mailto:jason@stacksmash.com">Jason T.
Greene</a>
- */
-public class MimeConstants
-{
- // Header constants
- public static final String CONTENT_TYPE = "Content-Type";
- public static final String CONTENT_LOCATION = "Content-Location";
- public static final String CONTENT_ID = "Content-Id";
- public static final String CONTENT_DESCRIPTION = "Content-Description";
- public static final String CONTENT_TRANSFER_ENCODING =
"Content-Transfer-Encoding";
-
- // Types
- public static final String TYPE_APPLICATION_OCTET_STREAM =
"application/octet-stream";
- public static final String TYPE_APPLICATION_XOP_XML =
"application/xop+xml";
- public static final String TYPE_MULTIPART_RELATED = "multipart/related";
- public static final String TYPE_TEXT_XML = "text/xml";
- public static final String TYPE_XML_UTF8 = TYPE_TEXT_XML + ";
charset=UTF-8";
- public static final String TYPE_SOAP11 = TYPE_TEXT_XML;
- public static final String TYPE_SOAP12 = "application/soap+xml";
-
- // Encoding
- public static final String TEXT_8BIT_ENCODING = "8bit";
- public static final String TEXT_7BIT_ENCODING = "7bit";
- public static final String BINARY_ENCODING = "binary";
- public static final String QUOTED_PRINTABLE_ENCODING = "quoted-printable";
- public static final String BASE64_ENCODING = "base64";
-
- // Misc
- public static final String CID_DOMAIN = "ws.jboss.org";
- public static final String ROOTPART_CID = "<rootpart@" + CID_DOMAIN +
">";
- public static final String START_INFO_XOP = "text/xml";
-}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/attachment/MimeConstants.java
(from rev 1560,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/attachment/MimeConstants.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/attachment/MimeConstants.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/attachment/MimeConstants.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -0,0 +1,58 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+package org.jboss.ws.core.soap.attachment;
+
+/**
+ * Generic mime related constants.
+ *
+ * @author <a href="mailto:jason@stacksmash.com">Jason T.
Greene</a>
+ */
+public class MimeConstants
+{
+ // Header constants
+ public static final String CONTENT_TYPE = "Content-Type";
+ public static final String CONTENT_LOCATION = "Content-Location";
+ public static final String CONTENT_ID = "Content-Id";
+ public static final String CONTENT_DESCRIPTION = "Content-Description";
+ public static final String CONTENT_TRANSFER_ENCODING =
"Content-Transfer-Encoding";
+
+ // Types
+ public static final String TYPE_APPLICATION_OCTET_STREAM =
"application/octet-stream";
+ public static final String TYPE_APPLICATION_XOP_XML =
"application/xop+xml";
+ public static final String TYPE_MULTIPART_RELATED = "multipart/related";
+ public static final String TYPE_TEXT_XML = "text/xml";
+ public static final String TYPE_XML_UTF8 = TYPE_TEXT_XML + ";
charset=UTF-8";
+ public static final String TYPE_SOAP11 = TYPE_TEXT_XML;
+ public static final String TYPE_SOAP12 = "application/soap+xml";
+
+ // Encoding
+ public static final String TEXT_8BIT_ENCODING = "8bit";
+ public static final String TEXT_7BIT_ENCODING = "7bit";
+ public static final String BINARY_ENCODING = "binary";
+ public static final String QUOTED_PRINTABLE_ENCODING = "quoted-printable";
+ public static final String BASE64_ENCODING = "base64";
+
+ // Misc
+ public static final String CID_DOMAIN = "ws.jboss.org";
+ public static final String ROOTPART_CID = "<rootpart@" + CID_DOMAIN +
">";
+ public static final String START_INFO_XOP = "text/xml";
+}
Deleted:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/attachment/MultipartRelatedDecoder.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/attachment/MultipartRelatedDecoder.java 2006-12-05
23:29:55 UTC (rev 1557)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/attachment/MultipartRelatedDecoder.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -1,211 +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.attachment;
-
-// $Id$
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.UnsupportedEncodingException;
-import java.util.Collection;
-import java.util.Enumeration;
-import java.util.LinkedList;
-import java.util.List;
-
-import javax.activation.DataHandler;
-import javax.mail.Header;
-import javax.mail.MessagingException;
-import javax.mail.internet.ContentType;
-import javax.mail.internet.InternetHeaders;
-import javax.mail.internet.ParseException;
-import javax.xml.soap.AttachmentPart;
-
-import org.jboss.ws.WSException;
-
-/**
- * Abstract MutilPartRelatedDecoder decodes a mime multipart/related stream.
- *
- * @author <a href="mailto:jason@stacksmash.com">Jason T.
Greene</a>
- * @author Thomas.Diesler(a)jboss.org
- * @since 18-Jan-2006
- */
-public class MultipartRelatedDecoder
-{
- private ContentType contentType;
-
- private String rootType;
-
- private AttachmentPartImpl rootPart;
-
- private LinkedList<AttachmentPart> relatedParts = new
LinkedList<AttachmentPart>();
-
- /**
- * Constructs a <code>MultipartRelatedDecoder</code>. This will block
until the message
- * has been decoded.
- *
- * @param contentType the mime Content-Type header provided by the transport
- * @param stream The stream to pull the multipart message from
- */
- public MultipartRelatedDecoder(ContentType contentType) throws IOException,
MessagingException
- {
- this.contentType = contentType;
- if (!contentType.getBaseType().equals(MimeConstants.TYPE_MULTIPART_RELATED))
- throw new IllegalArgumentException("Multipart related decoder called with a
non-multipart/related type");
-
- rootType = contentType.getParameter("type");
- if (rootType == null)
- throw new IllegalArgumentException("multipart/related type is invalid, it
is missing the root type parameter");
- }
-
- private boolean isValidRootType(String type) throws ParseException
- {
- // The type multipart/related parameter can not have parameters itself
- ContentType contentType = new ContentType(type);
- type = contentType.getBaseType();
-
- return rootType.equals(type);
- }
-
- public void decodeMultipartRelatedMessage(InputStream stream) throws IOException,
MessagingException
- {
- String boundaryParameter = contentType.getParameter("boundary");
- String start = contentType.getParameter("start");
- byte[] boundary;
-
- if (boundaryParameter == null)
- throw new IllegalArgumentException("multipart/related content type did not
contain a boundary");
-
- try
- {
- boundary = ("\r\n--" +
boundaryParameter).getBytes("US-ASCII");
- }
- catch (UnsupportedEncodingException e)
- {
- throw new WSException("US-ASCII not supported, this should never
happen");
- }
-
- BoundaryDelimitedInputStream delimitedStream = new
BoundaryDelimitedInputStream(stream, boundary);
-
- // Eat first inner stream since its empty
- byte[] buffer = new byte[256];
- while (delimitedStream.read(buffer) != -1)
- {
- }
-
- while (!delimitedStream.isOuterStreamClosed())
- {
- // If the stream is empty or an end marker is reached, skip to the next
- // one
- if (!advanceToHeaders(delimitedStream))
- continue;
-
- InternetHeaders headers = new InternetHeaders(delimitedStream);
- String typeHeader[] = headers.getHeader(MimeConstants.CONTENT_TYPE);
-
- if (typeHeader == null)
- throw new IllegalArgumentException("multipart/related stream invalid,
component Content-type missing.");
-
- SwapableMemoryDataSource source = new SwapableMemoryDataSource(delimitedStream,
typeHeader[0]);
- AttachmentPartImpl part = new AttachmentPartImpl(new DataHandler(source));
-
- Enumeration enumeration = headers.getAllHeaders();
-
- while (enumeration.hasMoreElements())
- {
- Header header = (Header)enumeration.nextElement();
- part.addMimeHeader(header.getName(), header.getValue());
- }
-
- // The root part is either the one pointed to by the start parameter, or
- // the first occuring part if start is not defined.
- if (rootPart == null && (start == null ||
start.equals(part.getContentId())))
- {
- if (isValidRootType(part.getContentType()) == false)
- throw new IllegalArgumentException("multipart/related type specified
a root type other than the one" + " that was found.");
-
- rootPart = part;
- }
- else
- {
- relatedParts.add(part);
- }
- }
- if (rootPart == null)
- throw new IllegalArgumentException("multipart/related stream invalid, no
root part was found");
- }
-
- private boolean advanceToHeaders(InputStream stream) throws IOException
- {
- boolean dash = false, cr = false;
- while (true)
- {
- int b = stream.read();
-
- switch (b)
- {
- case -1:
- return false;
- case '\r':
- cr = true;
- dash = false;
- break;
- case '-':
- if (dash == true)
- {
- // Two dashes indicate no further content
- stream.close();
- return false;
- }
- dash = true;
- cr = false;
- break;
- case '\n':
- if (cr == true)
- return true;
- dash = false;
- break;
- default:
- dash = false;
- cr = false;
- }
- }
- }
-
- /**
- * Returns an <code>AttachmentPart</code> representing the root part of
this multipart/related message.
- *
- * @return the root part of this multipart/related message
- */
- public AttachmentPart getRootPart()
- {
- return rootPart;
- }
-
- /**
- * Returns a collection of <code>AttachmentPart</code> objects that
represent the attachments on this message.
- * If there are no attachments, an empty collection is returned.
- */
- public Collection<AttachmentPart> getRelatedParts()
- {
- return relatedParts;
- }
-}
\ No newline at end of file
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/attachment/MultipartRelatedDecoder.java
(from rev 1560,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/attachment/MultipartRelatedDecoder.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/attachment/MultipartRelatedDecoder.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/attachment/MultipartRelatedDecoder.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -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.ws.core.soap.attachment;
+
+// $Id$
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.UnsupportedEncodingException;
+import java.util.Collection;
+import java.util.Enumeration;
+import java.util.LinkedList;
+import java.util.List;
+
+import javax.activation.DataHandler;
+import javax.mail.Header;
+import javax.mail.MessagingException;
+import javax.mail.internet.ContentType;
+import javax.mail.internet.InternetHeaders;
+import javax.mail.internet.ParseException;
+import javax.xml.soap.AttachmentPart;
+
+import org.jboss.ws.WSException;
+
+/**
+ * Abstract MutilPartRelatedDecoder decodes a mime multipart/related stream.
+ *
+ * @author <a href="mailto:jason@stacksmash.com">Jason T.
Greene</a>
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 18-Jan-2006
+ */
+public class MultipartRelatedDecoder
+{
+ private ContentType contentType;
+
+ private String rootType;
+
+ private AttachmentPartImpl rootPart;
+
+ private LinkedList<AttachmentPart> relatedParts = new
LinkedList<AttachmentPart>();
+
+ /**
+ * Constructs a <code>MultipartRelatedDecoder</code>. This will block
until the message
+ * has been decoded.
+ *
+ * @param contentType the mime Content-Type header provided by the transport
+ * @param stream The stream to pull the multipart message from
+ */
+ public MultipartRelatedDecoder(ContentType contentType) throws IOException,
MessagingException
+ {
+ this.contentType = contentType;
+ if (!contentType.getBaseType().equals(MimeConstants.TYPE_MULTIPART_RELATED))
+ throw new IllegalArgumentException("Multipart related decoder called with a
non-multipart/related type");
+
+ rootType = contentType.getParameter("type");
+ if (rootType == null)
+ throw new IllegalArgumentException("multipart/related type is invalid, it
is missing the root type parameter");
+ }
+
+ private boolean isValidRootType(String type) throws ParseException
+ {
+ // The type multipart/related parameter can not have parameters itself
+ ContentType contentType = new ContentType(type);
+ type = contentType.getBaseType();
+
+ return rootType.equals(type);
+ }
+
+ public void decodeMultipartRelatedMessage(InputStream stream) throws IOException,
MessagingException
+ {
+ String boundaryParameter = contentType.getParameter("boundary");
+ String start = contentType.getParameter("start");
+ byte[] boundary;
+
+ if (boundaryParameter == null)
+ throw new IllegalArgumentException("multipart/related content type did not
contain a boundary");
+
+ try
+ {
+ boundary = ("\r\n--" +
boundaryParameter).getBytes("US-ASCII");
+ }
+ catch (UnsupportedEncodingException e)
+ {
+ throw new WSException("US-ASCII not supported, this should never
happen");
+ }
+
+ BoundaryDelimitedInputStream delimitedStream = new
BoundaryDelimitedInputStream(stream, boundary);
+
+ // Eat first inner stream since its empty
+ byte[] buffer = new byte[256];
+ while (delimitedStream.read(buffer) != -1)
+ {
+ }
+
+ while (!delimitedStream.isOuterStreamClosed())
+ {
+ // If the stream is empty or an end marker is reached, skip to the next
+ // one
+ if (!advanceToHeaders(delimitedStream))
+ continue;
+
+ InternetHeaders headers = new InternetHeaders(delimitedStream);
+ String typeHeader[] = headers.getHeader(MimeConstants.CONTENT_TYPE);
+
+ if (typeHeader == null)
+ throw new IllegalArgumentException("multipart/related stream invalid,
component Content-type missing.");
+
+ SwapableMemoryDataSource source = new SwapableMemoryDataSource(delimitedStream,
typeHeader[0]);
+ AttachmentPartImpl part = new AttachmentPartImpl(new DataHandler(source));
+
+ Enumeration enumeration = headers.getAllHeaders();
+
+ while (enumeration.hasMoreElements())
+ {
+ Header header = (Header)enumeration.nextElement();
+ part.addMimeHeader(header.getName(), header.getValue());
+ }
+
+ // The root part is either the one pointed to by the start parameter, or
+ // the first occuring part if start is not defined.
+ if (rootPart == null && (start == null ||
start.equals(part.getContentId())))
+ {
+ if (isValidRootType(part.getContentType()) == false)
+ throw new IllegalArgumentException("multipart/related type specified
a root type other than the one" + " that was found.");
+
+ rootPart = part;
+ }
+ else
+ {
+ relatedParts.add(part);
+ }
+ }
+ if (rootPart == null)
+ throw new IllegalArgumentException("multipart/related stream invalid, no
root part was found");
+ }
+
+ private boolean advanceToHeaders(InputStream stream) throws IOException
+ {
+ boolean dash = false, cr = false;
+ while (true)
+ {
+ int b = stream.read();
+
+ switch (b)
+ {
+ case -1:
+ return false;
+ case '\r':
+ cr = true;
+ dash = false;
+ break;
+ case '-':
+ if (dash == true)
+ {
+ // Two dashes indicate no further content
+ stream.close();
+ return false;
+ }
+ dash = true;
+ cr = false;
+ break;
+ case '\n':
+ if (cr == true)
+ return true;
+ dash = false;
+ break;
+ default:
+ dash = false;
+ cr = false;
+ }
+ }
+ }
+
+ /**
+ * Returns an <code>AttachmentPart</code> representing the root part of
this multipart/related message.
+ *
+ * @return the root part of this multipart/related message
+ */
+ public AttachmentPart getRootPart()
+ {
+ return rootPart;
+ }
+
+ /**
+ * Returns a collection of <code>AttachmentPart</code> objects that
represent the attachments on this message.
+ * If there are no attachments, an empty collection is returned.
+ */
+ public Collection<AttachmentPart> getRelatedParts()
+ {
+ return relatedParts;
+ }
+}
\ No newline at end of file
Deleted:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/attachment/MultipartRelatedEncoder.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/attachment/MultipartRelatedEncoder.java 2006-12-05
23:29:55 UTC (rev 1557)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/attachment/MultipartRelatedEncoder.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -1,132 +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.attachment;
-
-//$Id$
-
-import java.io.IOException;
-import java.io.OutputStream;
-import java.util.Iterator;
-
-import javax.activation.DataHandler;
-import javax.mail.MessagingException;
-import javax.mail.internet.MimeBodyPart;
-import javax.mail.internet.MimeMultipart;
-import javax.xml.soap.AttachmentPart;
-import javax.xml.soap.MimeHeader;
-import javax.xml.soap.SOAPException;
-
-import org.jboss.ws.soap.SOAPMessageImpl;
-
-/**
- * MultipartRelatedEncoder encodes a SOAPMessage
- * into a multipart/related stream.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 17-Jan-2006
- */
-public abstract class MultipartRelatedEncoder
-{
- protected SOAPMessageImpl soapMessage;
- protected MimeMultipart multipart;
-
- public MultipartRelatedEncoder(SOAPMessageImpl soapMessage) throws SOAPException
- {
- this.soapMessage = soapMessage;
- }
-
- /** Build the multipart message */
- public abstract void encodeMultipartRelatedMessage() throws SOAPException,
MessagingException;
-
- protected void addAttachmentParts(MimeMultipart multipart) throws SOAPException,
MessagingException
- {
- Iterator attachmentParts = soapMessage.getAttachments();
- while (attachmentParts.hasNext())
- {
- AttachmentPart attachmentPart = (AttachmentPart)attachmentParts.next();
- DataHandler handler = attachmentPart.getDataHandler();
- MimeBodyPart mimePart = new MimeBodyPart();
- mimePart.setDataHandler(handler);
-
- Iterator mimeHeaders = attachmentPart.getAllMimeHeaders();
- while (mimeHeaders.hasNext())
- {
- MimeHeader soapHeader = (MimeHeader)mimeHeaders.next();
- mimePart.addHeader(soapHeader.getName(), soapHeader.getValue());
- }
-
- if (mimePart.getHeader(MimeConstants.CONTENT_TYPE) == null)
- {
- String type = handler.getContentType();
- mimePart.setHeader(MimeConstants.CONTENT_TYPE, (type != null) ? type :
MimeConstants.TYPE_APPLICATION_OCTET_STREAM);
- }
-
- if (mimePart.getHeader(MimeConstants.CONTENT_ID) == null)
- {
- CIDGenerator cidGenerator = soapMessage.getCidGenerator();
- mimePart.setHeader(MimeConstants.CONTENT_ID,
cidGenerator.generateFromCount());
- }
-
- // TODO - Binary encoding is the most efficient, however, some transports (old
mail servers)
- // require 7 bit ascii. Can we ask the remoting layer about the transport's
binary safety?
- mimePart.setHeader(MimeConstants.CONTENT_TRANSFER_ENCODING,
MimeConstants.BINARY_ENCODING);
-
- multipart.addBodyPart(mimePart);
- }
- }
-
- /**
- * Returns the new content type of this encoder. This value must be specified
- * in the mime Content-type header in what ever way that the transport
- * requires it.
- *
- * @return the content type
- */
- public String getContentType()
- {
- String contentType = multipart.getContentType();
- return contentType;
- }
-
- /**
- * Writes this message to the specified output stream.
- *
- * @param os the stream to write this message
- */
- public void writeTo(OutputStream os) throws IOException
- {
- if (multipart == null)
- throw new IOException("No data to write because encoding failed on
construction");
-
- try
- {
- // Ensure that the first boundary is always proceeded by CRLF
- os.write(13);
- os.write(10);
- multipart.writeTo(os);
- }
- catch (MessagingException e)
- {
- throw new IOException(e.getMessage());
- }
- }
-}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/attachment/MultipartRelatedEncoder.java
(from rev 1560,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/attachment/MultipartRelatedEncoder.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/attachment/MultipartRelatedEncoder.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/attachment/MultipartRelatedEncoder.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -0,0 +1,132 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+package org.jboss.ws.core.soap.attachment;
+
+//$Id$
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.Iterator;
+
+import javax.activation.DataHandler;
+import javax.mail.MessagingException;
+import javax.mail.internet.MimeBodyPart;
+import javax.mail.internet.MimeMultipart;
+import javax.xml.soap.AttachmentPart;
+import javax.xml.soap.MimeHeader;
+import javax.xml.soap.SOAPException;
+
+import org.jboss.ws.core.soap.SOAPMessageImpl;
+
+/**
+ * MultipartRelatedEncoder encodes a SOAPMessage
+ * into a multipart/related stream.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 17-Jan-2006
+ */
+public abstract class MultipartRelatedEncoder
+{
+ protected SOAPMessageImpl soapMessage;
+ protected MimeMultipart multipart;
+
+ public MultipartRelatedEncoder(SOAPMessageImpl soapMessage) throws SOAPException
+ {
+ this.soapMessage = soapMessage;
+ }
+
+ /** Build the multipart message */
+ public abstract void encodeMultipartRelatedMessage() throws SOAPException,
MessagingException;
+
+ protected void addAttachmentParts(MimeMultipart multipart) throws SOAPException,
MessagingException
+ {
+ Iterator attachmentParts = soapMessage.getAttachments();
+ while (attachmentParts.hasNext())
+ {
+ AttachmentPart attachmentPart = (AttachmentPart)attachmentParts.next();
+ DataHandler handler = attachmentPart.getDataHandler();
+ MimeBodyPart mimePart = new MimeBodyPart();
+ mimePart.setDataHandler(handler);
+
+ Iterator mimeHeaders = attachmentPart.getAllMimeHeaders();
+ while (mimeHeaders.hasNext())
+ {
+ MimeHeader soapHeader = (MimeHeader)mimeHeaders.next();
+ mimePart.addHeader(soapHeader.getName(), soapHeader.getValue());
+ }
+
+ if (mimePart.getHeader(MimeConstants.CONTENT_TYPE) == null)
+ {
+ String type = handler.getContentType();
+ mimePart.setHeader(MimeConstants.CONTENT_TYPE, (type != null) ? type :
MimeConstants.TYPE_APPLICATION_OCTET_STREAM);
+ }
+
+ if (mimePart.getHeader(MimeConstants.CONTENT_ID) == null)
+ {
+ CIDGenerator cidGenerator = soapMessage.getCidGenerator();
+ mimePart.setHeader(MimeConstants.CONTENT_ID,
cidGenerator.generateFromCount());
+ }
+
+ // TODO - Binary encoding is the most efficient, however, some transports (old
mail servers)
+ // require 7 bit ascii. Can we ask the remoting layer about the transport's
binary safety?
+ mimePart.setHeader(MimeConstants.CONTENT_TRANSFER_ENCODING,
MimeConstants.BINARY_ENCODING);
+
+ multipart.addBodyPart(mimePart);
+ }
+ }
+
+ /**
+ * Returns the new content type of this encoder. This value must be specified
+ * in the mime Content-type header in what ever way that the transport
+ * requires it.
+ *
+ * @return the content type
+ */
+ public String getContentType()
+ {
+ String contentType = multipart.getContentType();
+ return contentType;
+ }
+
+ /**
+ * Writes this message to the specified output stream.
+ *
+ * @param os the stream to write this message
+ */
+ public void writeTo(OutputStream os) throws IOException
+ {
+ if (multipart == null)
+ throw new IOException("No data to write because encoding failed on
construction");
+
+ try
+ {
+ // Ensure that the first boundary is always proceeded by CRLF
+ os.write(13);
+ os.write(10);
+ multipart.writeTo(os);
+ }
+ catch (MessagingException e)
+ {
+ throw new IOException(e.getMessage());
+ }
+ }
+}
Deleted:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/attachment/MultipartRelatedSwAEncoder.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/attachment/MultipartRelatedSwAEncoder.java 2006-12-05
23:29:55 UTC (rev 1557)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/attachment/MultipartRelatedSwAEncoder.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -1,86 +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.attachment;
-
-import java.io.OutputStream;
-
-import javax.mail.MessagingException;
-import javax.mail.internet.MimeBodyPart;
-import javax.mail.internet.MimeMultipart;
-import javax.mail.internet.ParameterList;
-import javax.xml.soap.SOAPEnvelope;
-import javax.xml.soap.SOAPException;
-
-import org.jboss.ws.soap.SOAPElementImpl;
-import org.jboss.ws.soap.SOAPElementWriter;
-import org.jboss.ws.soap.SOAPMessageImpl;
-
-/**
- * MultipartRelatedEncoder encodes a SOAPMessage
- * into a multipart/related stream.
- *
- * @author <a href="mailto:jason@stacksmash.com">Jason T.
Greene</a>
- */
-public class MultipartRelatedSwAEncoder extends MultipartRelatedEncoder
-{
- /**
- * Construct a MultipartRelatedEncoder from the specified
<code>SOAPMessage</code>.
- * There is minimal overhead on construction because all source streams are read
- * only on a call to {@link #writeTo(OutputStream)}.
- *
- * @param soapMessage the SOAP message to be sent as a root part
- */
- public MultipartRelatedSwAEncoder(SOAPMessageImpl soapMessage) throws SOAPException
- {
- super(soapMessage);
- }
-
- public void encodeMultipartRelatedMessage() throws SOAPException, MessagingException
- {
- ParameterList p = new ParameterList();
- p.set("type", MimeConstants.TYPE_TEXT_XML);
- p.set("start", MimeConstants.ROOTPART_CID);
-
- MimeMultipart multipart = new MimeMultipart("related" + p);
- MimeBodyPart rootPart = new MimeBodyPart();
-
- /*
- * TODO - For now we build the root part content from a serialized string of the
- * DOM tree, in the future, this should utilize a DataHandler, and a
DataContentHandler
- * to marshall the message. In this way the root part can be lazily written to the
output
- * stream.
- */
- SOAPEnvelope soapEnv = soapMessage.getSOAPPart().getEnvelope();
- String envStr = SOAPElementWriter.writeElement((SOAPElementImpl)soapEnv, false);
- rootPart.setText(envStr, "UTF-8");
-
- rootPart.setContentID(MimeConstants.ROOTPART_CID);
- rootPart.setHeader(MimeConstants.CONTENT_TYPE, MimeConstants.TYPE_XML_UTF8);
- rootPart.setHeader(MimeConstants.CONTENT_TRANSFER_ENCODING,
MimeConstants.TEXT_8BIT_ENCODING);
-
- multipart.addBodyPart(rootPart);
-
- addAttachmentParts(multipart);
-
- this.multipart = multipart;
- }
-}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/attachment/MultipartRelatedSwAEncoder.java
(from rev 1560,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/attachment/MultipartRelatedSwAEncoder.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/attachment/MultipartRelatedSwAEncoder.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/attachment/MultipartRelatedSwAEncoder.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -0,0 +1,86 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ws.core.soap.attachment;
+
+import java.io.OutputStream;
+
+import javax.mail.MessagingException;
+import javax.mail.internet.MimeBodyPart;
+import javax.mail.internet.MimeMultipart;
+import javax.mail.internet.ParameterList;
+import javax.xml.soap.SOAPEnvelope;
+import javax.xml.soap.SOAPException;
+
+import org.jboss.ws.core.soap.SOAPElementImpl;
+import org.jboss.ws.core.soap.SOAPElementWriter;
+import org.jboss.ws.core.soap.SOAPMessageImpl;
+
+/**
+ * MultipartRelatedEncoder encodes a SOAPMessage
+ * into a multipart/related stream.
+ *
+ * @author <a href="mailto:jason@stacksmash.com">Jason T.
Greene</a>
+ */
+public class MultipartRelatedSwAEncoder extends MultipartRelatedEncoder
+{
+ /**
+ * Construct a MultipartRelatedEncoder from the specified
<code>SOAPMessage</code>.
+ * There is minimal overhead on construction because all source streams are read
+ * only on a call to {@link #writeTo(OutputStream)}.
+ *
+ * @param soapMessage the SOAP message to be sent as a root part
+ */
+ public MultipartRelatedSwAEncoder(SOAPMessageImpl soapMessage) throws SOAPException
+ {
+ super(soapMessage);
+ }
+
+ public void encodeMultipartRelatedMessage() throws SOAPException, MessagingException
+ {
+ ParameterList p = new ParameterList();
+ p.set("type", MimeConstants.TYPE_TEXT_XML);
+ p.set("start", MimeConstants.ROOTPART_CID);
+
+ MimeMultipart multipart = new MimeMultipart("related" + p);
+ MimeBodyPart rootPart = new MimeBodyPart();
+
+ /*
+ * TODO - For now we build the root part content from a serialized string of the
+ * DOM tree, in the future, this should utilize a DataHandler, and a
DataContentHandler
+ * to marshall the message. In this way the root part can be lazily written to the
output
+ * stream.
+ */
+ SOAPEnvelope soapEnv = soapMessage.getSOAPPart().getEnvelope();
+ String envStr = SOAPElementWriter.writeElement((SOAPElementImpl)soapEnv, false);
+ rootPart.setText(envStr, "UTF-8");
+
+ rootPart.setContentID(MimeConstants.ROOTPART_CID);
+ rootPart.setHeader(MimeConstants.CONTENT_TYPE, MimeConstants.TYPE_XML_UTF8);
+ rootPart.setHeader(MimeConstants.CONTENT_TRANSFER_ENCODING,
MimeConstants.TEXT_8BIT_ENCODING);
+
+ multipart.addBodyPart(rootPart);
+
+ addAttachmentParts(multipart);
+
+ this.multipart = multipart;
+ }
+}
Deleted:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/attachment/MultipartRelatedXOPEncoder.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/attachment/MultipartRelatedXOPEncoder.java 2006-12-05
23:29:55 UTC (rev 1557)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/attachment/MultipartRelatedXOPEncoder.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -1,88 +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.attachment;
-
-import java.io.OutputStream;
-
-import javax.mail.MessagingException;
-import javax.mail.internet.MimeBodyPart;
-import javax.mail.internet.MimeMultipart;
-import javax.mail.internet.ParameterList;
-import javax.xml.soap.SOAPEnvelope;
-import javax.xml.soap.SOAPException;
-
-import org.jboss.ws.soap.SOAPElementImpl;
-import org.jboss.ws.soap.SOAPElementWriter;
-import org.jboss.ws.soap.SOAPMessageImpl;
-
-/**
- * <code>MultipartRelatedEncoder</code> encodes a
<code>SOAPMessage</code>
- * into a multipart/related stream.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 17-Jan-2006
- */
-public class MultipartRelatedXOPEncoder extends MultipartRelatedEncoder
-{
- /**
- * Construct a MultipartRelatedEncoder from the specified
<code>SOAPMessage</code>.
- * There is minimal overhead on construction because all source streams are read
- * only on a call to {@link #writeTo(OutputStream)}.
- *
- * @param soapMessage the SOAP message to be sent as a root part
- */
- public MultipartRelatedXOPEncoder(SOAPMessageImpl soapMessage) throws SOAPException
- {
- super(soapMessage);
- }
-
- public void encodeMultipartRelatedMessage() throws SOAPException, MessagingException
- {
- ParameterList p = new ParameterList();
- p.set("type", MimeConstants.TYPE_APPLICATION_XOP_XML);
- p.set("start", MimeConstants.ROOTPART_CID);
- p.set("start-info", MimeConstants.START_INFO_XOP);
-
- MimeMultipart multipart = new MimeMultipart("related" + p);
- MimeBodyPart rootPart = new MimeBodyPart();
-
- /*
- * TODO - For now we build the root part content from a serialized string of the
- * DOM tree, in the future, this should utilize a DataHandler, and a
DataContentHandler
- * to marshall the message. In this way the root part can be lazily written to the
output
- * stream.
- */
- SOAPEnvelope soapEnv = soapMessage.getSOAPPart().getEnvelope();
- String envStr = SOAPElementWriter.writeElement((SOAPElementImpl)soapEnv, false);
- rootPart.setText(envStr, "UTF-8");
-
- rootPart.setContentID(MimeConstants.ROOTPART_CID);
- rootPart.setHeader(MimeConstants.CONTENT_TYPE,
MimeConstants.TYPE_APPLICATION_XOP_XML + "; type=\"text/xml\"");
- rootPart.setHeader(MimeConstants.CONTENT_TRANSFER_ENCODING,
MimeConstants.TEXT_8BIT_ENCODING);
-
- multipart.addBodyPart(rootPart);
-
- addAttachmentParts(multipart);
-
- this.multipart = multipart;
- }
-}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/attachment/MultipartRelatedXOPEncoder.java
(from rev 1560,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/attachment/MultipartRelatedXOPEncoder.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/attachment/MultipartRelatedXOPEncoder.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/attachment/MultipartRelatedXOPEncoder.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -0,0 +1,88 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ws.core.soap.attachment;
+
+import java.io.OutputStream;
+
+import javax.mail.MessagingException;
+import javax.mail.internet.MimeBodyPart;
+import javax.mail.internet.MimeMultipart;
+import javax.mail.internet.ParameterList;
+import javax.xml.soap.SOAPEnvelope;
+import javax.xml.soap.SOAPException;
+
+import org.jboss.ws.core.soap.SOAPElementImpl;
+import org.jboss.ws.core.soap.SOAPElementWriter;
+import org.jboss.ws.core.soap.SOAPMessageImpl;
+
+/**
+ * <code>MultipartRelatedEncoder</code> encodes a
<code>SOAPMessage</code>
+ * into a multipart/related stream.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 17-Jan-2006
+ */
+public class MultipartRelatedXOPEncoder extends MultipartRelatedEncoder
+{
+ /**
+ * Construct a MultipartRelatedEncoder from the specified
<code>SOAPMessage</code>.
+ * There is minimal overhead on construction because all source streams are read
+ * only on a call to {@link #writeTo(OutputStream)}.
+ *
+ * @param soapMessage the SOAP message to be sent as a root part
+ */
+ public MultipartRelatedXOPEncoder(SOAPMessageImpl soapMessage) throws SOAPException
+ {
+ super(soapMessage);
+ }
+
+ public void encodeMultipartRelatedMessage() throws SOAPException, MessagingException
+ {
+ ParameterList p = new ParameterList();
+ p.set("type", MimeConstants.TYPE_APPLICATION_XOP_XML);
+ p.set("start", MimeConstants.ROOTPART_CID);
+ p.set("start-info", MimeConstants.START_INFO_XOP);
+
+ MimeMultipart multipart = new MimeMultipart("related" + p);
+ MimeBodyPart rootPart = new MimeBodyPart();
+
+ /*
+ * TODO - For now we build the root part content from a serialized string of the
+ * DOM tree, in the future, this should utilize a DataHandler, and a
DataContentHandler
+ * to marshall the message. In this way the root part can be lazily written to the
output
+ * stream.
+ */
+ SOAPEnvelope soapEnv = soapMessage.getSOAPPart().getEnvelope();
+ String envStr = SOAPElementWriter.writeElement((SOAPElementImpl)soapEnv, false);
+ rootPart.setText(envStr, "UTF-8");
+
+ rootPart.setContentID(MimeConstants.ROOTPART_CID);
+ rootPart.setHeader(MimeConstants.CONTENT_TYPE,
MimeConstants.TYPE_APPLICATION_XOP_XML + "; type=\"text/xml\"");
+ rootPart.setHeader(MimeConstants.CONTENT_TRANSFER_ENCODING,
MimeConstants.TEXT_8BIT_ENCODING);
+
+ multipart.addBodyPart(rootPart);
+
+ addAttachmentParts(multipart);
+
+ this.multipart = multipart;
+ }
+}
Deleted:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/attachment/RawByteArrayOutputStream.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/attachment/RawByteArrayOutputStream.java 2006-12-05
23:29:55 UTC (rev 1557)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/attachment/RawByteArrayOutputStream.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -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.soap.attachment;
-
-import java.io.ByteArrayOutputStream;
-
-/**
- * Extension of ByteArrayOutputStream that provides access to buf, saving a copy.
- *
- * @author <a href="mailto:jason@stacksmash.com">Jason T.
Greene</a>
- */
-public class RawByteArrayOutputStream extends ByteArrayOutputStream
-{
- public byte[] getBytes()
- {
- return buf;
- }
-}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/attachment/RawByteArrayOutputStream.java
(from rev 1560,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/attachment/RawByteArrayOutputStream.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/attachment/RawByteArrayOutputStream.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/attachment/RawByteArrayOutputStream.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -0,0 +1,37 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+package org.jboss.ws.core.soap.attachment;
+
+import java.io.ByteArrayOutputStream;
+
+/**
+ * Extension of ByteArrayOutputStream that provides access to buf, saving a copy.
+ *
+ * @author <a href="mailto:jason@stacksmash.com">Jason T.
Greene</a>
+ */
+public class RawByteArrayOutputStream extends ByteArrayOutputStream
+{
+ public byte[] getBytes()
+ {
+ return buf;
+ }
+}
Deleted:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/attachment/SimpleBoyerMoore.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/attachment/SimpleBoyerMoore.java 2006-12-05
23:29:55 UTC (rev 1557)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/attachment/SimpleBoyerMoore.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -1,102 +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.attachment;
-
-/**
- * <code>SimpleBoyerMoore</code> is an implementation of the simplified
- * version of the Boyer-Moore pattern search algorithm. This just means that the
- * "good match" portion of the algorithm is removed, which improves the
- * performance of non repeating patterns with the obvious side-effect of
- * reducing repeating pattern performance (e.g. gaggaggaaaggaggaagagaggaga).
- *
- * This version of the algorithm performs incredibly well if the pattern is
- * rare, for example a MIME boundary.
- *
- * This algorithm is binary safe.
- *
- * @author <a href="mailto:jason@stacksmash.com">Jason T.
Greene</a>
- */
-public class SimpleBoyerMoore
-{
- private int[] badMatch = new int[256];
-
- private byte[] pattern;
-
- public static final int PATTERN_NOT_FOUND = -1;
-
- /**
- * Constructs a <code>SimpleBoyerMoore</code> instance. This internally
- * stores the pattern so that the same instance can be used across several
- * searches.
- *
- * @param pattern the pattern to search for
- */
- public SimpleBoyerMoore(byte[] pattern)
- {
- this.pattern = pattern;
- precomputeBadMatchTable();
- }
-
- private void precomputeBadMatchTable()
- {
- java.util.Arrays.fill(badMatch, pattern.length);
- for (int i = 0; i < pattern.length - 1; i++)
- {
- badMatch[pattern[i] & 0xff] = pattern.length - i - 1;
- }
- }
-
- /**
- * Find an occurence of the search pattern within text.
- *
- * @param text a byte array of data to seach
- * @param offset the index in text to start searching from
- * @param length the maximum number of bytes to search
- *
- * @return if a match is found, the index of text where the patter occurs,
- * otherwise {@link #PATTERN_NOT_FOUND}
- */
- public int patternSearch(byte[] text, int offset, int length)
- {
- if (pattern.length > length)
- {
- return PATTERN_NOT_FOUND;
- }
-
- int i = 0, j = 0, k = 0;
- int end = offset + length;
-
- for (i = offset + pattern.length - 1; i < end; i += badMatch[text[i] &
0xff])
- {
- for (j = pattern.length - 1, k = i; (j >= 0) && (text[k] ==
pattern[j]); j--)
- {
- k--;
- }
- if (j == -1)
- {
- return k + 1;
- }
- }
-
- return PATTERN_NOT_FOUND;
- }
-}
\ No newline at end of file
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/attachment/SimpleBoyerMoore.java
(from rev 1560,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/attachment/SimpleBoyerMoore.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/attachment/SimpleBoyerMoore.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/attachment/SimpleBoyerMoore.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -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.ws.core.soap.attachment;
+
+/**
+ * <code>SimpleBoyerMoore</code> is an implementation of the simplified
+ * version of the Boyer-Moore pattern search algorithm. This just means that the
+ * "good match" portion of the algorithm is removed, which improves the
+ * performance of non repeating patterns with the obvious side-effect of
+ * reducing repeating pattern performance (e.g. gaggaggaaaggaggaagagaggaga).
+ *
+ * This version of the algorithm performs incredibly well if the pattern is
+ * rare, for example a MIME boundary.
+ *
+ * This algorithm is binary safe.
+ *
+ * @author <a href="mailto:jason@stacksmash.com">Jason T.
Greene</a>
+ */
+public class SimpleBoyerMoore
+{
+ private int[] badMatch = new int[256];
+
+ private byte[] pattern;
+
+ public static final int PATTERN_NOT_FOUND = -1;
+
+ /**
+ * Constructs a <code>SimpleBoyerMoore</code> instance. This internally
+ * stores the pattern so that the same instance can be used across several
+ * searches.
+ *
+ * @param pattern the pattern to search for
+ */
+ public SimpleBoyerMoore(byte[] pattern)
+ {
+ this.pattern = pattern;
+ precomputeBadMatchTable();
+ }
+
+ private void precomputeBadMatchTable()
+ {
+ java.util.Arrays.fill(badMatch, pattern.length);
+ for (int i = 0; i < pattern.length - 1; i++)
+ {
+ badMatch[pattern[i] & 0xff] = pattern.length - i - 1;
+ }
+ }
+
+ /**
+ * Find an occurence of the search pattern within text.
+ *
+ * @param text a byte array of data to seach
+ * @param offset the index in text to start searching from
+ * @param length the maximum number of bytes to search
+ *
+ * @return if a match is found, the index of text where the patter occurs,
+ * otherwise {@link #PATTERN_NOT_FOUND}
+ */
+ public int patternSearch(byte[] text, int offset, int length)
+ {
+ if (pattern.length > length)
+ {
+ return PATTERN_NOT_FOUND;
+ }
+
+ int i = 0, j = 0, k = 0;
+ int end = offset + length;
+
+ for (i = offset + pattern.length - 1; i < end; i += badMatch[text[i] &
0xff])
+ {
+ for (j = pattern.length - 1, k = i; (j >= 0) && (text[k] ==
pattern[j]); j--)
+ {
+ k--;
+ }
+ if (j == -1)
+ {
+ return k + 1;
+ }
+ }
+
+ return PATTERN_NOT_FOUND;
+ }
+}
\ No newline at end of file
Deleted:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/attachment/SwapableMemoryDataSource.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/attachment/SwapableMemoryDataSource.java 2006-12-05
23:29:55 UTC (rev 1557)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/attachment/SwapableMemoryDataSource.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -1,204 +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.attachment;
-
-import java.io.ByteArrayInputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-
-import javax.activation.DataSource;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.WSException;
-import org.jboss.ws.utils.IOUtils;
-
-/**
- * A datasource which offloads large attachments to disk.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @author <a href="mailto:jason@stacksmash.com">Jason T.
Greene</a>
- */
-public class SwapableMemoryDataSource implements DataSource
-{
- private static Logger log = Logger.getLogger(SwapableMemoryDataSource.class);
-
- private static final int BLOCK_SIZE = 32 * 1024;
-
- private static final int DEFAULT_MAX_MEMORY_SIZE = 64 * 1024;
-
- private static final String SWAP_PREFIX = "JBossWSsattachment";
-
- private static final String SWAP_SUFFIX = ".dat";
-
- private File swapFile;
-
- private String contentType = MimeConstants.TYPE_APPLICATION_OCTET_STREAM;
-
- private byte[] content;
-
- private int contentLength;
-
- private int maxMemorySize = 64 * 1024;
-
-
- /**
- * Constructs a <code>SwapableMemoryDataSource</code> from inputStream,
and contentType.
- * The instance then reads from the input stream, and stores it in memory unless the
size
- * of the content is larger that 64KB, at whichpoint the stream is stored in a
temporary
- * file on disk.
- *
- * @param inputStream the stream to read from
- * @param contentType the content type of this stream
- */
- public SwapableMemoryDataSource(InputStream inputStream, String contentType) throws
IOException
- {
- this(inputStream, contentType, DEFAULT_MAX_MEMORY_SIZE);
- }
-
- /**
- * Constructs a <code>SwapableMemoryDataSource</code> from inputStream,
and
- * contentType. The instance then reads from the input stream, and stores it
- * in memory unless the size of the content is larger than maxMemorySize, at
- * whichpoint the stream is stored in a temporary file on disk.
- *
- * @param inputStream the stream to read from
- * @param contentType the content type of this stream
- * @param maxMemorySize the maximum size in bytes that this data source is
- * allowed to allocate for stream storage
- */
- public SwapableMemoryDataSource(InputStream inputStream, String contentType, int
maxMemorySize) throws IOException
- {
- if (contentType != null)
- this.contentType = contentType;
-
- this.maxMemorySize = maxMemorySize;
-
- load(inputStream);
- }
-
- private void load(InputStream inputStream) throws IOException
- {
- RawByteArrayOutputStream rbaos = new RawByteArrayOutputStream();
- OutputStream os = rbaos;
-
- byte[] buffer = new byte[BLOCK_SIZE];
- int count = inputStream.read(buffer);
- while (count > 0) {
- os.write(buffer, 0, count);
-
- if (rbaos != null && rbaos.size() > maxMemorySize)
- {
- File tmpdir = null;
- try
- {
- tmpdir = IOUtils.createTempDirectory();
- }
- catch (Throwable e)
- {
- // Ignore if the server config cannot be found
- // this would be the case if we are on the client side
- }
-
- swapFile = File.createTempFile(SWAP_PREFIX, SWAP_SUFFIX, tmpdir);
- swapFile.deleteOnExit();
- os = new FileOutputStream(swapFile);
- rbaos.writeTo(os);
- rbaos = null;
- }
-
- count = inputStream.read(buffer);
- }
-
- os.flush();
- os.close();
-
- if (rbaos == null)
- {
- log.debug("Using swap file, location = " + swapFile.toURL() + "
size = " + swapFile.length());
- }
- else
- {
- contentLength = rbaos.size();
- log.debug("Using memory buffer, size = " + contentLength);
- content = rbaos.getBytes();
- }
- }
-
- protected void finalize() throws Throwable
- {
- super.finalize();
-
- if (swapFile != null)
- swapFile.delete();
- }
-
- /**
- * Returns the content type of this data source.
- *
- * @return the content type
- */
- public String getContentType()
- {
- return contentType;
- }
-
- /**
- * Returns a new input stream on this data source. Multiple calls
- * are allowed because the data is stored.
- *
- * @return a new input stream at the start of the data
- */
- public InputStream getInputStream() throws IOException
- {
- if (content != null)
- return new ByteArrayInputStream(content, 0, contentLength);
-
- if (swapFile != null)
- return new FileInputStream(swapFile);
-
- throw new WSException("No content available");
- }
-
- /**
- * This method always returns null.
- *
- * @return null
- */
- public String getName()
- {
- return null;
- }
-
- /**
- * This method always returns null.
- *
- * @return null
- */
- public OutputStream getOutputStream() throws IOException
- {
- return null;
- }
-}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/attachment/SwapableMemoryDataSource.java
(from rev 1560,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/attachment/SwapableMemoryDataSource.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/attachment/SwapableMemoryDataSource.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/attachment/SwapableMemoryDataSource.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -0,0 +1,204 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+package org.jboss.ws.core.soap.attachment;
+
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+import javax.activation.DataSource;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.WSException;
+import org.jboss.ws.utils.IOUtils;
+
+/**
+ * A datasource which offloads large attachments to disk.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @author <a href="mailto:jason@stacksmash.com">Jason T.
Greene</a>
+ */
+public class SwapableMemoryDataSource implements DataSource
+{
+ private static Logger log = Logger.getLogger(SwapableMemoryDataSource.class);
+
+ private static final int BLOCK_SIZE = 32 * 1024;
+
+ private static final int DEFAULT_MAX_MEMORY_SIZE = 64 * 1024;
+
+ private static final String SWAP_PREFIX = "JBossWSsattachment";
+
+ private static final String SWAP_SUFFIX = ".dat";
+
+ private File swapFile;
+
+ private String contentType = MimeConstants.TYPE_APPLICATION_OCTET_STREAM;
+
+ private byte[] content;
+
+ private int contentLength;
+
+ private int maxMemorySize = 64 * 1024;
+
+
+ /**
+ * Constructs a <code>SwapableMemoryDataSource</code> from inputStream,
and contentType.
+ * The instance then reads from the input stream, and stores it in memory unless the
size
+ * of the content is larger that 64KB, at whichpoint the stream is stored in a
temporary
+ * file on disk.
+ *
+ * @param inputStream the stream to read from
+ * @param contentType the content type of this stream
+ */
+ public SwapableMemoryDataSource(InputStream inputStream, String contentType) throws
IOException
+ {
+ this(inputStream, contentType, DEFAULT_MAX_MEMORY_SIZE);
+ }
+
+ /**
+ * Constructs a <code>SwapableMemoryDataSource</code> from inputStream,
and
+ * contentType. The instance then reads from the input stream, and stores it
+ * in memory unless the size of the content is larger than maxMemorySize, at
+ * whichpoint the stream is stored in a temporary file on disk.
+ *
+ * @param inputStream the stream to read from
+ * @param contentType the content type of this stream
+ * @param maxMemorySize the maximum size in bytes that this data source is
+ * allowed to allocate for stream storage
+ */
+ public SwapableMemoryDataSource(InputStream inputStream, String contentType, int
maxMemorySize) throws IOException
+ {
+ if (contentType != null)
+ this.contentType = contentType;
+
+ this.maxMemorySize = maxMemorySize;
+
+ load(inputStream);
+ }
+
+ private void load(InputStream inputStream) throws IOException
+ {
+ RawByteArrayOutputStream rbaos = new RawByteArrayOutputStream();
+ OutputStream os = rbaos;
+
+ byte[] buffer = new byte[BLOCK_SIZE];
+ int count = inputStream.read(buffer);
+ while (count > 0) {
+ os.write(buffer, 0, count);
+
+ if (rbaos != null && rbaos.size() > maxMemorySize)
+ {
+ File tmpdir = null;
+ try
+ {
+ tmpdir = IOUtils.createTempDirectory();
+ }
+ catch (Throwable e)
+ {
+ // Ignore if the server config cannot be found
+ // this would be the case if we are on the client side
+ }
+
+ swapFile = File.createTempFile(SWAP_PREFIX, SWAP_SUFFIX, tmpdir);
+ swapFile.deleteOnExit();
+ os = new FileOutputStream(swapFile);
+ rbaos.writeTo(os);
+ rbaos = null;
+ }
+
+ count = inputStream.read(buffer);
+ }
+
+ os.flush();
+ os.close();
+
+ if (rbaos == null)
+ {
+ log.debug("Using swap file, location = " + swapFile.toURL() + "
size = " + swapFile.length());
+ }
+ else
+ {
+ contentLength = rbaos.size();
+ log.debug("Using memory buffer, size = " + contentLength);
+ content = rbaos.getBytes();
+ }
+ }
+
+ protected void finalize() throws Throwable
+ {
+ super.finalize();
+
+ if (swapFile != null)
+ swapFile.delete();
+ }
+
+ /**
+ * Returns the content type of this data source.
+ *
+ * @return the content type
+ */
+ public String getContentType()
+ {
+ return contentType;
+ }
+
+ /**
+ * Returns a new input stream on this data source. Multiple calls
+ * are allowed because the data is stored.
+ *
+ * @return a new input stream at the start of the data
+ */
+ public InputStream getInputStream() throws IOException
+ {
+ if (content != null)
+ return new ByteArrayInputStream(content, 0, contentLength);
+
+ if (swapFile != null)
+ return new FileInputStream(swapFile);
+
+ throw new WSException("No content available");
+ }
+
+ /**
+ * This method always returns null.
+ *
+ * @return null
+ */
+ public String getName()
+ {
+ return null;
+ }
+
+ /**
+ * This method always returns null.
+ *
+ * @return null
+ */
+ public OutputStream getOutputStream() throws IOException
+ {
+ return null;
+ }
+}
Deleted:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/attachment/XmlDataContentHandler.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/attachment/XmlDataContentHandler.java 2006-12-05
23:29:55 UTC (rev 1557)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/attachment/XmlDataContentHandler.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -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.soap.attachment;
-
-import java.awt.datatransfer.DataFlavor;
-import java.awt.datatransfer.UnsupportedFlavorException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-
-import javax.activation.ActivationDataFlavor;
-import javax.activation.DataContentHandler;
-import javax.activation.DataSource;
-import javax.xml.transform.stream.StreamSource;
-
-import org.jboss.ws.utils.IOUtils;
-
-/**
- * <code>XmlDataContentHandler</code> is a JAF content handler that provides
- * marchalling/unmarshalling between a <code>StreamSource</code> and a
generic
- * stream.
- *
- * @author <a href="mailto:jason@stacksmash.com">Jason T.
Greene</a>
- */
-public class XmlDataContentHandler implements DataContentHandler
-{
- private DataFlavor[] flavors = new ActivationDataFlavor[]
- {
- new ActivationDataFlavor(StreamSource.class, "text/xml",
"XML"),
- new ActivationDataFlavor(StreamSource.class, "application/xml",
"XML")
- };
-
- /**
- * Returns a {@link StreamSource} from the specified
- * data source.
- *
- * @param ds the activation datasource
- * @return an XML stream source
- */
- public Object getContent(DataSource ds) throws IOException
- {
- return new StreamSource(ds.getInputStream());
- }
-
- /**
- * Returns a {@link StreamSource} from the specified
- * data source. The flavor must be one of the ones returned by {@link
#getTransferDataFlavors()}.
- *
- * @param df the flavor specifiying the mime type of ds
- * @param ds the activation data source
- * @return an XML stream source
- */
- public Object getTransferData(DataFlavor df, DataSource ds) throws
UnsupportedFlavorException, IOException
- {
- return getContent(ds);
- }
-
- /**
- * Returns the acceptable data flavors that this content handler supports.
- *
- * @return array of <code>ActivationDataHandlers</code>
- */
- public DataFlavor[] getTransferDataFlavors()
- {
- return flavors;
- }
-
- /**
- * Writes the passed in {@link StreamSource} object using the specified
- * mime type to the specified output stream. The mime type must be text/xml.
- *
- * @param obj an XML stream source
- * @param mimeType the string "text/xml"
- * @param os the output stream to write this xml stream to
- */
- public void writeTo(Object obj, String mimeType, OutputStream os) throws IOException
- {
- if (! mimeType.startsWith(MimeConstants.TYPE_TEXT_XML) && !
mimeType.startsWith("application/xml"))
- throw new IOException("Expected text/xml or application/xml, got " +
mimeType);
-
- if (! (obj instanceof StreamSource))
- throw new IOException("XML Content handler only supports a StreamSource
content object");
-
- // TODO - add support for reader source
- InputStream stream = ((StreamSource) obj).getInputStream();
- if (stream == null)
- throw new IOException("XML Content handler requires an input stream based
StreamSource");
-
- IOUtils.copyStream(os, stream);
- }
-}
\ No newline at end of file
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/attachment/XmlDataContentHandler.java
(from rev 1560,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/attachment/XmlDataContentHandler.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/attachment/XmlDataContentHandler.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/attachment/XmlDataContentHandler.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -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.core.soap.attachment;
+
+import java.awt.datatransfer.DataFlavor;
+import java.awt.datatransfer.UnsupportedFlavorException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+import javax.activation.ActivationDataFlavor;
+import javax.activation.DataContentHandler;
+import javax.activation.DataSource;
+import javax.xml.transform.stream.StreamSource;
+
+import org.jboss.ws.utils.IOUtils;
+
+/**
+ * <code>XmlDataContentHandler</code> is a JAF content handler that provides
+ * marchalling/unmarshalling between a <code>StreamSource</code> and a
generic
+ * stream.
+ *
+ * @author <a href="mailto:jason@stacksmash.com">Jason T.
Greene</a>
+ */
+public class XmlDataContentHandler implements DataContentHandler
+{
+ private DataFlavor[] flavors = new ActivationDataFlavor[]
+ {
+ new ActivationDataFlavor(StreamSource.class, "text/xml",
"XML"),
+ new ActivationDataFlavor(StreamSource.class, "application/xml",
"XML")
+ };
+
+ /**
+ * Returns a {@link StreamSource} from the specified
+ * data source.
+ *
+ * @param ds the activation datasource
+ * @return an XML stream source
+ */
+ public Object getContent(DataSource ds) throws IOException
+ {
+ return new StreamSource(ds.getInputStream());
+ }
+
+ /**
+ * Returns a {@link StreamSource} from the specified
+ * data source. The flavor must be one of the ones returned by {@link
#getTransferDataFlavors()}.
+ *
+ * @param df the flavor specifiying the mime type of ds
+ * @param ds the activation data source
+ * @return an XML stream source
+ */
+ public Object getTransferData(DataFlavor df, DataSource ds) throws
UnsupportedFlavorException, IOException
+ {
+ return getContent(ds);
+ }
+
+ /**
+ * Returns the acceptable data flavors that this content handler supports.
+ *
+ * @return array of <code>ActivationDataHandlers</code>
+ */
+ public DataFlavor[] getTransferDataFlavors()
+ {
+ return flavors;
+ }
+
+ /**
+ * Writes the passed in {@link StreamSource} object using the specified
+ * mime type to the specified output stream. The mime type must be text/xml.
+ *
+ * @param obj an XML stream source
+ * @param mimeType the string "text/xml"
+ * @param os the output stream to write this xml stream to
+ */
+ public void writeTo(Object obj, String mimeType, OutputStream os) throws IOException
+ {
+ if (! mimeType.startsWith(MimeConstants.TYPE_TEXT_XML) && !
mimeType.startsWith("application/xml"))
+ throw new IOException("Expected text/xml or application/xml, got " +
mimeType);
+
+ if (! (obj instanceof StreamSource))
+ throw new IOException("XML Content handler only supports a StreamSource
content object");
+
+ // TODO - add support for reader source
+ InputStream stream = ((StreamSource) obj).getInputStream();
+ if (stream == null)
+ throw new IOException("XML Content handler requires an input stream based
StreamSource");
+
+ IOUtils.copyStream(os, stream);
+ }
+}
\ No newline at end of file
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/deployment/ServiceEndpointDeployer.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/deployment/ServiceEndpointDeployer.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/deployment/ServiceEndpointDeployer.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -28,6 +28,9 @@
import org.jboss.logging.Logger;
import org.jboss.ws.WSException;
+import org.jboss.ws.core.server.ServiceEndpointInfo;
+import org.jboss.ws.core.server.ServiceEndpointManager;
+import org.jboss.ws.core.server.WSDLFilePublisher;
import org.jboss.ws.metadata.builder.jaxrpc.JAXRPCDeployment;
import org.jboss.ws.metadata.builder.jaxrpc.JAXRPCServerMetaDataBuilder;
import org.jboss.ws.metadata.builder.jaxws.JAXWSMetaDataBuilderEJB3;
@@ -36,9 +39,6 @@
import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
import org.jboss.ws.metadata.umdm.ServiceMetaData;
import org.jboss.ws.metadata.umdm.UnifiedMetaData;
-import org.jboss.ws.server.ServiceEndpointInfo;
-import org.jboss.ws.server.ServiceEndpointManager;
-import org.jboss.ws.server.WSDLFilePublisher;
/**
* The POJO deployer for web service endpoints. This Deployer is already decoupled from
the target
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/addressing/AddressingPropertiesImpl.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/addressing/AddressingPropertiesImpl.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/addressing/AddressingPropertiesImpl.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -30,7 +30,7 @@
import javax.xml.soap.SOAPElement;
import javax.xml.ws.addressing.*;
-import org.jboss.ws.soap.NameImpl;
+import org.jboss.ws.core.soap.NameImpl;
// $Id$
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/addressing/soap/SOAPAddressingPropertiesImpl.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/addressing/soap/SOAPAddressingPropertiesImpl.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/addressing/soap/SOAPAddressingPropertiesImpl.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -47,12 +47,12 @@
import org.jboss.util.NotImplementedException;
import org.jboss.ws.utils.DOMUtils;
+import org.jboss.ws.core.soap.NameImpl;
+import org.jboss.ws.core.soap.SOAPElementImpl;
+import org.jboss.ws.core.soap.SOAPFactoryImpl;
import org.jboss.ws.extras.addressing.AddressingConstantsImpl;
import org.jboss.ws.extras.addressing.AddressingPropertiesImpl;
import org.jboss.ws.extras.addressing.EndpointReferenceImpl;
-import org.jboss.ws.soap.NameImpl;
-import org.jboss.ws.soap.SOAPElementImpl;
-import org.jboss.ws.soap.SOAPFactoryImpl;
import org.jboss.ws.utils.ThreadLocalAssociation;
import org.jboss.xb.binding.NamespaceRegistry;
import org.w3c.dom.Attr;
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/eventing/EventingEndpointBase.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/eventing/EventingEndpointBase.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/eventing/EventingEndpointBase.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -34,9 +34,9 @@
import org.jboss.ws.Constants;
import org.jboss.ws.core.CommonMessageContext;
+import org.jboss.ws.core.soap.MessageContextAssociation;
import org.jboss.ws.extras.eventing.mgmt.SubscriptionManagerFactory;
import org.jboss.ws.extras.eventing.mgmt.SubscriptionManagerMBean;
-import org.jboss.ws.soap.MessageContextAssociation;
/**
* @author Heiko Braun, <heiko(a)openj.net>
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/eventing/SubscriptionManagerEndpointImpl.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/eventing/SubscriptionManagerEndpointImpl.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/eventing/SubscriptionManagerEndpointImpl.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -37,13 +37,13 @@
import org.jboss.ws.utils.DOMUtils;
import org.jboss.ws.Constants;
import org.jboss.ws.core.CommonMessageContext;
+import org.jboss.ws.core.soap.MessageContextAssociation;
import org.jboss.ws.extras.eventing.element.RenewRequest;
import org.jboss.ws.extras.eventing.element.RenewResponse;
import org.jboss.ws.extras.eventing.element.StatusRequest;
import org.jboss.ws.extras.eventing.element.StatusResponse;
import org.jboss.ws.extras.eventing.element.UnsubscribeRequest;
import org.jboss.ws.extras.eventing.mgmt.SubscriptionError;
-import org.jboss.ws.soap.MessageContextAssociation;
import org.w3c.dom.Element;
/**
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/eventing/deployment/EventingEndpoint.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/eventing/deployment/EventingEndpoint.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/eventing/deployment/EventingEndpoint.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -1,13 +1,13 @@
package org.jboss.ws.extras.eventing.deployment;
import org.jboss.ws.WSException;
+import org.jboss.ws.core.server.ServiceEndpoint;
+import org.jboss.ws.core.server.ServiceEndpointInfo;
import org.jboss.ws.extras.eventing.EventingConstants;
import org.jboss.ws.extras.eventing.metadata.EventingEpMetaExt;
import org.jboss.ws.extras.eventing.mgmt.SubscriptionManagerFactory;
import org.jboss.ws.extras.eventing.mgmt.SubscriptionManagerMBean;
import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
-import org.jboss.ws.server.ServiceEndpoint;
-import org.jboss.ws.server.ServiceEndpointInfo;
/**
* EventingEndpointLifecycle is responsible to create event sources
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/eventing/element/EndpointReference.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/eventing/element/EndpointReference.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/eventing/element/EndpointReference.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -24,7 +24,7 @@
// $Id$
import org.w3c.dom.Element;
-import org.jboss.ws.soap.SOAPFactoryImpl;
+import org.jboss.ws.core.soap.SOAPFactoryImpl;
import org.jboss.ws.extras.addressing.EndpointReferenceImpl;
import org.jboss.ws.extras.eventing.EventingConstants;
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/eventing/mgmt/Subscription.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/eventing/mgmt/Subscription.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/eventing/mgmt/Subscription.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -27,9 +27,9 @@
import org.apache.xpath.objects.XObject;
import org.jboss.logging.Logger;
import org.jboss.ws.utils.DOMWriter;
+import org.jboss.ws.core.soap.SOAPConnectionImpl;
import org.jboss.ws.extras.eventing.EventingConstants;
import org.jboss.ws.extras.eventing.element.EndpointReference;
-import org.jboss.ws.soap.SOAPConnectionImpl;
import org.w3c.dom.Element;
import javax.xml.soap.MessageFactory;
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/eventing/mgmt/SubscriptionManagerFactory.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/eventing/mgmt/SubscriptionManagerFactory.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/eventing/mgmt/SubscriptionManagerFactory.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -2,7 +2,7 @@
import org.jboss.kernel.spi.registry.KernelRegistry;
import org.jboss.kernel.spi.registry.KernelRegistryEntry;
-import org.jboss.ws.server.KernelLocator;
+import org.jboss.ws.core.server.KernelLocator;
/**
* @author Heiko Braun, <heiko(a)openj.net>
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/security/WSSecurityDispatcher.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/security/WSSecurityDispatcher.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/security/WSSecurityDispatcher.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -36,6 +36,7 @@
import org.jboss.ws.utils.DOMWriter;
import org.jboss.ws.WSException;
import org.jboss.ws.core.CommonMessageContext;
+import org.jboss.ws.core.soap.SOAPMessageImpl;
import org.jboss.ws.jaxrpc.StubExt;
import org.jboss.ws.metadata.umdm.EndpointMetaData;
import org.jboss.ws.metadata.umdm.OperationMetaData;
@@ -50,7 +51,6 @@
import org.jboss.ws.metadata.wsse.Sign;
import org.jboss.ws.metadata.wsse.Timestamp;
import org.jboss.ws.metadata.wsse.WSSecurityConfiguration;
-import org.jboss.ws.soap.SOAPMessageImpl;
import org.w3c.dom.Element;
public class WSSecurityDispatcher
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/xop/CreateAttachmentVisitor.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/xop/CreateAttachmentVisitor.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/xop/CreateAttachmentVisitor.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -21,9 +21,9 @@
*/
package org.jboss.ws.extras.xop;
-import org.jboss.ws.soap.SAAJVisitor;
-import org.jboss.ws.soap.SOAPElementImpl;
-import org.jboss.ws.soap.SOAPContentElement;
+import org.jboss.ws.core.soap.SAAJVisitor;
+import org.jboss.ws.core.soap.SOAPContentElement;
+import org.jboss.ws.core.soap.SOAPElementImpl;
import java.util.Iterator;
import java.io.Writer;
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/xop/RestoreXOPElementVisitor.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/xop/RestoreXOPElementVisitor.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/xop/RestoreXOPElementVisitor.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -21,9 +21,9 @@
*/
package org.jboss.ws.extras.xop;
-import org.jboss.ws.soap.SAAJVisitor;
-import org.jboss.ws.soap.SOAPContentElement;
-import org.jboss.ws.soap.SOAPElementImpl;
+import org.jboss.ws.core.soap.SAAJVisitor;
+import org.jboss.ws.core.soap.SOAPContentElement;
+import org.jboss.ws.core.soap.SOAPElementImpl;
import java.util.Iterator;
Modified: branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/xop/XOPContext.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/xop/XOPContext.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/xop/XOPContext.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -25,13 +25,13 @@
import org.jboss.ws.Constants;
import org.jboss.ws.WSException;
import org.jboss.ws.core.CommonMessageContext;
+import org.jboss.ws.core.soap.MessageContextAssociation;
+import org.jboss.ws.core.soap.NameImpl;
+import org.jboss.ws.core.soap.SOAPElementImpl;
+import org.jboss.ws.core.soap.SOAPMessageImpl;
+import org.jboss.ws.core.soap.attachment.MimeConstants;
import org.jboss.ws.extras.xop.jaxrpc.XOPMarshallerImpl;
import org.jboss.ws.jaxrpc.StubExt;
-import org.jboss.ws.soap.MessageContextAssociation;
-import org.jboss.ws.soap.NameImpl;
-import org.jboss.ws.soap.SOAPElementImpl;
-import org.jboss.ws.soap.SOAPMessageImpl;
-import org.jboss.ws.soap.attachment.MimeConstants;
import org.jboss.ws.utils.DOMUtils;
import org.jboss.ws.utils.JavaUtils;
import org.jboss.ws.utils.MimeUtils;
@@ -52,7 +52,7 @@
* A good starting point to understand how MTOM in JBossWS works is to take a
* look at the SOAPContentElement implementation.
*
- * @see org.jboss.ws.soap.SOAPContentElement#handleMTOMTransitions()
+ * @see org.jboss.ws.core.soap.SOAPContentElement#handleMTOMTransitions()
* @see org.jboss.ws.extras.xop.jaxrpc.XOPUnmarshallerImpl
* @see XOPMarshallerImpl
*
@@ -179,8 +179,8 @@
* If we would do this lazily (i.e. upon remoting callback) the previous content-type
* would already have been written.
*
- * @see org.jboss.ws.soap.SOAPConnectionImpl#callInternal(javax.xml.soap.SOAPMessage,
Object, boolean)
- * @see org.jboss.ws.binding.soap.SOAPMessageMarshaller#write(Object,
java.io.OutputStream)
+ * @see
org.jboss.ws.core.soap.SOAPConnectionImpl#callInternal(javax.xml.soap.SOAPMessage, Object,
boolean)
+ * @see org.jboss.ws.core.binding.soap.SOAPMessageMarshaller#write(Object,
java.io.OutputStream)
*/
public static void eagerlyCreateAttachments()
{
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/xop/jaxrpc/JBossXBContentAdapter.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/xop/jaxrpc/JBossXBContentAdapter.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/xop/jaxrpc/JBossXBContentAdapter.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -24,9 +24,9 @@
import org.jboss.logging.Logger;
import org.jboss.ws.Constants;
import org.jboss.ws.WSException;
+import org.jboss.ws.core.soap.attachment.ContentHandlerRegistry;
+import org.jboss.ws.core.soap.attachment.SwapableMemoryDataSource;
import org.jboss.ws.extras.xop.XOPContext;
-import org.jboss.ws.soap.attachment.ContentHandlerRegistry;
-import org.jboss.ws.soap.attachment.SwapableMemoryDataSource;
import org.jboss.ws.utils.IOUtils;
import org.jboss.ws.utils.MimeUtils;
import org.jboss.xb.binding.sunday.marshalling.MarshallingContext;
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/xop/jaxrpc/XOPMarshallerImpl.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/xop/jaxrpc/XOPMarshallerImpl.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/xop/jaxrpc/XOPMarshallerImpl.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -24,11 +24,11 @@
import org.jboss.logging.Logger;
import org.jboss.util.NotImplementedException;
import org.jboss.ws.core.CommonMessageContext;
+import org.jboss.ws.core.soap.MessageContextAssociation;
+import org.jboss.ws.core.soap.SOAPMessageImpl;
+import org.jboss.ws.core.soap.attachment.ContentHandlerRegistry;
+import org.jboss.ws.core.soap.attachment.MimeConstants;
import org.jboss.ws.extras.xop.XOPContext;
-import org.jboss.ws.soap.MessageContextAssociation;
-import org.jboss.ws.soap.SOAPMessageImpl;
-import org.jboss.ws.soap.attachment.ContentHandlerRegistry;
-import org.jboss.ws.soap.attachment.MimeConstants;
import org.jboss.xb.binding.sunday.xop.XOPMarshaller;
import org.jboss.xb.binding.sunday.xop.XOPObject;
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/xop/jaxrpc/XOPUnmarshallerImpl.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/xop/jaxrpc/XOPUnmarshallerImpl.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/xop/jaxrpc/XOPUnmarshallerImpl.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -24,8 +24,8 @@
import org.jboss.logging.Logger;
import org.jboss.ws.Constants;
import org.jboss.ws.WSException;
+import org.jboss.ws.core.soap.attachment.ContentHandlerRegistry;
import org.jboss.ws.extras.xop.XOPContext;
-import org.jboss.ws.soap.attachment.ContentHandlerRegistry;
import org.jboss.xb.binding.sunday.xop.XOPObject;
import org.jboss.xb.binding.sunday.xop.XOPUnmarshaller;
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/jboss50/AbstractDeployer.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/jboss50/AbstractDeployer.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/jboss50/AbstractDeployer.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -28,11 +28,11 @@
import org.jboss.deployers.spi.deployer.DeploymentUnit;
import org.jboss.kernel.spi.registry.KernelRegistry;
import org.jboss.kernel.spi.registry.KernelRegistryEntry;
+import org.jboss.ws.core.server.KernelLocator;
import org.jboss.ws.deployment.AbstractServiceEndpointPublisher;
import org.jboss.ws.deployment.ServiceEndpointDeployer;
import org.jboss.ws.deployment.UnifiedDeploymentInfo;
import org.jboss.ws.deployment.UnifiedDeploymentInfo.DeploymentType;
-import org.jboss.ws.server.KernelLocator;
/**
* An abstract web service deployer
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/jboss50/AbstractJSEDeployer.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/jboss50/AbstractJSEDeployer.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/jboss50/AbstractJSEDeployer.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -43,9 +43,9 @@
import org.jboss.metadata.web.Servlet;
import org.jboss.virtual.VirtualFile;
import org.jboss.ws.WSException;
+import org.jboss.ws.core.server.ServerConfig;
+import org.jboss.ws.core.server.ServerConfigFactory;
import org.jboss.ws.deployment.UnifiedDeploymentInfo;
-import org.jboss.ws.server.ServerConfig;
-import org.jboss.ws.server.ServerConfigFactory;
import org.jboss.ws.utils.IOUtils;
/**
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/jboss50/JBossContextServlet.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/jboss50/JBossContextServlet.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/jboss50/JBossContextServlet.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -25,7 +25,7 @@
import org.jboss.logging.Logger;
import org.jboss.ws.core.CommonContextServlet;
-import org.jboss.ws.server.ServiceEndpointManagerFactory;
+import org.jboss.ws.core.server.ServiceEndpointManagerFactory;
/**
* The servlet that that is associated with context /jbossws
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/jboss50/JBossServiceEndpointServlet.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/jboss50/JBossServiceEndpointServlet.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/jboss50/JBossServiceEndpointServlet.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -29,12 +29,12 @@
import org.jboss.logging.Logger;
import org.jboss.ws.WSException;
+import org.jboss.ws.core.server.AbstractServiceEndpointServlet;
+import org.jboss.ws.core.server.ServiceEndpoint;
import org.jboss.ws.metadata.config.WSCommonConfig;
import org.jboss.ws.metadata.umdm.HandlerMetaData;
import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
import org.jboss.ws.metadata.umdm.HandlerMetaData.HandlerType;
-import org.jboss.ws.server.ServiceEndpoint;
-import org.jboss.ws.server.AbstractServiceEndpointServlet;
/**
* A servlet that is installed for every web service endpoint.
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/jboss50/PortComponentLinkServlet.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/jboss50/PortComponentLinkServlet.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/jboss50/PortComponentLinkServlet.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -34,9 +34,9 @@
import org.jboss.logging.Logger;
import org.jboss.ws.WSException;
-import org.jboss.ws.server.ServiceEndpoint;
-import org.jboss.ws.server.ServiceEndpointManager;
-import org.jboss.ws.server.ServiceEndpointManagerFactory;
+import org.jboss.ws.core.server.ServiceEndpoint;
+import org.jboss.ws.core.server.ServiceEndpointManager;
+import org.jboss.ws.core.server.ServiceEndpointManagerFactory;
/**
* A servlet that reports the serviceURL for a given service ID.
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/jboss50/ServerConfigImpl.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/jboss50/ServerConfigImpl.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/jboss50/ServerConfigImpl.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -30,7 +30,7 @@
import javax.management.ObjectName;
import org.jboss.mx.util.MBeanServerLocator;
-import org.jboss.ws.server.ServerConfig;
+import org.jboss.ws.core.server.ServerConfig;
import org.jboss.ws.utils.ObjectNameFactory;
/**
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/jboss50/ServiceEndpointGeneratorEJB.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/jboss50/ServiceEndpointGeneratorEJB.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/jboss50/ServiceEndpointGeneratorEJB.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -34,12 +34,12 @@
import org.jboss.deployers.spi.deployer.DeploymentUnit;
import org.jboss.logging.Logger;
import org.jboss.ws.WSException;
+import org.jboss.ws.core.server.ServerConfig;
+import org.jboss.ws.core.server.ServerConfigFactory;
import org.jboss.ws.metadata.umdm.EndpointMetaData;
import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
import org.jboss.ws.metadata.umdm.ServiceMetaData;
import org.jboss.ws.metadata.umdm.UnifiedMetaData;
-import org.jboss.ws.server.ServerConfig;
-import org.jboss.ws.server.ServerConfigFactory;
import org.jboss.ws.utils.DOMUtils;
import org.jboss.ws.utils.DOMWriter;
import org.w3c.dom.Element;
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/jboss50/ServiceEndpointInvokerEJB3.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/jboss50/ServiceEndpointInvokerEJB3.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/jboss50/ServiceEndpointInvokerEJB3.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -32,11 +32,11 @@
import org.jboss.ejb3.stateless.StatelessContainer;
import org.jboss.logging.Logger;
import org.jboss.ws.WSException;
-import org.jboss.ws.binding.EndpointInvocation;
+import org.jboss.ws.core.binding.EndpointInvocation;
+import org.jboss.ws.core.server.AbstractServiceEndpointInvoker;
+import org.jboss.ws.core.server.ServiceEndpointInfo;
+import org.jboss.ws.core.server.ServiceEndpointInvoker;
import org.jboss.ws.deployment.UnifiedDeploymentInfo;
-import org.jboss.ws.server.AbstractServiceEndpointInvoker;
-import org.jboss.ws.server.ServiceEndpointInfo;
-import org.jboss.ws.server.ServiceEndpointInvoker;
import org.jboss.ws.utils.ObjectNameFactory;
/**
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/jboss50/ServiceEndpointLifecycleDeployer.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/jboss50/ServiceEndpointLifecycleDeployer.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/jboss50/ServiceEndpointLifecycleDeployer.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -31,10 +31,10 @@
import org.jboss.kernel.spi.registry.KernelRegistry;
import org.jboss.kernel.spi.registry.KernelRegistryEntry;
import org.jboss.metadata.WebMetaData;
+import org.jboss.ws.core.server.KernelLocator;
import org.jboss.ws.deployment.ServiceEndpointDeployer;
import org.jboss.ws.deployment.UnifiedDeploymentInfo;
import org.jboss.ws.metadata.umdm.UnifiedMetaData;
-import org.jboss.ws.server.KernelLocator;
/**
* A deployer that starts and stops web service deployments
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/tomcat/KernelBootstrap.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/tomcat/KernelBootstrap.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/tomcat/KernelBootstrap.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -28,7 +28,7 @@
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;
+import org.jboss.ws.core.server.KernelLocator;
/**
* Bootstrap the microkernel in Tomcat
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/tomcat/ServerConfigImpl.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/tomcat/ServerConfigImpl.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/tomcat/ServerConfigImpl.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -26,7 +26,7 @@
import java.io.File;
import java.io.IOException;
-import org.jboss.ws.server.ServerConfig;
+import org.jboss.ws.core.server.ServerConfig;
/**
* Tomcat specific implementation of a ServerConfig
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/tomcat/TomcatContextServlet.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/tomcat/TomcatContextServlet.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/tomcat/TomcatContextServlet.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -38,8 +38,8 @@
import org.jboss.logging.Logger;
import org.jboss.ws.WSException;
import org.jboss.ws.core.CommonContextServlet;
-import org.jboss.ws.server.ServiceEndpointManager;
-import org.jboss.ws.server.ServiceEndpointManagerFactory;
+import org.jboss.ws.core.server.ServiceEndpointManager;
+import org.jboss.ws.core.server.ServiceEndpointManagerFactory;
/**
* The servlet that that is associated with context /jbossws
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/tomcat/TomcatServiceEndpointServlet.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/tomcat/TomcatServiceEndpointServlet.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/tomcat/TomcatServiceEndpointServlet.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -38,12 +38,12 @@
import org.jboss.kernel.spi.registry.KernelRegistryEntry;
import org.jboss.logging.Logger;
import org.jboss.ws.WSException;
+import org.jboss.ws.core.server.AbstractServiceEndpointServlet;
+import org.jboss.ws.core.server.KernelLocator;
import org.jboss.ws.deployment.JAXWSDeployment;
import org.jboss.ws.deployment.ServiceEndpointDeployer;
import org.jboss.ws.deployment.UnifiedDeploymentInfo;
import org.jboss.ws.metadata.builder.jaxrpc.JAXRPCDeployment;
-import org.jboss.ws.server.AbstractServiceEndpointServlet;
-import org.jboss.ws.server.KernelLocator;
/**
* A servlet that is installed for every web service endpoint.
Modified: branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/CallImpl.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/CallImpl.java 2006-12-06
00:32:54 UTC (rev 1560)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/CallImpl.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -46,8 +46,9 @@
import org.jboss.logging.Logger;
import org.jboss.ws.Constants;
-import org.jboss.ws.binding.UnboundHeader;
import org.jboss.ws.core.CommonClient;
+import org.jboss.ws.core.binding.UnboundHeader;
+import org.jboss.ws.core.soap.MessageContextAssociation;
import org.jboss.ws.extras.xop.XOPContext;
import org.jboss.ws.jaxrpc.handler.HandlerChainBaseImpl;
import org.jboss.ws.jaxrpc.handler.SOAPMessageContextJAXRPC;
@@ -60,7 +61,6 @@
import org.jboss.ws.metadata.umdm.TypesMetaData;
import org.jboss.ws.metadata.umdm.HandlerMetaData.HandlerType;
import org.jboss.ws.metadata.wsdl.xmlschema.JBossXSModel;
-import org.jboss.ws.soap.MessageContextAssociation;
import org.jboss.ws.utils.JavaUtils;
/** Provides support for the dynamic invocation of a service endpoint.
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/SOAP11BindingJAXRPC.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/SOAP11BindingJAXRPC.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/SOAP11BindingJAXRPC.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -26,8 +26,8 @@
import javax.xml.soap.SOAPMessage;
import org.jboss.ws.core.CommonSOAP11Binding;
+import org.jboss.ws.core.soap.SOAPFaultImpl;
import org.jboss.ws.metadata.umdm.OperationMetaData;
-import org.jboss.ws.soap.SOAPFaultImpl;
/**
* The JAXRPC SOAP11Binding
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/SOAP12BindingJAXRPC.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/SOAP12BindingJAXRPC.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/SOAP12BindingJAXRPC.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -26,8 +26,8 @@
import javax.xml.soap.SOAPMessage;
import org.jboss.ws.core.CommonSOAP12Binding;
+import org.jboss.ws.core.soap.SOAPFaultImpl;
import org.jboss.ws.metadata.umdm.OperationMetaData;
-import org.jboss.ws.soap.SOAPFaultImpl;
/**
* The JAXRPC SOAP12Binding
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/SOAPBindingJAXRPC.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/SOAPBindingJAXRPC.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/SOAPBindingJAXRPC.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -29,8 +29,8 @@
import org.jboss.logging.Logger;
import org.jboss.ws.core.CommonMessageContext;
+import org.jboss.ws.core.soap.MessageContextAssociation;
import org.jboss.ws.metadata.umdm.OperationMetaData;
-import org.jboss.ws.soap.MessageContextAssociation;
/**
* The SOAPBinding interface is an abstraction for the SOAP binding.
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/SOAPFaultHelperJAXRPC.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/SOAPFaultHelperJAXRPC.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/SOAPFaultHelperJAXRPC.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -47,20 +47,20 @@
import org.jboss.ws.utils.DOMWriter;
import org.jboss.ws.Constants;
import org.jboss.ws.WSException;
-import org.jboss.ws.binding.BindingException;
-import org.jboss.ws.binding.DeserializerSupport;
-import org.jboss.ws.binding.SerializationContext;
-import org.jboss.ws.binding.SerializerSupport;
import org.jboss.ws.core.CommonMessageContext;
+import org.jboss.ws.core.binding.BindingException;
+import org.jboss.ws.core.binding.DeserializerSupport;
+import org.jboss.ws.core.binding.SerializationContext;
+import org.jboss.ws.core.binding.SerializerSupport;
+import org.jboss.ws.core.soap.MessageContextAssociation;
+import org.jboss.ws.core.soap.MessageFactoryImpl;
+import org.jboss.ws.core.soap.NameImpl;
+import org.jboss.ws.core.soap.SOAPEnvelopeImpl;
+import org.jboss.ws.core.soap.SOAPFactoryImpl;
import org.jboss.ws.jaxrpc.encoding.DeserializerFactoryBase;
import org.jboss.ws.jaxrpc.encoding.SerializerFactoryBase;
import org.jboss.ws.metadata.umdm.FaultMetaData;
import org.jboss.ws.metadata.umdm.OperationMetaData;
-import org.jboss.ws.soap.MessageContextAssociation;
-import org.jboss.ws.soap.MessageFactoryImpl;
-import org.jboss.ws.soap.NameImpl;
-import org.jboss.ws.soap.SOAPEnvelopeImpl;
-import org.jboss.ws.soap.SOAPFactoryImpl;
import org.jboss.xb.binding.NamespaceRegistry;
import org.w3c.dom.Element;
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/SerializationContextJAXRPC.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/SerializationContextJAXRPC.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/SerializationContextJAXRPC.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -29,7 +29,8 @@
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.core.binding.SerializationContext;
+import org.jboss.ws.core.soap.MessageContextAssociation;
import org.jboss.ws.jaxrpc.handler.SOAPMessageContextJAXRPC;
import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping;
import org.jboss.ws.metadata.jaxrpcmapping.JavaXmlTypeMapping;
@@ -37,7 +38,6 @@
import org.jboss.ws.metadata.umdm.OperationMetaData;
import org.jboss.ws.metadata.umdm.ServiceMetaData;
import org.jboss.ws.metadata.umdm.TypesMetaData;
-import org.jboss.ws.soap.MessageContextAssociation;
import org.jboss.ws.utils.JavaUtils;
/**
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/ServiceObjectFactory.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/ServiceObjectFactory.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/ServiceObjectFactory.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -58,6 +58,9 @@
import org.jboss.logging.Logger;
import org.jboss.ws.Constants;
import org.jboss.ws.WSException;
+import org.jboss.ws.core.server.ServiceEndpoint;
+import org.jboss.ws.core.server.ServiceEndpointManager;
+import org.jboss.ws.core.server.ServiceEndpointManagerFactory;
import org.jboss.ws.metadata.j2ee.UnifiedPortComponentRefMetaData;
import org.jboss.ws.metadata.j2ee.UnifiedServiceRefMetaData;
import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping;
@@ -68,9 +71,6 @@
import org.jboss.ws.metadata.umdm.HandlerMetaData.HandlerInitParam;
import org.jboss.ws.metadata.umdm.HandlerMetaData.HandlerType;
import org.jboss.ws.metadata.wsse.WSSecurityConfiguration;
-import org.jboss.ws.server.ServiceEndpoint;
-import org.jboss.ws.server.ServiceEndpointManager;
-import org.jboss.ws.server.ServiceEndpointManagerFactory;
/**
* This ServiceObjectFactory reconstructs a javax.xml.rpc.Service
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/ServiceReferenceable.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/ServiceReferenceable.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/ServiceReferenceable.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -35,14 +35,14 @@
import javax.naming.Referenceable;
import javax.naming.StringRefAddr;
+import org.jboss.ws.core.server.ServiceEndpointManager;
+import org.jboss.ws.core.server.ServiceEndpointManagerFactory;
import org.jboss.ws.deployment.UnifiedDeploymentInfo;
import org.jboss.ws.metadata.j2ee.UnifiedPortComponentRefMetaData;
import org.jboss.ws.metadata.j2ee.UnifiedServiceRefMetaData;
import org.jboss.ws.metadata.j2ee.UnifiedWebMetaData;
import org.jboss.ws.metadata.wsse.WSSecurityConfiguration;
import org.jboss.ws.metadata.wsse.WSSecurityConfigurationFactory;
-import org.jboss.ws.server.ServiceEndpointManager;
-import org.jboss.ws.server.ServiceEndpointManagerFactory;
/**
* A JNDI reference to a javax.xml.rpc.Service
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/ServletEndpointContextImpl.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/ServletEndpointContextImpl.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/ServletEndpointContextImpl.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -32,8 +32,8 @@
import javax.xml.rpc.handler.MessageContext;
import javax.xml.rpc.server.ServletEndpointContext;
-import org.jboss.ws.server.EndpointContext;
-import org.jboss.ws.soap.MessageContextAssociation;
+import org.jboss.ws.core.server.EndpointContext;
+import org.jboss.ws.core.soap.MessageContextAssociation;
/**
* Implementation of <code>ServletEndpointContext</code>
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/Base64Deserializer.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/Base64Deserializer.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/Base64Deserializer.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -26,9 +26,9 @@
import javax.xml.namespace.QName;
import org.jboss.logging.Logger;
-import org.jboss.ws.binding.BindingException;
-import org.jboss.ws.binding.DeserializerSupport;
-import org.jboss.ws.binding.SerializationContext;
+import org.jboss.ws.core.binding.BindingException;
+import org.jboss.ws.core.binding.DeserializerSupport;
+import org.jboss.ws.core.binding.SerializationContext;
import org.jboss.ws.extras.xop.XOPContext;
import org.jboss.ws.extras.xop.jaxrpc.XOPUnmarshallerImpl;
import org.jboss.ws.utils.DOMUtils;
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/Base64DeserializerFactory.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/Base64DeserializerFactory.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/Base64DeserializerFactory.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -21,7 +21,7 @@
*/
package org.jboss.ws.jaxrpc.encoding;
-import org.jboss.ws.binding.DeserializerSupport;
+import org.jboss.ws.core.binding.DeserializerSupport;
// $Id$
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/Base64Serializer.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/Base64Serializer.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/Base64Serializer.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -26,9 +26,9 @@
import javax.xml.namespace.QName;
import org.jboss.logging.Logger;
-import org.jboss.ws.binding.BindingException;
-import org.jboss.ws.binding.SerializationContext;
-import org.jboss.ws.binding.SerializerSupport;
+import org.jboss.ws.core.binding.BindingException;
+import org.jboss.ws.core.binding.SerializationContext;
+import org.jboss.ws.core.binding.SerializerSupport;
import org.jboss.ws.extras.xop.XOPContext;
import org.jboss.ws.extras.xop.jaxrpc.XOPMarshallerImpl;
import org.jboss.ws.utils.JavaUtils;
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/Base64SerializerFactory.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/Base64SerializerFactory.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/Base64SerializerFactory.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -21,7 +21,7 @@
*/
package org.jboss.ws.jaxrpc.encoding;
-import org.jboss.ws.binding.SerializerSupport;
+import org.jboss.ws.core.binding.SerializerSupport;
// $Id$
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/CalendarDeserializer.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/CalendarDeserializer.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/CalendarDeserializer.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -28,9 +28,9 @@
import javax.xml.namespace.QName;
import org.jboss.logging.Logger;
-import org.jboss.ws.binding.BindingException;
-import org.jboss.ws.binding.DeserializerSupport;
-import org.jboss.ws.binding.SerializationContext;
+import org.jboss.ws.core.binding.BindingException;
+import org.jboss.ws.core.binding.DeserializerSupport;
+import org.jboss.ws.core.binding.SerializationContext;
import org.jboss.xb.binding.SimpleTypeBindings;
/**
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/CalendarDeserializerFactory.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/CalendarDeserializerFactory.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/CalendarDeserializerFactory.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -21,7 +21,7 @@
*/
package org.jboss.ws.jaxrpc.encoding;
-import org.jboss.ws.binding.DeserializerSupport;
+import org.jboss.ws.core.binding.DeserializerSupport;
// $Id$
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/CalendarSerializer.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/CalendarSerializer.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/CalendarSerializer.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -28,9 +28,9 @@
import javax.xml.namespace.QName;
import org.jboss.logging.Logger;
-import org.jboss.ws.binding.BindingException;
-import org.jboss.ws.binding.SerializationContext;
-import org.jboss.ws.binding.SerializerSupport;
+import org.jboss.ws.core.binding.BindingException;
+import org.jboss.ws.core.binding.SerializationContext;
+import org.jboss.ws.core.binding.SerializerSupport;
import org.jboss.xb.binding.NamespaceRegistry;
import org.jboss.xb.binding.SimpleTypeBindings;
import org.w3c.dom.NamedNodeMap;
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/CalendarSerializerFactory.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/CalendarSerializerFactory.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/CalendarSerializerFactory.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -21,7 +21,7 @@
*/
package org.jboss.ws.jaxrpc.encoding;
-import org.jboss.ws.binding.SerializerSupport;
+import org.jboss.ws.core.binding.SerializerSupport;
// $Id$
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/DateDeserializer.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/DateDeserializer.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/DateDeserializer.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -29,9 +29,9 @@
import javax.xml.namespace.QName;
import org.jboss.logging.Logger;
-import org.jboss.ws.binding.BindingException;
-import org.jboss.ws.binding.DeserializerSupport;
-import org.jboss.ws.binding.SerializationContext;
+import org.jboss.ws.core.binding.BindingException;
+import org.jboss.ws.core.binding.DeserializerSupport;
+import org.jboss.ws.core.binding.SerializationContext;
import org.jboss.xb.binding.SimpleTypeBindings;
/**
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/DateDeserializerFactory.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/DateDeserializerFactory.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/DateDeserializerFactory.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -21,7 +21,7 @@
*/
package org.jboss.ws.jaxrpc.encoding;
-import org.jboss.ws.binding.DeserializerSupport;
+import org.jboss.ws.core.binding.DeserializerSupport;
// $Id$
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/DateSerializer.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/DateSerializer.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/DateSerializer.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -30,9 +30,9 @@
import javax.xml.namespace.QName;
import org.jboss.logging.Logger;
-import org.jboss.ws.binding.BindingException;
-import org.jboss.ws.binding.SerializationContext;
-import org.jboss.ws.binding.SerializerSupport;
+import org.jboss.ws.core.binding.BindingException;
+import org.jboss.ws.core.binding.SerializationContext;
+import org.jboss.ws.core.binding.SerializerSupport;
import org.jboss.xb.binding.NamespaceRegistry;
import org.jboss.xb.binding.SimpleTypeBindings;
import org.w3c.dom.NamedNodeMap;
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/DateSerializerFactory.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/DateSerializerFactory.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/DateSerializerFactory.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -21,7 +21,7 @@
*/
package org.jboss.ws.jaxrpc.encoding;
-import org.jboss.ws.binding.SerializerSupport;
+import org.jboss.ws.core.binding.SerializerSupport;
// $Id$
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/DeserializerFactoryBase.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/DeserializerFactoryBase.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/DeserializerFactoryBase.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -29,8 +29,8 @@
import javax.xml.rpc.encoding.DeserializerFactory;
import org.jboss.util.NotImplementedException;
-import org.jboss.ws.binding.BindingException;
-import org.jboss.ws.binding.DeserializerSupport;
+import org.jboss.ws.core.binding.BindingException;
+import org.jboss.ws.core.binding.DeserializerSupport;
/**
* @author Thomas.Diesler(a)jboss.org
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/ElementDeserializer.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/ElementDeserializer.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/ElementDeserializer.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -27,9 +27,9 @@
import org.jboss.logging.Logger;
import org.jboss.ws.utils.DOMUtils;
-import org.jboss.ws.binding.BindingException;
-import org.jboss.ws.binding.DeserializerSupport;
-import org.jboss.ws.binding.SerializationContext;
+import org.jboss.ws.core.binding.BindingException;
+import org.jboss.ws.core.binding.DeserializerSupport;
+import org.jboss.ws.core.binding.SerializationContext;
import org.w3c.dom.Element;
/**
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/ElementDeserializerFactory.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/ElementDeserializerFactory.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/ElementDeserializerFactory.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -21,7 +21,7 @@
*/
package org.jboss.ws.jaxrpc.encoding;
-import org.jboss.ws.binding.DeserializerSupport;
+import org.jboss.ws.core.binding.DeserializerSupport;
// $Id$
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/ElementSerializer.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/ElementSerializer.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/ElementSerializer.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -27,9 +27,9 @@
import org.jboss.logging.Logger;
import org.jboss.ws.utils.DOMWriter;
-import org.jboss.ws.binding.BindingException;
-import org.jboss.ws.binding.SerializationContext;
-import org.jboss.ws.binding.SerializerSupport;
+import org.jboss.ws.core.binding.BindingException;
+import org.jboss.ws.core.binding.SerializationContext;
+import org.jboss.ws.core.binding.SerializerSupport;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/ElementSerializerFactory.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/ElementSerializerFactory.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/ElementSerializerFactory.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -21,7 +21,7 @@
*/
package org.jboss.ws.jaxrpc.encoding;
-import org.jboss.ws.binding.SerializerSupport;
+import org.jboss.ws.core.binding.SerializerSupport;
// $Id$
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/HexDeserializer.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/HexDeserializer.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/HexDeserializer.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -26,9 +26,9 @@
import javax.xml.namespace.QName;
import org.jboss.logging.Logger;
-import org.jboss.ws.binding.BindingException;
-import org.jboss.ws.binding.DeserializerSupport;
-import org.jboss.ws.binding.SerializationContext;
+import org.jboss.ws.core.binding.BindingException;
+import org.jboss.ws.core.binding.DeserializerSupport;
+import org.jboss.ws.core.binding.SerializationContext;
import org.jboss.xb.binding.SimpleTypeBindings;
/**
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/HexDeserializerFactory.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/HexDeserializerFactory.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/HexDeserializerFactory.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -21,7 +21,7 @@
*/
package org.jboss.ws.jaxrpc.encoding;
-import org.jboss.ws.binding.DeserializerSupport;
+import org.jboss.ws.core.binding.DeserializerSupport;
// $Id$
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/HexSerializer.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/HexSerializer.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/HexSerializer.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -26,9 +26,9 @@
import javax.xml.namespace.QName;
import org.jboss.logging.Logger;
-import org.jboss.ws.binding.BindingException;
-import org.jboss.ws.binding.SerializationContext;
-import org.jboss.ws.binding.SerializerSupport;
+import org.jboss.ws.core.binding.BindingException;
+import org.jboss.ws.core.binding.SerializationContext;
+import org.jboss.ws.core.binding.SerializerSupport;
import org.jboss.ws.utils.JavaUtils;
import org.jboss.xb.binding.NamespaceRegistry;
import org.jboss.xb.binding.SimpleTypeBindings;
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/HexSerializerFactory.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/HexSerializerFactory.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/HexSerializerFactory.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -21,7 +21,7 @@
*/
package org.jboss.ws.jaxrpc.encoding;
-import org.jboss.ws.binding.SerializerSupport;
+import org.jboss.ws.core.binding.SerializerSupport;
// $Id$
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/NullValueSerializer.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/NullValueSerializer.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/NullValueSerializer.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -27,9 +27,9 @@
import org.jboss.logging.Logger;
import org.jboss.ws.Constants;
-import org.jboss.ws.binding.BindingException;
-import org.jboss.ws.binding.SerializationContext;
-import org.jboss.ws.binding.SerializerSupport;
+import org.jboss.ws.core.binding.BindingException;
+import org.jboss.ws.core.binding.SerializationContext;
+import org.jboss.ws.core.binding.SerializerSupport;
import org.jboss.xb.binding.NamespaceRegistry;
import org.w3c.dom.NamedNodeMap;
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/QNameDeserializer.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/QNameDeserializer.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/QNameDeserializer.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -29,9 +29,9 @@
import org.jboss.logging.Logger;
import org.jboss.ws.utils.DOMUtils;
-import org.jboss.ws.binding.BindingException;
-import org.jboss.ws.binding.DeserializerSupport;
-import org.jboss.ws.binding.SerializationContext;
+import org.jboss.ws.core.binding.BindingException;
+import org.jboss.ws.core.binding.DeserializerSupport;
+import org.jboss.ws.core.binding.SerializationContext;
import org.jboss.xb.binding.NamespaceRegistry;
import org.jboss.xb.binding.SimpleTypeBindings;
import org.w3c.dom.Element;
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/QNameDeserializerFactory.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/QNameDeserializerFactory.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/QNameDeserializerFactory.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -21,7 +21,7 @@
*/
package org.jboss.ws.jaxrpc.encoding;
-import org.jboss.ws.binding.DeserializerSupport;
+import org.jboss.ws.core.binding.DeserializerSupport;
// $Id$
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/QNameSerializer.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/QNameSerializer.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/QNameSerializer.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -26,9 +26,9 @@
import javax.xml.namespace.QName;
import org.jboss.logging.Logger;
-import org.jboss.ws.binding.BindingException;
-import org.jboss.ws.binding.SerializationContext;
-import org.jboss.ws.binding.SerializerSupport;
+import org.jboss.ws.core.binding.BindingException;
+import org.jboss.ws.core.binding.SerializationContext;
+import org.jboss.ws.core.binding.SerializerSupport;
import org.jboss.xb.binding.NamespaceRegistry;
import org.jboss.xb.binding.SimpleTypeBindings;
import org.w3c.dom.NamedNodeMap;
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/QNameSerializerFactory.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/QNameSerializerFactory.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/QNameSerializerFactory.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -21,7 +21,7 @@
*/
package org.jboss.ws.jaxrpc.encoding;
-import org.jboss.ws.binding.SerializerSupport;
+import org.jboss.ws.core.binding.SerializerSupport;
// $Id$
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/SOAPArrayDeserializer.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/SOAPArrayDeserializer.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/SOAPArrayDeserializer.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -35,9 +35,9 @@
import org.jboss.ws.utils.DOMWriter;
import org.jboss.ws.Constants;
import org.jboss.ws.WSException;
-import org.jboss.ws.binding.BindingException;
-import org.jboss.ws.binding.DeserializerSupport;
-import org.jboss.ws.binding.SerializationContext;
+import org.jboss.ws.core.binding.BindingException;
+import org.jboss.ws.core.binding.DeserializerSupport;
+import org.jboss.ws.core.binding.SerializationContext;
import org.jboss.ws.jaxrpc.TypeMappingImpl;
import org.jboss.ws.metadata.umdm.ParameterMetaData;
import org.jboss.ws.utils.JavaUtils;
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/SOAPArrayDeserializerFactory.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/SOAPArrayDeserializerFactory.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/SOAPArrayDeserializerFactory.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -21,8 +21,8 @@
*/
package org.jboss.ws.jaxrpc.encoding;
-import org.jboss.ws.binding.BindingException;
-import org.jboss.ws.binding.DeserializerSupport;
+import org.jboss.ws.core.binding.BindingException;
+import org.jboss.ws.core.binding.DeserializerSupport;
// $Id$
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/SOAPArraySerializer.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/SOAPArraySerializer.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/SOAPArraySerializer.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -28,9 +28,9 @@
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.binding.SerializationContext;
-import org.jboss.ws.binding.SerializerSupport;
+import org.jboss.ws.core.binding.BindingException;
+import org.jboss.ws.core.binding.SerializationContext;
+import org.jboss.ws.core.binding.SerializerSupport;
import org.jboss.ws.jaxrpc.TypeMappingImpl;
import org.jboss.ws.metadata.umdm.ParameterMetaData;
import org.jboss.ws.utils.JavaUtils;
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/SOAPArraySerializerFactory.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/SOAPArraySerializerFactory.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/SOAPArraySerializerFactory.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -21,8 +21,8 @@
*/
package org.jboss.ws.jaxrpc.encoding;
-import org.jboss.ws.binding.BindingException;
-import org.jboss.ws.binding.SerializerSupport;
+import org.jboss.ws.core.binding.BindingException;
+import org.jboss.ws.core.binding.SerializerSupport;
// $Id$
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/SOAPElementDeserializer.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/SOAPElementDeserializer.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/SOAPElementDeserializer.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -27,11 +27,11 @@
import org.jboss.logging.Logger;
import org.jboss.ws.utils.DOMUtils;
-import org.jboss.ws.binding.BindingException;
-import org.jboss.ws.binding.DeserializerSupport;
-import org.jboss.ws.binding.SerializationContext;
-import org.jboss.ws.soap.SOAPElementImpl;
-import org.jboss.ws.soap.SOAPFactoryImpl;
+import org.jboss.ws.core.binding.BindingException;
+import org.jboss.ws.core.binding.DeserializerSupport;
+import org.jboss.ws.core.binding.SerializationContext;
+import org.jboss.ws.core.soap.SOAPElementImpl;
+import org.jboss.ws.core.soap.SOAPFactoryImpl;
import org.w3c.dom.Element;
/**
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/SOAPElementDeserializerFactory.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/SOAPElementDeserializerFactory.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/SOAPElementDeserializerFactory.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -21,7 +21,7 @@
*/
package org.jboss.ws.jaxrpc.encoding;
-import org.jboss.ws.binding.DeserializerSupport;
+import org.jboss.ws.core.binding.DeserializerSupport;
// $Id$
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/SOAPElementSerializer.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/SOAPElementSerializer.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/SOAPElementSerializer.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -28,9 +28,9 @@
import org.jboss.logging.Logger;
import org.jboss.ws.utils.DOMWriter;
-import org.jboss.ws.binding.BindingException;
-import org.jboss.ws.binding.SerializationContext;
-import org.jboss.ws.binding.SerializerSupport;
+import org.jboss.ws.core.binding.BindingException;
+import org.jboss.ws.core.binding.SerializationContext;
+import org.jboss.ws.core.binding.SerializerSupport;
import org.w3c.dom.NamedNodeMap;
/**
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/SOAPElementSerializerFactory.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/SOAPElementSerializerFactory.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/SOAPElementSerializerFactory.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -21,7 +21,7 @@
*/
package org.jboss.ws.jaxrpc.encoding;
-import org.jboss.ws.binding.SerializerSupport;
+import org.jboss.ws.core.binding.SerializerSupport;
// $Id$
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/SerializerFactoryBase.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/SerializerFactoryBase.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/SerializerFactoryBase.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -29,8 +29,8 @@
import javax.xml.rpc.encoding.SerializerFactory;
import org.jboss.util.NotImplementedException;
-import org.jboss.ws.binding.BindingException;
-import org.jboss.ws.binding.SerializerSupport;
+import org.jboss.ws.core.binding.BindingException;
+import org.jboss.ws.core.binding.SerializerSupport;
/**
* @author Thomas.Diesler(a)jboss.org
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/SimpleDeserializer.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/SimpleDeserializer.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/SimpleDeserializer.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -24,9 +24,9 @@
// $Id$
import org.jboss.logging.Logger;
-import org.jboss.ws.binding.BindingException;
-import org.jboss.ws.binding.DeserializerSupport;
-import org.jboss.ws.binding.SerializationContext;
+import org.jboss.ws.core.binding.BindingException;
+import org.jboss.ws.core.binding.DeserializerSupport;
+import org.jboss.ws.core.binding.SerializationContext;
import org.jboss.xb.binding.SimpleTypeBindings;
import javax.xml.namespace.QName;
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/SimpleDeserializerFactory.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/SimpleDeserializerFactory.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/SimpleDeserializerFactory.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -21,7 +21,7 @@
*/
package org.jboss.ws.jaxrpc.encoding;
-import org.jboss.ws.binding.DeserializerSupport;
+import org.jboss.ws.core.binding.DeserializerSupport;
// $Id$
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/SimpleSerializer.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/SimpleSerializer.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/SimpleSerializer.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -27,9 +27,9 @@
import org.jboss.logging.Logger;
import org.jboss.util.NotImplementedException;
-import org.jboss.ws.binding.BindingException;
-import org.jboss.ws.binding.SerializationContext;
-import org.jboss.ws.binding.SerializerSupport;
+import org.jboss.ws.core.binding.BindingException;
+import org.jboss.ws.core.binding.SerializationContext;
+import org.jboss.ws.core.binding.SerializerSupport;
import org.jboss.xb.binding.NamespaceRegistry;
import org.jboss.xb.binding.SimpleTypeBindings;
import org.w3c.dom.NamedNodeMap;
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/SimpleSerializerFactory.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/SimpleSerializerFactory.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/SimpleSerializerFactory.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -21,7 +21,7 @@
*/
package org.jboss.ws.jaxrpc.encoding;
-import org.jboss.ws.binding.SerializerSupport;
+import org.jboss.ws.core.binding.SerializerSupport;
// $Id$
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/handler/HandlerChainBaseImpl.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/handler/HandlerChainBaseImpl.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/handler/HandlerChainBaseImpl.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -49,14 +49,14 @@
import org.jboss.logging.Logger;
import org.jboss.ws.Constants;
import org.jboss.ws.core.CommonMessageContext;
+import org.jboss.ws.core.soap.SOAPElementImpl;
+import org.jboss.ws.core.soap.SOAPElementWriter;
+import org.jboss.ws.core.soap.SOAPEnvelopeImpl;
+import org.jboss.ws.core.soap.SOAPMessageImpl;
import org.jboss.ws.metadata.umdm.EndpointMetaData;
import org.jboss.ws.metadata.umdm.OperationMetaData;
import org.jboss.ws.metadata.umdm.ParameterMetaData;
import org.jboss.ws.metadata.umdm.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
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/handler/HandlerDelegateJAXRPC.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/handler/HandlerDelegateJAXRPC.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/handler/HandlerDelegateJAXRPC.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -34,15 +34,15 @@
import javax.xml.rpc.handler.HandlerInfo;
import org.jboss.logging.Logger;
+import org.jboss.ws.core.server.HandlerDelegate;
+import org.jboss.ws.core.server.ServiceEndpointInfo;
+import org.jboss.ws.core.soap.MessageContextAssociation;
import org.jboss.ws.extras.xop.XOPContext;
import org.jboss.ws.metadata.umdm.HandlerMetaData;
import org.jboss.ws.metadata.umdm.HandlerMetaDataJAXRPC;
import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
import org.jboss.ws.metadata.umdm.HandlerMetaData.HandlerInitParam;
import org.jboss.ws.metadata.umdm.HandlerMetaData.HandlerType;
-import org.jboss.ws.server.HandlerDelegate;
-import org.jboss.ws.server.ServiceEndpointInfo;
-import org.jboss.ws.soap.MessageContextAssociation;
/** Delegates to JAXRPC handlers
*
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/handler/MessageContextJAXRPC.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/handler/MessageContextJAXRPC.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/handler/MessageContextJAXRPC.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -26,8 +26,8 @@
import javax.xml.rpc.handler.MessageContext;
import javax.xml.soap.SOAPMessage;
-import org.jboss.ws.binding.SerializationContext;
import org.jboss.ws.core.CommonMessageContext;
+import org.jboss.ws.core.binding.SerializationContext;
import org.jboss.ws.jaxrpc.SerializationContextJAXRPC;
import org.jboss.ws.metadata.umdm.EndpointMetaData;
import org.jboss.ws.metadata.umdm.ServiceMetaData;
Modified: branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/JAXBDeserializer.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/JAXBDeserializer.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/JAXBDeserializer.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -33,9 +33,9 @@
import javax.xml.ws.WebServiceException;
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.core.binding.BindingException;
+import org.jboss.ws.core.binding.ComplexTypeDeserializer;
+import org.jboss.ws.core.binding.SerializationContext;
import org.jboss.ws.extras.xop.jaxws.AttachmentUnmarshallerImpl;
import org.jboss.ws.jaxrpc.TypeMappingImpl;
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/JAXBDeserializerFactory.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/JAXBDeserializerFactory.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/JAXBDeserializerFactory.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -21,8 +21,8 @@
*/
package org.jboss.ws.jaxws;
-import org.jboss.ws.binding.BindingException;
-import org.jboss.ws.binding.DeserializerSupport;
+import org.jboss.ws.core.binding.BindingException;
+import org.jboss.ws.core.binding.DeserializerSupport;
import org.jboss.ws.jaxrpc.encoding.DeserializerFactoryBase;
// $Id$
Modified: branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/JAXBSerializer.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/JAXBSerializer.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/JAXBSerializer.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -32,9 +32,9 @@
import javax.xml.ws.WebServiceException;
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.core.binding.BindingException;
+import org.jboss.ws.core.binding.ComplexTypeSerializer;
+import org.jboss.ws.core.binding.SerializationContext;
import org.jboss.ws.extras.xop.jaxws.AttachmentMarshallerImpl;
import org.jboss.ws.jaxrpc.TypeMappingImpl;
import org.w3c.dom.NamedNodeMap;
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/JAXBSerializerFactory.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/JAXBSerializerFactory.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/JAXBSerializerFactory.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -21,8 +21,8 @@
*/
package org.jboss.ws.jaxws;
-import org.jboss.ws.binding.BindingException;
-import org.jboss.ws.binding.SerializerSupport;
+import org.jboss.ws.core.binding.BindingException;
+import org.jboss.ws.core.binding.SerializerSupport;
import org.jboss.ws.jaxrpc.encoding.SerializerFactoryBase;
// $Id$
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/SerializationContextJAXWS.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/SerializationContextJAXWS.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/SerializationContextJAXWS.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -24,7 +24,7 @@
// $Id$
import org.jboss.logging.Logger;
-import org.jboss.ws.binding.SerializationContext;
+import org.jboss.ws.core.binding.SerializationContext;
/**
* The serialization context for JAXWS endpoints/clients
Modified: branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/client/ClientImpl.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/client/ClientImpl.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/client/ClientImpl.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -43,6 +43,7 @@
import org.jboss.ws.core.CommonBindingProvider;
import org.jboss.ws.core.CommonClient;
import org.jboss.ws.core.CommonMessageContext;
+import org.jboss.ws.core.soap.MessageContextAssociation;
import org.jboss.ws.jaxws.core.BindingExt;
import org.jboss.ws.jaxws.core.BindingProviderImpl;
import org.jboss.ws.jaxws.handler.HandlerChainExecutor;
@@ -52,7 +53,6 @@
import org.jboss.ws.metadata.umdm.EndpointMetaData;
import org.jboss.ws.metadata.umdm.OperationMetaData;
import org.jboss.ws.metadata.umdm.HandlerMetaData.HandlerType;
-import org.jboss.ws.soap.MessageContextAssociation;
/**
* Provides support for the dynamic invocation of a service endpoint.
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/client/DispatchImpl.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/client/DispatchImpl.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/client/DispatchImpl.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -51,10 +51,10 @@
import javax.xml.ws.Service.Mode;
import org.jboss.logging.Logger;
+import org.jboss.ws.core.soap.SOAPBodyImpl;
+import org.jboss.ws.core.soap.SOAPConnectionImpl;
import org.jboss.ws.jaxws.core.BindingProviderImpl;
import org.jboss.ws.metadata.umdm.EndpointMetaData;
-import org.jboss.ws.soap.SOAPBodyImpl;
-import org.jboss.ws.soap.SOAPConnectionImpl;
import org.jboss.ws.utils.DOMWriter;
/**
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/core/HTTPBindingJAXWS.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/core/HTTPBindingJAXWS.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/core/HTTPBindingJAXWS.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -31,10 +31,10 @@
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.core.CommonBinding;
+import org.jboss.ws.core.binding.BindingException;
+import org.jboss.ws.core.binding.EndpointInvocation;
+import org.jboss.ws.core.binding.UnboundHeader;
import org.jboss.ws.metadata.umdm.OperationMetaData;
import org.jboss.ws.metadata.umdm.HandlerMetaData.HandlerType;
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/core/MessageBinding.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/core/MessageBinding.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/core/MessageBinding.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -33,15 +33,15 @@
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.binding.EndpointInvocation;
-import org.jboss.ws.binding.UnboundHeader;
import org.jboss.ws.core.CommonBinding;
+import org.jboss.ws.core.binding.BindingException;
+import org.jboss.ws.core.binding.EndpointInvocation;
+import org.jboss.ws.core.binding.UnboundHeader;
+import org.jboss.ws.core.soap.MessageContextAssociation;
import org.jboss.ws.jaxws.handler.SOAPMessageContextJAXWS;
import org.jboss.ws.metadata.umdm.OperationMetaData;
import org.jboss.ws.metadata.umdm.ParameterMetaData;
import org.jboss.ws.metadata.umdm.HandlerMetaData.HandlerType;
-import org.jboss.ws.soap.MessageContextAssociation;
/** A binding for unprocessed SOAP Messages
*
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/core/PayloadBinding.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/core/PayloadBinding.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/core/PayloadBinding.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -35,18 +35,18 @@
import org.jboss.util.NotImplementedException;
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.core.CommonBinding;
+import org.jboss.ws.core.binding.BindingException;
+import org.jboss.ws.core.binding.EndpointInvocation;
+import org.jboss.ws.core.binding.UnboundHeader;
+import org.jboss.ws.core.soap.MessageContextAssociation;
+import org.jboss.ws.core.soap.MessageFactoryImpl;
+import org.jboss.ws.core.soap.SOAPBodyImpl;
+import org.jboss.ws.core.soap.SOAPMessageImpl;
import org.jboss.ws.jaxws.handler.SOAPMessageContextJAXWS;
import org.jboss.ws.metadata.umdm.OperationMetaData;
import org.jboss.ws.metadata.umdm.ParameterMetaData;
import org.jboss.ws.metadata.umdm.HandlerMetaData.HandlerType;
-import org.jboss.ws.soap.MessageContextAssociation;
-import org.jboss.ws.soap.MessageFactoryImpl;
-import org.jboss.ws.soap.SOAPBodyImpl;
-import org.jboss.ws.soap.SOAPMessageImpl;
/** A BindingProvider for a JAXWS payload
*
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/core/SOAP11BindingJAXWS.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/core/SOAP11BindingJAXWS.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/core/SOAP11BindingJAXWS.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -34,9 +34,9 @@
import org.jboss.ws.Constants;
import org.jboss.ws.core.CommonSOAP11Binding;
+import org.jboss.ws.core.soap.SOAPFaultImpl;
import org.jboss.ws.metadata.umdm.OperationMetaData;
import org.jboss.ws.metadata.umdm.HandlerMetaData.HandlerType;
-import org.jboss.ws.soap.SOAPFaultImpl;
/**
* The JAXWS SOAP11Binding
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/core/SOAP12BindingJAXWS.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/core/SOAP12BindingJAXWS.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/core/SOAP12BindingJAXWS.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -35,9 +35,9 @@
import org.jboss.ws.Constants;
import org.jboss.ws.core.CommonSOAP12Binding;
+import org.jboss.ws.core.soap.SOAPFaultImpl;
import org.jboss.ws.metadata.umdm.OperationMetaData;
import org.jboss.ws.metadata.umdm.HandlerMetaData.HandlerType;
-import org.jboss.ws.soap.SOAPFaultImpl;
/**
* The SOAP11Binding
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/core/SOAPBindingJAXWS.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/core/SOAPBindingJAXWS.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/core/SOAPBindingJAXWS.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -33,8 +33,8 @@
import org.jboss.logging.Logger;
import org.jboss.ws.core.CommonMessageContext;
+import org.jboss.ws.core.soap.MessageContextAssociation;
import org.jboss.ws.metadata.umdm.OperationMetaData;
-import org.jboss.ws.soap.MessageContextAssociation;
/**
* The SOAPBinding interface is an abstraction for the SOAP binding.
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/core/SOAPFaultHelperJAXWS.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/core/SOAPFaultHelperJAXWS.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/core/SOAPFaultHelperJAXWS.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -39,19 +39,19 @@
import org.jboss.logging.Logger;
import org.jboss.ws.Constants;
-import org.jboss.ws.binding.BindingException;
-import org.jboss.ws.binding.DeserializerSupport;
-import org.jboss.ws.binding.SerializationContext;
-import org.jboss.ws.binding.SerializerSupport;
import org.jboss.ws.core.CommonMessageContext;
+import org.jboss.ws.core.binding.BindingException;
+import org.jboss.ws.core.binding.DeserializerSupport;
+import org.jboss.ws.core.binding.SerializationContext;
+import org.jboss.ws.core.binding.SerializerSupport;
+import org.jboss.ws.core.soap.MessageContextAssociation;
+import org.jboss.ws.core.soap.NameImpl;
+import org.jboss.ws.core.soap.SOAPFactoryImpl;
import org.jboss.ws.jaxrpc.SOAPFaultHelperJAXRPC;
import org.jboss.ws.jaxrpc.encoding.DeserializerFactoryBase;
import org.jboss.ws.jaxrpc.encoding.SerializerFactoryBase;
import org.jboss.ws.metadata.umdm.FaultMetaData;
import org.jboss.ws.metadata.umdm.OperationMetaData;
-import org.jboss.ws.soap.MessageContextAssociation;
-import org.jboss.ws.soap.NameImpl;
-import org.jboss.ws.soap.SOAPFactoryImpl;
import org.jboss.ws.utils.DOMUtils;
import org.jboss.ws.utils.DOMWriter;
import org.w3c.dom.Element;
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/handler/HandlerChainExecutor.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/handler/HandlerChainExecutor.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/handler/HandlerChainExecutor.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -35,9 +35,9 @@
import org.jboss.logging.Logger;
import org.jboss.ws.core.CommonMessageContext;
+import org.jboss.ws.core.soap.SOAPEnvelopeImpl;
import org.jboss.ws.jaxrpc.Style;
import org.jboss.ws.metadata.umdm.EndpointMetaData;
-import org.jboss.ws.soap.SOAPEnvelopeImpl;
import org.jboss.ws.utils.DOMWriter;
/**
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/handler/HandlerDelegateJAXWS.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/handler/HandlerDelegateJAXWS.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/handler/HandlerDelegateJAXWS.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -31,12 +31,12 @@
import javax.xml.ws.handler.PortInfo;
import org.jboss.logging.Logger;
+import org.jboss.ws.core.server.HandlerDelegate;
+import org.jboss.ws.core.server.ServiceEndpointInfo;
+import org.jboss.ws.core.soap.MessageContextAssociation;
import org.jboss.ws.metadata.umdm.EndpointMetaData;
import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
import org.jboss.ws.metadata.umdm.HandlerMetaData.HandlerType;
-import org.jboss.ws.server.HandlerDelegate;
-import org.jboss.ws.server.ServiceEndpointInfo;
-import org.jboss.ws.soap.MessageContextAssociation;
/** Delegates to JAXWS handlers
*
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/handler/LogicalMessageImpl.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/handler/LogicalMessageImpl.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/handler/LogicalMessageImpl.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -35,8 +35,8 @@
import javax.xml.ws.LogicalMessage;
import javax.xml.ws.WebServiceException;
-import org.jboss.ws.soap.SOAPBodyImpl;
-import org.jboss.ws.soap.SOAPContentElement;
+import org.jboss.ws.core.soap.SOAPBodyImpl;
+import org.jboss.ws.core.soap.SOAPContentElement;
/**
* The LogicalMessageContext interface extends MessageContext to provide access to a the
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/handler/MessageContextJAXWS.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/handler/MessageContextJAXWS.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/handler/MessageContextJAXWS.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -30,8 +30,8 @@
import javax.xml.ws.handler.MessageContext;
-import org.jboss.ws.binding.SerializationContext;
import org.jboss.ws.core.CommonMessageContext;
+import org.jboss.ws.core.binding.SerializationContext;
import org.jboss.ws.jaxws.SerializationContextJAXWS;
import org.jboss.ws.metadata.umdm.EndpointMetaData;
import org.jboss.ws.metadata.umdm.ServiceMetaData;
Modified: branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/spi/EndpointImpl.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/spi/EndpointImpl.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/spi/EndpointImpl.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -40,9 +40,9 @@
import org.jboss.logging.Logger;
import org.jboss.util.NotImplementedException;
+import org.jboss.ws.core.server.HttpContext;
+import org.jboss.ws.core.server.HttpServer;
import org.jboss.ws.jaxws.core.BindingProviderImpl;
-import org.jboss.ws.server.HttpContext;
-import org.jboss.ws.server.HttpServer;
/**
* A Web service endpoint implementation.
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jbossxb/JBossXBDeserializer.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jbossxb/JBossXBDeserializer.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jbossxb/JBossXBDeserializer.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -29,9 +29,9 @@
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.core.binding.BindingException;
+import org.jboss.ws.core.binding.ComplexTypeDeserializer;
+import org.jboss.ws.core.binding.SerializationContext;
import org.jboss.ws.jaxrpc.SerializationContextJAXRPC;
import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping;
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jbossxb/JBossXBDeserializerFactory.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jbossxb/JBossXBDeserializerFactory.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jbossxb/JBossXBDeserializerFactory.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -21,8 +21,8 @@
*/
package org.jboss.ws.jbossxb;
-import org.jboss.ws.binding.BindingException;
-import org.jboss.ws.binding.DeserializerSupport;
+import org.jboss.ws.core.binding.BindingException;
+import org.jboss.ws.core.binding.DeserializerSupport;
import org.jboss.ws.jaxrpc.encoding.DeserializerFactoryBase;
// $Id$
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jbossxb/JBossXBSerializer.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jbossxb/JBossXBSerializer.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jbossxb/JBossXBSerializer.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -25,9 +25,9 @@
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.core.binding.BindingException;
+import org.jboss.ws.core.binding.ComplexTypeSerializer;
+import org.jboss.ws.core.binding.SerializationContext;
import org.jboss.ws.jaxrpc.SerializationContextJAXRPC;
import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping;
import org.w3c.dom.NamedNodeMap;
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jbossxb/JBossXBSerializerFactory.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jbossxb/JBossXBSerializerFactory.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jbossxb/JBossXBSerializerFactory.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -21,8 +21,8 @@
*/
package org.jboss.ws.jbossxb;
-import org.jboss.ws.binding.BindingException;
-import org.jboss.ws.binding.SerializerSupport;
+import org.jboss.ws.core.binding.BindingException;
+import org.jboss.ws.core.binding.SerializerSupport;
import org.jboss.ws.jaxrpc.encoding.SerializerFactoryBase;
// $Id$
Modified: branches/tdiesler/trunk/src/main/java/org/jboss/ws/jbossxb/JBossXBSupport.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jbossxb/JBossXBSupport.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jbossxb/JBossXBSupport.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -5,12 +5,12 @@
import javax.xml.namespace.QName;
import org.jboss.ws.core.CommonMessageContext;
+import org.jboss.ws.core.soap.MessageContextAssociation;
import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping;
import org.jboss.ws.metadata.umdm.EndpointMetaData;
import org.jboss.ws.metadata.umdm.OperationMetaData;
import org.jboss.ws.metadata.umdm.ServiceMetaData;
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;
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/builder/MetaDataBuilder.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/builder/MetaDataBuilder.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/builder/MetaDataBuilder.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -46,6 +46,8 @@
import org.jboss.ws.Constants;
import org.jboss.ws.WSException;
import org.jboss.ws.core.CommonSOAPBinding;
+import org.jboss.ws.core.server.ServiceEndpointManager;
+import org.jboss.ws.core.server.ServiceEndpointManagerFactory;
import org.jboss.ws.deployment.UnifiedDeploymentInfo;
import org.jboss.ws.jaxrpc.Use;
import org.jboss.ws.metadata.j2ee.UnifiedApplicationMetaData;
@@ -67,8 +69,6 @@
import org.jboss.ws.metadata.wsdl.WSDLService;
import org.jboss.ws.metadata.wsse.WSSecurityConfiguration;
import org.jboss.ws.metadata.wsse.WSSecurityConfigurationFactory;
-import org.jboss.ws.server.ServiceEndpointManager;
-import org.jboss.ws.server.ServiceEndpointManagerFactory;
import org.jboss.ws.utils.ObjectNameFactory;
import org.w3c.dom.Element;
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/umdm/ServerEndpointMetaData.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/umdm/ServerEndpointMetaData.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/umdm/ServerEndpointMetaData.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -31,12 +31,12 @@
import org.jboss.logging.Logger;
import org.jboss.ws.WSException;
+import org.jboss.ws.core.server.ServiceEndpoint;
import org.jboss.ws.metadata.config.WSCommonConfig;
import org.jboss.ws.metadata.config.WSConfigFactory;
import org.jboss.ws.metadata.config.jaxrpc.WSConfigRootJAXRPC;
import org.jboss.ws.metadata.config.jaxws.WSConfigRootJAXWS;
import org.jboss.ws.metadata.umdm.HandlerMetaData.HandlerType;
-import org.jboss.ws.server.ServiceEndpoint;
/**
* Client side endpoint meta data.
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/umdm/UnifiedMetaData.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/umdm/UnifiedMetaData.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/umdm/UnifiedMetaData.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -30,9 +30,9 @@
import java.util.StringTokenizer;
import org.jboss.logging.Logger;
+import org.jboss.ws.core.server.ServiceEndpointManager;
import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping;
import org.jboss.ws.metadata.wsdl.WSDLDefinitions;
-import org.jboss.ws.server.ServiceEndpointManager;
/**
* The top level meta data.
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/xsd/SchemaUtils.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/xsd/SchemaUtils.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/xsd/SchemaUtils.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -49,14 +49,14 @@
import org.apache.xerces.xs.XSTypeDefinition;
import org.jboss.ws.Constants;
import org.jboss.ws.WSException;
+import org.jboss.ws.core.server.ServerConfig;
+import org.jboss.ws.core.server.ServerConfigFactory;
import org.jboss.ws.metadata.wsdl.xmlschema.JBossXSComplexTypeDefinition;
import org.jboss.ws.metadata.wsdl.xmlschema.JBossXSElementDeclaration;
import org.jboss.ws.metadata.wsdl.xmlschema.JBossXSErrorHandler;
import org.jboss.ws.metadata.wsdl.xmlschema.JBossXSSimpleTypeDefinition;
import org.jboss.ws.metadata.wsdl.xmlschema.JBossXSStringList;
import org.jboss.ws.metadata.wsdl.xmlschema.JBossXSTypeDefinition;
-import org.jboss.ws.server.ServerConfig;
-import org.jboss.ws.server.ServerConfigFactory;
/**
* Util class that deals with XML Schema
Deleted: branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/AttrImpl.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/AttrImpl.java 2006-12-06
00:32:54 UTC (rev 1560)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/AttrImpl.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -1,85 +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 org.w3c.dom.Attr;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.TypeInfo;
-
-/**
- * Facade for DOM Attr. Helps ensure that the propper SAAJ entities are returned
- * after DOM calls are made.
- *
- * @author <a href="mailto:jason.greene@jboss.com">Jason T.
Greene</a>
- * @version $Revision$
- */
-public class AttrImpl extends NodeImpl implements Attr
-{
- private SOAPElementImpl element;
-
- private Attr attr;
-
- public AttrImpl(SOAPElementImpl element, Attr attr)
- {
- super(attr);
- this.attr = attr;
- this.element = element;
- }
-
- public String getName()
- {
- return attr.getName();
- }
-
- public Element getOwnerElement()
- {
- return element;
- }
-
- public Document getOwnerDocument()
- {
- return element.getOwnerDocument();
- }
-
- public boolean getSpecified()
- {
- return attr.getSpecified();
- }
-
- public String getValue()
- {
- return attr.getValue();
- }
-
- public TypeInfo getSchemaTypeInfo()
- {
- // TODO Implement DOM3
- return null;
- }
-
- public boolean isId()
- {
- // TODO Implement DOM3
- return false;
- }
-}
\ No newline at end of file
Deleted: branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/DetailEntryImpl.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/DetailEntryImpl.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/DetailEntryImpl.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -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.ws.soap;
-
-import javax.xml.soap.DetailEntry;
-import javax.xml.soap.Name;
-
-/**
- * The content for a Detail object, giving details for a SOAPFault object.
- * A DetailEntry object, which carries information about errors related to the SOAPBody
object that contains it,
- * is application-specific.
- *
- * @author Thomas.Diesler(a)jboss.org
- */
-public class DetailEntryImpl extends SOAPElementImpl implements DetailEntry
-{
- public DetailEntryImpl(Name name)
- {
- super(name);
- }
-
- public DetailEntryImpl(SOAPElementImpl soapElement)
- {
- super(soapElement);
- }
-}
Deleted: branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/DetailImpl.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/DetailImpl.java 2006-12-06
00:32:54 UTC (rev 1560)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/DetailImpl.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -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.soap;
-
-import java.util.Iterator;
-
-import javax.xml.soap.Detail;
-import javax.xml.soap.DetailEntry;
-import javax.xml.soap.Name;
-import javax.xml.soap.SOAPException;
-
-/**
- * A container for DetailEntry objects. DetailEntry objects give detailed error
information that is application-specific
- * and related to the SOAPBody object that contains it.
- *
- * A Detail object, which is part of a SOAPFault object, can be retrieved using the
method SOAPFault.getDetail.
- *
- * The Detail interface provides two methods. One creates a new DetailEntry object and
also automatically adds
- * it to the Detail object. The second method gets a list of the DetailEntry objects
contained in a Detail object.
- *
- * @author Thomas.Diesler(a)jboss.org
- */
-public class DetailImpl extends SOAPFaultElementImpl implements Detail
-{
- public DetailImpl()
- {
- super("detail");
- }
-
- public DetailEntry addDetailEntry(Name name) throws SOAPException
- {
- DetailEntryImpl detailEntry = new DetailEntryImpl(name);
- addChildElement(detailEntry);
- return detailEntry;
- }
-
- public Iterator getDetailEntries()
- {
- return getChildElements();
- }
-}
Deleted:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/DocumentFragmentImpl.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/DocumentFragmentImpl.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/DocumentFragmentImpl.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -1,231 +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 org.w3c.dom.DOMException;
-import org.w3c.dom.Document;
-import org.w3c.dom.DocumentFragment;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.w3c.dom.UserDataHandler;
-
-/**
- * An implementation of a DOM Document fragment. This just delegates to
- *
- * @author <a href="mailto:jason.greene@jboss.com">Jason T.
Greene</a>
- * @version $Revision$
- */
-public class DocumentFragmentImpl implements DocumentFragment
-{
- private DocumentFragment delegate;
-
- public DocumentFragmentImpl(DocumentFragment fragment)
- {
- this.delegate = fragment;
- }
-
- public Node appendChild(Node arg0) throws DOMException
- {
- return delegate.appendChild(arg0);
- }
-
- public Node cloneNode(boolean arg0)
- {
- return delegate.cloneNode(arg0);
- }
-
- public short compareDocumentPosition(Node arg0) throws DOMException
- {
- return delegate.compareDocumentPosition(arg0);
- }
-
- public NamedNodeMap getAttributes()
- {
- return delegate.getAttributes();
- }
-
- public String getBaseURI()
- {
- return delegate.getBaseURI();
- }
-
- public NodeList getChildNodes()
- {
- return delegate.getChildNodes();
- }
-
- public Object getFeature(String arg0, String arg1)
- {
- return delegate.getFeature(arg0, arg1);
- }
-
- public Node getFirstChild()
- {
- return delegate.getFirstChild();
- }
-
- public Node getLastChild()
- {
- return delegate.getLastChild();
- }
-
- public String getLocalName()
- {
- return delegate.getLocalName();
- }
-
- public String getNamespaceURI()
- {
- return delegate.getNamespaceURI();
- }
-
- public Node getNextSibling()
- {
- return delegate.getNextSibling();
- }
-
- public String getNodeName()
- {
- return delegate.getNodeName();
- }
-
- public short getNodeType()
- {
- return delegate.getNodeType();
- }
-
- public String getNodeValue() throws DOMException
- {
- return delegate.getNodeValue();
- }
-
- public Document getOwnerDocument()
- {
- return delegate.getOwnerDocument();
- }
-
- public Node getParentNode()
- {
- return delegate.getParentNode();
- }
-
- public String getPrefix()
- {
- return delegate.getPrefix();
- }
-
- public Node getPreviousSibling()
- {
- return delegate.getPreviousSibling();
- }
-
- public String getTextContent() throws DOMException
- {
- return delegate.getTextContent();
- }
-
- public Object getUserData(String arg0)
- {
- return delegate.getUserData(arg0);
- }
-
- public boolean hasAttributes()
- {
- return delegate.hasAttributes();
- }
-
- public boolean hasChildNodes()
- {
- return delegate.hasChildNodes();
- }
-
- public Node insertBefore(Node arg0, Node arg1) throws DOMException
- {
- return delegate.insertBefore(arg0, arg1);
- }
-
- public boolean isDefaultNamespace(String arg0)
- {
- return delegate.isDefaultNamespace(arg0);
- }
-
- public boolean isEqualNode(Node arg0)
- {
- return delegate.isEqualNode(arg0);
- }
-
- public boolean isSameNode(Node arg0)
- {
- return delegate.isSameNode(arg0);
- }
-
- public boolean isSupported(String arg0, String arg1)
- {
- return delegate.isSupported(arg0, arg1);
- }
-
- public String lookupNamespaceURI(String arg0)
- {
- return delegate.lookupNamespaceURI(arg0);
- }
-
- public String lookupPrefix(String arg0)
- {
- return delegate.lookupPrefix(arg0);
- }
-
- public void normalize()
- {
- delegate.normalize();
- }
-
- public Node removeChild(Node arg0) throws DOMException
- {
- return delegate.removeChild(arg0);
- }
-
- public Node replaceChild(Node arg0, Node arg1) throws DOMException
- {
- return delegate.replaceChild(arg0, arg1);
- }
-
- public void setNodeValue(String arg0) throws DOMException
- {
- delegate.setNodeValue(arg0);
- }
-
- public void setPrefix(String arg0) throws DOMException
- {
- delegate.setPrefix(arg0);
- }
-
- public void setTextContent(String arg0) throws DOMException
- {
- delegate.setTextContent(arg0);
- }
-
- public Object setUserData(String arg0, Object arg1, UserDataHandler arg2)
- {
- return delegate.setUserData(arg0, arg1, arg2);
- }
-}
Deleted: branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/EndpointInfo.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/EndpointInfo.java 2006-12-06
00:32:54 UTC (rev 1560)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/EndpointInfo.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -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.soap;
-
-// $Id$
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Properties;
-
-import org.jboss.ws.metadata.umdm.EndpointMetaData;
-
-/** A wrapper object that associates the target address with some metadata
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 20-Jul-2005
- */
-public class EndpointInfo
-{
- private String targetAddress;
- private Map<String, Object> properties;
-
- public EndpointInfo(EndpointMetaData epMetaData, String targetAddress, Map<String,
Object> callProps)
- {
- this.targetAddress = targetAddress;
- this.properties = new HashMap<String, Object>();
-
- // Add the service properties
- Properties serviceProps = epMetaData.getServiceMetaData().getProperties();
- if (serviceProps != null)
- {
- Iterator it = serviceProps.entrySet().iterator();
- while (it.hasNext())
- {
- Map.Entry entry = (Map.Entry)it.next();
- String key = (String)entry.getKey();
- Object val = entry.getValue();
- properties.put(key, val);
- }
- }
-
- // Add the endpoint properties
- Properties epProps = epMetaData.getProperties();
- if (epProps != null)
- {
- Iterator it = epProps.entrySet().iterator();
- while (it.hasNext())
- {
- Map.Entry entry = (Map.Entry)it.next();
- String key = (String)entry.getKey();
- Object val = entry.getValue();
- properties.put(key, val);
- }
- }
-
- // Add the call properties
- if (callProps != null)
- {
- properties.putAll(callProps);
- }
- }
-
- public Map<String, Object> getProperties()
- {
- return properties;
- }
-
- public String getTargetAddress()
- {
- return targetAddress;
- }
-
- public boolean equals(Object obj)
- {
- if (!(obj instanceof EndpointInfo))
- return false;
- return toString().equals(obj.toString());
- }
-
- public int hashCode()
- {
- return toString().hashCode();
- }
-
- public String toString()
- {
- return "[addr=" + targetAddress + ",props=" + properties +
"]";
- }
-}
\ No newline at end of file
Deleted: branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/JAXWSPayloadBuilder.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/JAXWSPayloadBuilder.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/JAXWSPayloadBuilder.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -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.ws.soap;
-
-//$Id$
-
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Iterator;
-
-import javax.xml.namespace.QName;
-import javax.xml.soap.Name;
-import javax.xml.soap.SOAPException;
-import javax.xml.soap.SOAPHeader;
-import javax.xml.transform.stream.StreamSource;
-
-import org.jboss.ws.utils.DOMUtils;
-import org.jboss.ws.utils.DOMWriter;
-import org.w3c.dom.Element;
-
-/**
- * A SOAPEnvelope builder for JAXWS in service mode PAYLOAD
- *
- * @author Thomas.Diesler(a)jboss.com
- * @since 30-Jun-2006
- */
-public class JAXWSPayloadBuilder implements PayloadBuilder
-{
- 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();
- 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"));
- SOAPBodyImpl soapBody = (SOAPBodyImpl)soapEnv.getBody();
-
- DOMUtils.copyAttributes(soapBody, domBody);
-
- Iterator itBody = DOMUtils.getChildElements(domBody);
- if (itBody.hasNext())
- {
- Element domBodyElement = (Element)itBody.next();
- String xmlStr = DOMWriter.printNode(domBodyElement, false);
- soapBody.setPayload(new StreamSource(new
ByteArrayInputStream(xmlStr.getBytes())));
- }
- }
-}
Deleted:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/MessageContextAssociation.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/MessageContextAssociation.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/MessageContextAssociation.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -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.ws.soap;
-
-// $Id$
-
-import java.util.Stack;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.core.CommonMessageContext;
-import org.jboss.ws.utils.ThreadLocalAssociation;
-
-/**
- * A thread local association with the current message context
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 14-Dec-2004
- */
-public class MessageContextAssociation
-{
- // provide logging
- private static Logger log = Logger.getLogger(MessageContextAssociation.class);
-
-
- public static void pushMessageContext(CommonMessageContext msgContext)
- {
- log.debug("pushMessageContext: " + msgContext + " (Thread "
+Thread.currentThread().getName()+ ")");
- Stack<CommonMessageContext> stack =
ThreadLocalAssociation.localMsgContextAssoc().get();
- if (stack == null)
- {
- stack = new Stack<CommonMessageContext>();
- ThreadLocalAssociation.localMsgContextAssoc().set(stack);
- }
- stack.push(msgContext);
- }
-
- public static CommonMessageContext peekMessageContext()
- {
- CommonMessageContext msgContext = null;
- Stack<CommonMessageContext> stack =
ThreadLocalAssociation.localMsgContextAssoc().get();
- if (stack != null && stack.isEmpty() == false)
- {
- msgContext = stack.peek();
- }
- return msgContext;
- }
-
- public static CommonMessageContext popMessageContext()
- {
- CommonMessageContext msgContext = null;
- Stack<CommonMessageContext> stack =
ThreadLocalAssociation.localMsgContextAssoc().get();
- if (stack != null && stack.isEmpty() == false)
- {
- msgContext = stack.pop();
- }
- log.debug("popMessageContext: " + msgContext +" (Thread "
+Thread.currentThread().getName()+ ")");
- return msgContext;
- }
-}
Deleted: branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/MessageFactoryImpl.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/MessageFactoryImpl.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/MessageFactoryImpl.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -1,279 +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 java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Collection;
-import java.util.Iterator;
-
-import javax.mail.internet.ContentType;
-import javax.mail.internet.ParseException;
-import javax.xml.soap.AttachmentPart;
-import javax.xml.soap.MessageFactory;
-import javax.xml.soap.MimeHeader;
-import javax.xml.soap.MimeHeaders;
-import javax.xml.soap.SOAPException;
-import javax.xml.soap.SOAPMessage;
-import javax.xml.ws.Service.Mode;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.Constants;
-import org.jboss.ws.core.CommonMessageContext;
-import org.jboss.ws.jaxrpc.Style;
-import org.jboss.ws.soap.attachment.MimeConstants;
-import org.jboss.ws.soap.attachment.MultipartRelatedDecoder;
-import org.jboss.ws.utils.IOUtils;
-
-/**
- * MessageFactory implementation
- *
- * @author Thomas.Diesler(a)jboss.org
- */
-public class MessageFactoryImpl extends MessageFactory
-{
- private static Logger log = Logger.getLogger(MessageFactoryImpl.class);
-
- // The envelope URI used by the MessageFactory
- private String envelopeURI = Constants.NS_SOAP11_ENV;
-
- // The JAXWS ServiceMode
- private Mode serviceMode;
- // The style used by this MessageFactory
- private Style style;
-
- /**
- * Get the SOAP envelope URI this factory will use when creating envelopes.
- */
- public String getEnvelopeURI()
- {
- return envelopeURI;
- }
-
- /**
- * Set the SOAP envelope URI this factory will use when creating envelopes.
- */
- public void setEnvelopeURI(String envelopeURI)
- {
- this.envelopeURI = envelopeURI;
- }
-
- /**
- * Get the Style this message factory will use
- */
- public Style getStyle()
- {
- if (style == null)
- {
- CommonMessageContext msgContext =
MessageContextAssociation.peekMessageContext();
- if (msgContext != null && msgContext.getOperationMetaData() != null)
- {
- style = msgContext.getOperationMetaData().getStyle();
- }
- log.trace("Using style: " + style);
- }
- return style;
- }
-
- public void setStyle(Style style)
- {
- this.style = style;
- }
-
- public Mode getServiceMode()
- {
- return serviceMode;
- }
-
- public void setServiceMode(Mode serviceMode)
- {
- this.serviceMode = serviceMode;
- }
-
- /**
- * Creates a new SOAPMessage object with the default SOAPPart, SOAPEnvelope,
- * SOAPBody, and SOAPHeader objects. Profile-specific message factories can
- * choose to prepopulate the SOAPMessage object with profile-specific
- * headers.
- *
- * Content can be added to this message's SOAPPart object, and the message
- * can be sent "as is" when a message containing only a SOAP part is
- * sufficient. Otherwise, the SOAPMessage object needs to create one or more
- * AttachmentPart objects and add them to itself. Any content that is not in
- * XML format must be in an AttachmentPart object.
- *
- * @return a new SOAPMessage object
- * @throws javax.xml.soap.SOAPException
- * if a SOAP error occurs
- */
- public SOAPMessage createMessage() throws SOAPException
- {
- SOAPMessageImpl soapMessage = new SOAPMessageImpl();
- SOAPPartImpl soapPart = (SOAPPartImpl)soapMessage.getSOAPPart();
- new SOAPEnvelopeImpl(soapPart, envelopeURI);
- return soapMessage;
- }
-
- /**
- * Internalizes the contents of the given InputStream object into a new
- * SOAPMessage object and returns the SOAPMessage object.
- *
- * @param mimeHeaders
- * the transport-specific headers passed to the message in a
- * transport-independent fashion for creation of the message
- * @param ins
- * the InputStream object that contains the data for a message
- * @return a new SOAPMessage object containing the data from the given
- * InputStream object
- * @throws java.io.IOException
- * if there is a problem in reading data from the input stream
- * @throws javax.xml.soap.SOAPException
- * if the message is invalid
- */
- public SOAPMessage createMessage(MimeHeaders mimeHeaders, InputStream ins) throws
IOException, SOAPException
- {
- return createMessageInternal(mimeHeaders, ins, false);
- }
-
- public SOAPMessage createMessageInternal(MimeHeaders mimeHeaders, InputStream ins,
boolean ignoreParseError) throws IOException, SOAPException
- {
- if (mimeHeaders == null)
- {
- mimeHeaders = new MimeHeaders();
- }
- else if (log.isTraceEnabled())
- {
- Iterator<MimeHeader> itMimeHeaders = mimeHeaders.getAllHeaders();
- while (itMimeHeaders.hasNext())
- {
- MimeHeader mh = itMimeHeaders.next();
- log.trace(mh);
- }
- }
-
- ContentType contentType = getContentType(mimeHeaders);
- log.debug("createMessage: [contentType=" + contentType + "]");
-
- // Debug the incoming message
- if (log.isTraceEnabled())
- {
- ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);
- IOUtils.copyStream(baos, ins);
- byte[] bytes = baos.toByteArray();
-
- log.trace("createMessage\n" + new String(bytes));
- ins = new ByteArrayInputStream(bytes);
- }
-
- Collection<AttachmentPart> attachments = null;
- if (isMultipartRelatedContent(contentType))
- {
- MultipartRelatedDecoder decoder;
- try
- {
- decoder = new MultipartRelatedDecoder(contentType);
- decoder.decodeMultipartRelatedMessage(ins);
- }
- catch (RuntimeException rte)
- {
- throw rte;
- }
- catch (IOException ex)
- {
- throw ex;
- }
- catch (Exception ex)
- {
- throw new SOAPException("Cannot decode multipart related message",
ex);
- }
-
- ins = decoder.getRootPart().getDataHandler().getInputStream();
- attachments = decoder.getRelatedParts();
- }
- else if (isSoapContent(contentType) == false)
- {
- throw new SOAPException("Unsupported content type: " + contentType);
- }
-
- SOAPMessageImpl soapMessage = new SOAPMessageImpl();
- if (mimeHeaders != null)
- soapMessage.setMimeHeaders(mimeHeaders);
-
- if (attachments != null)
- soapMessage.setAttachments(attachments);
-
- // Get the SOAPEnvelope builder
- PayloadBuilder payloadBuilder;
- if (serviceMode == Mode.PAYLOAD)
- {
- payloadBuilder = new JAXWSPayloadBuilder();
- }
- else
- {
- SAAJPayloadBuilderDOM jaxrpcBuilder = new SAAJPayloadBuilderDOM(getStyle());
- payloadBuilder = jaxrpcBuilder;
- }
-
- // Build the payload
- payloadBuilder.build(soapMessage, ins, ignoreParseError);
-
- return soapMessage;
- }
-
- private static ContentType getContentType(MimeHeaders headers) throws SOAPException
- {
- ContentType contentType = null;
- try
- {
- String[] type = headers.getHeader(MimeConstants.CONTENT_TYPE);
- if (type != null)
- {
- contentType = new ContentType(type[0]);
- }
- else
- {
- contentType = new ContentType(MimeConstants.TYPE_SOAP11);
- }
- return contentType;
- }
- catch (ParseException e)
- {
- throw new SOAPException("Could not parse content type:" + e);
- }
- }
-
- private boolean isSoapContent(ContentType type)
- {
- String baseType = type.getBaseType();
- return MimeConstants.TYPE_SOAP11.equals(baseType) ||
MimeConstants.TYPE_SOAP12.equals(baseType);
- }
-
- private boolean isMultipartRelatedContent(ContentType type)
- {
- String baseType = type.getBaseType();
- return MimeConstants.TYPE_MULTIPART_RELATED.equals(baseType);
- }
-}
Deleted: branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/NameImpl.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/NameImpl.java 2006-12-06
00:32:54 UTC (rev 1560)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/NameImpl.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -1,127 +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.namespace.QName;
-import javax.xml.soap.Name;
-
-/**
- * An implementation of a Name
- * <p/>
- * At this time of writing, the spec does not say anything about null values.
- * We assume emty string for any null value.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 01-June-2004
- */
-public class NameImpl implements Name
-{
- private QName qname;
-
- public NameImpl(QName qname)
- {
- this.qname = qname;
- }
-
- public NameImpl(String local)
- {
- qname = new QName(local);
- }
-
- public NameImpl(String local, String prefix, String uri)
- {
- if (prefix != null)
- qname = new QName(uri, local, prefix);
- else
- qname = new QName(uri, local);
- }
-
- /**
- * Gets the local name part of the XML name that this Name object represents.
- *
- * @return a string giving the local name
- */
- public String getLocalName()
- {
- return qname.getLocalPart();
- }
-
- /**
- * Returns the prefix that was specified when this Name object was initialized.
- * This prefix is associated with the namespace for the XML name that this Name object
represents.
- *
- * @return the prefix as a string
- */
- public String getPrefix()
- {
- return qname.getPrefix();
- }
-
- /**
- * Gets the namespace-qualified name of the XML name that this Name object
represents.
- *
- * @return the namespace-qualified name as a string
- */
- public String getQualifiedName()
- {
- String prefix = getPrefix();
- if (prefix.length() > 0)
- return prefix + ":" + qname.getLocalPart();
- else
- return qname.getLocalPart();
- }
-
- /**
- * Returns the URI of the namespace for the XML name that this Name object
represents.
- *
- * @return the URI as a string
- */
- public String getURI()
- {
- return qname.getNamespaceURI();
- }
-
- public int hashCode()
- {
- return qname.hashCode();
- }
-
- public boolean equals(Object obj)
- {
- if (!(obj instanceof NameImpl)) return false;
- if (obj == this) return true;
- NameImpl other = (NameImpl)obj;
- return qname.equals(other.qname);
- }
-
- public QName toQName()
- {
- return qname;
- }
-
- public String toString()
- {
- return qname.toString();
- }
-}
Deleted: branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/NodeImpl.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/NodeImpl.java 2006-12-06
00:32:54 UTC (rev 1560)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/NodeImpl.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -1,674 +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 java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import javax.xml.namespace.QName;
-import javax.xml.soap.SOAPElement;
-import javax.xml.soap.SOAPException;
-
-import org.jboss.logging.Logger;
-import org.jboss.util.NotImplementedException;
-import org.jboss.ws.utils.DOMUtils;
-import org.jboss.ws.utils.DOMWriter;
-import org.jboss.ws.WSException;
-import org.w3c.dom.DOMException;
-import org.w3c.dom.Document;
-import org.w3c.dom.DocumentFragment;
-import org.w3c.dom.Element;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.w3c.dom.UserDataHandler;
-
-/**
- * A representation of a node (element) in an XML document.
- * This interface extnends the standard DOM Node interface with methods for getting and
setting the value of a node,
- * for getting and setting the parent of a node, and for removing a node.
- *
- * When creating a DOM2 tree the objects maintained by the tree are
<code>org.w3c.dom.Node</code> objects
- * and not <code>javax.xml.soap.Node</code> objects.
- * <p/>
- * This implementation schields the client from the the underlying DOM2 tree, returning
<code>javax.xml.soap.Node</code>
- * objects.
- *
- * @author Thomas.Diesler(a)jboss.org
- */
-public class NodeImpl implements javax.xml.soap.Node
-{
- // provide logging
- private static Logger log = Logger.getLogger(NodeImpl.class);
-
- // The parent of this Node
- protected SOAPElementImpl soapParent;
- // This org.w3c.dom.Node
- protected org.w3c.dom.Node domNode;
- // A list of soap children
- private List<NodeImpl> soapChildren = new ArrayList<NodeImpl>();
-
- /** Construct the Node for a given org.w3c.dom.Node
- *
- * This constructor is used:
- *
- * 1) SOAPElement construction
- * 2) Text construction
- */
- NodeImpl(org.w3c.dom.Node node)
- {
- // Method selection in Java is done at compile time
- // Late binding does not work in this case
- if (node instanceof NodeImpl)
- throw new IllegalArgumentException("Copy constructor should be
used");
-
- domNode = node;
-
- // SOAP child elements should be constructed externally
- if (DOMUtils.hasChildElements(node))
- throw new IllegalArgumentException("Node cannot have child
elements");
- }
-
- /** The copy constructor used when converting types (i.e. SOAPElement ->
SOAPHeaderElement)
- */
- NodeImpl(NodeImpl node)
- {
- soapParent = node.soapParent;
- domNode = node.domNode;
- Iterator i = node.soapChildren.iterator();
- while (i.hasNext())
- {
- NodeImpl childNode = (NodeImpl)i.next();
- childNode.soapParent = (SOAPElementImpl)this;
- soapChildren.add(childNode);
- }
- }
-
- /** Get the QName of this Node */
- protected QName getQName()
- {
- String nsURI = getNamespaceURI();
- String localPart = getLocalName();
- String prefix = getPrefix();
-
- QName qname;
- if (nsURI != null && prefix != null)
- {
- qname = new QName(nsURI, localPart, prefix);
- }
- else if (nsURI != null)
- {
- qname = new QName(nsURI, localPart);
- }
- else
- {
- qname = new QName(localPart);
- }
-
- return qname;
- }
-
- // javax.xml.soap.Node
*********************************************************************************************
-
- /**
- * Removes this Node object from the tree.
- */
- public void detachNode()
- {
- org.w3c.dom.Node domParent = domNode.getParentNode();
- if (domParent != null)
- domParent.removeChild(domNode);
-
- if (soapParent != null)
- ((NodeImpl)soapParent).soapChildren.remove(this);
-
- soapParent = null;
- }
-
- /**
- * Returns the parent node of this Node object.
- * This method can throw an UnsupportedOperationException if the tree is not kept in
memory.
- *
- * @return the SOAPElement object that is the parent of this Node object or null if
this Node object is root
- */
- public SOAPElement getParentElement()
- {
- return soapParent;
- }
-
- /**
- * Sets the parent of this Node object to the given SOAPElement object.
- *
- * @param parent the SOAPElement object to be set as the parent of this Node object
- * @throws javax.xml.soap.SOAPException if there is a problem in setting the parent to
the given node
- */
- public void setParentElement(SOAPElement parent) throws SOAPException
- {
- // detach from the old parent
- if (soapParent != null)
- detachNode();
-
- soapParent = (SOAPElementImpl)parent;
- }
-
- /**
- * Returns the value of this node if this is a Text node or the value of the immediate
child of this node otherwise.
- * <p/>
- * If there is an immediate child of this Node that it is a Text node then it's
value will be returned.
- * If there is more than one Text node then the value of the first Text Node will be
returned.
- * Otherwise null is returned.
- *
- * @return a String with the text of this node if this is a Text node or the text
contained by the first immediate
- * child of this Node object that is a Text object if such a child exists;
null otherwise.
- */
- public String getValue()
- {
- // The Text node should overwrite getValue
- if (this instanceof javax.xml.soap.Text)
- throw new WSException("javax.xml.soap.Text should take care of
this");
-
- String nodeValue = null;
- org.w3c.dom.Node child = (org.w3c.dom.Node)getFirstChild();
- if (child instanceof org.w3c.dom.Text)
- nodeValue = ((org.w3c.dom.Text)child).getNodeValue();
-
- return nodeValue;
- }
-
- /**
- * If this is a Text node then this method will set its value, otherwise it sets the
value of the immediate (Text) child of this node.
- * <p/>
- * The value of the immediate child of this node can be set only if, there is one
child node and
- * that node is a Text node, or if there are no children in which case a child Text
node will be created.
- *
- * @param value A value string
- * @throws IllegalStateException if the node is not a Text node and either has more
than one child node or has a child node that is not a Text node.
- */
- public void setValue(String value)
- {
- // The Text node should overwrite setValue
- if (this instanceof javax.xml.soap.Text)
- throw new WSException("javax.xml.soap.Text should take care of
this");
-
- org.w3c.dom.Node child = (org.w3c.dom.Node)getFirstChild();
- if (child instanceof org.w3c.dom.Text)
- ((org.w3c.dom.Text)child).setNodeValue(value);
-
- if (child == null)
- {
- child = domNode.getOwnerDocument().createTextNode(value);
- appendChild(new TextImpl(child));
- }
- }
-
- /**
- * Notifies the implementation that this Node object is no longer being used by the
application and that the
- * implementation is free to reuse this object for nodes that may be created later.
- * Calling the method recycleNode implies that the method detachNode has been called
previously.
- */
- public void recycleNode()
- {
-
- }
-
- private List<NodeImpl> convertDocumentFragment(DocumentFragment docFragment)
throws DOMException
- {
- List<NodeImpl> list = new ArrayList<NodeImpl>();
- try
- {
- SOAPFactoryImpl soapFactory = new SOAPFactoryImpl();
- for (Node node = docFragment.getFirstChild(); node != null; node =
node.getNextSibling())
- {
- switch (node.getNodeType())
- {
- case Node.ELEMENT_NODE:
- {
- SOAPElementImpl soapChild = soapFactory.createElement((Element)node,
true);
- list.add(soapChild);
- break;
- }
- case Node.TEXT_NODE:
- {
- TextImpl text = new TextImpl(node);
- list.add(text);
- break;
- }
- case Node.CDATA_SECTION_NODE:
- {
- TextImpl text = new TextImpl(node);
- list.add(text);
- break;
- }
- }
- }
- }
- catch (SOAPException ex)
- {
- throw new DOMException(DOMException.INVALID_STATE_ERR, "Could not convert a
document fragment to a node");
- }
- return list;
- }
-
- // BEGIN org.w3c.dom.Node
*******************************************************************************************
-
- public String getNodeName()
- {
- return domNode.getNodeName();
- }
-
- public String getNodeValue() throws DOMException
- {
- return domNode.getNodeValue();
- }
-
- public void setNodeValue(String nodeValue) throws DOMException
- {
- domNode.setNodeValue(nodeValue);
- }
-
- public short getNodeType()
- {
- return domNode.getNodeType();
- }
-
- public org.w3c.dom.Node getParentNode()
- {
- assertSOAPParent();
- return soapParent;
- }
-
- public NodeList getChildNodes()
- {
- return new NodeListImpl(soapChildren);
- }
-
- public org.w3c.dom.Node getFirstChild()
- {
- NodeImpl child = null;
- org.w3c.dom.Node domChild = domNode.getFirstChild();
- if (domChild != null)
- {
- child = (NodeImpl)soapChildren.get(0);
- if (domChild != child.domNode)
- throw new WSException("Inconsistent node, child lists not
synchronized");
- }
- return child;
- }
-
- public org.w3c.dom.Node getLastChild()
- {
- NodeImpl child = null;
- org.w3c.dom.Node domChild = domNode.getLastChild();
- if (domChild != null)
- {
- child = (NodeImpl)soapChildren.get(soapChildren.size() - 1);
- if (domChild != child.domNode)
- throw new WSException("Inconsistent node, child lists not
synchronized");
- }
- return child;
- }
-
- public org.w3c.dom.Node getPreviousSibling()
- {
- assertSOAPParent();
-
- NodeImpl sibling = null;
- if (soapParent != null)
- {
- List children = ((NodeImpl)soapParent).soapChildren;
- for (int i = 0; i < children.size(); i++)
- {
- NodeImpl node = (NodeImpl)children.get(i);
- if (node == this && i > 0)
- {
- sibling = (NodeImpl)children.get(i - 1);
- break;
- }
- }
-
- if (sibling != null && sibling.domNode != domNode.getPreviousSibling())
- throw new WSException("Inconsistent node, child lists not
synchronized");
- }
-
- return sibling;
- }
-
- public org.w3c.dom.Node getNextSibling()
- {
- assertSOAPParent();
-
- NodeImpl sibling = null;
- if (soapParent != null)
- {
- List children = ((NodeImpl)soapParent).soapChildren;
- for (int i = 0; i < children.size(); i++)
- {
- NodeImpl node = (NodeImpl)children.get(i);
- if (node == this && (i + 1) < children.size())
- {
- sibling = (NodeImpl)children.get(i + 1);
- break;
- }
- }
-
- if (sibling != null && sibling.domNode != domNode.getNextSibling())
- throw new WSException("Inconsistent node, child lists not
synchronized");
- }
-
- return sibling;
- }
-
- public NamedNodeMap getAttributes()
- {
- return domNode.getAttributes();
- }
-
- public Document getOwnerDocument()
- {
- // Climb the tree in hopes of finding the soap envelope.
- // If it's not there (a detached subtree), then we return a non-associated
document
- if (soapParent == null)
- return new SOAPDocument();
-
- return soapParent.getOwnerDocument();
- }
-
- public org.w3c.dom.Node insertBefore(org.w3c.dom.Node newChild, org.w3c.dom.Node
refChild) throws DOMException
- {
- // DOM says that if refChild is null, an append is performed
- if (refChild == null)
- return appendChild(newChild);
-
- newChild = convertDOMNode(newChild);
- refChild = convertDOMNode(refChild);
-
- if (newChild instanceof DocumentFragment)
- {
- List<NodeImpl> list =
convertDocumentFragment((DocumentFragment)newChild);
- for (NodeImpl node : list)
- {
- insertBefore(node, refChild);
- }
- return newChild;
- }
-
- int index = soapChildren.indexOf(refChild);
- if (index < 0)
- throw new IllegalArgumentException("Cannot find refChild in list of
javax.xml.soap.Node children");
-
- NodeImpl soapNewNode = (NodeImpl)newChild;
- soapNewNode.detachNode();
-
- NodeImpl soapRefNode = (NodeImpl)refChild;
- domNode.insertBefore(soapNewNode.domNode, soapRefNode.domNode);
- soapChildren.add(index, soapNewNode);
-
- soapNewNode.soapParent = (SOAPElementImpl)this;
-
- return newChild;
- }
-
- public org.w3c.dom.Node replaceChild(org.w3c.dom.Node newChild, org.w3c.dom.Node
oldChild) throws DOMException
- {
- newChild = convertDOMNode(newChild);
- oldChild = convertDOMNode(oldChild);
-
- if (newChild instanceof DocumentFragment)
- {
- insertBefore(newChild, oldChild);
- ((NodeImpl)oldChild).detachNode();
- return newChild;
- }
-
- int index = soapChildren.indexOf(oldChild);
- if (index < 0)
- throw new DOMException(DOMException.NOT_FOUND_ERR, "Cannot find oldChild in
list of javax.xml.soap.Node children");
-
- NodeImpl soapNewNode = (NodeImpl)newChild;
- NodeImpl soapOldNode = (NodeImpl)oldChild;
-
- soapNewNode.detachNode();
-
- if (soapNewNode.domNode != soapOldNode.domNode)
- domNode.replaceChild(soapNewNode.domNode, soapOldNode.domNode);
-
- soapChildren.remove(index);
- soapChildren.add(index, soapNewNode);
-
- soapNewNode.soapParent = soapOldNode.soapParent;
- soapOldNode.soapParent = null;
-
- return newChild;
- }
-
- public org.w3c.dom.Node removeChild(org.w3c.dom.Node oldChild) throws DOMException
- {
- oldChild = convertDOMNode(oldChild);
-
- int index = soapChildren.indexOf(oldChild);
- if (index < 0)
- throw new DOMException(DOMException.NOT_FOUND_ERR, "Cannot find oldChild in
list of javax.xml.soap.Node children");
-
- NodeImpl soapOldNode = (NodeImpl)oldChild;
- domNode.removeChild(soapOldNode.domNode);
- soapChildren.remove(index);
-
- soapOldNode.soapParent = null;
-
- return oldChild;
- }
-
- public org.w3c.dom.Node appendChild(org.w3c.dom.Node newChild) throws DOMException
- {
- newChild = convertDOMNode(newChild);
-
- if (newChild instanceof DocumentFragment)
- {
- List<NodeImpl> list =
convertDocumentFragment((DocumentFragment)newChild);
- for (NodeImpl node : list)
- {
- appendChild(node);
- }
- return newChild;
- }
-
- if ((this instanceof SOAPElementImpl) == false)
- throw new DOMException(DOMException.INVALID_ACCESS_ERR, "Cannot append
child to this node: " + this);
-
- NodeImpl soapNode = (NodeImpl)newChild;
- soapNode.detachNode();
-
- domNode.appendChild(soapNode.domNode);
- soapNode.soapParent = (SOAPElementImpl)this;
-
- soapChildren.add(soapNode);
-
- return newChild;
- }
-
- public boolean hasChildNodes()
- {
- return domNode.hasChildNodes();
- }
-
- public org.w3c.dom.Node cloneNode(boolean deep)
- {
- return domNode.cloneNode(deep);
- }
-
- public void normalize()
- {
- domNode.normalize();
- }
-
- public boolean isSupported(String feature, String version)
- {
- return domNode.isSupported(feature, version);
- }
-
- public String getNamespaceURI()
- {
- return domNode.getNamespaceURI();
- }
-
- public String getPrefix()
- {
- return domNode.getPrefix();
- }
-
- public void setPrefix(String prefix) throws DOMException
- {
- domNode.setPrefix(prefix);
- }
-
- public String getLocalName()
- {
- return domNode.getLocalName();
- }
-
- public boolean hasAttributes()
- {
- return domNode.hasAttributes();
- }
-
- public int hashCode()
- {
- return domNode.hashCode();
- }
-
- public String toString()
- {
- return super.toString() + "[" + domNode.toString() + "]";
- }
-
- private Node convertDOMNode(org.w3c.dom.Node node)
- {
- Node retNode;
- if (node instanceof NodeImpl)
- {
- retNode = node;
- }
- else if (node instanceof DocumentFragment)
- {
- retNode = new DocumentFragmentImpl((DocumentFragment)node);
- }
- else if (node instanceof org.w3c.dom.Text)
- {
- retNode = new TextImpl(node);
- }
- else
- {
- throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Operation only
supported for javax.xml.soap.Node, this is a " + node);
- }
- return retNode;
- }
-
- private void assertSOAPParent()
- {
- org.w3c.dom.Node domParent = domNode.getParentNode();
- if (domParent != null && soapParent == null)
- throw new WSException("Inconsistent node, has a DOM parent but no SOAP
parent [" + this + "] " + DOMWriter.printNode(this, false));
- if (domParent == null && soapParent != null)
- throw new WSException("Inconsistent node, has a SOAP parent but no DOM
parent [" + this + "] " + DOMWriter.printNode(this, false));
- if (soapParent != null && domParent != soapParent.domNode)
- throw new WSException("Inconsistent node, SOAP parent is not identical with
DOM parent [" + this + "] " + DOMWriter.printNode(this, false));
- }
-
- // END org.w3c.dom.Node
*******************************************************************************************
-
- // BEGIN org.w3c.dom.Node DOM Level 3
*****************************************************************************
-
- public short compareDocumentPosition(Node other) throws DOMException
- {
- // FIXME compareDocumentPosition
- throw new NotImplementedException("compareDocumentPosition");
- }
-
- public String getBaseURI()
- {
- // FIXME getBaseURI
- throw new NotImplementedException("getBaseURI");
- }
-
- public Object getFeature(String feature, String version)
- {
- // FIXME getFeature
- throw new NotImplementedException("getFeature");
- }
-
- public String getTextContent() throws DOMException
- {
- // FIXME getTextContent
- throw new NotImplementedException("getTextContent");
- }
-
- public Object getUserData(String key)
- {
- // FIXME getUserData
- throw new NotImplementedException("getUserData");
- }
-
- public boolean isDefaultNamespace(String namespaceURI)
- {
- // FIXME isDefaultNamespace
- throw new NotImplementedException("isDefaultNamespace");
- }
-
- public boolean isEqualNode(Node arg)
- {
- // FIXME isEqualNode
- throw new NotImplementedException("isEqualNode");
- }
-
- public boolean isSameNode(Node other)
- {
- // FIXME isSameNode
- throw new NotImplementedException("isSameNode");
- }
-
- public String lookupNamespaceURI(String prefix)
- {
- // FIXME lookupNamespaceURI
- throw new NotImplementedException("lookupNamespaceURI");
- }
-
- public String lookupPrefix(String namespaceURI)
- {
- // FIXME lookupPrefix
- throw new NotImplementedException("lookupPrefix");
- }
-
- public void setTextContent(String textContent) throws DOMException
- {
- // FIXME setTextContent
- throw new NotImplementedException("setTextContent");
- }
-
- public Object setUserData(String key, Object data, UserDataHandler handler)
- {
- // FIXME setUserData
- throw new NotImplementedException("setUserData");
- }
-
- // END org.w3c.dom.Node DOM Level 3
*****************************************************************************
-}
Deleted: branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/NodeListImpl.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/NodeListImpl.java 2006-12-06
00:32:54 UTC (rev 1560)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/NodeListImpl.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -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.soap;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-/**
- * The NodeList interface provides the abstraction of an ordered collection of nodes,
without defining or constraining
- * how this collection is implemented. NodeList objects in the DOM are live.
- *
- * The items in the NodeList are accessible via an integral index, starting from 0.
- *
- * @author Thomas.Diesler(a)jboss.org
- */
-class NodeListImpl implements NodeList
-{
- private List<NodeImpl> nodeList = new ArrayList<NodeImpl>();
-
- NodeListImpl(List<NodeImpl> nodes)
- {
- nodeList = new ArrayList<NodeImpl>(nodes);
- }
-
- NodeListImpl(Iterator<NodeImpl> nodes)
- {
- nodeList = new ArrayList<NodeImpl>();
- while (nodes.hasNext())
- nodeList.add(nodes.next());
- }
-
- public Node item(int index)
- {
- if (nodeList.size() > index)
- return nodeList.get(index);
- else
- return null;
- }
-
- public int getLength()
- {
- return nodeList.size();
- }
-}
Deleted: branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/PayloadBuilder.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/PayloadBuilder.java 2006-12-06
00:32:54 UTC (rev 1560)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/PayloadBuilder.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -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;
-
-// $Id$
-
-import java.io.IOException;
-import java.io.InputStream;
-
-import javax.xml.soap.SOAPException;
-
-/**
- * @author Heiko Braun, <heiko.braun(a)jboss.com>
- * @author Thomas.Diesler(a)jboss.com
- * @since 19-Apr-2006
- */
-public interface PayloadBuilder
-{
- void build(SOAPMessageImpl soapMessage, InputStream in, boolean ignoreParseError)
throws IOException, SOAPException;
-}
Deleted:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SAAJPayloadBuilderDOM.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SAAJPayloadBuilderDOM.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SAAJPayloadBuilderDOM.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -1,268 +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 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.WSException;
-import org.jboss.ws.jaxrpc.Style;
-import org.jboss.ws.utils.DOMUtils;
-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(a)jboss.com>
- * @author Thomas.Diesler(a)jboss.com
- * @since 19-Apr-2006
- */
-public class SAAJPayloadBuilderDOM implements PayloadBuilder
-{
- // provide logging
- private static Logger log = Logger.getLogger(SAAJPayloadBuilderDOM.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());
- }
- }
-}
Deleted:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SAAJPayloadBuilderStax.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SAAJPayloadBuilderStax.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SAAJPayloadBuilderStax.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -1,467 +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 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(a)jboss.com>
- * @author Thomas.Diesler(a)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();
- }
-}
Deleted: branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SAAJVisitable.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SAAJVisitable.java 2006-12-06
00:32:54 UTC (rev 1560)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SAAJVisitable.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -1,31 +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(a)jboss.com>
- * @version $Id$
- * @since Sep 26, 2006
- */
-public interface SAAJVisitable {
- public void accept(SAAJVisitor visitor);
-}
Deleted: branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SAAJVisitor.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SAAJVisitor.java 2006-12-06
00:32:54 UTC (rev 1560)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SAAJVisitor.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -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.soap;
-
-import javax.xml.soap.SOAPElement;
-
-/**
- * @author Heiko Braun <heiko.braun(a)jboss.com>
- * @version $Id$
- * @since Sep 26, 2006
- */
-public interface SAAJVisitor {
- void visitSOAPElement(SOAPElementImpl soapElement);
- void visitSOAPContentElement(SOAPContentElement scElement);
-}
Deleted: branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPBodyElementDoc.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPBodyElementDoc.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPBodyElementDoc.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -1,46 +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.Name;
-import javax.xml.soap.SOAPBodyElement;
-
-/**
- * An abstract implemenation of the SOAPBodyElement
- * <p/>
- * This class should not expose functionality that is not part of
- * {@link javax.xml.soap.SOAPBodyElement}. Client code should use
<code>SOAPBodyElement</code>.
- *
- * @author Thomas.Diesler(a)jboss.org
- */
-public class SOAPBodyElementDoc extends SOAPContentElement implements SOAPBodyElement
-{
- public SOAPBodyElementDoc(Name name)
- {
- super(name);
- }
-
- public SOAPBodyElementDoc(SOAPElementImpl element)
- {
- super(element);
- }
-}
Deleted:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPBodyElementMessage.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPBodyElementMessage.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPBodyElementMessage.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -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.soap;
-
-import org.jboss.ws.utils.DOMWriter;
-import javax.xml.soap.Name;
-import javax.xml.soap.SOAPBodyElement;
-import javax.xml.rpc.JAXRPCException;
-import java.io.Writer;
-
-/**
- * An abstract implemenation of the SOAPBodyElement
- * <p/>
- * This class should not expose functionality that is not part of
- * {@link javax.xml.soap.SOAPBodyElement}. Client code should use
<code>SOAPBodyElement</code>.
- *
- * @author Thomas.Diesler(a)jboss.org
- */
-public class SOAPBodyElementMessage extends SOAPElementImpl implements SOAPBodyElement
-{
- public SOAPBodyElementMessage(Name name)
- {
- super(name);
- }
-
- public SOAPBodyElementMessage(SOAPElementImpl element)
- {
- super(element);
- }
-
- public void writeElement(Writer writer) {
- try
- {
- DOMWriter domWriter = new DOMWriter(writer);
- domWriter.print(this);
- }
- catch (Exception e)
- {
- throw new JAXRPCException(e);
- }
- }
-}
Deleted: branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPBodyElementRpc.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPBodyElementRpc.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPBodyElementRpc.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -1,53 +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 org.jboss.ws.utils.DOMWriter;
-import org.jboss.ws.WSException;
-import org.w3c.dom.Element;
-import javax.xml.soap.Name;
-import javax.xml.soap.SOAPBodyElement;
-import javax.xml.rpc.JAXRPCException;
-import java.io.IOException;
-import java.io.Writer;
-import java.util.Iterator;
-
-/**
- * An abstract implemenation of the SOAPBodyElement
- * <p/>
- * This class should not expose functionality that is not part of
- * {@link javax.xml.soap.SOAPBodyElement}. Client code should use
<code>SOAPBodyElement</code>.
- *
- * @author Thomas.Diesler(a)jboss.org
- */
-public class SOAPBodyElementRpc extends SOAPElementImpl implements SOAPBodyElement
-{
- public SOAPBodyElementRpc(Name name)
- {
- super(name);
- }
-
- public SOAPBodyElementRpc(SOAPElementImpl element)
- {
- super(element);
- }
-}
Deleted: branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPBodyImpl.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPBodyImpl.java 2006-12-06
00:32:54 UTC (rev 1560)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPBodyImpl.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -1,406 +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 java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.Reader;
-import java.io.Writer;
-import java.util.Iterator;
-import java.util.Locale;
-
-import javax.xml.soap.Name;
-import javax.xml.soap.SOAPBody;
-import javax.xml.soap.SOAPBodyElement;
-import javax.xml.soap.SOAPElement;
-import javax.xml.soap.SOAPException;
-import javax.xml.soap.SOAPFault;
-import javax.xml.transform.Source;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.sax.SAXSource;
-import javax.xml.transform.stream.StreamResult;
-import javax.xml.transform.stream.StreamSource;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.Constants;
-import org.jboss.ws.WSException;
-import org.jboss.ws.core.CommonMessageContext;
-import org.jboss.ws.metadata.umdm.UnifiedMetaData;
-import org.jboss.ws.utils.DOMUtils;
-import org.jboss.ws.utils.DOMWriter;
-import org.w3c.dom.DOMException;
-import org.w3c.dom.Document;
-import org.w3c.dom.DocumentFragment;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.xml.sax.InputSource;
-
-/**
- * An object that represents the contents of the SOAP body element in a SOAP message.
- * A SOAP body element consists of XML data that affects the way the application-specific
content is processed.
- *
- * A SOAPBody object contains SOAPBodyElement objects, which have the content for the
SOAP body.
- * A SOAPFault object, which carries status and/or error information, is an example of a
SOAPBodyElement object.
- *
- * @author Thomas.Diesler(a)jboss.org
- */
-public class SOAPBodyImpl extends SOAPElementImpl implements SOAPBody
-{
- // provide logging
- private static Logger log = Logger.getLogger(SOAPBodyImpl.class);
-
- // Generic JAXWS payload
- private Source payload;
- private boolean isDOMValid = true;
- private boolean isModifiedFromSource;
-
- public SOAPBodyImpl(String prefix, String namespace)
- {
- super("Body", prefix, namespace);
- }
-
- public boolean isDOMValid()
- {
- return isDOMValid;
- }
-
- public boolean isModifiedFromSource()
- {
- return isModifiedFromSource;
- }
-
- public Source getPayload()
- {
- return payload;
- }
-
- public void setPayload(Source payload)
- {
- log.debug("setPayload: " + payload.getClass().getName());
- removeContents();
- this.payload = payload;
- this.isDOMValid = false;
- }
-
- /** Convert the child into a SOAPBodyElement */
- public SOAPElement addChildElement(SOAPElement child) throws SOAPException
- {
- log.trace("addChildElement: " + child.getElementName());
- expandToDOM();
- if ((child instanceof SOAPBodyElement) == false)
- child = convertToBodyElement(child);
-
- child = super.addChildElement(child);
- return child;
- }
-
- public SOAPBodyElement addBodyElement(Name name) throws SOAPException
- {
- log.trace("addBodyElement: " + name);
- expandToDOM();
- SOAPBodyElement child = new SOAPBodyElementDoc(name);
- return (SOAPBodyElement)addChildElement(child);
- }
-
- public SOAPBodyElement addDocument(Document doc) throws SOAPException
- {
- log.trace("addDocument");
- expandToDOM();
- Element rootElement = doc.getDocumentElement();
- SOAPFactoryImpl soapFactory = new SOAPFactoryImpl();
- SOAPElementImpl soapElement = soapFactory.createElement(rootElement, true);
- return (SOAPBodyElement)addChildElement(soapElement);
- }
-
- public SOAPFault addFault() throws SOAPException
- {
- log.trace("addFault");
- expandToDOM();
- if (hasFault())
- throw new SOAPException("A SOAPBody may contain at most one SOAPFault child
element");
-
- return addFault(new NameImpl(Constants.SOAP11_FAULT_CODE_SERVER), "Generic
server fault");
- }
-
- public SOAPFault addFault(Name faultCode, String faultString) throws SOAPException
- {
- log.trace("addFault");
- expandToDOM();
- if (hasFault())
- throw new SOAPException("A SOAPBody may contain at most one SOAPFault child
element");
-
- SOAPFaultImpl soapFault = new SOAPFaultImpl(getNamespaceURI());
- soapFault = (SOAPFaultImpl)addChildElement(soapFault);
- soapFault.setFaultCode(faultCode);
- soapFault.setFaultString(faultString);
- return soapFault;
- }
-
- public SOAPFault addFault(Name faultCode, String faultString, Locale locale) throws
SOAPException
- {
- log.trace("addFault");
- expandToDOM();
- if (hasFault())
- throw new SOAPException("A SOAPBody may contain at most one SOAPFault child
element");
-
- SOAPFaultImpl soapFault = new SOAPFaultImpl(getNamespaceURI());
- soapFault.setFaultCode(faultCode);
- soapFault.setFaultString(faultString, locale);
- addChildElement(soapFault);
- return soapFault;
- }
-
- public SOAPFault getFault()
- {
- log.trace("getFault");
- expandToDOM();
- Iterator it = getChildElements(new NameImpl("Fault",
Constants.PREFIX_ENV, getSOAPEnvelope().getNamespaceURI()));
- return (it.hasNext() ? (SOAPFault)it.next() : null);
- }
-
- public boolean hasFault()
- {
- log.trace("hasFault");
- expandToDOM();
- return getChildElements(Constants.SOAP11_FAULT).hasNext();
- }
-
- public Node appendChild(Node newChild) throws DOMException
- {
- log.trace("appendChild: " + newChild.getNodeName());
- expandToDOM();
- Node retNode;
- if (!(newChild instanceof SOAPBodyElement || newChild instanceof
DocumentFragment))
- {
- newChild = convertToBodyElement(newChild);
- }
- retNode = super.appendChild(newChild);
- return retNode;
- }
-
- public Node insertBefore(Node newChild, Node refChild) throws DOMException
- {
- log.trace("insertBefore: " + newChild.getNodeName());
- expandToDOM();
- if (!(newChild instanceof SOAPBodyElement || newChild instanceof
DocumentFragment))
- newChild = convertToBodyElement(newChild);
-
- return super.insertBefore(newChild, refChild);
- }
-
- public Node replaceChild(Node newChild, Node oldChild) throws DOMException
- {
- log.trace("replaceChild: " + newChild.getNodeName());
- expandToDOM();
- if (!(newChild instanceof SOAPBodyElement || newChild instanceof
DocumentFragment))
- {
- newChild = convertToBodyElement(newChild);
- }
-
- return super.replaceChild(newChild, oldChild);
- }
-
- public Iterator getChildElements()
- {
- log.trace("getChildElements");
- expandToDOM();
- return super.getChildElements();
- }
-
- public Iterator getChildElements(Name name)
- {
- log.trace("getChildElements: " + name);
- expandToDOM();
- return super.getChildElements(name);
- }
-
- public NodeList getChildNodes()
- {
- log.trace("getChildNodes");
- expandToDOM();
- return super.getChildNodes();
- }
-
- public Node getFirstChild()
- {
- log.trace("getFirstChild");
- expandToDOM();
- return super.getFirstChild();
- }
-
- public Node getLastChild()
- {
- log.trace("getLastChild");
- expandToDOM();
- return super.getLastChild();
- }
-
- public boolean hasChildNodes()
- {
- log.trace("hasChildNodes");
- expandToDOM();
- return super.hasChildNodes();
- }
-
- private SOAPBodyElementDoc convertToBodyElement(Node node)
- {
- if (!(node instanceof SOAPElementImpl))
- throw new IllegalArgumentException("SOAPElement expected");
-
- SOAPElementImpl element = (SOAPElementImpl)node;
- element.detachNode();
- return new SOAPBodyElementDoc(element);
- }
-
- private void expandToDOM()
- {
- if (isDOMValid == false)
- {
- // DOM expansion should only happen when a handler accesses the DOM API.
- // We do not allow DOM expansion on a dev release.
- CommonMessageContext msgContext =
MessageContextAssociation.peekMessageContext();
- if (msgContext != null && UnifiedMetaData.isFinalRelease() == false)
- {
- Boolean allowExpand =
(Boolean)msgContext.getProperty(CommonMessageContext.ALLOW_EXPAND_TO_DOM);
- if (Boolean.TRUE.equals(allowExpand) == false)
- throw new WSException("Expanding content element to DOM");
- }
-
- log.trace("BEGIN expandToDOM");
-
- isDOMValid = true;
- try
- {
- Element child = getBodyElementFromSource();
- SOAPFactoryImpl soapFactory = new SOAPFactoryImpl();
- addChildElement(soapFactory.createElement(child, true));
- payload = null;
- }
- catch (RuntimeException rte)
- {
- isDOMValid = false;
- throw rte;
- }
- catch (Exception ex)
- {
- isDOMValid = false;
- throw new WSException("Cannot expand to DOM" + ex);
- }
- finally
- {
- isModifiedFromSource = true;
- log.trace("END expandToDOM");
- }
- }
- }
-
- private Element getBodyElementFromSource()
- {
- Element child = null;
- try
- {
- if (payload instanceof StreamSource)
- {
- StreamSource streamSource = (StreamSource)payload;
-
- InputStream ins = streamSource.getInputStream();
- if (ins != null)
- {
- child = DOMUtils.parse(ins);
- }
- else
- {
- Reader reader = streamSource.getReader();
- child = DOMUtils.parse(new InputSource(reader));
- }
-
- // reset the excausted input stream
- String xmlStr = DOMWriter.printNode(child, false);
- payload = new StreamSource(new ByteArrayInputStream(xmlStr.getBytes()));
- }
- else if (payload instanceof DOMSource)
- {
- DOMSource domSource = (DOMSource)payload;
- Node node = domSource.getNode();
- if (node instanceof Element)
- {
- child = (Element)node;
- }
- else if (node instanceof Document)
- {
- child = ((Document)node).getDocumentElement();
- }
- else
- {
- throw new WSException("Unsupported Node type: " +
node.getClass().getName());
- }
- }
- else if (payload instanceof SAXSource)
- {
- // The fact that JAXBSource derives from SAXSource is an implementation
detail.
- // Thus in general applications are strongly discouraged from accessing
methods defined on SAXSource.
- // The XMLReader object obtained by the getXMLReader method shall be used
only for parsing the InputSource object returned by the getInputSource method.
-
- TransformerFactory tf = TransformerFactory.newInstance();
- ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);
- tf.newTransformer().transform(payload, new StreamResult(baos));
-
- child = DOMUtils.parse(new ByteArrayInputStream(baos.toByteArray()));
- }
- else
- {
- throw new WSException("Source type not implemented: " +
payload.getClass().getName());
- }
- }
- catch (RuntimeException rte)
- {
- throw rte;
- }
- catch (Exception ex)
- {
- throw new WSException("Cannot get root element from Source" + ex);
- }
- return child;
- }
-
- @Override
- public void writeElementContent(Writer writer) throws IOException
- {
- if (payload != null)
- {
- Element child = getBodyElementFromSource();
- String xmlPayload = DOMWriter.printNode(child, false);
- log.debug("Content from payload: " + xmlPayload);
- writer.write(xmlPayload);
- }
- else
- {
- super.writeElementContent(writer);
- }
- }
-}
Deleted:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPConnectionFactoryImpl.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPConnectionFactoryImpl.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPConnectionFactoryImpl.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -1,80 +0,0 @@
-/*
- * The Apache Software License, Version 1.1
- *
- *
- * Copyright (c) 2002-2003 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes software developed by the
- * Apache Software Foundation (
http://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Axis" and "Apache Software Foundation" must
- * not be used to endorse or promote products derived from this
- * software without prior written permission. For written
- * permission, please contact apache(a)apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- * nor may "Apache" appear in their name, without prior written
- * permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * <
http://www.apache.org/>.
- */
-package org.jboss.ws.soap;
-
-// $Id$
-
-import javax.xml.soap.SOAPConnection;
-import javax.xml.soap.SOAPConnectionFactory;
-import javax.xml.soap.SOAPException;
-
-/**
- * SOAP Connection Factory implementation
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 02-Feb-2005
- */
-public class SOAPConnectionFactoryImpl extends SOAPConnectionFactory
-{
- /** Create a new SOAPConnection.
- *
- * @return the new SOAPConnection object.
- * @throws javax.xml.soap.SOAPException if there was an exception creating
theSOAPConnection object.
- */
- public SOAPConnection createConnection() throws SOAPException
- {
- return new SOAPConnectionImpl();
- }
-}
Deleted: branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPConnectionImpl.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPConnectionImpl.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPConnectionImpl.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -1,358 +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 java.net.MalformedURLException;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Properties;
-
-import javax.xml.rpc.Stub;
-import javax.xml.soap.MimeHeader;
-import javax.xml.soap.MimeHeaders;
-import javax.xml.soap.SOAPConnection;
-import javax.xml.soap.SOAPEnvelope;
-import javax.xml.soap.SOAPException;
-import javax.xml.soap.SOAPMessage;
-import javax.xml.ws.BindingProvider;
-import javax.xml.ws.addressing.EndpointReference;
-
-import org.jboss.logging.Logger;
-import org.jboss.remoting.Client;
-import org.jboss.remoting.InvokerLocator;
-import org.jboss.remoting.security.SSLSocketBuilder;
-import org.jboss.remoting.transport.http.HTTPMetadataConstants;
-import org.jboss.ws.binding.soap.SOAPMessageMarshaller;
-import org.jboss.ws.binding.soap.SOAPMessageUnMarshaller;
-import org.jboss.ws.extras.xop.XOPContext;
-import org.jboss.ws.jaxrpc.StubExt;
-
-/**
- * SOAPConnection implementation
- *
- * @author Thomas.Diesler(a)jboss.org
- * @author <a href="mailto:jason@stacksmash.com">Jason T.
Greene</a>
- *
- * @since 02-Feb-2005
- */
-public class SOAPConnectionImpl extends SOAPConnection
-{
- // provide logging
- private static Logger log = Logger.getLogger(SOAPConnectionImpl.class);
- private static Logger msgLog = Logger.getLogger("jbossws.SOAPMessage");
-
- private Map<String, Object> config = new HashMap<String, Object>();
-
- private static Map<String, String> metadataMap = new HashMap<String,
String>();
- static
- {
- metadataMap.put(Stub.USERNAME_PROPERTY, "http.basic.username");
- metadataMap.put(Stub.PASSWORD_PROPERTY, "http.basic.password");
- metadataMap.put(BindingProvider.USERNAME_PROPERTY,
"http.basic.username");
- metadataMap.put(BindingProvider.PASSWORD_PROPERTY,
"http.basic.password");
- }
- private static Map<String, String> configMap = new HashMap<String,
String>();
- static
- {
- configMap.put(StubExt.PROPERTY_KEY_STORE,
SSLSocketBuilder.REMOTING_KEY_STORE_FILE_PATH);
- configMap.put(StubExt.PROPERTY_KEY_STORE_PASSWORD,
SSLSocketBuilder.REMOTING_KEY_STORE_PASSWORD);
- configMap.put(StubExt.PROPERTY_KEY_STORE_TYPE,
SSLSocketBuilder.REMOTING_KEY_STORE_TYPE);
- configMap.put(StubExt.PROPERTY_TRUST_STORE,
SSLSocketBuilder.REMOTING_TRUST_STORE_FILE_PATH);
- configMap.put(StubExt.PROPERTY_TRUST_STORE_PASSWORD,
SSLSocketBuilder.REMOTING_TRUST_STORE_PASSWORD);
- configMap.put(StubExt.PROPERTY_TRUST_STORE_TYPE,
SSLSocketBuilder.REMOTING_TRUST_STORE_TYPE);
- }
-
- private boolean closed;
-
- public SOAPConnectionImpl()
- {
- // HTTPClientInvoker conect sends gratuitous POST
- //
http://jira.jboss.com/jira/browse/JBWS-711
- config.put(Client.ENABLE_LEASE, false);
- }
-
- /**
- * Sends the given message to the specified endpoint and blocks until it has
- * returned the response.
- */
- public SOAPMessage call(SOAPMessage reqMessage, Object endpoint) throws SOAPException
- {
- return callInternal(reqMessage, endpoint, false);
- }
-
- /**
- * Sends the given message to the specified endpoint. This method is logically
- * non blocking.
- */
- public SOAPMessage callOneWay(SOAPMessage reqMessage, Object endpoint) throws
SOAPException
- {
- return callInternal(reqMessage, endpoint, true);
- }
-
- /** Sends the given message to the specified endpoint. */
- private SOAPMessage callInternal(SOAPMessage reqMessage, Object endpoint, boolean
oneway) throws SOAPException
- {
- if (reqMessage == null)
- throw new IllegalArgumentException("Given SOAPMessage cannot be
null");
- if (endpoint == null)
- throw new IllegalArgumentException("Given endpoint cannot be null");
-
- if (closed)
- throw new SOAPException("SOAPConnection is already closed");
-
- InvokerLocator locator;
- Client remotingClient;
- String targetAddress;
- Map callProps;
-
- if (endpoint instanceof EndpointInfo)
- {
- EndpointInfo epInfo = (EndpointInfo)endpoint;
- targetAddress = epInfo.getTargetAddress();
- callProps = epInfo.getProperties();
-
- if (callProps.containsKey(StubExt.PROPERTY_CLIENT_TIMEOUT))
- {
- Object timeout = callProps.get(StubExt.PROPERTY_CLIENT_TIMEOUT);
- int qmIndex = targetAddress.indexOf("?");
- targetAddress += (qmIndex < 0 ? "?" : "&") +
"timeout=" + timeout;
- }
- }
- else if (endpoint instanceof EndpointReference)
- {
- EndpointReference epr = (EndpointReference)endpoint;
- targetAddress = epr.getAddress().toString();
- callProps = null;
- }
- else
- {
- targetAddress = endpoint.toString();
- callProps = null;
- }
-
- // enforce xop transitions
- // TODO: there should be a clear transition to an immutable object model
- XOPContext.eagerlyCreateAttachments();
-
- // save object model changes
- if (reqMessage.saveRequired()) reqMessage.saveChanges();
-
- try
- {
- // Get the invoker from Remoting for a given endpoint address
- log.debug("Get locator for: " + endpoint);
- locator = new InvokerLocator(targetAddress);
- }
- catch (MalformedURLException e)
- {
- throw new SOAPException("Malformed endpoint address", e);
- }
-
- Map metadata = getRemotingMetaData(reqMessage, targetAddress, callProps);
-
- try
- {
- remotingClient = new Client(locator, "saaj", config);
- remotingClient.connect();
- remotingClient.setMarshaller(new SOAPMessageMarshaller());
- if (oneway == false)
- remotingClient.setUnMarshaller(new SOAPMessageUnMarshaller());
- }
- catch (RuntimeException rte)
- {
- throw rte;
- }
- catch (Exception e)
- {
- throw new SOAPException("Could not setup remoting client", e);
- }
-
- try
- {
- // debug the outgoing message
- if(msgLog.isTraceEnabled())
- {
- SOAPEnvelope soapReqEnv = reqMessage.getSOAPPart().getEnvelope();
- String envStr = SOAPElementWriter.writeElement((SOAPElementImpl)soapReqEnv,
true);
- msgLog.trace("Remoting meta data: " + metadata);
- msgLog.trace("Outgoing SOAPMessage\n" + envStr);
- }
-
- SOAPMessage resMessage = null;
- if (oneway == true)
- {
- remotingClient.invokeOneway(reqMessage, metadata, false);
- }
- else
- {
- resMessage = (SOAPMessage)remotingClient.invoke(reqMessage, metadata);
- }
-
- // disconnect the rmoting client
- remotingClient.disconnect();
-
- // debug the incomming response message
- if (resMessage != null && msgLog.isTraceEnabled())
- {
- SOAPEnvelope soapResEnv = resMessage.getSOAPPart().getEnvelope();
- String envStr = SOAPElementWriter.writeElement((SOAPElementImpl)soapResEnv,
true);
- msgLog.trace("Incoming Response SOAPMessage\n" + envStr);
- }
-
- return resMessage;
- }
- catch (RuntimeException rte)
- {
- throw rte;
- }
- catch (Throwable t)
- {
- throw new SOAPException("Could not transmit message", t);
- }
- }
-
- /** Closes this SOAPConnection
- */
- public void close() throws SOAPException
- {
- if (closed)
- throw new SOAPException("SOAPConnection is already closed");
-
- closed = true;
- }
-
- private Map getRemotingMetaData(SOAPMessage reqMessage, String targetAddress, Map
callProps) throws SOAPException
- {
- // 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.
-
- MimeHeaders mimeHeaders = reqMessage.getMimeHeaders();
- String[] action = mimeHeaders.getHeader("SOAPAction");
- if (action != null && action.length > 0)
- {
- String soapAction = action[0];
-
- // R1109 The value of the SOAPAction HTTP header field in a HTTP request MESSAGE
MUST be a quoted string.
- if (soapAction.startsWith("\"") == false ||
soapAction.endsWith("\"") == false)
- soapAction = "\"" + soapAction + "\"";
-
- mimeHeaders.setHeader("SOAPAction", soapAction);
- }
- else
- {
- mimeHeaders.setHeader("SOAPAction", "\"\"");
- }
-
- Map<String, Object> metadata = new HashMap<String, Object>();
-
- // We need to unmarshall faults (HTTP 500)
- metadata.put(HTTPMetadataConstants.NO_THROW_ON_ERROR, "true");
-
- Properties props = new Properties();
- metadata.put("HEADER", props);
-
- Iterator i = mimeHeaders.getAllHeaders();
- while (i.hasNext())
- {
- MimeHeader header = (MimeHeader)i.next();
- String currentValue = props.getProperty(header.getName());
-
- /*
- * Coalesce multiple headers into one
- *
- * From HTTP/1.1 RFC 2616:
- *
- * Multiple message-header fields with the same field-name MAY be
- * present in a message if and only if the entire field-value for that
- * header field is defined as a comma-separated list [i.e., #(values)].
- * It MUST be possible to combine the multiple header fields into one
- * "field-name: field-value" pair, without changing the semantics of
- * the message, by appending each subsequent field-value to the first,
- * each separated by a comma.
- */
- if (currentValue != null)
- {
- props.put(header.getName(), currentValue + "," +
header.getValue());
- }
- else
- {
- props.put(header.getName(), header.getValue());
- }
- }
-
- if (callProps != null)
- {
- Iterator it = callProps.entrySet().iterator();
-
- // Get authentication type, default to BASIC authetication
- String authType = (String)callProps.get(StubExt.PROPERTY_AUTH_TYPE);
- if (authType == null)
- authType = StubExt.PROPERTY_AUTH_TYPE_BASIC;
-
- while (it.hasNext())
- {
- Map.Entry entry = (Map.Entry)it.next();
- String key = (String)entry.getKey();
- Object val = entry.getValue();
-
- // pass properties to remoting meta data
- if (metadataMap.containsKey(key))
- {
- String remotingKey = metadataMap.get(key);
- if (key.equals(Stub.USERNAME_PROPERTY) ||
key.equals(Stub.PASSWORD_PROPERTY))
- {
- if (authType.equals(StubExt.PROPERTY_AUTH_TYPE_BASIC))
- {
- metadata.put(remotingKey, val);
- }
- else
- {
- log.warn("Ignore '" + key + "' with auth
typy: " + authType);
- }
- }
- else
- {
- metadata.put(remotingKey, val);
- }
- }
-
- // pass properties to remoting client config
- if (configMap.containsKey(key))
- {
- String remotingKey = configMap.get(key);
- config.put(remotingKey, val);
- }
- }
- }
-
- return metadata;
- }
-}
Deleted: branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPContentElement.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPContentElement.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPContentElement.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -1,1040 +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 org.jboss.logging.Logger;
-import org.jboss.ws.Constants;
-import org.jboss.ws.WSException;
-import org.jboss.ws.soap.attachment.SwapableMemoryDataSource;
-import org.jboss.ws.binding.BindingException;
-import org.jboss.ws.binding.DeserializerSupport;
-import org.jboss.ws.binding.SerializationContext;
-import org.jboss.ws.binding.SerializerSupport;
-import org.jboss.ws.core.CommonMessageContext;
-import org.jboss.ws.extras.xop.XOPContext;
-import org.jboss.ws.jaxrpc.TypeMappingImpl;
-import org.jboss.ws.jaxrpc.encoding.DeserializerFactoryBase;
-import org.jboss.ws.jaxrpc.encoding.NullValueSerializer;
-import org.jboss.ws.jaxrpc.encoding.SerializerFactoryBase;
-import org.jboss.ws.metadata.umdm.ParameterMetaData;
-import org.jboss.ws.metadata.umdm.UnifiedMetaData;
-import org.jboss.ws.utils.DOMUtils;
-import org.jboss.ws.utils.DOMWriter;
-import org.jboss.ws.utils.JavaUtils;
-import org.jboss.ws.utils.MimeUtils;
-import org.w3c.dom.*;
-
-import javax.xml.namespace.QName;
-import javax.xml.soap.Name;
-import javax.xml.soap.SOAPElement;
-import javax.xml.soap.SOAPException;
-import javax.activation.DataHandler;
-import javax.activation.DataSource;
-import java.io.IOException;
-import java.io.Writer;
-import java.io.InputStream;
-import java.io.ByteArrayOutputStream;
-import java.lang.reflect.Array;
-import java.lang.reflect.Method;
-import java.util.Iterator;
-
-/**
- * A SOAPElement that gives access to its content as XML fragment or Java object.
- *
- * The SOAPContentElement has three content representations, which may exist in
parallel.
- * The getter and setter of the content properties perform the conversions.
- * It is the responsibility of this objects to keep the representations in sync.
- *
- * +---------+ +-------------+ +-------------+
- * | Object | <-----> | XMLFragment | <-----> | DOMTree |
- * +---------+ +-------------+ +-------------+
- *
- * The idea is, that jaxrpc handlers can work with both the object and the dom view of
this SOAPElement.
- * Note, that state transitions may be expensive.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 13-Dec-2004
- */
-public class SOAPContentElement extends SOAPElementImpl
-{
- // provide logging
- private static Logger log = Logger.getLogger(SOAPContentElement.class);
-
- // The well formed XML content of this element.
- private String xmlFragment;
- // The java object content of this element.
- private Object objectValue;
- // True if the current DOM tree is valid
- private boolean isDOMValid;
- // True if the current content object is valid
- private boolean isObjectValid;
- // True while expanding to DOM
- private boolean expandingToDOM;
-
- // The associated parameter
- private ParameterMetaData paramMetaData;
-
- /** Construct a SOAPContentElement
- */
- public SOAPContentElement(Name name)
- {
- super(name);
- isDOMValid = true;
- }
-
- public SOAPContentElement(SOAPElementImpl element)
- {
- super(element);
- isDOMValid = true;
- }
-
- public ParameterMetaData getParamMetaData()
- {
- if (paramMetaData == null)
- throw new IllegalStateException("Parameter meta data not available");
-
- return paramMetaData;
- }
-
- public void setParamMetaData(ParameterMetaData paramMetaData)
- {
- this.paramMetaData = paramMetaData;
- }
-
- public QName getXmlType()
- {
- return getParamMetaData().getXmlType();
- }
-
- public Class getJavaType()
- {
- return getParamMetaData().getJavaType();
- }
-
- public boolean isDOMValid()
- {
- return isDOMValid;
- }
-
- public boolean isObjectValid()
- {
- return isObjectValid;
- }
-
- public boolean isFragmentValid()
- {
- return xmlFragment != null;
- }
-
- public String getXMLFragment()
- {
- // Serialize the valueContent
- if (xmlFragment == null && isObjectValid)
- {
- assertContentMapping();
-
- QName xmlType = getXmlType();
- Class javaType = getJavaType();
- log.debug("getXMLFragment from Object [xmlType=" + xmlType +
",javaType=" + javaType + "]");
-
- CommonMessageContext msgContext =
MessageContextAssociation.peekMessageContext();
- if (msgContext == null)
- throw new WSException("MessageContext not available");
-
- SerializationContext serContext = msgContext.getSerializationContext();
- serContext.setProperty(ParameterMetaData.class.getName(), getParamMetaData());
-
- TypeMappingImpl typeMapping = serContext.getTypeMapping();
-
- QName xmlName = getQName();
- try
- {
- SerializerSupport ser;
- if (objectValue != null)
- {
- SerializerFactoryBase serializerFactory =
getSerializerFactory(typeMapping, javaType, xmlType);
- ser = (SerializerSupport)serializerFactory.getSerializer();
- }
- else
- {
- ser = new NullValueSerializer();
- }
-
- xmlFragment = ser.serialize(xmlName, xmlType, getObjectValue(), serContext,
null);
- log.debug("xmlFragment: " + xmlFragment);
- invalidateObjectContent();
- }
- catch (BindingException e)
- {
- throw new WSException(e);
- }
- }
-
- // Generate the xmlFragment from the DOM tree
- else if (xmlFragment == null && isDOMValid)
- {
- log.debug("getXMLFragment from DOM");
- xmlFragment = DOMWriter.printNode(this, false);
- log.debug("xmlFragment: " + xmlFragment);
- invalidateDOMContent();
- }
-
- if (xmlFragment == null || xmlFragment.startsWith("<") == false)
- throw new WSException("Invalid XMLFragment: " + xmlFragment);
-
- return xmlFragment;
- }
-
- public void setXMLFragment(String xmlFragment)
- {
- log.debug("setXMLFragment: " + xmlFragment);
-
- if (xmlFragment == null || xmlFragment.startsWith("<") == false)
- throw new WSException("Invalid XMLFragment: " + xmlFragment);
-
- removeContentsAsIs();
- resetElementContent();
-
- this.xmlFragment = xmlFragment;
- invalidateDOMContent();
- invalidateObjectContent();
- }
-
- public Object getObjectValue()
- {
- if (isObjectValid == false)
- {
- QName xmlType = getXmlType();
- Class javaType = getJavaType();
-
- log.debug("getObjectValue [xmlType=" + xmlType +
",javaType=" + javaType + "]");
- assertContentMapping();
-
- CommonMessageContext msgContext =
MessageContextAssociation.peekMessageContext();
- if (msgContext == null)
- throw new WSException("MessageContext not available");
-
- SerializationContext serContext = msgContext.getSerializationContext();
- serContext.setProperty(ParameterMetaData.class.getName(), getParamMetaData());
-
- try
- {
- // Get the deserializer from the type mapping
- TypeMappingImpl typeMapping = serContext.getTypeMapping();
- DeserializerFactoryBase deserializerFactory =
getDeserializerFactory(typeMapping, javaType, xmlType);
- DeserializerSupport des =
(DeserializerSupport)deserializerFactory.getDeserializer();
-
- String strContent = getXMLFragment();
-
- Object obj = des.deserialize(getQName(), xmlType, strContent, serContext);
- if (obj != null)
- {
- Class objType = obj.getClass();
- boolean isAssignable = JavaUtils.isAssignableFrom(javaType, objType);
- if (isAssignable == false && javaType.isArray())
- {
- try
- {
- Method toArrayMethod = objType.getMethod("toArray", new
Class[] {});
- Class returnType = toArrayMethod.getReturnType();
- if (JavaUtils.isAssignableFrom(javaType, returnType))
- {
- Method getValueMethod = objType.getMethod("getValue",
new Class[] {});
- Object value = getValueMethod.invoke(obj, new Object[] {});
- if (value != null)
- {
- // Do not invoke toArray if getValue returns null
- obj = toArrayMethod.invoke(obj, new Object[] {});
- }
- else
- {
- // if the fragment did not indicate a null return
- // by an xsi:nil we return an empty array
- Class componentType = javaType.getComponentType();
- obj = Array.newInstance(componentType, 0);
- }
- isAssignable = true;
- }
- }
- catch (Exception e)
- {
- // ignore
- }
- }
-
- if (isAssignable == false)
- {
- // handle XOP simple types, i.e. in RPC/LIT
- try
- {
- String contentType = MimeUtils.resolveMimeType(javaType);
- log.debug("Adopt DataHandler to " + javaType +",
contentType "+ contentType);
-
- DataSource ds = new
SwapableMemoryDataSource(((DataHandler)obj).getInputStream(), contentType);
- DataHandler dh = new DataHandler(ds);
- obj = dh.getContent();
-
- // 'application/octet-stream' will return a byte[] instead
fo the stream
- if(obj instanceof InputStream)
- {
- ByteArrayOutputStream bout = new ByteArrayOutputStream();
- dh.writeTo(bout);
- obj = bout.toByteArray();
- }
- }
- catch (IOException e)
- {
- throw new WSException("Failed to adopt XOP content type",
e);
- }
-
- if(!JavaUtils.isAssignableFrom(javaType, obj.getClass()))
- {
- throw new WSException("Java type '" + javaType +
"' is not assignable from: " + objType.getName());
- }
- }
- }
-
- this.objectValue = obj;
- this.isObjectValid = true;
- }
- catch (BindingException e)
- {
- throw new WSException(e);
- }
-
- log.debug("objectValue: " + (objectValue != null ?
objectValue.getClass().getName() : null));
- }
-
- return objectValue;
- }
-
- public void setObjectValue(Object objValue)
- {
- log.debug("setObjectValue: " + objValue);
- removeContentsAsIs();
- resetElementContent();
- this.objectValue = objValue;
- this.isObjectValid = true;
- }
-
- private void removeContentsAsIs()
- {
- log.trace("removeContentsAsIs");
- boolean cachedFlag = isDOMValid;
- try
- {
- this.isDOMValid = true;
- super.removeContents();
- }
- finally
- {
- this.isDOMValid = cachedFlag;
- }
- }
-
- // Get the serializer factory for a given javaType and xmlType
- private SerializerFactoryBase getSerializerFactory(TypeMappingImpl typeMapping, Class
javaType, QName xmlType)
- {
- SerializerFactoryBase serializerFactory =
(SerializerFactoryBase)typeMapping.getSerializer(javaType, xmlType);
-
- // The type mapping might contain a mapping for the array wrapper bean
- if (serializerFactory == null && javaType.isArray())
- {
- Class arrayWrapperType = typeMapping.getJavaType(xmlType);
- if (arrayWrapperType != null)
- {
- try
- {
- Method toArrayMethod = arrayWrapperType.getMethod("toArray", new
Class[] {});
- Class returnType = toArrayMethod.getReturnType();
- if (JavaUtils.isAssignableFrom(javaType, returnType))
- {
- serializerFactory =
(SerializerFactoryBase)typeMapping.getSerializer(arrayWrapperType, xmlType);
- }
- }
- catch (NoSuchMethodException e)
- {
- // ignore
- }
- }
- }
-
- if (serializerFactory == null)
- throw new WSException("Cannot obtain serializer factory for:
[xmlType=" + xmlType + ",javaType=" + javaType + "]");
-
- return serializerFactory;
- }
-
- // Get the deserializer factory for a given javaType and xmlType
- private DeserializerFactoryBase getDeserializerFactory(TypeMappingImpl typeMapping,
Class javaType, QName xmlType)
- {
- DeserializerFactoryBase deserializerFactory =
(DeserializerFactoryBase)typeMapping.getDeserializer(javaType, xmlType);
-
- // The type mapping might contain a mapping for the array wrapper bean
- if (deserializerFactory == null && javaType.isArray())
- {
- Class arrayWrapperType = typeMapping.getJavaType(xmlType);
- if (arrayWrapperType != null)
- {
- try
- {
- Method toArrayMethod = arrayWrapperType.getMethod("toArray", new
Class[] {});
- Class returnType = toArrayMethod.getReturnType();
- if (JavaUtils.isAssignableFrom(javaType, returnType))
- {
- deserializerFactory =
(DeserializerFactoryBase)typeMapping.getDeserializer(arrayWrapperType, xmlType);
- }
- }
- catch (NoSuchMethodException e)
- {
- // ignore
- }
- }
- }
-
- if (deserializerFactory == null)
- throw new WSException("Cannot obtain deserializer factory for:
[xmlType=" + xmlType + ",javaType=" + javaType + "]");
-
- return deserializerFactory;
- }
-
- /** Assert the notNull state of the xmlType and javaType
- */
- private void assertContentMapping()
- {
- if (getJavaType() == null)
- throw new WSException("javaType cannot be null");
- if (getXmlType() == null)
- throw new WSException("xmlType cannot be null");
- }
-
- // SOAPElement interface
********************************************************************************************
-
- public SOAPElement addChildElement(SOAPElement child) throws SOAPException
- {
- log.trace("addChildElement: " + child);
- expandToDOM();
- SOAPElement soapElement = super.addChildElement(child);
- invalidateObjectContent();
- invalidateXMLContent();
- return soapElement;
- }
-
- public SOAPElement addChildElement(String localName, String prefix) throws
SOAPException
- {
- log.trace("addChildElement: [localName=" + localName +
",prefix=" + prefix + "]");
- expandToDOM();
- SOAPElement soapElement = super.addChildElement(localName, prefix);
- invalidateObjectContent();
- invalidateXMLContent();
- return soapElement;
- }
-
- public SOAPElement addChildElement(String localName, String prefix, String uri) throws
SOAPException
- {
- log.trace("addChildElement: [localName=" + localName +
",prefix=" + prefix + ",uri=" + uri + "]");
- expandToDOM();
- SOAPElement soapElement = super.addChildElement(localName, prefix, uri);
- invalidateObjectContent();
- invalidateXMLContent();
- return soapElement;
- }
-
- public SOAPElement addChildElement(Name name) throws SOAPException
- {
- log.trace("addChildElement: [name=" + name + "]");
- expandToDOM();
- SOAPElement soapElement = super.addChildElement(name);
- invalidateObjectContent();
- invalidateXMLContent();
- return soapElement;
- }
-
- public SOAPElement addChildElement(String name) throws SOAPException
- {
- log.trace("addChildElement: [name=" + name + "]");
- expandToDOM();
- SOAPElement soapElement = super.addChildElement(name);
- invalidateObjectContent();
- invalidateXMLContent();
- return soapElement;
- }
-
- public SOAPElement addTextNode(String value) throws SOAPException
- {
- log.trace("addTextNode: [value=" + value + "]");
- expandToDOM();
- SOAPElement soapElement = super.addTextNode(value);
- invalidateObjectContent();
- invalidateXMLContent();
- return soapElement;
- }
-
- public Iterator getChildElements()
- {
- log.trace("getChildElements");
- expandToDOM();
- return super.getChildElements();
- }
-
- public Iterator getChildElements(Name name)
- {
- log.trace("getChildElements: [name=" + name + "]");
- expandToDOM();
- return super.getChildElements(name);
- }
-
- public void removeContents()
- {
- log.trace("removeContents");
- expandToDOM();
- super.removeContents();
- invalidateObjectContent();
- invalidateXMLContent();
- }
-
- public Iterator getAllAttributes()
- {
- return super.getAllAttributes();
- }
-
- public String getAttribute(String name)
- {
- return super.getAttribute(name);
- }
-
- public Attr getAttributeNode(String name)
- {
- return super.getAttributeNode(name);
- }
-
- public Attr getAttributeNodeNS(String namespaceURI, String localName)
- {
- return super.getAttributeNodeNS(namespaceURI, localName);
- }
-
- public String getAttributeNS(String namespaceURI, String localName)
- {
- return super.getAttributeNS(namespaceURI, localName);
- }
-
- public String getAttributeValue(Name name)
- {
- return super.getAttributeValue(name);
- }
-
- public SOAPElement addAttribute(Name name, String value) throws SOAPException
- {
- log.trace("addAttribute: [name=" + name + ",value=" + value +
"]");
- expandToDOM();
- return super.addAttribute(name, value);
- }
-
- public SOAPElement addNamespaceDeclaration(String prefix, String nsURI)
- {
- log.trace("addNamespaceDeclaration: [prefix=" + prefix +
",nsURI=" + nsURI + "]");
- expandToDOM();
- return super.addNamespaceDeclaration(prefix, nsURI);
- }
-
- public Name getElementName()
- {
- return super.getElementName();
- }
-
- public NodeList getElementsByTagName(String name)
- {
- log.trace("getElementsByTagName: [name=" + name + "]");
- expandToDOM();
- return super.getElementsByTagName(name);
- }
-
- public NodeList getElementsByTagNameNS(String namespaceURI, String localName)
- {
- log.trace("getElementsByTagName: [nsURI=" + namespaceURI +
",localName=" + localName + "]");
- expandToDOM();
- return super.getElementsByTagNameNS(namespaceURI, localName);
- }
-
- public String getEncodingStyle()
- {
- return super.getEncodingStyle();
- }
-
- public Iterator getNamespacePrefixes()
- {
- return super.getNamespacePrefixes();
- }
-
- public String getNamespaceURI(String prefix)
- {
- return super.getNamespaceURI(prefix);
- }
-
- public TypeInfo getSchemaTypeInfo()
- {
- return super.getSchemaTypeInfo();
- }
-
- public String getTagName()
- {
- return super.getTagName();
- }
-
- public Iterator getVisibleNamespacePrefixes()
- {
- return super.getVisibleNamespacePrefixes();
- }
-
- public boolean hasAttribute(String name)
- {
- return super.hasAttribute(name);
- }
-
- public boolean hasAttributeNS(String namespaceURI, String localName)
- {
- return super.hasAttributeNS(namespaceURI, localName);
- }
-
- public boolean removeAttribute(Name name)
- {
- log.trace("removeAttribute: " + name.getQualifiedName());
- expandToDOM();
- return super.removeAttribute(name);
- }
-
- public void removeAttribute(String name) throws DOMException
- {
- log.trace("removeAttribute: " + name);
- expandToDOM();
- super.removeAttribute(name);
- }
-
- public Attr removeAttributeNode(Attr oldAttr) throws DOMException
- {
- log.trace("removeAttribute: " + oldAttr.getNodeName());
- expandToDOM();
- return super.removeAttributeNode(oldAttr);
- }
-
- public void removeAttributeNS(String namespaceURI, String localName) throws
DOMException
- {
- log.trace("removeAttributeNS: {" + namespaceURI + "}" +
localName);
- expandToDOM();
- super.removeAttributeNS(namespaceURI, localName);
- }
-
- public boolean removeNamespaceDeclaration(String prefix)
- {
- log.trace("removeNamespaceDeclaration: " + prefix);
- expandToDOM();
- return super.removeNamespaceDeclaration(prefix);
- }
-
- public void setAttribute(String name, String value) throws DOMException
- {
- log.trace("setAttribute: [name=" + name + ",value=" + value +
"]");
- expandToDOM();
- super.setAttribute(name, value);
- }
-
- public Attr setAttributeNode(Attr newAttr) throws DOMException
- {
- log.trace("setAttributeNode: " + newAttr);
- expandToDOM();
- return super.setAttributeNode(newAttr);
- }
-
- public Attr setAttributeNodeNS(Attr newAttr) throws DOMException
- {
- log.trace("setAttributeNodeNS: " + newAttr);
- expandToDOM();
- return super.setAttributeNodeNS(newAttr);
- }
-
- public void setAttributeNS(String namespaceURI, String qualifiedName, String value)
throws DOMException
- {
- log.trace("setAttribute: [nsURI=" + namespaceURI + ",name=" +
qualifiedName + ",value=" + value + "]");
- expandToDOM();
- super.setAttributeNS(namespaceURI, qualifiedName, value);
- }
-
- public void setEncodingStyle(String encodingStyle) throws SOAPException
- {
- super.setEncodingStyle(encodingStyle);
- }
-
- public void setIdAttribute(String name, boolean isId) throws DOMException
- {
- log.trace("setIdAttribute: [name=" + name + ",value=" + isId +
"]");
- expandToDOM();
- super.setIdAttribute(name, isId);
- }
-
- public void setIdAttributeNode(Attr idAttr, boolean isId) throws DOMException
- {
- log.trace("setIdAttributeNode: [idAttr=" + idAttr + ",value=" +
isId + "]");
- expandToDOM();
- super.setIdAttributeNode(idAttr, isId);
- }
-
- public void setIdAttributeNS(String namespaceURI, String localName, boolean isId)
throws DOMException
- {
- log.trace("setIdAttributeNS: [nsURI=" + namespaceURI + ",name="
+ localName + ",value=" + isId + "]");
- expandToDOM();
- super.setIdAttributeNS(namespaceURI, localName, isId);
- }
-
- // Node interface
**************************************************************************************************
-
- public Node appendChild(Node newChild) throws DOMException
- {
- log.trace("appendChild: " + newChild);
- expandToDOM();
- Node node = super.appendChild(newChild);
- invalidateObjectContent();
- invalidateXMLContent();
- return node;
- }
-
- public Node cloneNode(boolean deep)
- {
- log.trace("cloneNode: deep=" + deep);
- expandToDOM();
- return super.cloneNode(deep);
- }
-
- public NodeList getChildNodes()
- {
- log.trace("getChildNodes");
- expandToDOM();
- return super.getChildNodes();
- }
-
- public Node getFirstChild()
- {
- log.trace("getFirstChild");
- expandToDOM();
- return super.getFirstChild();
- }
-
- public Node getLastChild()
- {
- log.trace("getLastChild");
- expandToDOM();
- return super.getLastChild();
- }
-
- public String getValue()
- {
- log.trace("getValue");
- expandToDOM();
- return super.getValue();
- }
-
- public boolean hasChildNodes()
- {
- log.trace("hasChildNodes");
- expandToDOM();
- return super.hasChildNodes();
- }
-
- public Node removeChild(Node oldChild) throws DOMException
- {
- log.trace("removeChild: " + oldChild);
- expandToDOM();
- Node node = super.removeChild(oldChild);
- invalidateObjectContent();
- invalidateXMLContent();
- return node;
- }
-
- public Node replaceChild(Node newChild, Node oldChild) throws DOMException
- {
- log.trace("replaceChild: [new=" + newChild + ",old=" + oldChild
+ "]");
- expandToDOM();
- Node node = super.replaceChild(newChild, oldChild);
- invalidateObjectContent();
- invalidateXMLContent();
- return node;
- }
-
- public void setValue(String value)
- {
- log.trace("setValue: " + value);
- expandToDOM();
- super.setValue(value);
- invalidateObjectContent();
- invalidateXMLContent();
- }
-
- public NamedNodeMap getAttributes()
- {
- return super.getAttributes();
- }
-
- public boolean hasAttributes()
- {
- return super.hasAttributes();
- }
-
- // END Node interface
***********************************************************************************************
-
- /** Expand the content, generating appropriate child nodes
- */
- private void expandToDOM()
- {
- // SOAPContentElements should only be expanded when handlers do require it.
- if (isDOMValid == false && expandingToDOM == false)
- {
- log.trace("BEGIN: expandToDOM " + getElementName());
- expandingToDOM = true;
-
- // DOM expansion should only happen when a handler accesses the DOM API.
- CommonMessageContext msgContext =
MessageContextAssociation.peekMessageContext();
- if (msgContext != null && !UnifiedMetaData.isFinalRelease())
- {
- Boolean allowExpand =
(Boolean)msgContext.getProperty(CommonMessageContext.ALLOW_EXPAND_TO_DOM);
- if (Boolean.TRUE.equals(allowExpand) == false)
- throw new WSException("Expanding content element to DOM");
- }
-
- try
- {
- if (xmlFragment == null && isObjectValid)
- xmlFragment = getXMLFragment();
-
- if (xmlFragment == null && isObjectValid == false)
- throw new IllegalStateException("Neither DOM, nor XML, nor Object
valid");
-
- if (xmlFragment != null)
- {
- String wrappedXMLFragment =
insertNamespaceDeclarations("<wrapper>" + xmlFragment +
"</wrapper>");
- Element contentRoot = DOMUtils.parse(wrappedXMLFragment);
- contentRoot = DOMUtils.getFirstChildElement(contentRoot);
-
- String rootLocalName = contentRoot.getLocalName();
- String rootPrefix = contentRoot.getPrefix();
- String rootNS = contentRoot.getNamespaceURI();
- Name contentRootName = new NameImpl(rootLocalName, rootPrefix, rootNS);
-
- // Make sure the content root element name matches this element name
- Name name = getElementName();
- if (contentRootName.equals(name) == false)
- throw new WSException("Content root name does not match element
name: " + contentRootName + " != " + name);
-
- // Copy attributes
- DOMUtils.copyAttributes(this, contentRoot);
-
- SOAPFactoryImpl soapFactory = new SOAPFactoryImpl();
-
- NodeList nlist = contentRoot.getChildNodes();
- for (int i = 0; i < nlist.getLength(); i++)
- {
- Node child = nlist.item(i);
- short childType = child.getNodeType();
- if (childType == Node.ELEMENT_NODE)
- {
- SOAPElementImpl soapElement =
soapFactory.createElement((Element)child, true);
- super.addChildElement(soapElement);
- if (Constants.NAME_XOP_INCLUDE.equals(name) || isXOPParameter())
- XOPContext.inlineXOPData(soapElement);
- }
- else if (childType == Node.TEXT_NODE)
- {
- String nodeValue = child.getNodeValue();
- super.addTextNode(nodeValue);
- }
- else if (childType == Node.CDATA_SECTION_NODE)
- {
- String nodeValue = child.getNodeValue();
- super.addTextNode(nodeValue);
- }
- else
- {
- log.trace("Ignore child type: " + childType);
- }
- }
- }
-
- isDOMValid = true;
- }
- catch (RuntimeException e)
- {
- invalidateDOMContent();
- throw e;
- }
- catch (Exception e)
- {
- invalidateDOMContent();
- throw new WSException(e);
- }
- finally
- {
- expandingToDOM = false;
- log.trace("END: expandToDOM " + getElementName());
- }
-
- invalidateXMLContent();
- invalidateObjectContent();
- }
- }
-
- public String insertNamespaceDeclarations(String xmlfragment)
- {
- StringBuilder xmlBuffer = new StringBuilder(xmlfragment);
-
- int endIndex = xmlfragment.indexOf(">");
- int insIndex = endIndex;
- if (xmlfragment.charAt(insIndex - 1) == '/')
- insIndex = insIndex - 1;
-
- SOAPElement soapElement = this;
- while (soapElement != null)
- {
- Iterator it = soapElement.getNamespacePrefixes();
- while (it.hasNext())
- {
- String prefix = (String)it.next();
- String nsURI = soapElement.getNamespaceURI(prefix);
- String nsDecl = " xmlns:" + prefix + "='" + nsURI +
"'";
-
- // Make sure there is not a duplicate on just the wrapper tag
- int nsIndex = xmlBuffer.indexOf("xmlns:" + prefix);
- if (nsIndex < 0 || nsIndex > endIndex)
- {
- xmlBuffer.insert(insIndex, nsDecl);
- endIndex += nsDecl.length();
- }
- }
- soapElement = soapElement.getParentElement();
- }
-
- log.trace("insertNamespaceDeclarations: " + xmlBuffer);
- return xmlBuffer.toString();
- }
-
- private void invalidateDOMContent()
- {
- if (expandingToDOM == false)
- {
- log.trace("invalidateDOMContent");
- this.isDOMValid = false;
- }
- }
-
- private void invalidateObjectContent()
- {
- if (expandingToDOM == false)
- {
- log.trace("invalidateObjectContent");
- this.isObjectValid = false;
- this.objectValue = null;
- }
- }
-
- private void invalidateXMLContent()
- {
- if (expandingToDOM == false)
- {
- log.trace("invalidateXMLContent");
- this.xmlFragment = null;
- }
- }
-
- private void resetElementContent()
- {
- if (expandingToDOM == false)
- {
- log.trace("resetElementContent");
- invalidateDOMContent();
- invalidateObjectContent();
- invalidateXMLContent();
- }
- }
-
- public void writeElement(Writer writer) throws IOException
- {
- handleMTOMTransitions();
-
- if (isDOMValid)
- {
- new DOMWriter(writer).print(this);
- }
- else
- {
- writer.write(getXMLFragment());
- }
- }
-
- /**
- * When a SOAPContentElement transitions between dom-valid and xml-valid
- * the XOP elements need to transition from XOP optimized to base64 and
reverse.<p>
- *
- * If MTOM is disabled through a message context property we always enforce the
- * base64 representation by expanding to DOM, the same happens when a JAXRPC handler
- * accesses the SOAPContentElement.<p>
- *
- * If the element is in dom-valid state (because a handlers accessed it), upon
marshalling
- * it's needs to be decided wether or not the <code>xop:Include</code>
should be restored.
- * This as well depends upon the message context property.
- */
- public void handleMTOMTransitions()
- {
- // MTOM processing is only required on XOP parameters
- if( isXOPParameter() == false)
- return;
-
- if ( !XOPContext.isMTOMEnabled() )
- {
- // If MTOM is disabled, we force dom expansion on XOP parameters.
- // This will inline any XOP include element and remove the attachment part.
- // See SOAPFactoryImpl for details.
-
- log.debug("MTOM disabled: Force inline XOP data");
- CommonMessageContext msgContext =
MessageContextAssociation.peekMessageContext();
- msgContext.setProperty(CommonMessageContext.ALLOW_EXPAND_TO_DOM, Boolean.TRUE);
- expandToDOM();
- }
- else if ( isDOMValid && XOPContext.isMTOMEnabled() )
- {
- // When the DOM representation is valid,
- // but MTOM is enabled we need to convert the inlined
- // element back to an xop:Include element and create the attachment part
-
- log.debug("MTOM enabled: Restore XOP data");
- XOPContext.restoreXOPDataDOM(this);
- }
- }
-
- private boolean isXOPParameter()
- {
- return paramMetaData != null && paramMetaData.isXOP();
- }
-
- public void accept(SAAJVisitor visitor)
- {
- visitor.visitSOAPContentElement(this);
- }
-}
Deleted: branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPDocument.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPDocument.java 2006-12-06
00:32:54 UTC (rev 1560)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPDocument.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -1,440 +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 org.jboss.ws.utils.DOMUtils;
-import org.w3c.dom.Attr;
-import org.w3c.dom.CDATASection;
-import org.w3c.dom.Comment;
-import org.w3c.dom.DOMConfiguration;
-import org.w3c.dom.DOMException;
-import org.w3c.dom.DOMImplementation;
-import org.w3c.dom.Document;
-import org.w3c.dom.DocumentFragment;
-import org.w3c.dom.DocumentType;
-import org.w3c.dom.Element;
-import org.w3c.dom.EntityReference;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.w3c.dom.ProcessingInstruction;
-import org.w3c.dom.Text;
-import org.w3c.dom.UserDataHandler;
-
-/**
- * <code>SOAPDocument</code> ensures that the propper SAAJ elements are
- * returned when Document calls are made from a DOM client. This implementation
- * enscapsulates a single ThreadLocal Document object.
- *
- * @author <a href="mailto:jason.greene@jboss.com">Jason T.
Greene</a>
- * @version $Revision$
- */
-public class SOAPDocument implements Document
-{
- // TODO Revisit methods that are restricted or not implemented.
-
- private Document doc = DOMUtils.getOwnerDocument();
-
- // Document methods
-
- public DocumentType getDoctype()
- {
- return doc.getDoctype();
- }
-
- public DOMImplementation getImplementation()
- {
- // Should this be allowed?
- return doc.getImplementation();
- }
-
- public Element getDocumentElement()
- {
- // The base SOAPDocument does not have an element, only SOAPPart will
- return null;
- }
-
- public Element createElement(String tagName) throws DOMException
- {
- return new SOAPElementImpl(tagName);
- }
-
- public DocumentFragment createDocumentFragment()
- {
- return doc.createDocumentFragment();
- }
-
- public Text createTextNode(String data)
- {
- return doc.createTextNode(data);
- }
-
- public Comment createComment(String data)
- {
- return doc.createComment(data);
- }
-
- public CDATASection createCDATASection(String data) throws DOMException
- {
- return createCDATASection(data);
- }
-
- public ProcessingInstruction createProcessingInstruction(String target, String data)
throws DOMException
- {
- return createProcessingInstruction(target, data);
- }
-
- public Attr createAttribute(String name) throws DOMException
- {
- return doc.createAttribute(name);
- }
-
- public EntityReference createEntityReference(String name) throws DOMException
- {
- // Not allowed
- return null;
- }
-
- public NodeList getElementsByTagName(String tagname)
- {
- // The base SOAPDocument does not have an element, only SOAPPart will
- return null;
- }
-
- public Node importNode(Node importedNode, boolean deep) throws DOMException
- {
- // This should never be needed
- return doc.importNode(importedNode, deep);
- }
-
- public Element createElementNS(String namespaceURI, String qualifiedName) throws
DOMException
- {
- int loc = qualifiedName.indexOf(":");
-
- if (loc == -1)
- return new SOAPElementImpl(qualifiedName, null, namespaceURI);
-
- if (loc == qualifiedName.length() - 1)
- throw new IllegalArgumentException("Invalid qualified name");
-
- return new SOAPElementImpl(qualifiedName.substring(loc + 1),
qualifiedName.substring(0, loc), namespaceURI);
- }
-
- public Attr createAttributeNS(String namespaceURI, String qualifiedName) throws
DOMException
- {
- return doc.createAttributeNS(namespaceURI, qualifiedName);
- }
-
- public NodeList getElementsByTagNameNS(String namespaceURI, String localName)
- {
- // The base SOAPDocument does not have an element, only SOAPPart will
- return null;
- }
-
- public Element getElementById(String elementId)
- {
- // The base SOAPDocument does not have an element, only SOAPPart will
- return null;
- }
-
- // Node methods
- public String getNodeName()
- {
- return doc.getNodeName();
- }
-
- public String getNodeValue() throws DOMException
- {
- throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Node operations not
allowed on SOAPDocument");
- }
-
- public void setNodeValue(String nodeValue) throws DOMException
- {
- throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Node operations not
allowed on SOAPDocument");
- }
-
- public short getNodeType()
- {
- return doc.getNodeType();
- }
-
- public Node getParentNode()
- {
- throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Node operations not
allowed on SOAPDocument");
- }
-
- public NodeList getChildNodes()
- {
- throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Node operations not
allowed on SOAPDocument");
- }
-
- public Node getFirstChild()
- {
- throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Node operations not
allowed on SOAPDocument");
- }
-
- public Node getLastChild()
- {
- throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Node operations not
allowed on SOAPDocument");
- }
-
- public Node getPreviousSibling()
- {
- throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Node operations not
allowed on SOAPDocument");
- }
-
- public Node getNextSibling()
- {
- throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Node operations not
allowed on SOAPDocument");
- }
-
- public NamedNodeMap getAttributes()
- {
- throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Node operations not
allowed on SOAPDocument");
- }
-
- public Document getOwnerDocument()
- {
- throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Node operations not
allowed on SOAPDocument");
- }
-
- public Node insertBefore(Node newChild, Node refChild) throws DOMException
- {
- throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Node operations not
allowed on SOAPDocument");
- }
-
- public Node replaceChild(Node newChild, Node oldChild) throws DOMException
- {
- throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Node operations not
allowed on SOAPDocument");
- }
-
- public Node removeChild(Node oldChild) throws DOMException
- {
- throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Node operations not
allowed on SOAPDocument");
- }
-
- public Node appendChild(Node newChild) throws DOMException
- {
- throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Node operations not
allowed on SOAPDocument");
- }
-
- public boolean hasChildNodes()
- {
- throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Node operations not
allowed on SOAPDocument");
- }
-
- public Node cloneNode(boolean deep)
- {
- throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Node operations not
allowed on SOAPDocument");
- }
-
- public void normalize()
- {
- throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Node operations not
allowed on SOAPDocument");
- }
-
- public boolean isSupported(String feature, String version)
- {
- throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Node operations not
allowed on SOAPDocument");
- }
-
- public String getNamespaceURI()
- {
- throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Node operations not
allowed on SOAPDocument");
- }
-
- public String getPrefix()
- {
- throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Node operations not
allowed on SOAPDocument");
- }
-
- public void setPrefix(String prefix) throws DOMException
- {
- throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Node operations not
allowed on SOAPDocument");
- }
-
- public String getLocalName()
- {
- throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Node operations not
allowed on SOAPDocument");
- }
-
- public boolean hasAttributes()
- {
- throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Node operations not
allowed on SOAPDocument");
- }
-
- // DOM3 methods
-
- public String getInputEncoding()
- {
- // FIXME getInputEncoding
- return null;
- }
-
- public String getXmlEncoding()
- {
- // FIXME getXmlEncoding
- return null;
- }
-
- public boolean getXmlStandalone()
- {
- // FIXME getXmlStandalone
- return false;
- }
-
- public void setXmlStandalone(boolean arg0) throws DOMException
- {
- // FIXME setXmlStandalone
- }
-
- public String getXmlVersion()
- {
- // FIXME getXmlVersion
- return null;
- }
-
- public void setXmlVersion(String arg0) throws DOMException
- {
- // FIXME setXmlVersion
- }
-
- public boolean getStrictErrorChecking()
- {
- // FIXME getStrictErrorChecking
- return false;
- }
-
- public void setStrictErrorChecking(boolean arg0)
- {
- // FIXME setStrictErrorChecking
-
- }
-
- public String getDocumentURI()
- {
- // FIXME getDocumentURI
- return null;
- }
-
- public void setDocumentURI(String arg0)
- {
- // FIXME setDocumentURI
-
- }
-
- public Node adoptNode(Node arg0) throws DOMException
- {
- // FIXME adoptNode
- return null;
- }
-
- public DOMConfiguration getDomConfig()
- {
- // FIXME getDomConfig
- return null;
- }
-
- public void normalizeDocument()
- {
- // FIXME normalizeDocument
-
- }
-
- public Node renameNode(Node arg0, String arg1, String arg2) throws DOMException
- {
- // FIXME renameNode
- return null;
- }
-
- public String getBaseURI()
- {
- // FIXME getBaseURI
- return null;
- }
-
- public short compareDocumentPosition(Node arg0) throws DOMException
- {
- // FIXME compareDocumentPosition
- return 0;
- }
-
- public String getTextContent() throws DOMException
- {
- // FIXME getTextContent
- return null;
- }
-
- public void setTextContent(String arg0) throws DOMException
- {
- // FIXME setTextContent
-
- }
-
- public boolean isSameNode(Node arg0)
- {
- // FIXME isSameNode
- return false;
- }
-
- public String lookupPrefix(String arg0)
- {
- // FIXME lookupPrefix
- return null;
- }
-
- public boolean isDefaultNamespace(String arg0)
- {
- // FIXME isDefaultNamespace
- return false;
- }
-
- public String lookupNamespaceURI(String arg0)
- {
- // FIXME lookupNamespaceURI
- return null;
- }
-
- public boolean isEqualNode(Node arg0)
- {
- // FIXME isEqualNode
- return false;
- }
-
- public Object getFeature(String arg0, String arg1)
- {
- // FIXME getFeature
- return null;
- }
-
- public Object setUserData(String arg0, Object arg1, UserDataHandler arg2)
- {
- // FIXME setUserData
- return null;
- }
-
- public Object getUserData(String arg0)
- {
- // FIXME getUserData
- return null;
- }
-}
\ No newline at end of file
Deleted: branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPElementImpl.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPElementImpl.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPElementImpl.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -1,738 +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 java.io.IOException;
-import java.io.Writer;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import javax.xml.namespace.QName;
-import javax.xml.soap.Name;
-import javax.xml.soap.Node;
-import javax.xml.soap.SOAPElement;
-import javax.xml.soap.SOAPEnvelope;
-import javax.xml.soap.SOAPException;
-import javax.xml.soap.Text;
-
-import org.jboss.logging.Logger;
-import org.jboss.util.NotImplementedException;
-import org.jboss.ws.utils.DOMUtils;
-import org.jboss.ws.Constants;
-import org.jboss.ws.WSException;
-import org.w3c.dom.Attr;
-import org.w3c.dom.DOMException;
-import org.w3c.dom.Element;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.NodeList;
-import org.w3c.dom.TypeInfo;
-
-/**
- * An object representing an element of a SOAP message that is allowed but not
specifically prescribed by a
- * SOAP specification. This interface serves as the base interface for those objects that
are specifically
- * prescribed by a SOAP specification.
- *
- * Methods in this interface that are required to return SAAJ specific objects may
"silently" replace nodes
- * in the tree as required to successfully return objects of the correct type.
- *
- * @author Thomas.Diesler(a)jboss.org
- */
-public class SOAPElementImpl extends NodeImpl implements SOAPElement, SAAJVisitable
-{
- // provide logging
- private static Logger log = Logger.getLogger(SOAPElementImpl.class);
-
- // The org.w3c.dom.Element
- private Element element;
- // The element name
- private Name elementName;
- // The element's encoding style
- private String encodingStyle = Constants.URI_LITERAL_ENC;
-
- /** Called by SOAPFactory */
- public SOAPElementImpl(String localPart)
- {
-
- super(DOMUtils.createElement(localPart, null, null));
- this.element = (Element)domNode;
- log.trace("new SOAPElementImpl: " + getElementName());
- }
-
- /** Called by SOAPFactory */
- public SOAPElementImpl(String localPart, String prefix, String nsURI)
- {
- super(DOMUtils.createElement(localPart, prefix, nsURI));
- this.element = (Element)domNode;
- log.trace("new SOAPElementImpl: " + getElementName());
- }
-
- /** Called by SOAPFactory */
- public SOAPElementImpl(Name name)
- {
- this(name.getLocalName(), name.getPrefix(), name.getURI());
- }
-
- /** Copy constructor for converting SOAPElement types
- */
- protected SOAPElementImpl(SOAPElementImpl element)
- {
- super(element);
- this.element = (Element)domNode;
- log.trace("new SOAPElementImpl: " + getElementName());
- }
-
- /** Get the SOAPEnvelope for this SOAPElement */
- public SOAPEnvelope getSOAPEnvelope()
- {
- SOAPElement soapElement = this;
- while (soapElement != null && (soapElement instanceof SOAPEnvelope) ==
false)
- soapElement = soapElement.getParentElement();
-
- return (SOAPEnvelope)soapElement;
- }
-
- // javax.xml.soap.SOAPElement
*************************************************************************************
-
- /**
- * Adds an attribute with the specified name and value to this SOAPElement object.
- *
- * @param name a Name object with the name of the attribute
- * @param value a String giving the value of the attribute
- * @return the SOAPElement object into which the attribute was inserted
- * @throws javax.xml.soap.SOAPException if there is an error in creating the
Attribute
- */
- public SOAPElement addAttribute(Name name, String value) throws SOAPException
- {
- // xml:lang='en'
- if ("xml".equals(name.getPrefix()))
- {
- setAttribute(name.getQualifiedName(), value);
- }
- else
- {
- setAttributeNS(name.getURI(), name.getQualifiedName(), value);
- }
- return this;
- }
-
- /**
- * Creates a new SOAPElement object initialized with the specified local name and adds
the new element to this SOAPElement object.
- *
- * @param name a String giving the local name for the element
- * @return the new SOAPElement object that was created
- * @throws javax.xml.soap.SOAPException if there is an error in creating the
SOAPElement object
- */
- public SOAPElement addChildElement(String name) throws SOAPException
- {
- SOAPElement soapElement = new SOAPElementImpl(name);
- soapElement = addChildElement(soapElement);
- return soapElement;
- }
-
- /**
- * Creates a new SOAPElement object initialized with the specified local name and
prefix and adds the new element to this SOAPElement object.
- *
- * @param localName a String giving the local name for the new element
- * @param prefix a String giving the namespace prefix for the new element
- * @return the new SOAPElement object that was created
- * @throws javax.xml.soap.SOAPException if there is an error in creating the
SOAPElement object
- */
- public SOAPElement addChildElement(String localName, String prefix) throws
SOAPException
- {
- String nsURI = getNamespaceURI(prefix);
- if (nsURI == null)
- throw new IllegalArgumentException("Cannot obtain namespace URI for prefix:
" + prefix);
-
- SOAPElement soapElement = new SOAPElementImpl(localName, prefix, nsURI);
- soapElement = addChildElement(soapElement);
- return soapElement;
- }
-
- /**
- * Creates a new SOAPElement object initialized with the specified local name, prefix,
and URI and adds the new element to this SOAPElement object.
- *
- * @param localName a String giving the local name for the new element
- * @param prefix a String giving the namespace prefix for the new element
- * @param uri a String giving the URI of the namespace to which the new element
belongs
- * @return the new SOAPElement object that was created
- * @throws javax.xml.soap.SOAPException if there is an error in creating the
SOAPElement object
- */
- public SOAPElement addChildElement(String localName, String prefix, String uri) throws
SOAPException
- {
- SOAPElement soapElement = new SOAPElementImpl(localName, prefix, uri);
- soapElement = addChildElement(soapElement);
- return soapElement;
- }
-
- /**
- * Creates a new SOAPElement object initialized with the given Name object and adds
the new element to this SOAPElement object.
- *
- * @param name a Name object with the XML name for the new element
- * @return the new SOAPElement object that was created
- * @throws javax.xml.soap.SOAPException if there is an error in creating the
SOAPElement object
- */
- public SOAPElement addChildElement(Name name) throws SOAPException
- {
- SOAPElement soapElement = new SOAPElementImpl(name);
- soapElement = addChildElement(soapElement);
- return soapElement;
- }
-
- /**
- * Add a SOAPElement as a child of this SOAPElement instance. The SOAPElement is
expected to be created by a
- * SOAPElementFactory.
- * <p/>
- * Callers should not rely on the element instance being added as is into the XML
tree.
- * Implementations could end up copying the content of the SOAPElement passed into an
instance of a different SOAPElement
- * implementation. For instance if addChildElement() is called on a SOAPHeader,
element will be copied into an instance
- * of a SOAPHeaderElement.
- * <p/>
- * The fragment rooted in element is either added as a whole or not at all, if there
was an error.
- * <p/>
- * The fragment rooted in element cannot contain elements named "Envelope",
"Header" or "Body" and in the SOAP namespace.
- * Any namespace prefixes present in the fragment should be fully resolved using
appropriate namespace declarations
- * within the fragment itself.
- *
- * @param child the SOAPElement to be added as a new child
- * @return an instance representing the new SOAP element that was actually added to
the tree.
- * @throws javax.xml.soap.SOAPException if there was an error in adding this element
as a child
- */
- public SOAPElement addChildElement(SOAPElement child) throws SOAPException
- {
- log.trace("addChildElement: " + getElementName() + " -> " +
child.getElementName());
- SOAPElementImpl soapElement = (SOAPElementImpl)child;
- soapElement = (SOAPElementImpl)appendChild(soapElement);
- return soapElement.completeNamespaceDeclaration();
- }
-
- /**
- * Adds a namespace declaration with the specified prefix and URI to this SOAPElement
object.
- *
- * @param prefix a String giving the prefix of the namespace
- * @param nsURI a String giving the uri of the namespace
- * @return the SOAPElement object into which this namespace declaration was inserted.
- * @throws javax.xml.soap.SOAPException if there is an error in creating the
namespace
- */
- public SOAPElement addNamespaceDeclaration(String prefix, String nsURI)
- {
- if (nsURI == null)
- throw new IllegalArgumentException("Invalid 'null' namespace
URI");
- if (nsURI.length() == 0)
- throw new IllegalArgumentException("Invalid empty namespace URI");
-
- String qualifiedName = "xmlns";
- if (prefix != null && prefix.length() > 0)
- qualifiedName += ":" + prefix;
-
- log.trace("addNamespaceDeclaration: " + qualifiedName +
"='" + nsURI + "'");
-
element.setAttributeNS("http://www.w3.org/2000/xmlns/", qualifiedName,
nsURI);
- return this;
- }
-
- // Add the namespace declaration if it is not visible yet
- private SOAPElement completeNamespaceDeclaration()
- {
- String prefix = getPrefix();
- String nsURI = getNamespaceURI();
- if (prefix != null && nsURI != null)
- {
- String prevNS = getNamespaceURI(prefix);
- if (nsURI.equals(prevNS) == false)
- addNamespaceDeclaration(prefix, nsURI);
- }
- return this;
- }
-
- /**
- * Creates a new Text object initialized with the given String and adds it to this
SOAPElement object.
- *
- * @param value a String object with the textual content to be added
- * @return the SOAPElement object into which the new Text object was inserted
- * @throws javax.xml.soap.SOAPException if there is an error in creating the new Text
object
- */
- public SOAPElement addTextNode(String value) throws SOAPException
- {
- log.trace("addTextNode: " + value);
- org.w3c.dom.Text domText = element.getOwnerDocument().createTextNode(value);
- javax.xml.soap.Text soapText = new TextImpl(domText);
- appendChild(soapText);
- return this;
- }
-
- /**
- * Returns an Iterator over all of the attribute Name objects in this SOAPElement
object.
- * <p/>
- * The iterator can be used to get the attribute names, which can then be passed to
the method getAttributeValue to
- * retrieve the value of each attribute.
- *
- * @return an iterator over the names of the attributes
- */
- public Iterator getAllAttributes()
- {
- ArrayList list = new ArrayList();
- NamedNodeMap nnm = getAttributes();
- for (int i = 0; i < nnm.getLength(); i++)
- {
- org.w3c.dom.Node node = (org.w3c.dom.Node)nnm.item(i);
- String local = node.getLocalName();
- String prefix = node.getPrefix();
- String uri = node.getNamespaceURI();
- if ("xmlns".equals(prefix) == false)
- {
- Name name;
- if (uri != null && uri.length() > 0)
- {
- name = new NameImpl(local, prefix, uri);
- }
- else
- {
- name = new NameImpl(local);
- }
- list.add(name);
- }
- }
- return list.iterator();
- }
-
- /**
- * Returns the value of the attribute with the specified name.
- *
- * @param name a Name object with the name of the attribute
- * @return a String giving the value of the specified attribute
- */
- public String getAttributeValue(Name name)
- {
- Attr attr = getAttributeNode(name);
- return (attr != null ? attr.getValue() : null);
- }
-
- private Attr getAttributeNode(Name name)
- {
- Attr attr = null;
- String nsURI = name.getURI();
- if (nsURI.length() > 0)
- attr = element.getAttributeNodeNS(nsURI, name.getLocalName());
- else attr = element.getAttributeNode(name.getLocalName());
-
- return attr;
- }
-
- /**
- * Returns an Iterator over all the immediate child Nodes of this element.
- * <p/>
- * This includes javax.xml.soap.Text objects as well as SOAPElement objects.
- * Calling this method may cause child Element, SOAPElement and org.w3c.dom.Text nodes
to be replaced by SOAPElement,
- * SOAPHeaderElement, SOAPBodyElement or javax.xml.soap.Text nodes as appropriate for
the type of this parent node.
- * As a result the calling application must treat any existing references to these
child nodes that have been obtained
- * through DOM APIs as invalid and either discard them or refresh them with the values
returned by this Iterator.
- * This behavior can be avoided by calling the equivalent DOM APIs. See javax.xml.soap
for more details.
- *
- * @return an iterator with the content of this SOAPElement object
- */
- public Iterator getChildElements()
- {
- List list = new ArrayList();
- NodeList nodeList = getChildNodes();
- for (int i = 0; i < nodeList.getLength(); i++)
- {
- org.w3c.dom.Node node = nodeList.item(i);
- if (node instanceof SOAPElement)
- {
- list.add(node);
- }
- else if (node instanceof Text)
- {
- String value = node.getNodeValue();
- if (value.trim().length() > 0)
- list.add(node);
- }
- }
- return list.iterator();
- }
-
- /**
- * Returns an Iterator over all the immediate child Nodes of this element with the
specified name.
- * <p/>
- * All of these children will be SOAPElement nodes.
- * Calling this method may cause child Element, SOAPElement and org.w3c.dom.Text nodes
to be replaced by SOAPElement,
- * SOAPHeaderElement, SOAPBodyElement or javax.xml.soap.Text nodes as appropriate for
the type of this parent node.
- * As a result the calling application must treat any existing references to these
child nodes that have been obtained
- * through DOM APIs as invalid and either discard them or refresh them with the values
returned by this Iterator.
- * This behavior can be avoided by calling the equivalent DOM APIs. See javax.xml.soap
for more details.
- *
- * @param name a Name object with the name of the child elements to be returned
- * @return an Iterator object over all the elements in this SOAPElement object with
the specified name
- */
- public Iterator getChildElements(Name name)
- {
- List<SOAPElement> list = new ArrayList<SOAPElement>();
- Iterator it = getChildElements();
- while (it.hasNext())
- {
- Object elementOrTextNode = it.next();
- if (elementOrTextNode instanceof SOAPElement)
- {
- SOAPElement el = (SOAPElement)elementOrTextNode;
- if (el.getElementName().equals(name))
- list.add(el);
- }
- }
- return list.iterator();
- }
-
- /**
- * Returns the name of this SOAPElement object.
- *
- * @return a Name object with the name of this SOAPElement object
- */
- public Name getElementName()
- {
- if (elementName == null)
- {
- String nsURI = element.getNamespaceURI();
- if (nsURI != null && nsURI.length() > 0)
- {
- String prefix = element.getPrefix();
- String localName = element.getLocalName();
- elementName = new NameImpl(localName, prefix, nsURI);
- }
- else
- {
- String nodeName = element.getNodeName();
- elementName = new NameImpl(nodeName);
- }
- }
- return elementName;
- }
-
- /**
- * Returns the encoding style for this SOAPElement object.
- *
- * @return a String giving the encoding style
- */
- public String getEncodingStyle()
- {
- return encodingStyle;
- }
-
- /**
- * Returns an Iterator over the namespace prefix Strings declared by this element.
- * <p/>
- * The prefixes returned by this iterator can be passed to the method getNamespaceURI
to retrieve the URI of each namespace.
- *
- * @return an iterator over the namespace prefixes in this SOAPElement object
- */
- public Iterator getNamespacePrefixes()
- {
- ArrayList list = getNamespacePrefixList();
- return list.iterator();
- }
-
- private ArrayList getNamespacePrefixList()
- {
- ArrayList list = new ArrayList();
- NamedNodeMap attrMap = element.getAttributes();
- for (int i = 0; i < attrMap.getLength(); i++)
- {
- Attr attr = (Attr)attrMap.item(i);
- String attrName = attr.getNodeName();
- if (attrName.startsWith("xmlns:"))
- list.add(attrName.substring(6));
- }
- return list;
- }
-
- /**
- * Returns the URI of the namespace that has the given prefix.
- *
- * @param prefix a String giving the prefix of the namespace for which to search
- * @return a String with the uri of the namespace that has the given prefix
- */
- public String getNamespaceURI(String prefix)
- {
- String nsURI = element.getAttribute("xmlns:" + prefix);
- if (nsURI.length() == 0 && getParentElement() != null)
- return getParentElement().getNamespaceURI(prefix);
-
- return (nsURI.length() > 0 ? nsURI : null);
- }
-
- /**
- * Returns an Iterator over the namespace prefix Strings visible to this element.
- * <p/>
- * The prefixes returned by this iterator can be passed to the method getNamespaceURI
to retrieve the URI of each namespace.
- *
- * @return an iterator over the namespace prefixes are within scope of this
SOAPElement object
- */
- public Iterator getVisibleNamespacePrefixes()
- {
- ArrayList list = getNamespacePrefixList();
- SOAPElementImpl parent = (SOAPElementImpl)getParentElement();
- while (parent != null)
- {
- list.addAll(parent.getNamespacePrefixList());
- parent = (SOAPElementImpl)parent.getParentElement();
- }
- return list.iterator();
- }
-
- /**
- * Removes the attribute with the specified name.
- *
- * @param name the Name object with the name of the attribute to be removed
- * @return true if the attribute was removed successfully; false if it was not
- */
- public boolean removeAttribute(Name name)
- {
- Attr attr = getAttributeNode(name);
- if (attr != null)
- {
- element.removeAttributeNode(attr);
- return true;
- }
- return false;
- }
-
- /**
- * Detaches all children of this SOAPElement.
- * <p/>
- * This method is useful for rolling back the construction of partially completed
SOAPHeaders and SOAPBodys in
- * preparation for sending a fault when an error condition is detected.
- * It is also useful for recycling portions of a document within a SOAP message.
- */
- public void removeContents()
- {
- log.trace("removeContents");
- Iterator it = getChildElements();
- while (it.hasNext())
- {
- SOAPElement el = (SOAPElement)it.next();
- el.detachNode();
- }
- }
-
- /**
- * Removes the namespace declaration corresponding to the given prefix.
- *
- * @param prefix a String giving the prefix for which to search
- * @return true if the namespace declaration was removed successfully; false if it was
not
- */
- public boolean removeNamespaceDeclaration(String prefix)
- {
- boolean ret = getAttributeNode("xmlns:" + prefix) != null;
- removeAttribute("xmlns:" + prefix);
- return ret;
- }
-
- /**
- * Sets the encoding style for this SOAPElement object to one specified.
- *
- * @param encodingStyle a String giving the encoding style
- * @throws javax.xml.soap.SOAPException if there was a problem in the encoding style
being set.
- */
- public void setEncodingStyle(String encodingStyle) throws SOAPException
- {
- if (!Constants.URI_LITERAL_ENC.equals(encodingStyle) &&
!Constants.URI_SOAP11_ENC.equals(encodingStyle))
- throw new IllegalArgumentException("Unsupported encodingStyle: " +
encodingStyle);
-
- this.encodingStyle = encodingStyle;
- }
-
- // org.w3c.Element
***********************************************************************************************
-
- public String getTagName()
- {
- return element.getTagName();
- }
-
- public void removeAttribute(String name) throws DOMException
- {
- element.removeAttribute(name);
- }
-
- public boolean hasAttribute(String name)
- {
- return element.hasAttribute(name);
- }
-
- public String getAttribute(String name)
- {
- return element.getAttribute(name);
- }
-
- public void removeAttributeNS(String namespaceURI, String localName) throws
DOMException
- {
- element.removeAttributeNS(namespaceURI, localName);
- }
-
- public void setAttribute(String name, String value) throws DOMException
- {
- element.setAttribute(name, value);
- }
-
- public boolean hasAttributeNS(String namespaceURI, String localName)
- {
- return element.hasAttributeNS(namespaceURI, localName);
- }
-
- public Attr getAttributeNode(String name)
- {
- Attr attr = element.getAttributeNode(name);
-
- return (attr == null) ? null : new AttrImpl(this, attr);
- }
-
- public Attr removeAttributeNode(Attr oldAttr) throws DOMException
- {
- return element.removeAttributeNode(oldAttr);
- }
-
- public Attr setAttributeNode(Attr newAttr) throws DOMException
- {
- return element.setAttributeNode(newAttr);
- }
-
- public Attr setAttributeNodeNS(Attr newAttr) throws DOMException
- {
- return element.setAttributeNodeNS(newAttr);
- }
-
- public NodeList getElementsByTagName(String name)
- {
- return new NodeListImpl(DOMUtils.getChildElements(this, name));
- }
-
- public String getAttributeNS(String namespaceURI, String localName)
- {
- return element.getAttributeNS(namespaceURI, localName);
- }
-
- public void setAttributeNS(String namespaceURI, String qualifiedName, String value)
throws DOMException
- {
- element.setAttributeNS(namespaceURI, qualifiedName, value);
- }
-
- public Attr getAttributeNodeNS(String namespaceURI, String localName)
- {
- /* FIXME We really need to do more than just return an object wrapper.
- * All Attrs should be stored as nodes on our local tree, so that
- * they are discovered during node traversal calls.
- */
- Attr attr = element.getAttributeNodeNS(namespaceURI, localName);
-
- return (attr == null) ? null : new AttrImpl(this, attr);
- }
-
- public NodeList getElementsByTagNameNS(String namespaceURI, String localName)
- {
- return new NodeListImpl(DOMUtils.getChildElements(this, new QName(namespaceURI,
localName)));
- }
-
- public TypeInfo getSchemaTypeInfo()
- {
- throw new NotImplementedException("getSchemaTypeInfo");
- }
-
- public void setIdAttribute(String name, boolean isId) throws DOMException
- {
- throw new NotImplementedException("setIdAttribute");
- }
-
- public void setIdAttributeNode(Attr idAttr, boolean isId) throws DOMException
- {
- throw new NotImplementedException("setIdAttributeNode");
- }
-
- public void setIdAttributeNS(String namespaceURI, String localName, boolean isId)
throws DOMException
- {
- throw new NotImplementedException("setIdAttributeNS");
- }
-
- public void accept(SAAJVisitor visitor) {
- visitor.visitSOAPElement(this);
- }
- /**
- * The default implementation uses a DOMWriter.
- * SOAPContentElements overwrite this to optimize DOM callbacks.
- */
- public void writeElement(Writer writer) throws IOException
- {
- String qualName = getElementName().getQualifiedName();
- writer.write("<" + qualName);
-
- // namespaces
- Iterator nsPrefixes = getNamespacePrefixes();
- while (nsPrefixes.hasNext())
- {
- String prefix = (String)nsPrefixes.next();
- writer.write(" xmlns:" + prefix + "='" +
getNamespaceURI(prefix) + "'");
- }
-
- // attributes
- Iterator attNames = getAllAttributes();
- while (attNames.hasNext())
- {
- NameImpl name = (NameImpl)attNames.next();
- String attPrefix = name.getPrefix() != null ? name.getPrefix() : "";
- String attFqn = attPrefix.length() > 0 ? attPrefix + ":" +
name.getLocalName() : name.getLocalName();
- writer.write(" " + attFqn + "='" +
getAttributeValue(name) + "'");
- }
- writer.write(">");
-
- writeElementContent(writer);
-
- writer.write("</" + qualName + ">");
- }
-
- protected void writeElementContent(Writer out) throws IOException
- {
- Iterator it = getChildElements();
- if (it.hasNext())
- {
- while (it.hasNext())
- {
- Node node = (Node)it.next();
- if (node instanceof SOAPElementImpl)
- {
- ((SOAPElementImpl)node).writeElement(out);
- }
- else if (node instanceof TextImpl)
- {
- out.write(node.getValue());
- }
- else
- {
- throw new WSException("Unhandled soap node: " +
node.getClass().getName());
- }
- }
- }
- else
- {
- String value = getValue();
- if (value != null)
- out.write(value);
- }
- }
-}
Deleted: branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPElementWriter.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPElementWriter.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPElementWriter.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -1,157 +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 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(a)jboss.com>
- * @author Thomas.Diesler(a)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);
- }
- }
- }
-}
Deleted: branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPEnvelopeImpl.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPEnvelopeImpl.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPEnvelopeImpl.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -1,185 +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 java.io.IOException;
-import java.io.Writer;
-import java.util.Iterator;
-
-import javax.xml.namespace.QName;
-import javax.xml.rpc.JAXRPCException;
-import javax.xml.rpc.soap.SOAPFaultException;
-import javax.xml.soap.Name;
-import javax.xml.soap.Node;
-import javax.xml.soap.SOAPBody;
-import javax.xml.soap.SOAPElement;
-import javax.xml.soap.SOAPEnvelope;
-import javax.xml.soap.SOAPException;
-import javax.xml.soap.SOAPHeader;
-import javax.xml.soap.SOAPMessage;
-
-import org.jboss.ws.Constants;
-import org.w3c.dom.Document;
-
-/**
- * The container for the SOAPHeader and SOAPBody portions of a SOAPPart object. By
default, a
- * SOAPMessage object is created with a SOAPPart object that has a SOAPEnvelope object.
- * The SOAPEnvelope object by default has an empty SOAPBody object and an empty
SOAPHeader object.
- * The SOAPBody object is required, and the SOAPHeader object, though optional, is used
in the majority of cases.
- *
- * @author Thomas.Diesler(a)jboss.org
- */
-public class SOAPEnvelopeImpl extends SOAPElementImpl implements SOAPEnvelope
-{
- // Reference the enclosing SOAPPart, so that getOwnerDocument() works correctly
- private SOAPPartImpl soapPart;
- private boolean domExpansionEnabled = false;
-
- /** Construct a SOAP envelope for the given SOAP version URI prefix, etc.
- */
- public SOAPEnvelopeImpl(SOAPPartImpl soapPart, SOAPElementImpl element) throws
SOAPException
- {
- super(element);
-
- this.soapPart = soapPart;
- soapPart.setEnvelope(this);
-
- String prefix = getPrefix();
- String namespaceURI = getNamespaceURI();
-
- assertEnvelopeNamespace(namespaceURI);
- addNamespaceDeclaration(prefix, namespaceURI);
-
- addHeader();
- addBody();
- }
-
- /** Construct a SOAP envelope for the given SOAP version URI.
- */
- SOAPEnvelopeImpl(SOAPPartImpl soapPart, String namespace) throws SOAPException
- {
- super("Envelope", Constants.PREFIX_ENV, namespace);
-
- this.soapPart = soapPart;
- soapPart.setEnvelope(this);
-
- assertEnvelopeNamespace(namespace);
- addNamespaceDeclaration(getPrefix(), namespace);
-
- addHeader();
- addBody();
- }
-
- private void assertEnvelopeNamespace(String namespaceURI)
- {
- if (!Constants.NS_SOAP12_ENV.equals(namespaceURI) &&
!Constants.NS_SOAP11_ENV.equals(namespaceURI))
- {
- QName faultCode = Constants.SOAP11_FAULT_CODE_VERSION_MISMATCH;
- String faultString = "Invalid SOAP envelope namespace: " +
namespaceURI;
- throw new SOAPFaultException(faultCode, faultString, null, null);
- }
- }
-
- public SOAPMessage getSOAPMessage()
- {
- return soapPart.getSOAPMessage();
- }
-
- public SOAPBody addBody() throws SOAPException
- {
- SOAPBody body = getBody();
- if (body != null)
- throw new SOAPException("SOAPEnvelope already has a body element");
-
- body = new SOAPBodyImpl(getPrefix(), getNamespaceURI());
- addChildElement(body);
- return body;
- }
-
- public SOAPHeader addHeader() throws SOAPException
- {
- SOAPHeader header = getHeader();
- if (header != null)
- throw new SOAPException("SOAPEnvelope already has a header element");
-
- header = new SOAPHeaderImpl(getPrefix(), getNamespaceURI());
- return (SOAPHeader)addChildElement(header);
- }
-
- /** Make sure the child is either a SOAPHeader or SOAPBody */
- public SOAPElement addChildElement(SOAPElement child) throws SOAPException
- {
- if ((child instanceof SOAPHeader) == false && (child instanceof SOAPBody)
== false)
- throw new IllegalArgumentException("SOAPHeader or SOAPBody
expected");
-
- return super.addChildElement(child);
- }
-
- public Name createName(String localName) throws SOAPException
- {
- return new NameImpl(localName);
- }
-
- public Name createName(String localName, String prefix, String uri) throws
SOAPException
- {
- return new NameImpl(localName, prefix, uri);
- }
-
- public SOAPBody getBody() throws SOAPException
- {
- Iterator it = getChildElements();
- while (it.hasNext())
- {
- Node node = (Node)it.next();
- if (node.getLocalName().equals("Body"))
- return (SOAPBody)node;
- }
- return null;
- }
-
- public SOAPHeader getHeader() throws SOAPException
- {
- Iterator it = getChildElements();
- while (it.hasNext())
- {
- Node node = (Node)it.next();
- if (node.getLocalName().equals("Header"))
- return (SOAPHeader)node;
- }
- return null;
- }
-
- /**
- * Text nodes are not supported.
- */
- public SOAPElement addTextNode(String value) throws SOAPException
- {
- throw new SOAPException("Cannot add Text node to SOAPEnvelope");
- }
-
- public Document getOwnerDocument()
- {
- return soapPart;
- }
-}
Deleted: branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPFactoryImpl.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPFactoryImpl.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPFactoryImpl.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -1,127 +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.soap.Detail;
-import javax.xml.soap.Name;
-import javax.xml.soap.SOAPElement;
-import javax.xml.soap.SOAPException;
-import javax.xml.soap.SOAPFactory;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.utils.DOMUtils;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-/**
- * SOAPFactory implementation.
- *
- * @author Thomas.Diesler(a)jboss.org
- */
-public class SOAPFactoryImpl extends SOAPFactory
-{
- private static Logger log = Logger.getLogger(SOAPFactoryImpl.class);
-
- public SOAPElement createElement(Name name) throws SOAPException
- {
- return new SOAPElementImpl(name);
- }
-
- public SOAPElement createElement(String localName) throws SOAPException
- {
- return new SOAPElementImpl(localName);
- }
-
- public SOAPElement createElement(String localName, String prefix, String uri) throws
SOAPException
- {
- return new SOAPElementImpl(localName, prefix, uri);
- }
-
- /**
- * Create a SOAPElement from a DOM Element.
- * This method is not part of the javax.xml.soap.SOAPFactory interface.
- */
- public SOAPElementImpl createElement(Element domNode, boolean deep) throws
SOAPException
- {
- if (domNode == null)
- throw new IllegalArgumentException("Source node cannot be null");
-
- String localName = domNode.getLocalName();
- String prefix = domNode.getPrefix() != null ? domNode.getPrefix() : "";
- String nsURI = domNode.getNamespaceURI() != null ? domNode.getNamespaceURI() :
"";
-
- SOAPElementImpl soapElement = new SOAPElementImpl(localName, prefix, nsURI);
-
- // Add the child elements as well
- if (deep)
- {
- if (domNode instanceof Element)
- DOMUtils.copyAttributes(soapElement, (Element)domNode);
-
- NodeList nlist = domNode.getChildNodes();
- for (int i = 0; i < nlist.getLength(); i++)
- {
- Node child = nlist.item(i);
- short nodeType = child.getNodeType();
- if (nodeType == Node.ELEMENT_NODE)
- {
- SOAPElementImpl soapChild = createElement((Element)child, true);
- soapElement.addChildElement(soapChild);
- }
- else if (nodeType == Node.TEXT_NODE)
- {
- String nodeValue = child.getNodeValue();
- soapElement.addTextNode(nodeValue);
- }
- else if (nodeType == Node.CDATA_SECTION_NODE)
- {
- String nodeValue = child.getNodeValue();
- soapElement.addTextNode(nodeValue);
- }
- else
- {
- log.trace("Ignore child type: " + nodeType);
- }
- }
- }
-
- return soapElement;
- }
-
- public Detail createDetail() throws SOAPException
- {
- return new DetailImpl();
- }
-
- public Name createName(String localName, String prefix, String uri) throws
SOAPException
- {
- return new NameImpl(localName, prefix, uri);
- }
-
- public Name createName(String localName) throws SOAPException
- {
- return new NameImpl(localName);
- }
-}
Deleted:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPFaultElementImpl.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPFaultElementImpl.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPFaultElementImpl.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -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.soap;
-
-import javax.xml.soap.Name;
-import javax.xml.soap.SOAPFaultElement;
-
-public class SOAPFaultElementImpl extends SOAPElementImpl implements SOAPFaultElement
-{
- public SOAPFaultElementImpl(String localPart)
- {
- super(localPart);
- }
-
- public SOAPFaultElementImpl(String localPart, String prefix, String namespace)
- {
- super(localPart, prefix, namespace);
- }
-
- public SOAPFaultElementImpl(Name name)
- {
- super(name);
- }
-}
\ No newline at end of file
Deleted: branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPFaultImpl.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPFaultImpl.java 2006-12-06
00:32:54 UTC (rev 1560)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPFaultImpl.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -1,242 +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 java.io.IOException;
-import java.io.Writer;
-import java.util.Iterator;
-import java.util.Locale;
-
-import javax.xml.namespace.QName;
-import javax.xml.rpc.JAXRPCException;
-import javax.xml.soap.Detail;
-import javax.xml.soap.Name;
-import javax.xml.soap.SOAPElement;
-import javax.xml.soap.SOAPException;
-import javax.xml.soap.SOAPFault;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.utils.DOMUtils;
-import org.jboss.ws.utils.DOMWriter;
-import org.jboss.ws.Constants;
-import org.jboss.ws.WSException;
-import org.jboss.xb.QNameBuilder;
-import org.w3c.dom.Element;
-
-/**
- * An element in the SOAPBody object that contains error and/or status information.
- * This information may relate to errors in the SOAPMessage object or to problems
- * that are not related to the content in the message itself. Problems not related
- * to the message itself are generally errors in processing, such as the inability
- * to communicate with an upstream server.
- *
- * The SOAPFault interface provides methods for retrieving the information contained
- * in a SOAPFault object and for setting the fault code, the fault actor, and a string
- * describing the fault. A fault code is one of the codes defined in the SOAP 1.1
specification
- * that describe the fault. An actor is an intermediate recipient to whom a message was
routed.
- * The message path may include one or more actors, or, if no actors are specified, the
message
- * goes only to the default actor, which is the final intended recipient.
- *
- * @author Thomas.Diesler(a)jboss.org
- */
-public class SOAPFaultImpl extends SOAPBodyElementDoc implements SOAPFault
-{
- // provide logging
- private static Logger log = Logger.getLogger(SOAPFaultImpl.class);
-
- private SOAPElement faultcode;
- private SOAPElement faultstring;
- private SOAPElement faultactor;
- private Locale faultStringLocale;
-
- public SOAPFaultImpl(String namespaceURI) throws SOAPException
- {
- super(new NameImpl("Fault", Constants.PREFIX_ENV, namespaceURI));
- SOAPFactoryImpl factory = new SOAPFactoryImpl();
- addChildElement(faultcode = factory.createElement("faultcode"));
- addChildElement(faultstring = factory.createElement("faultstring"));
- }
-
- /** Creates an optional Detail object and sets it as the Detail object for this
SOAPFault object.
- */
- public Detail addDetail() throws SOAPException
- {
- Detail detail = getDetail();
- if (detail != null)
- throw new SOAPException("SOAPFault already contains a detail node");
-
- SOAPFactoryImpl factory = new SOAPFactoryImpl();
- detail = (Detail)addChildElement(factory.createDetail());
- return detail;
- }
-
- /** Returns the optional detail element for this SOAPFault object.
- */
- public Detail getDetail()
- {
- Detail detail = null;
- Iterator it = getChildElements(new NameImpl("detail"));
- while (it.hasNext())
- {
- Object obj = it.next();
- if (obj instanceof Detail)
- {
- detail = (Detail)obj;
- }
- else if (obj instanceof SOAPElementImpl)
- {
- try
- {
- SOAPElementImpl soapEl = (SOAPElementImpl)obj;
- SOAPFactoryImpl factory = new SOAPFactoryImpl();
- detail = (Detail)addChildElement(factory.createDetail());
-
- Iterator childIt = DOMUtils.getChildElements(soapEl);
- while (childIt.hasNext())
- {
- Element domElement = (Element)childIt.next();
- SOAPElement detailEntry = new
DetailEntryImpl(factory.createElement(domElement, true));
- detail.addChildElement(detailEntry);
- }
- }
- catch (SOAPException e)
- {
- throw new WSException("Unable to create fault detail: " +
e.getMessage());
- }
-
- }
- }
-
- return detail;
- }
-
- /** Gets the fault actor for this SOAPFault object.
- */
- public String getFaultActor()
- {
- return (faultactor != null ? faultactor.getValue() : null);
- }
-
- /** Gets the fault code for this SOAPFault object.
- */
- public String getFaultCode()
- {
- String value = faultcode.getValue();
- return value;
- }
-
- /**
- * Gets the mandatory SOAP 1.1 fault code for this SOAPFault object as a SAAJ Name
object.
- */
- public Name getFaultCodeAsName()
- {
- QName qname = QNameBuilder.buildQName(this, faultcode.getValue());
- return new NameImpl(qname);
- }
-
- /** Gets the fault string for this SOAPFault object.
- */
- public String getFaultString()
- {
- String value = faultstring.getValue();
- return value;
- }
-
- /** Gets the locale of the fault string for this SOAPFault object.
- */
- public Locale getFaultStringLocale()
- {
- return faultStringLocale;
- }
-
- /** Sets this SOAPFault object with the given fault actor.
- */
- public void setFaultActor(String faultActor) throws SOAPException
- {
- if (faultactor == null)
- {
- SOAPFactoryImpl factory = new SOAPFactoryImpl();
- addChildElement(faultactor = factory.createElement("faultactor"));
- }
-
- faultactor.setValue(faultActor);
- }
-
- /** Sets this SOAPFault object with the give fault code.
- */
- public void setFaultCode(String faultCode) throws SOAPException
- {
- // Must be of the form "prefix:localName" where the prefix has been
defined in a namespace declaration.
- if (faultCode == null || faultCode.indexOf(":") < 1)
- throw new IllegalArgumentException("Invalid faultCode: " +
faultCode);
-
- QName qname = QNameBuilder.buildQName(this, faultCode);
- setFaultCode(new NameImpl(qname));
- }
-
- /** Sets this SOAPFault object with the given fault code.
- */
- public void setFaultCode(Name faultName) throws SOAPException
- {
- String nsURI = faultName.getURI();
- String prefix = faultName.getPrefix();
- String localName = faultName.getLocalName();
-
- // For lazy folkes like the CTS that don't bother to give
- // a namesapce URI, assume they use a standard code
- if ("".equals(nsURI))
- {
- log.warn("Empty namespace URI with fault code '" + faultName +
"', assuming: " + Constants.NS_SOAP11_ENV);
- nsURI = Constants.NS_SOAP11_ENV;
- }
-
- if ("".equals(prefix) && getNamespaceURI().equals(nsURI))
- prefix = getPrefix();
-
- String prevNS = getNamespaceURI(prefix);
- if (nsURI.equals(prevNS) == false)
- addNamespaceDeclaration(prefix, nsURI);
-
- String faultCode = prefix + ":" + localName;
- faultcode.setValue(faultCode);
- }
-
- /** Sets the fault string for this SOAPFault object to the given string.
- */
- public void setFaultString(String faultString) throws SOAPException
- {
- faultstring.setValue(faultString);
- }
-
- /** Sets the fault string for this SOAPFault object to the given string and localized
to the given locale.
- */
- public void setFaultString(String faultString, Locale locale) throws SOAPException
- {
- setFaultString(faultString);
- this.faultStringLocale = locale;
- }
-
- public void writeElement(Writer writer)
- {
- new DOMWriter(writer).print(this);
- }
-}
\ No newline at end of file
Deleted:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPHeaderElementImpl.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPHeaderElementImpl.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPHeaderElementImpl.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -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.soap;
-
-import java.io.IOException;
-import java.io.StringWriter;
-import java.io.Writer;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import javax.xml.soap.Name;
-import javax.xml.soap.SOAPElement;
-import javax.xml.soap.SOAPEnvelope;
-import javax.xml.soap.SOAPException;
-import javax.xml.soap.SOAPHeader;
-import javax.xml.soap.SOAPHeaderElement;
-
-import org.jboss.ws.Constants;
-
-/**
- * An object representing the contents in the SOAP header part of the SOAP envelope.
- * The immediate children of a SOAPHeader object can be represented only as
SOAPHeaderElement objects.
- *
- * A SOAPHeaderElement object can have other SOAPElement objects as its children.
- *
- * @author Thomas.Diesler(a)jboss.org
- */
-public class SOAPHeaderElementImpl extends SOAPContentElement implements
SOAPHeaderElement
-{
- public SOAPHeaderElementImpl(Name name)
- {
- super(name);
- }
-
- public SOAPHeaderElementImpl(SOAPElementImpl element)
- {
- super(element);
- }
-
- public String getActor()
- {
- String envURI = Constants.NS_SOAP11_ENV;
- String attr = getAttributeNS(envURI, Constants.SOAP11_ATTR_ACTOR);
- return attr;
- }
-
- public boolean getMustUnderstand()
- {
- String envURI = Constants.NS_SOAP11_ENV;
- String attr = getAttributeNS(envURI, Constants.SOAP11_ATTR_MUST_UNDERSTAND);
- return "1".equals(attr);
- }
-
- public void setActor(String actorURI)
- {
- String envURI = Constants.NS_SOAP11_ENV;
- String qualifiedName = Constants.PREFIX_ENV + ":" +
Constants.SOAP11_ATTR_ACTOR;
- setAttributeNS(envURI, qualifiedName, actorURI);
- }
-
- public void setMustUnderstand(boolean mustUnderstand)
- {
- String envURI = Constants.NS_SOAP11_ENV;
- String qualifiedName = Constants.PREFIX_ENV + ":" +
Constants.SOAP11_ATTR_MUST_UNDERSTAND;
- setAttributeNS(envURI, qualifiedName, mustUnderstand ? "1" :
"0");
- }
-
- public void setParentElement(SOAPElement parent) throws SOAPException
- {
- if (parent == null)
- throw new SOAPException("Invalid null parent element");
-
- if ((parent instanceof SOAPHeader) == false)
- throw new SOAPException("Invalid parent element: " +
parent.getElementName());
-
- super.setParentElement(parent);
- }
-
- @Override
- public void writeElement(Writer writer) throws IOException
- {
- StringWriter strwr = new StringWriter(256);
- super.writeElement(strwr);
-
- SOAPHeader soapHeader = (SOAPHeader)getParentElement();
- SOAPEnvelope soapEnvelope = (SOAPEnvelope)soapHeader.getParentElement();
-
- // Find known namespace declarations
- List<String> knownNamespaces = new ArrayList<String>();
- Iterator prefixes = soapEnvelope.getNamespacePrefixes();
- while (prefixes.hasNext())
- {
- String prefix = (String)prefixes.next();
- String nsURI = soapEnvelope.getNamespaceURI(prefix);
- String xmlns = " xmlns:" + prefix + "='" + nsURI +
"'";
- knownNamespaces.add(xmlns);
- }
- prefixes = soapHeader.getNamespacePrefixes();
- while (prefixes.hasNext())
- {
- String prefix = (String)prefixes.next();
- String nsURI = soapHeader.getNamespaceURI(prefix);
- String xmlns = " xmlns:" + prefix + "='" + nsURI +
"'";
- knownNamespaces.add(xmlns);
- }
-
- // Remove known namespace declarations
- String xmlFragment = strwr.toString();
- for (String xmlns : knownNamespaces)
- {
- int start = xmlFragment.indexOf(xmlns);
- while (start > 0)
- {
- int end = start + xmlns.length();
- xmlFragment = xmlFragment.substring(0, start) + xmlFragment.substring(end);
- start = xmlFragment.indexOf(xmlns);
- }
- }
-
- writer.write(xmlFragment);
- }
-}
Deleted: branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPHeaderImpl.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPHeaderImpl.java 2006-12-06
00:32:54 UTC (rev 1560)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPHeaderImpl.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -1,197 +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 java.util.ArrayList;
-import java.util.Iterator;
-
-import javax.xml.soap.Name;
-import javax.xml.soap.SOAPElement;
-import javax.xml.soap.SOAPException;
-import javax.xml.soap.SOAPHeader;
-import javax.xml.soap.SOAPHeaderElement;
-
-import org.w3c.dom.DOMException;
-import org.w3c.dom.DocumentFragment;
-import org.w3c.dom.Node;
-
-/**
- * A representation of the SOAP header element. A SOAP header element consists of XML
data that affects the way the
- * application-specific content is processed by the message provider. For example,
transaction semantics,
- * authentication information, and so on, can be specified as the content of a SOAPHeader
object.
- *
- * @author Thomas.Diesler(a)jboss.org
- */
-public class SOAPHeaderImpl extends SOAPElementImpl implements SOAPHeader
-{
- public SOAPHeaderImpl(String prefix, String namespace)
- {
- super("Header", prefix, namespace);
- }
-
- private SOAPHeaderElementImpl convertToHeaderElement(Node node)
- {
- if (!(node instanceof SOAPElementImpl))
- throw new IllegalArgumentException("SOAPElement expected");
-
- SOAPElementImpl element = (SOAPElementImpl)node;
-
- // convert to SOAPHeaderElement
- element.detachNode();
- return new SOAPHeaderElementImpl(element);
- }
-
- /*** Add a SOAPHeaderElement as a child of this SOAPHeader instance.
- */
- public SOAPElement addChildElement(SOAPElement child) throws SOAPException
- {
- // Check that we get a SOAPHeaderElement
- if ((child instanceof SOAPHeaderElement) == false)
- child = convertToHeaderElement(child);
-
- return super.addChildElement(child);
- }
-
- /** Creates a new SOAPHeaderElement object initialized with the specified name and
adds it to this SOAPHeader object.
- */
- public SOAPHeaderElement addHeaderElement(Name name) throws SOAPException
- {
- if (name == null || name.getURI().length() == 0 || name.getPrefix().length() == 0)
- throw new SOAPException("Invalid SOAPHeaderElement name: " + name);
-
- SOAPHeaderElementImpl headerElement = new SOAPHeaderElementImpl(name);
- addChildElement(headerElement);
- return headerElement;
- }
-
- /** Returns an Iterator over all the SOAPHeaderElement objects in this SOAPHeader
object.
- */
- public Iterator examineAllHeaderElements()
- {
- // make a defensive copy
- ArrayList list = new ArrayList();
- Iterator it = getChildElements();
- while (it.hasNext())
- {
- SOAPHeaderElement shElement = (SOAPHeaderElement)it.next();
- list.add(shElement);
- }
- return list.iterator();
- }
-
- /** Returns an Iterator over all the SOAPHeaderElement objects in this SOAPHeader
object that have the specified actor.
- */
- public Iterator examineHeaderElements(String actor)
- {
- if (actor == null)
- throw new IllegalArgumentException("Invalid actor: " + actor);
-
- // make a defensive copy
- ArrayList list = new ArrayList();
- Iterator it = getChildElements();
- while (it.hasNext())
- {
- SOAPHeaderElement shElement = (SOAPHeaderElement)it.next();
- if (actor.equals(shElement.getActor()))
- list.add(shElement);
- }
- return list.iterator();
- }
-
- /** Returns an Iterator over all the SOAPHeaderElement objects in this SOAPHeader
object that have the specified
- * actor and that have a MustUnderstand attribute whose value is equivalent to true.
- */
- public Iterator examineMustUnderstandHeaderElements(String actor)
- {
- if (actor == null)
- throw new IllegalArgumentException("Invalid actor: " + actor);
-
- // make a defensive copy
- ArrayList list = new ArrayList();
- Iterator it = getChildElements();
- while (it.hasNext())
- {
- SOAPHeaderElement shElement = (SOAPHeaderElement)it.next();
- if (actor.equals(shElement.getActor()) &&
shElement.getMustUnderstand())
- list.add(shElement);
- }
- return list.iterator();
- }
-
- public Iterator extractAllHeaderElements()
- {
- // make a defensive copy
- ArrayList list = new ArrayList();
- Iterator it = getChildElements();
- while (it.hasNext())
- {
- SOAPHeaderElement shElement = (SOAPHeaderElement)it.next();
- removeChild(shElement);
- list.add(shElement);
- }
- return list.iterator();
- }
-
- public Iterator extractHeaderElements(String actor)
- {
- if (actor == null)
- throw new IllegalArgumentException("Invalid actor: " + actor);
-
- // make a defensive copy
- ArrayList list = new ArrayList();
- Iterator it = getChildElements();
- while (it.hasNext())
- {
- SOAPHeaderElement shElement = (SOAPHeaderElement)it.next();
- if (actor.equals(shElement.getActor()))
- {
- removeChild(shElement);
- list.add(shElement);
- }
- }
- return list.iterator();
- }
-
- public Node appendChild(Node newChild) throws DOMException
- {
- if (!(newChild instanceof SOAPHeaderElementImpl || newChild instanceof
DocumentFragment))
- newChild = convertToHeaderElement(newChild);
-
- return super.appendChild(newChild);
- }
-
- public Node insertBefore(Node newChild, Node refChild) throws DOMException
- {
- if (!(newChild instanceof SOAPHeaderElementImpl || newChild instanceof
DocumentFragment))
- newChild = convertToHeaderElement(newChild);
-
- return super.insertBefore(newChild, refChild);
- }
-
- public Node replaceChild(Node newChild, Node oldChild) throws DOMException
- {
- if (!(newChild instanceof SOAPHeaderElementImpl || newChild instanceof
DocumentFragment))
- newChild = convertToHeaderElement(newChild);
-
- return super.replaceChild(newChild, oldChild);
- }
-}
\ No newline at end of file
Deleted:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPMessageDispatcher.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPMessageDispatcher.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPMessageDispatcher.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -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.ws.soap;
-
-// $Id$
-
-import java.util.Iterator;
-
-import javax.xml.namespace.QName;
-import javax.xml.soap.Name;
-import javax.xml.soap.SOAPBody;
-import javax.xml.soap.SOAPBodyElement;
-import javax.xml.soap.SOAPException;
-import javax.xml.soap.SOAPMessage;
-import javax.xml.ws.addressing.AddressingProperties;
-import javax.xml.ws.addressing.JAXWSAConstants;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.core.CommonMessageContext;
-import org.jboss.ws.jaxrpc.Style;
-import org.jboss.ws.metadata.umdm.EndpointMetaData;
-import org.jboss.ws.metadata.umdm.OperationMetaData;
-
-/**
- * Derive the operation meta data from incomming SOAP message
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 22-Nov-2005
- */
-public class SOAPMessageDispatcher
-{
- // provide logging
- private static Logger log = Logger.getLogger(SOAPMessageDispatcher.class);
-
- /** Get the operation meta data for a given SOAP message
- */
- public OperationMetaData getDispatchDestination(EndpointMetaData epMetaData,
SOAPMessage soapMessage) throws SOAPException
- {
- OperationMetaData opMetaData = null;
-
- // Dispatch based on wsa:Action
- CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
- AddressingProperties inProps =
(AddressingProperties)msgContext.getProperty(JAXWSAConstants.SERVER_ADDRESSING_PROPERTIES_INBOUND);
- if (inProps != null && inProps.getAction() != null)
- {
- String wsaAction = inProps.getAction().getURI().toASCIIString();
- for (OperationMetaData opAux : epMetaData.getOperations())
- {
- if (wsaAction.equals(opAux.getSOAPAction()))
- {
- opMetaData = opAux;
- log.debug("Use wsa:Action dispatch: " + wsaAction);
- break;
- }
- }
- }
-
- // Dispatch to JAXWS Provider
- if (opMetaData == null && epMetaData.getServiceMode() != null)
- {
- QName xmlName = new QName(epMetaData.getQName().getNamespaceURI(),
"invoke");
- opMetaData = epMetaData.getOperation(xmlName);
- }
-
- // Dispatch based on SOAPBodyElement name
- if (opMetaData == null)
- {
- SOAPBody soapBody = soapMessage.getSOAPBody();
-
- Iterator bodyChildren = soapBody.getChildElements();
- if (bodyChildren.hasNext() == false)
- {
- if (epMetaData.getStyle() == Style.RPC)
- throw new SOAPException("Empty SOAP body with no child element not
supported for RPC");
-
- // [JBWS-1125] Support empty soap body elements
- for (OperationMetaData opAux : epMetaData.getOperations())
- {
- if (opAux.getParameters().size() == 0)
- {
- log.debug ("Dispatching empty SOAP body");
- opMetaData = opAux;
- break;
- }
- }
- }
- else
- {
- SOAPBodyElement soapBodyElement = (SOAPBodyElement)bodyChildren.next();
- if (bodyChildren.hasNext())
- throw new SOAPException("SOAPBody has more than on child
element");
-
- Name soapName = soapBodyElement.getElementName();
- QName xmlElementName = new QName(soapName.getURI(),
soapName.getLocalName());
- opMetaData = epMetaData.getOperation(xmlElementName);
- }
- }
-
- // Dispatch to a generic operation that takes an org.w3c.dom.Element
- if (opMetaData == null)
- {
- for (OperationMetaData opAux : epMetaData.getOperations())
- {
- if (opAux.isMessageEndpoint())
- {
- log.debug("Use generic message style dispatch");
- opMetaData = opAux;
- break;
- }
- }
- }
-
- log.debug("getDispatchDestination: " + (opMetaData != null ?
opMetaData.getQName() : null));
- return opMetaData;
- }
-}
\ No newline at end of file
Deleted: branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPMessageImpl.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPMessageImpl.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPMessageImpl.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -1,414 +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 java.io.IOException;
-import java.io.OutputStream;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-
-import javax.mail.MessagingException;
-import javax.xml.soap.AttachmentPart;
-import javax.xml.soap.MimeHeader;
-import javax.xml.soap.MimeHeaders;
-import javax.xml.soap.SOAPEnvelope;
-import javax.xml.soap.SOAPException;
-import javax.xml.soap.SOAPFault;
-import javax.xml.soap.SOAPMessage;
-import javax.xml.soap.SOAPPart;
-
-import org.jboss.ws.WSException;
-import org.jboss.ws.extras.xop.XOPContext;
-import org.jboss.ws.metadata.umdm.EndpointMetaData;
-import org.jboss.ws.metadata.umdm.OperationMetaData;
-import org.jboss.ws.soap.attachment.AttachmentPartImpl;
-import org.jboss.ws.soap.attachment.CIDGenerator;
-import org.jboss.ws.soap.attachment.MimeConstants;
-import org.jboss.ws.soap.attachment.MultipartRelatedEncoder;
-import org.jboss.ws.soap.attachment.MultipartRelatedSwAEncoder;
-import org.jboss.ws.soap.attachment.MultipartRelatedXOPEncoder;
-
-/**
- * The root class for all SOAP messages. As transmitted on the "wire", a SOAP
message is an XML document or a
- * MIME message whose first body part is an XML/SOAP document.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @author <a href="mailto:jason@stacksmash.com">Jason T.
Greene</a>
- */
-public class SOAPMessageImpl extends SOAPMessage
-{
- private boolean saveRequired = true;
- private MimeHeaders mimeHeaders = new MimeHeaders();
- private List<AttachmentPart> attachments = new
LinkedList<AttachmentPart>();
- private CIDGenerator cidGenerator = new CIDGenerator();
- private boolean isXOPMessage;
- private SOAPPartImpl soapPart;
- private MultipartRelatedEncoder multipartRelatedEncoder;
-
- // Cache the associated operation meta data
- private OperationMetaData opMetaData;
-
- SOAPMessageImpl() throws SOAPException
- {
- soapPart = new SOAPPartImpl(this);
- setProperty(CHARACTER_SET_ENCODING, "UTF-8");
- setProperty(WRITE_XML_DECLARATION, false);
- }
-
- public CIDGenerator getCidGenerator()
- {
- return cidGenerator;
- }
-
- public boolean isXOPMessage()
- {
- return isXOPMessage;
- }
-
- public void setXOPMessage(boolean isXOPMessage)
- {
- this.isXOPMessage = isXOPMessage;
- }
-
- public void setAttachments(Collection<AttachmentPart> parts) throws
SOAPException
- {
- for (AttachmentPart part : parts)
- {
- attachments.add(part);
- }
- saveRequired = true;
- }
-
- public void addAttachmentPart(AttachmentPart part)
- {
- if (part == null)
- return;
-
- attachments.add(part);
- saveRequired = true;
- }
-
- public AttachmentPart getAttachmentByContentId(String cid) throws SOAPException
- {
- for (AttachmentPart part : attachments)
- {
- String contentId = part.getContentId();
- if (contentId.equals(cid))
- return part;
- }
- return null;
- }
-
- public AttachmentPart removeAttachmentByContentId(String cid)
- {
- for (AttachmentPart part : attachments)
- {
- String contentId = part.getContentId();
- if (contentId.equals(cid))
- {
- attachments.remove(part);
- return part;
- }
- }
-
- return null;
- }
- public AttachmentPart getAttachmentByPartName(String partName)
- {
- for (AttachmentPart part : attachments)
- {
- String contentId = part.getContentId();
- if (contentId.startsWith("<" + partName + "="))
- return part;
- }
- return null;
- }
-
- public AttachmentPart createAttachmentPart()
- {
- return new AttachmentPartImpl();
- }
-
- public String getContentDescription()
- {
- String[] value = mimeHeaders.getHeader(MimeConstants.CONTENT_DESCRIPTION);
-
- return (value == null) ? null : value[0];
- }
-
- public void setContentDescription(String description)
- {
- mimeHeaders.setHeader(MimeConstants.CONTENT_DESCRIPTION, description);
- }
-
- public MimeHeaders getMimeHeaders()
- {
- return mimeHeaders;
- }
-
- public void setMimeHeaders(MimeHeaders headers)
- {
- if (headers == null)
- throw new IllegalArgumentException("MimeHeaders cannot be null");
- this.mimeHeaders = headers;
- }
-
- public SOAPPart getSOAPPart()
- {
- return soapPart;
- }
-
- public void removeAllAttachments()
- {
- attachments.clear();
- saveRequired = true;
- }
-
- public int countAttachments()
- {
- return attachments.size();
- }
-
- public Iterator getAttachments()
- {
- // Someone could call remove on this iterator, affecting the attachment count
- saveRequired = true;
- return attachments.iterator();
- }
-
- public Iterator getAttachments(MimeHeaders headers)
- {
- if (headers == null)
- throw new WSException("MimeHeaders can not be null");
-
- return new MimeMatchingAttachmentsIterator(headers, attachments);
- }
-
- public void saveChanges() throws SOAPException
- {
- if (saveRequired == true)
- {
- try
- {
- boolean hasAttachments = attachments.size() > 0;
-
- if (isXOPMessage() && !XOPContext.isMTOMEnabled() &&
hasAttachments)
- throw new IllegalStateException("XOP parameter not properly
inlined");
-
- // default content-type
- String contentType = MimeConstants.TYPE_SOAP11 + "; charset=" +
getCharSetEncoding();
-
- if (hasAttachments)
- {
- if (isXOPMessage() && XOPContext.isMTOMEnabled())
- {
- multipartRelatedEncoder = new MultipartRelatedXOPEncoder(this);
- multipartRelatedEncoder.encodeMultipartRelatedMessage();
- contentType = multipartRelatedEncoder.getContentType();
- }
- else
- {
- multipartRelatedEncoder = new MultipartRelatedSwAEncoder(this);
- multipartRelatedEncoder.encodeMultipartRelatedMessage();
- contentType = multipartRelatedEncoder.getContentType();
- }
- }
-
- mimeHeaders.setHeader(MimeConstants.CONTENT_TYPE, contentType);
-
- }
- catch (MessagingException ex)
- {
- throw new SOAPException(ex);
- }
-
- /*
- * We are lazily encoding our message, which means that currently
- * Content-Length is not being calculated. This should not be a problem
- * because HTTP/1.1 does not require that it be sent (WS Basic Profile 1.1
- * states that implementations SHOULD send HTTP 1.1). If it is determined
- * that it must be sent, this perhaps should be done by the transport
- * layer. However, there could be a space optimization where length is
- * precalulated per attachment, and that calculation would, of course,
- * belong here.
- */
-
- saveRequired = false;
- }
- }
-
- public boolean saveRequired()
- {
- return saveRequired;
- }
-
- public void writeTo(OutputStream outs) throws SOAPException, IOException
- {
- // Save all changes
- saveChanges();
-
- // If there are attachments then we delegate encoding to MultipartRelatedEncoder
- if (attachments.size() > 0)
- {
- multipartRelatedEncoder.writeTo(outs);
- }
- else
- {
- SOAPEnvelope soapEnv = getSOAPPart().getEnvelope();
- if (soapEnv != null)
- {
- boolean writeXML = isWriteXMLDeclaration();
- String charsetEncoding = getCharSetEncoding();
- SOAPElementWriter writer = new SOAPElementWriter(outs, charsetEncoding);
-
writer.setWriteXMLDeclaration(writeXML).writeElement((SOAPEnvelopeImpl)soapEnv);
- }
- }
- }
-
- private String getCharSetEncoding() throws SOAPException
- {
- String charsetName = (String)getProperty(CHARACTER_SET_ENCODING);
- if (charsetName == null)
- charsetName = "UTF-8";
- return charsetName;
- }
-
- /** Get the operation meta data for this SOAP message
- */
- public OperationMetaData getOperationMetaData(EndpointMetaData epMetaData) throws
SOAPException
- {
- if (opMetaData == null)
- {
- SOAPMessageDispatcher dispatcher = new SOAPMessageDispatcher();
- opMetaData = dispatcher.getDispatchDestination(epMetaData, this);
- }
- return opMetaData;
- }
-
- public boolean isFaultMessage()
- {
- SOAPFault soapFault = null;
- try
- {
- soapFault = getSOAPBody().getFault();
- }
- catch (Exception ignore)
- {
- }
- return soapFault != null;
- }
-
- private boolean isWriteXMLDeclaration() throws SOAPException
- {
- Boolean booleanValue = new Boolean(false);
- Object propValue = getProperty(WRITE_XML_DECLARATION);
- if (propValue instanceof Boolean)
- booleanValue = (Boolean)propValue;
- if (propValue instanceof String)
- booleanValue = new Boolean((String)propValue);
- return booleanValue.booleanValue();
- }
-
- public static class MimeMatchingAttachmentsIterator implements Iterator
- {
- private Iterator iterator;
-
- private MimeHeaders headers = new MimeHeaders();
-
- private AttachmentPart lastMatch;
-
- public MimeMatchingAttachmentsIterator(MimeHeaders headers, List attachments)
- {
- iterator = attachments.iterator();
-
- if (headers != null)
- this.headers = headers;
- }
-
- private boolean containsAllHeaders(Iterator headerIterator, AttachmentPart part)
- {
- while (headerIterator.hasNext())
- {
- MimeHeader header = (MimeHeader)headerIterator.next();
- String[] values = part.getMimeHeader(header.getName());
- if (values == null)
- return false;
-
- boolean match = false;
- for (int j = 0; j < values.length; j++)
- {
- if (values[j].equalsIgnoreCase(header.getValue()))
- {
- match = true;
- break;
- }
- }
-
- if (!match)
- return false;
- }
-
- return true;
- }
-
- private void nextMatch()
- {
- while (iterator.hasNext())
- {
- AttachmentPart part = (AttachmentPart)iterator.next();
- if (containsAllHeaders(headers.getAllHeaders(), part))
- {
- lastMatch = part;
- break;
- }
- }
- }
-
- public boolean hasNext()
- {
- if (lastMatch == null)
- nextMatch();
-
- return lastMatch != null;
- }
-
- public Object next()
- {
- if (!hasNext())
- return null;
-
- Object retval = lastMatch;
- lastMatch = null;
-
- return retval;
- }
-
- public void remove()
- {
- iterator.remove();
- }
- }
-}
Deleted: branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPPartImpl.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPPartImpl.java 2006-12-06
00:32:54 UTC (rev 1560)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPPartImpl.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -1,547 +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 java.io.IOException;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import javax.xml.soap.MimeHeaders;
-import javax.xml.soap.SOAPBody;
-import javax.xml.soap.SOAPEnvelope;
-import javax.xml.soap.SOAPException;
-import javax.xml.soap.SOAPMessage;
-import javax.xml.soap.SOAPPart;
-import javax.xml.transform.Source;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.stream.StreamSource;
-
-import org.jboss.logging.Logger;
-import org.jboss.util.NotImplementedException;
-import org.jboss.ws.utils.DOMUtils;
-import org.w3c.dom.Attr;
-import org.w3c.dom.CDATASection;
-import org.w3c.dom.Comment;
-import org.w3c.dom.DOMConfiguration;
-import org.w3c.dom.DOMException;
-import org.w3c.dom.DOMImplementation;
-import org.w3c.dom.Document;
-import org.w3c.dom.DocumentFragment;
-import org.w3c.dom.DocumentType;
-import org.w3c.dom.Element;
-import org.w3c.dom.EntityReference;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.w3c.dom.ProcessingInstruction;
-import org.w3c.dom.Text;
-import org.w3c.dom.UserDataHandler;
-
-/** An implementation of SOAPPart.
- *
- *
- * @author Thomas.Diesler(a)jboss.org
- */
-public class SOAPPartImpl extends SOAPPart
-{
- // provide logging
- private static Logger log = Logger.getLogger(SOAPPartImpl.class);
-
- private SOAPMessage soapMessage;
- private SOAPEnvelope soapEnvelope;
-
- private SOAPDocument doc = new SOAPDocument();
-
- SOAPPartImpl(SOAPMessage message)
- {
- this.soapMessage = message;
- }
-
- public SOAPMessage getSOAPMessage()
- {
- return soapMessage;
- }
-
- public SOAPEnvelope getEnvelope() throws SOAPException
- {
- return soapEnvelope;
- }
-
- public void setEnvelope(SOAPEnvelope soapEnvelope)
- {
- this.soapEnvelope = soapEnvelope;
- }
-
- public void removeMimeHeader(String s)
- {
- MimeHeaders mimeHeaders = soapMessage.getMimeHeaders();
- mimeHeaders.removeHeader(s);
- }
-
- public void removeAllMimeHeaders()
- {
- MimeHeaders mimeHeaders = soapMessage.getMimeHeaders();
- mimeHeaders.removeAllHeaders();
- }
-
- public String[] getMimeHeader(String name)
- {
- MimeHeaders mimeHeaders = soapMessage.getMimeHeaders();
- return mimeHeaders.getHeader(name);
- }
-
- public void setMimeHeader(String name, String value)
- {
- MimeHeaders mimeHeaders = soapMessage.getMimeHeaders();
- mimeHeaders.setHeader(name, value);
- }
-
- public void addMimeHeader(String name, String value)
- {
- MimeHeaders mimeHeaders = soapMessage.getMimeHeaders();
- mimeHeaders.addHeader(name, value);
- }
-
- public Iterator getAllMimeHeaders()
- {
- MimeHeaders mimeHeaders = soapMessage.getMimeHeaders();
- return mimeHeaders.getAllHeaders();
- }
-
- public Iterator getMatchingMimeHeaders(String names[])
- {
- MimeHeaders mimeHeaders = soapMessage.getMimeHeaders();
- return mimeHeaders.getMatchingHeaders(names);
- }
-
- public Iterator getNonMatchingMimeHeaders(String names[])
- {
- MimeHeaders mimeHeaders = soapMessage.getMimeHeaders();
- return mimeHeaders.getNonMatchingHeaders(names);
- }
-
- public void setContent(Source source) throws SOAPException
- {
- // 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 (source == null)
- {
- log.debug("Setting content source to null removes the SOAPEnvelope");
- soapEnvelope = null;
- return;
- }
-
- Element domElement;
- if (source instanceof DOMSource)
- {
- DOMSource domSource = (DOMSource)source;
- Node node = domSource.getNode();
- if (node instanceof Document)
- domElement = ((Document)node).getDocumentElement();
- else if (node instanceof Element)
- domElement = (Element)node;
- else
- throw new SOAPException("Unsupported DOMSource node: " + node);
- }
- else if (source instanceof StreamSource)
- {
- try
- {
- StreamSource streamSource = (StreamSource)source;
- domElement = DOMUtils.parse(streamSource.getInputStream());
- }
- catch (IOException e)
- {
- throw new SOAPException("Cannot parse stream source", e);
- }
- }
- else
- {
- throw new SOAPException("Unsupported source parameter: " + source);
- }
-
- SOAPFactoryImpl factory = new SOAPFactoryImpl();
- SOAPElementImpl soapElement = factory.createElement(domElement, true);
-
- SOAPBody body = soapEnvelope.getBody();
- body.removeContents();
- body.addChildElement(soapElement);
- }
-
- public Source getContent() throws SOAPException
- {
- SOAPBody body = soapEnvelope.getBody();
- return new DOMSource(body.getFirstChild());
- }
-
- // Document
*********************************************************************************************************
-
- public DOMImplementation getImplementation()
- {
- return doc.getImplementation();
- }
-
- public DocumentFragment createDocumentFragment()
- {
- return doc.createDocumentFragment();
- }
-
- public DocumentType getDoctype()
- {
- return doc.getDoctype();
- }
-
- public Element getDocumentElement()
- {
- return soapEnvelope;
- }
-
- public Attr createAttribute(String name) throws DOMException
- {
- return doc.createAttribute(name);
- }
-
- public CDATASection createCDATASection(String data) throws DOMException
- {
- return doc.createCDATASection(data);
- }
-
- public Comment createComment(String data)
- {
- return doc.createComment(data);
- }
-
- public Element createElement(String tagName) throws DOMException
- {
- return doc.createElement(tagName);
- }
-
- public Element getElementById(String elementId)
- {
- return doc.getElementById(elementId);
- }
-
- public EntityReference createEntityReference(String name) throws DOMException
- {
- return doc.createEntityReference(name);
- }
-
- public org.w3c.dom.Node importNode(org.w3c.dom.Node importedNode, boolean deep) throws
DOMException
- {
- return doc.importNode(importedNode, deep);
- }
-
- public NodeList getElementsByTagName(String tagname)
- {
- return doc.getElementsByTagName(tagname);
- }
-
- public Text createTextNode(String data)
- {
- return doc.createTextNode(data);
- }
-
- public Attr createAttributeNS(String namespaceURI, String qualifiedName) throws
DOMException
- {
- return doc.createAttributeNS(namespaceURI, qualifiedName);
- }
-
- public Element createElementNS(String namespaceURI, String qualifiedName) throws
DOMException
- {
- return doc.createElementNS(namespaceURI, qualifiedName);
- }
-
- public NodeList getElementsByTagNameNS(String namespaceURI, String localName)
- {
- return doc.getElementsByTagNameNS(namespaceURI, localName);
- }
-
- public ProcessingInstruction createProcessingInstruction(String target, String data)
throws DOMException
- {
- return doc.createProcessingInstruction(target, data);
- }
-
- // Node
*********************************************************************************************************
-
- public org.w3c.dom.Node appendChild(org.w3c.dom.Node node) throws DOMException
- {
- throw new NotImplementedException();
- }
-
- public org.w3c.dom.Node cloneNode(boolean b)
- {
- throw new NotImplementedException();
- }
-
- public NamedNodeMap getAttributes()
- {
- throw new NotImplementedException();
- }
-
- public NodeList getChildNodes()
- {
- List<NodeImpl> list = new ArrayList<NodeImpl>();
- if (soapEnvelope != null)
- {
- list.add((NodeImpl)soapEnvelope);
- }
- return new NodeListImpl(list);
- }
-
- public org.w3c.dom.Node getFirstChild()
- {
- return soapEnvelope;
- }
-
- public org.w3c.dom.Node getLastChild()
- {
- return soapEnvelope;
- }
-
- public String getLocalName()
- {
- throw new NotImplementedException();
- }
-
- public String getNamespaceURI()
- {
- throw new NotImplementedException();
- }
-
- public org.w3c.dom.Node getNextSibling()
- {
- throw new NotImplementedException();
- }
-
- public String getNodeName()
- {
- return doc.getNodeName();
- }
-
- public short getNodeType()
- {
- return doc.getNodeType();
- }
-
- public String getNodeValue() throws DOMException
- {
- throw new NotImplementedException();
- }
-
- public Document getOwnerDocument()
- {
- throw new NotImplementedException();
- }
-
- public org.w3c.dom.Node getParentNode()
- {
- throw new NotImplementedException();
- }
-
- public String getPrefix()
- {
- throw new NotImplementedException();
- }
-
- public org.w3c.dom.Node getPreviousSibling()
- {
- throw new NotImplementedException();
- }
-
- public boolean hasAttributes()
- {
- throw new NotImplementedException();
- }
-
- public boolean hasChildNodes()
- {
- throw new NotImplementedException();
- }
-
- public org.w3c.dom.Node insertBefore(org.w3c.dom.Node node, org.w3c.dom.Node node1)
throws DOMException
- {
- throw new NotImplementedException();
- }
-
- public boolean isSupported(String s, String s1)
- {
- throw new NotImplementedException();
- }
-
- public void normalize()
- {
- throw new NotImplementedException();
- }
-
- public org.w3c.dom.Node removeChild(org.w3c.dom.Node node) throws DOMException
- {
- throw new NotImplementedException();
- }
-
- public org.w3c.dom.Node replaceChild(org.w3c.dom.Node node, org.w3c.dom.Node node1)
throws DOMException
- {
- throw new NotImplementedException();
- }
-
- public void setNodeValue(String s) throws DOMException
- {
- throw new NotImplementedException();
- }
-
- public void setPrefix(String s) throws DOMException
- {
- throw new NotImplementedException();
- }
-
- public Node adoptNode(Node source) throws DOMException
- {
- throw new NotImplementedException("adoptNode");
- }
-
- public String getDocumentURI()
- {
- throw new NotImplementedException("getDocumentURI");
- }
-
- public DOMConfiguration getDomConfig()
- {
- throw new NotImplementedException("getDomConfig");
- }
-
- public String getInputEncoding()
- {
- throw new NotImplementedException("getInputEncoding");
- }
-
- public boolean getStrictErrorChecking()
- {
- throw new NotImplementedException("getStrictErrorChecking");
- }
-
- public String getXmlEncoding()
- {
- throw new NotImplementedException("getXmlEncoding");
- }
-
- public boolean getXmlStandalone()
- {
- throw new NotImplementedException("getXmlStandalone");
- }
-
- public String getXmlVersion()
- {
- throw new NotImplementedException("getXmlVersion");
- }
-
- public void normalizeDocument()
- {
- throw new NotImplementedException("normalizeDocument");
- }
-
- public Node renameNode(Node n, String namespaceURI, String qualifiedName) throws
DOMException
- {
- throw new NotImplementedException("renameNode");
- }
-
- public void setDocumentURI(String documentURI)
- {
- throw new NotImplementedException("setDocumentURI");
- }
-
- public void setStrictErrorChecking(boolean strictErrorChecking)
- {
- throw new NotImplementedException("setStrictErrorChecking");
- }
-
- public void setXmlStandalone(boolean xmlStandalone) throws DOMException
- {
- throw new NotImplementedException("setXmlStandalone");
- }
-
- public void setXmlVersion(String xmlVersion) throws DOMException
- {
- throw new NotImplementedException("setXmlVersion");
- }
-
- public short compareDocumentPosition(Node other) throws DOMException
- {
- throw new NotImplementedException("compareDocumentPosition");
- }
-
- public String getBaseURI()
- {
- throw new NotImplementedException("getBaseURI");
- }
-
- public Object getFeature(String feature, String version)
- {
- throw new NotImplementedException("getFeature");
- }
-
- public String getTextContent() throws DOMException
- {
- throw new NotImplementedException("getTextContent");
- }
-
- public Object getUserData(String key)
- {
- throw new NotImplementedException("getUserData");
- }
-
- public boolean isDefaultNamespace(String namespaceURI)
- {
- throw new NotImplementedException("isDefaultNamespace");
- }
-
- public boolean isEqualNode(Node arg)
- {
- throw new NotImplementedException("isEqualNode");
- }
-
- public boolean isSameNode(Node other)
- {
- throw new NotImplementedException("isSameNode");
- }
-
- public String lookupNamespaceURI(String prefix)
- {
- throw new NotImplementedException("lookupNamespaceURI");
- }
-
- public String lookupPrefix(String namespaceURI)
- {
- throw new NotImplementedException("lookupPrefix");
- }
-
- public void setTextContent(String textContent) throws DOMException
- {
- throw new NotImplementedException("setTextContent");
- }
-
- public Object setUserData(String key, Object data, UserDataHandler handler)
- {
- throw new NotImplementedException("setUserData");
- }
-}
Deleted: branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/TextImpl.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/TextImpl.java 2006-12-06
00:32:54 UTC (rev 1560)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/TextImpl.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -1,327 +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 org.w3c.dom.DOMException;
-import org.w3c.dom.Text;
-
-/**
- * A representation of a node whose value is text. A Text
- * object may represent text that is content or text that is a comment.
- *
- * @author Thomas.Diesler(a)jboss.org
- */
-public class TextImpl extends NodeImpl implements javax.xml.soap.Text
-{
-
- public TextImpl(org.w3c.dom.Node node)
- {
- super(node);
- }
-
- /** Retrieves whether this object represents a comment.
- */
- public boolean isComment()
- {
- String value = getNodeValue().trim();
- return value.startsWith("<!--") &&
value.endsWith("-->");
- }
-
- public String getValue()
- {
- return getNodeValue();
- }
-
- public void setValue(String value)
- {
- setNodeValue(value);
- }
-
- /**
- * Breaks this node into two nodes at the specified <code>offset</code>,
keeping both in the tree as siblings.
- * <p/>
- * After being split, this node will contain all the content up to the
<code>offset</code> point. A
- * new node of the same type, which contains all the content at and after the
<code>offset</code> point, is returned.
- * If the original node had a parent node, the new node is inserted as the next
sibling of the original node.
- * When the <code>offset</code> is equal to the length of this node, the
new node has no data.
- *
- * @param offset The 16-bit unit offset at which to split, starting from
<code>0</code>.
- * @return The new node, of the same type as this node.
- * @throws org.w3c.dom.DOMException INDEX_SIZE_ERR: Raised if the specified offset is
negative or greater
- * than the number of 16-bit units in
<code>data</code>.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is
readonly.
- */
- public Text splitText(int offset) throws DOMException
- {
-
- if (offset < 0 || offset > getNodeValue().length())
- throw new IllegalArgumentException("Invalid offset [" + offset +
"] for '" + getNodeValue() + "'");
-
- String before = getNodeValue().substring(0, offset + 1);
- setNodeValue(before);
-
- String after = getNodeValue().substring(offset + 1);
- TextImpl txtNode = new TextImpl(domNode.getOwnerDocument().createTextNode(after));
-
- org.w3c.dom.Node parent = getParentNode();
- if (parent != null)
- {
- org.w3c.dom.Node sibling = getNextSibling();
- if (sibling == null)
- parent.appendChild(txtNode);
- else
- parent.insertBefore(txtNode, sibling);
- }
-
- return txtNode;
- }
-
- // org.w3c.dom.CharacterData
***************************************************************************************
-
- /**
- * The number of 16-bit units that are available through
<code>data</code>
- * and the <code>substringData</code> method below. This may have the
- * value zero, i.e., <code>CharacterData</code> nodes may be empty.
- */
- public int getLength()
- {
- return getNodeValue().length();
- }
-
- /**
- * Remove a range of 16-bit units from the node. Upon success,
- * <code>data</code> and <code>length</code> reflect the
change.
- *
- * @param offset The offset from which to start removing.
- * @param count The number of 16-bit units to delete. If the sum of
- * <code>offset</code> and <code>count</code>
exceeds
- * <code>length</code> then all 16-bit units from
<code>offset</code>
- * to the end of the data are deleted.
- * @throws org.w3c.dom.DOMException INDEX_SIZE_ERR: Raised if the specified
<code>offset</code> is
- * negative or greater than the number of 16-bit
units in
- * <code>data</code>, or if the specified
<code>count</code> is
- * negative.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if
this node is readonly.
- */
- public void deleteData(int offset, int count) throws DOMException
- {
- String value = getNodeValue().substring(0, offset + 1);
- setNodeValue(value);
- }
-
- /**
- * The character data of the node that implements this interface. The DOM
- * implementation may not put arbitrary limits on the amount of data
- * that may be stored in a <code>CharacterData</code> node. However,
- * implementation limits may mean that the entirety of a node's data may
- * not fit into a single <code>DOMString</code>. In such cases, the user
- * may call <code>substringData</code> to retrieve the data in
- * appropriately sized pieces.
- *
- * @throws org.w3c.dom.DOMException NO_MODIFICATION_ALLOWED_ERR: Raised when the node
is readonly.
- * @throws org.w3c.dom.DOMException DOMSTRING_SIZE_ERR: Raised when it would return
more characters than
- * fit in a <code>DOMString</code>
variable on the implementation
- * platform.
- */
- public String getData() throws DOMException
- {
- return getNodeValue();
- }
-
- /**
- * Extracts a range of data from the node.
- *
- * @param offset Start offset of substring to extract.
- * @param count The number of 16-bit units to extract.
- * @return The specified substring. If the sum of <code>offset</code> and
- * <code>count</code> exceeds the <code>length</code>,
then all 16-bit
- * units to the end of the data are returned.
- * @throws org.w3c.dom.DOMException INDEX_SIZE_ERR: Raised if the specified
<code>offset</code> is
- * negative or greater than the number of 16-bit
units in
- * <code>data</code>, or if the specified
<code>count</code> is
- * negative.
- * <br>DOMSTRING_SIZE_ERR: Raised if the
specified range of text does
- * not fit into a
<code>DOMString</code>.
- */
- public String substringData(int offset, int count) throws DOMException
- {
- return getNodeValue().substring(offset, offset + count);
- }
-
- /**
- * Replace the characters starting at the specified 16-bit unit offset
- * with the specified string.
- *
- * @param offset The offset from which to start replacing.
- * @param count The number of 16-bit units to replace. If the sum of
- * <code>offset</code> and <code>count</code>
exceeds
- * <code>length</code>, then all 16-bit units to the end of
the data
- * are replaced; (i.e., the effect is the same as a
<code>remove</code>
- * method call with the same range, followed by an
<code>append</code>
- * method invocation).
- * @param arg The <code>DOMString</code> with which the range must be
- * replaced.
- * @throws org.w3c.dom.DOMException INDEX_SIZE_ERR: Raised if the specified
<code>offset</code> is
- * negative or greater than the number of 16-bit
units in
- * <code>data</code>, or if the specified
<code>count</code> is
- * negative.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if
this node is readonly.
- */
- public void replaceData(int offset, int count, String arg) throws DOMException
- {
- StringBuilder buffer = new StringBuilder(getNodeValue());
- buffer.replace(offset, offset + count, arg);
- setNodeValue(buffer.toString());
- }
-
- /**
- * Insert a string at the specified 16-bit unit offset.
- *
- * @param offset The character offset at which to insert.
- * @param arg The <code>DOMString</code> to insert.
- * @throws org.w3c.dom.DOMException INDEX_SIZE_ERR: Raised if the specified
<code>offset</code> is
- * negative or greater than the number of 16-bit
units in
- * <code>data</code>.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if
this node is readonly.
- */
- public void insertData(int offset, String arg) throws DOMException
- {
- StringBuilder buffer = new StringBuilder(getNodeValue());
- buffer.insert(offset, arg);
- setNodeValue(buffer.toString());
- }
-
- /**
- * Append the string to the end of the character data of the node. Upon
- * success, <code>data</code> provides access to the concatenation of
- * <code>data</code> and the <code>DOMString</code>
specified.
- *
- * @param arg The <code>DOMString</code> to append.
- * @throws org.w3c.dom.DOMException NO_MODIFICATION_ALLOWED_ERR: Raised if this node
is readonly.
- */
- public void appendData(String arg) throws DOMException
- {
- setNodeValue(getNodeValue() + arg);
- }
-
- /**
- * The character data of the node that implements this interface. The DOM
- * implementation may not put arbitrary limits on the amount of data
- * that may be stored in a <code>CharacterData</code> node. However,
- * implementation limits may mean that the entirety of a node's data may
- * not fit into a single <code>DOMString</code>. In such cases, the user
- * may call <code>substringData</code> to retrieve the data in
- * appropriately sized pieces.
- *
- * @throws org.w3c.dom.DOMException NO_MODIFICATION_ALLOWED_ERR: Raised when the node
is readonly.
- * @throws org.w3c.dom.DOMException DOMSTRING_SIZE_ERR: Raised when it would return
more characters than
- * fit in a <code>DOMString</code>
variable on the implementation
- * platform.
- */
- public void setData(String data) throws DOMException
- {
- setNodeValue(data);
- }
-
- // Stubbed out org.w3c.dom.Text methods **************************
-
- /**
- * TODO - complete the implementation
- *
- * Returns whether this text node contains <a
href='http://www.w3.org/TR/2004/REC-xml-infoset-20040204#infoitem.cha...
- * element content whitespace</a>, often abusively called "ignorable
whitespace". The text node is
- * determined to contain whitespace in element content during the load
- * of the document or if validation occurs while using
- * <code>Document.normalizeDocument()</code>.
- * @since DOM Level 3
- */
- public boolean isElementContentWhitespace()
- {
- return false;
- }
-
- /**
- * TODO - complete the implementation
- *
- * Returns all text of <code>Text</code> nodes logically-adjacent text
- * nodes to this node, concatenated in document order.
- * <br>For instance, in the example below <code>wholeText</code> on
the
- * <code>Text</code> node that contains "bar" returns
"barfoo", while on
- * the <code>Text</code> node that contains "foo" it returns
"barfoo".
- * @since DOM Level 3
- */
- public String getWholeText()
- {
- return null;
- }
-
- /**
- * TODO - complete the implementation
- *
- * Replaces the text of the current node and all logically-adjacent text
- * nodes with the specified text. All logically-adjacent text nodes are
- * removed including the current node unless it was the recipient of the
- * replacement text.
- * <br>This method returns the node which received the replacement text.
- * The returned node is:
- * <ul>
- * <li><code>null</code>, when the replacement text is
- * the empty string;
- * </li>
- * <li>the current node, except when the current node is
- * read-only;
- * </li>
- * <li> a new <code>Text</code> node of the same type (
- * <code>Text</code> or <code>CDATASection</code>) as the
current node
- * inserted at the location of the replacement.
- * </li>
- * </ul>
- * <br>For instance, in the above example calling
- * <code>replaceWholeText</code> on the <code>Text</code> node
that
- * contains "bar" with "yo" in argument results in the following:
- * <br>Where the nodes to be removed are read-only descendants of an
- * <code>EntityReference</code>, the
<code>EntityReference</code> must
- * be removed instead of the read-only nodes. If any
- * <code>EntityReference</code> to be removed has descendants that are
- * not <code>EntityReference</code>, <code>Text</code>, or
- * <code>CDATASection</code> nodes, the
<code>replaceWholeText</code>
- * method must fail before performing any modification of the document,
- * raising a <code>DOMException</code> with the code
- * <code>NO_MODIFICATION_ALLOWED_ERR</code>.
- * <br>For instance, in the example below calling
- * <code>replaceWholeText</code> on the <code>Text</code> node
that
- * contains "bar" fails, because the
<code>EntityReference</code> node
- * "ent" contains an <code>Element</code> node which cannot be
removed.
- * @param content The content of the replacing <code>Text</code> node.
- * @return The <code>Text</code> node created with the specified content.
- * @exception org.w3c.dom.DOMException
- * NO_MODIFICATION_ALLOWED_ERR: Raised if one of the <code>Text</code>
- * nodes being replaced is readonly.
- * @since DOM Level 3
- */
- public Text replaceWholeText(String content)
- throws DOMException
- {
- return null;
- }
-
-}
Modified: branches/tdiesler/trunk/src/main/java/org/jboss/ws/utils/IOUtils.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/utils/IOUtils.java 2006-12-06
00:32:54 UTC (rev 1560)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/utils/IOUtils.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -27,8 +27,8 @@
import org.jboss.logging.Logger;
import org.jboss.ws.WSException;
-import org.jboss.ws.server.ServerConfig;
-import org.jboss.ws.server.ServerConfigFactory;
+import org.jboss.ws.core.server.ServerConfig;
+import org.jboss.ws.core.server.ServerConfigFactory;
import javax.activation.DataHandler;
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/utils/ThreadLocalAssociation.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/utils/ThreadLocalAssociation.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/utils/ThreadLocalAssociation.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -44,7 +44,7 @@
/**
* SOAP message context
- * @see org.jboss.ws.soap.MessageContextAssociation
+ * @see org.jboss.ws.core.soap.MessageContextAssociation
*/
private static ThreadLocal<Stack<CommonMessageContext>> msgContextAssoc =
new ThreadLocal<Stack<CommonMessageContext>>();
Modified:
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/binding/SOAPBindingTestCase.java
===================================================================
---
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/binding/SOAPBindingTestCase.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/binding/SOAPBindingTestCase.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -36,19 +36,19 @@
import org.jboss.test.ws.JBossWSTest;
import org.jboss.ws.Constants;
-import org.jboss.ws.binding.EndpointInvocation;
-import org.jboss.ws.binding.UnboundHeader;
import org.jboss.ws.core.CommonBinding;
import org.jboss.ws.core.CommonBindingProvider;
import org.jboss.ws.core.CommonMessageContext;
import org.jboss.ws.core.CommonSOAPBinding;
+import org.jboss.ws.core.binding.EndpointInvocation;
+import org.jboss.ws.core.binding.UnboundHeader;
+import org.jboss.ws.core.soap.MessageContextAssociation;
+import org.jboss.ws.core.soap.MessageFactoryImpl;
import org.jboss.ws.jaxrpc.CallImpl;
import org.jboss.ws.jaxrpc.handler.SOAPMessageContextJAXRPC;
import org.jboss.ws.metadata.umdm.OperationMetaData;
import org.jboss.ws.metadata.umdm.ParameterMetaData;
import org.jboss.ws.metadata.umdm.EndpointMetaData.Type;
-import org.jboss.ws.soap.MessageContextAssociation;
-import org.jboss.ws.soap.MessageFactoryImpl;
import org.jboss.ws.utils.DOMUtils;
/**
Modified:
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/jbossxb/SerializerDeserializerTestCase.java
===================================================================
---
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/jbossxb/SerializerDeserializerTestCase.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/jbossxb/SerializerDeserializerTestCase.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -32,9 +32,9 @@
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.core.binding.DeserializerSupport;
+import org.jboss.ws.core.binding.SerializationContext;
+import org.jboss.ws.core.binding.SerializerSupport;
import org.jboss.ws.jaxrpc.SerializationContextJAXRPC;
import org.jboss.ws.jaxrpc.TypeMappingImpl;
import org.jboss.ws.jaxrpc.TypeMappingRegistryImpl;
Modified:
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/soap/MessageFactoryTestCase.java
===================================================================
---
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/soap/MessageFactoryTestCase.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/soap/MessageFactoryTestCase.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -31,7 +31,7 @@
import org.jboss.test.ws.JBossWSTest;
import org.jboss.ws.Constants;
-import org.jboss.ws.soap.MessageFactoryImpl;
+import org.jboss.ws.core.soap.MessageFactoryImpl;
import org.jboss.ws.utils.DOMUtils;
import org.w3c.dom.Element;
Modified:
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/soap/SOAPConnectionTestCase.java
===================================================================
---
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/soap/SOAPConnectionTestCase.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/soap/SOAPConnectionTestCase.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -38,7 +38,7 @@
import org.jboss.test.ws.JBossWSTest;
import org.jboss.test.ws.JBossWSTestSetup;
-import org.jboss.ws.soap.SOAPBodyElementRpc;
+import org.jboss.ws.core.soap.SOAPBodyElementRpc;
/** Test call on a SOAPConnection
*
Modified:
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/soap/SOAPContentElementTestCase.java
===================================================================
---
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/soap/SOAPContentElementTestCase.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/soap/SOAPContentElementTestCase.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -33,8 +33,8 @@
import javax.xml.soap.Text;
import org.jboss.test.ws.JBossWSTest;
-import org.jboss.ws.soap.NameImpl;
-import org.jboss.ws.soap.SOAPContentElement;
+import org.jboss.ws.core.soap.NameImpl;
+import org.jboss.ws.core.soap.SOAPContentElement;
/**
* Test the SOAPContentElement
Modified:
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/soap/SOAPEnvelopeTestCase.java
===================================================================
---
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/soap/SOAPEnvelopeTestCase.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/soap/SOAPEnvelopeTestCase.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -32,7 +32,7 @@
import org.jboss.test.ws.JBossWSTest;
import org.jboss.ws.Constants;
-import org.jboss.ws.soap.MessageFactoryImpl;
+import org.jboss.ws.core.soap.MessageFactoryImpl;
import org.jboss.ws.utils.DOMUtils;
import org.w3c.dom.Element;
Modified:
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/soap/SOAPFactoryTestCase.java
===================================================================
---
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/soap/SOAPFactoryTestCase.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/soap/SOAPFactoryTestCase.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -39,7 +39,7 @@
public void testSOAPFactoryCreation() throws Exception
{
SOAPFactory factory = SOAPFactory.newInstance();
- assertEquals(org.jboss.ws.soap.SOAPFactoryImpl.class, factory.getClass());
+ assertEquals(org.jboss.ws.core.soap.SOAPFactoryImpl.class, factory.getClass());
}
public void testCreateDetail() throws Exception
Modified:
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/soap/SOAPHeaderElementTestCase.java
===================================================================
---
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/soap/SOAPHeaderElementTestCase.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/soap/SOAPHeaderElementTestCase.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -32,8 +32,8 @@
import javax.xml.soap.SOAPMessage;
import org.jboss.test.ws.JBossWSTest;
-import org.jboss.ws.soap.MessageFactoryImpl;
-import org.jboss.ws.soap.NameImpl;
+import org.jboss.ws.core.soap.MessageFactoryImpl;
+import org.jboss.ws.core.soap.NameImpl;
import org.jboss.ws.utils.DOMUtils;
/**
Modified:
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/soap/SOAPHeaderTestCase.java
===================================================================
---
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/soap/SOAPHeaderTestCase.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/soap/SOAPHeaderTestCase.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -34,8 +34,8 @@
import org.jboss.test.ws.JBossWSTest;
import org.jboss.ws.Constants;
-import org.jboss.ws.soap.MessageFactoryImpl;
-import org.jboss.ws.soap.NameImpl;
+import org.jboss.ws.core.soap.MessageFactoryImpl;
+import org.jboss.ws.core.soap.NameImpl;
import org.jboss.ws.utils.DOMUtils;
/**
Modified:
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/soap/attachment/GenericAttachmentTestCase.java
===================================================================
---
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/soap/attachment/GenericAttachmentTestCase.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/soap/attachment/GenericAttachmentTestCase.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -41,17 +41,17 @@
import org.jboss.test.ws.JBossWSTest;
import org.jboss.ws.Constants;
-import org.jboss.ws.binding.EndpointInvocation;
import org.jboss.ws.core.CommonBinding;
import org.jboss.ws.core.CommonBindingProvider;
import org.jboss.ws.core.CommonSOAPBinding;
+import org.jboss.ws.core.binding.EndpointInvocation;
+import org.jboss.ws.core.soap.MessageContextAssociation;
+import org.jboss.ws.core.soap.MessageFactoryImpl;
+import org.jboss.ws.core.soap.attachment.MimeConstants;
import org.jboss.ws.jaxrpc.CallImpl;
import org.jboss.ws.jaxrpc.handler.SOAPMessageContextJAXRPC;
import org.jboss.ws.metadata.umdm.OperationMetaData;
import org.jboss.ws.metadata.umdm.EndpointMetaData.Type;
-import org.jboss.ws.soap.MessageContextAssociation;
-import org.jboss.ws.soap.MessageFactoryImpl;
-import org.jboss.ws.soap.attachment.MimeConstants;
/**
* TODO
Modified:
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/jbws1179/TestEndpointImpl.java
===================================================================
---
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/jbws1179/TestEndpointImpl.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/jbws1179/TestEndpointImpl.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -26,8 +26,8 @@
import javax.servlet.http.HttpSession;
import org.jboss.ws.core.CommonMessageContext;
+import org.jboss.ws.core.soap.MessageContextAssociation;
import org.jboss.ws.jaxrpc.handler.MessageContextJAXRPC;
-import org.jboss.ws.soap.MessageContextAssociation;
/**
*
Modified:
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/jbws1186/ServerHandler.java
===================================================================
---
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/jbws1186/ServerHandler.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/jbws1186/ServerHandler.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -36,7 +36,7 @@
import javax.xml.soap.SOAPMessage;
import org.jboss.logging.Logger;
-import org.jboss.ws.soap.SOAPContentElement;
+import org.jboss.ws.core.soap.SOAPContentElement;
public class ServerHandler extends GenericHandler
{
Modified:
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/jbws1190/TestEndpointImpl.java
===================================================================
---
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/jbws1190/TestEndpointImpl.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/jbws1190/TestEndpointImpl.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -25,12 +25,12 @@
import java.io.FilenameFilter;
import java.net.MalformedURLException;
+import org.jboss.ws.core.server.ServerConfig;
+import org.jboss.ws.core.server.ServerConfigFactory;
import org.jboss.ws.metadata.wsdl.WSDLDefinitions;
import org.jboss.ws.metadata.wsdl.WSDLDefinitionsFactory;
import org.jboss.ws.metadata.wsdl.WSDLEndpoint;
import org.jboss.ws.metadata.wsdl.WSDLService;
-import org.jboss.ws.server.ServerConfig;
-import org.jboss.ws.server.ServerConfigFactory;
/**
*
Modified:
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/jbws1205/TestEndpointImpl.java
===================================================================
---
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/jbws1205/TestEndpointImpl.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/jbws1205/TestEndpointImpl.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -28,8 +28,8 @@
import javax.naming.InitialContext;
import javax.xml.rpc.Service;
-import org.jboss.ws.server.ServerConfig;
-import org.jboss.ws.server.ServerConfigFactory;
+import org.jboss.ws.core.server.ServerConfig;
+import org.jboss.ws.core.server.ServerConfigFactory;
/**
* @author darran.lofthouse(a)jboss.com
Modified:
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/samples/swa/AttachmentSAAJTestCase.java
===================================================================
---
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/samples/swa/AttachmentSAAJTestCase.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/samples/swa/AttachmentSAAJTestCase.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -49,7 +49,7 @@
import org.jboss.test.ws.JBossWSTest;
import org.jboss.test.ws.JBossWSTestSetup;
-import org.jboss.ws.soap.SOAPBodyElementRpc;
+import org.jboss.ws.core.soap.SOAPBodyElementRpc;
/**
* Test SOAP with Attachements (SwA) through the SAAJ layer.
Modified:
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/wsse/MicrosoftInteropTestCase.java
===================================================================
---
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/wsse/MicrosoftInteropTestCase.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/wsse/MicrosoftInteropTestCase.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -32,11 +32,11 @@
import javax.xml.soap.SOAPMessage;
import org.jboss.test.ws.JBossWSTest;
+import org.jboss.ws.core.soap.MessageFactoryImpl;
import org.jboss.ws.extras.security.Constants;
import org.jboss.ws.extras.security.SecurityDecoder;
import org.jboss.ws.extras.security.SecurityStore;
import org.jboss.ws.extras.security.Util;
-import org.jboss.ws.soap.MessageFactoryImpl;
import org.jboss.ws.utils.DOMUtils;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
Modified:
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/wsse/RoundTripTestCase.java
===================================================================
---
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/wsse/RoundTripTestCase.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/wsse/RoundTripTestCase.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -34,6 +34,7 @@
import org.jboss.security.SecurityAssociation;
import org.jboss.test.ws.JBossWSTest;
+import org.jboss.ws.core.soap.MessageFactoryImpl;
import org.jboss.ws.extras.security.Constants;
import org.jboss.ws.extras.security.EncryptionOperation;
import org.jboss.ws.extras.security.OperationDescription;
@@ -49,7 +50,6 @@
import org.jboss.ws.extras.security.TimestampOperation;
import org.jboss.ws.extras.security.Util;
import org.jboss.ws.extras.security.WsuIdTarget;
-import org.jboss.ws.soap.MessageFactoryImpl;
import org.jboss.ws.utils.DOMWriter;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
Modified:
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/wsse/SunInteropTestCase.java
===================================================================
---
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/wsse/SunInteropTestCase.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/wsse/SunInteropTestCase.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -31,11 +31,11 @@
import javax.xml.soap.SOAPMessage;
import org.jboss.test.ws.JBossWSTest;
+import org.jboss.ws.core.soap.MessageFactoryImpl;
import org.jboss.ws.extras.security.Constants;
import org.jboss.ws.extras.security.SecurityDecoder;
import org.jboss.ws.extras.security.SecurityStore;
import org.jboss.ws.extras.security.Util;
-import org.jboss.ws.soap.MessageFactoryImpl;
import org.jboss.ws.utils.DOMWriter;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
Modified:
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/xop/doclit/InlineHandler.java
===================================================================
---
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/xop/doclit/InlineHandler.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/xop/doclit/InlineHandler.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -22,7 +22,7 @@
package org.jboss.test.ws.jaxrpc.xop.doclit;
import org.jboss.logging.Logger;
-import org.jboss.ws.soap.NameImpl;
+import org.jboss.ws.core.soap.NameImpl;
import javax.xml.rpc.handler.GenericHandler;
import javax.xml.rpc.handler.HandlerInfo;
Modified:
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/xop/rpclit/InlineHandler.java
===================================================================
---
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/xop/rpclit/InlineHandler.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/xop/rpclit/InlineHandler.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -1,7 +1,7 @@
package org.jboss.test.ws.jaxrpc.xop.rpclit;
import org.jboss.logging.Logger;
-import org.jboss.ws.soap.NameImpl;
+import org.jboss.ws.core.soap.NameImpl;
import javax.xml.namespace.QName;
import javax.xml.rpc.handler.GenericHandler;
Modified:
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/xop/shared/MTOMServiceBase.java
===================================================================
---
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/xop/shared/MTOMServiceBase.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/xop/shared/MTOMServiceBase.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -22,8 +22,8 @@
package org.jboss.test.ws.jaxrpc.xop.shared;
import org.jboss.ws.core.CommonMessageContext;
+import org.jboss.ws.core.soap.MessageContextAssociation;
import org.jboss.ws.extras.xop.XOPContext;
-import org.jboss.ws.soap.MessageContextAssociation;
import org.jboss.ws.jaxrpc.StubExt;
import java.util.StringTokenizer;
Modified:
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/endpoint/EndpointServlet.java
===================================================================
---
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/endpoint/EndpointServlet.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/endpoint/EndpointServlet.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -35,8 +35,8 @@
import javax.xml.ws.Service;
import javax.xml.ws.soap.SOAPBinding;
-import org.jboss.ws.server.HttpContext;
-import org.jboss.ws.server.HttpServer;
+import org.jboss.ws.core.server.HttpContext;
+import org.jboss.ws.core.server.HttpServer;
/**
* Test Endpoint deployment
Modified:
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/exception/ExceptionEndpointImpl.java
===================================================================
---
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/exception/ExceptionEndpointImpl.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/exception/ExceptionEndpointImpl.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -27,8 +27,8 @@
import javax.xml.soap.SOAPFault;
import javax.xml.ws.soap.SOAPFaultException;
-import org.jboss.ws.soap.NameImpl;
-import org.jboss.ws.soap.SOAPFaultImpl;
+import org.jboss.ws.core.soap.NameImpl;
+import org.jboss.ws.core.soap.SOAPFaultImpl;
@WebService(endpointInterface="org.jboss.test.ws.jaxws.exception.ExceptionEndpoint")
public class ExceptionEndpointImpl implements ExceptionEndpoint
Modified:
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1190/TestEndpointImpl.java
===================================================================
---
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1190/TestEndpointImpl.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1190/TestEndpointImpl.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -27,12 +27,12 @@
import javax.jws.WebService;
+import org.jboss.ws.core.server.ServerConfig;
+import org.jboss.ws.core.server.ServerConfigFactory;
import org.jboss.ws.metadata.wsdl.WSDLDefinitions;
import org.jboss.ws.metadata.wsdl.WSDLDefinitionsFactory;
import org.jboss.ws.metadata.wsdl.WSDLEndpoint;
import org.jboss.ws.metadata.wsdl.WSDLService;
-import org.jboss.ws.server.ServerConfig;
-import org.jboss.ws.server.ServerConfigFactory;
/**
*
Modified:
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/jsr181/soapbinding/JSR181SOAPBindingTestCase.java
===================================================================
---
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/jsr181/soapbinding/JSR181SOAPBindingTestCase.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/jsr181/soapbinding/JSR181SOAPBindingTestCase.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -39,7 +39,7 @@
import org.jboss.test.ws.JBossWSTest;
import org.jboss.test.ws.JBossWSTestSetup;
-import org.jboss.ws.soap.NameImpl;
+import org.jboss.ws.core.soap.NameImpl;
/**
* Test the JSR-181 annotation: javax.jws.SOAPBinding
Modified:
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/jsr181/webmethod/JSR181WebMethodTestCase.java
===================================================================
---
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/jsr181/webmethod/JSR181WebMethodTestCase.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/jsr181/webmethod/JSR181WebMethodTestCase.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -41,7 +41,7 @@
import org.jboss.test.ws.JBossWSTest;
import org.jboss.test.ws.JBossWSTestSetup;
-import org.jboss.ws.soap.NameImpl;
+import org.jboss.ws.core.soap.NameImpl;
import org.jboss.ws.utils.DOMUtils;
import org.w3c.dom.Element;
import org.xml.sax.InputSource;
Modified:
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/jsr181/webresult/JSR181WebResultTestCase.java
===================================================================
---
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/jsr181/webresult/JSR181WebResultTestCase.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/jsr181/webresult/JSR181WebResultTestCase.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -37,10 +37,10 @@
import org.jboss.test.ws.JBossWSTest;
import org.jboss.test.ws.JBossWSTestSetup;
+import org.jboss.ws.core.soap.NameImpl;
import org.jboss.ws.jaxrpc.CallImpl;
import org.jboss.ws.jaxrpc.ServiceFactoryImpl;
import org.jboss.ws.metadata.umdm.OperationMetaData;
-import org.jboss.ws.soap.NameImpl;
/**
* Test the JSR-181 annotation: javax.jws.webresult
Modified:
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/samples/retail/handler/SOAPMessageTrace.java
===================================================================
---
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/samples/retail/handler/SOAPMessageTrace.java 2006-12-06
00:32:54 UTC (rev 1560)
+++
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/samples/retail/handler/SOAPMessageTrace.java 2006-12-06
00:44:31 UTC (rev 1561)
@@ -23,10 +23,10 @@
import org.jboss.ws.jaxws.handler.GenericSOAPHandler;
import org.jboss.ws.core.CommonMessageContext;
-import org.jboss.ws.soap.MessageContextAssociation;
-import org.jboss.ws.soap.SOAPMessageImpl;
-import org.jboss.ws.soap.SOAPElementWriter;
-import org.jboss.ws.soap.SOAPElementImpl;
+import org.jboss.ws.core.soap.MessageContextAssociation;
+import org.jboss.ws.core.soap.SOAPElementImpl;
+import org.jboss.ws.core.soap.SOAPElementWriter;
+import org.jboss.ws.core.soap.SOAPMessageImpl;
import org.jboss.logging.Logger;
import javax.xml.ws.handler.MessageContext;