Author: thomas.diesler(a)jboss.com
Date: 2006-12-07 07:36:23 -0500 (Thu, 07 Dec 2006)
New Revision: 1604
Added:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/binding/JBossXBDeserializer.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/binding/JBossXBDeserializerFactory.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/binding/JBossXBSerializer.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/binding/JBossXBSerializerFactory.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/extensions/xop/jaxrpc/
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/extensions/xop/jaxrpc/JBossXBContentAdapter.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/extensions/xop/jaxrpc/XOPMarshallerImpl.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/extensions/xop/jaxrpc/XOPScanner.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/extensions/xop/jaxrpc/XOPUnmarshallerImpl.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/umdm/
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/umdm/ClientEndpointMetaData.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/umdm/EndpointMetaData.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/umdm/ExtensibleMetaData.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/umdm/FaultMetaData.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/umdm/HandlerMetaData.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/umdm/HandlerMetaDataJAXRPC.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/umdm/MetaDataExtension.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/umdm/OperationMetaData.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/umdm/ParameterMetaData.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/umdm/ServerEndpointMetaData.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/umdm/ServiceMetaData.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/umdm/TypeMappingMetaData.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/umdm/TypesMetaData.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/umdm/UnifiedMetaData.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/webservices/
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/webservices/PortComponentMetaData.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/webservices/WebserviceDescriptionMetaData.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/webservices/WebservicesFactory.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/webservices/WebservicesMetaData.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/tools/wsdl/
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/tools/wsdl/WSDL11DefinitionFactory.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/tools/wsdl/WSDL11Reader.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/tools/wsdl/WSDL11Writer.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/tools/wsdl/WSDLDefinitionsFactory.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/tools/wsdl/WSDLLocatorImpl.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/tools/wsdl/WSDLWriter.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/tools/wsdl/WSDLWriterResolver.java
Removed:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/binding/jbossxb/JBossXBDeserializer.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/binding/jbossxb/JBossXBDeserializerFactory.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/binding/jbossxb/JBossXBSerializer.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/binding/jbossxb/JBossXBSerializerFactory.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/eventing/
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/extensions/xop/JBossXBContentAdapter.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/extensions/xop/XOPMarshallerImpl.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/extensions/xop/XOPScanner.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/extensions/xop/XOPUnmarshallerImpl.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/jboss/
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/ClientEndpointMetaData.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/EndpointMetaData.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/ExtensibleMetaData.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/FaultMetaData.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/HandlerMetaData.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/HandlerMetaDataJAXRPC.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/MetaDataExtension.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/OperationMetaData.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/ParameterMetaData.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/ServerEndpointMetaData.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/ServiceMetaData.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/TypeMappingMetaData.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/TypesMetaData.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/UnifiedMetaData.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/jsr109/
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/webservices/PortComponentMetaData.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/webservices/WebserviceDescriptionMetaData.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/webservices/WebservicesFactory.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/webservices/WebservicesMetaData.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/wsdl/WSDL11DefinitionFactory.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/wsdl/WSDL11Reader.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/wsdl/WSDL11Writer.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/wsdl/WSDL20Reader.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/wsdl/WSDL20Writer.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/wsdl/WSDLDefinitionsFactory.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/wsdl/WSDLLocatorImpl.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/wsdl/WSDLWriter.java
Modified:
branches/tdiesler/jbossws-1.0/.classpath
branches/tdiesler/jbossws-1.0/build.xml
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/CommonBinding.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/CommonBindingProvider.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/CommonClient.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/CommonMessageContext.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/CommonSOAP11Binding.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/CommonSOAP12Binding.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/CommonSOAPBinding.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/EndpointInvocation.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/CallImpl.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/CallProxy.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/HandlerRegistryImpl.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/LiteralTypeMapping.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/ParameterWrapping.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/SOAPFaultExceptionHelper.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/SerializationContextJAXRPC.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/ServiceImpl.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/ServiceObjectFactory.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/StubExt.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/binding/Base64Deserializer.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/binding/Base64Serializer.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/binding/SOAPArrayDeserializer.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/binding/SOAPArraySerializer.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/binding/jbossxb/JBossXBMarshallerImpl.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/binding/jbossxb/JBossXBSupport.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/binding/jbossxb/JBossXBUnmarshallerImpl.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/binding/jbossxb/SchemaBindingBuilder.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/handler/HandlerChainBaseImpl.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/handler/HandlerDelegateJAXRPC.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/handler/MessageContextJAXRPC.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/handler/ServerHandlerChain.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/server/AbstractServiceEndpointInvoker.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/server/HandlerDelegate.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/server/ServiceEndpoint.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/server/ServiceEndpointInfo.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/server/ServiceEndpointInvokerJSE.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/server/ServiceEndpointManager.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/server/ServiceEndpointManagerMBean.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/server/StandardEndpointServlet.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/server/WSDLFilePublisher.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/server/WSDLRequestHandler.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/soap/EndpointInfo.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/soap/SOAPContentElement.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/soap/SOAPMessageDispatcher.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/soap/SOAPMessageImpl.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/soap/UnboundHeader.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/deployment/AnnotationsMetaDataBuilder.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/deployment/JSR109ClientMetaDataBuilder.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/deployment/JSR109Deployment.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/deployment/JSR109MetaDataBuilder.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/deployment/JSR109ServerMetaDataBuilder.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/deployment/JSR181MetaDataBuilder.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/deployment/JSR181MetaDataBuilderEJB21.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/deployment/JSR181MetaDataBuilderEJB3.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/deployment/JSR181MetaDataBuilderJSE.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/deployment/MetaDataBuilder.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/deployment/ServiceEndpointDeployer.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/extensions/addressing/jaxrpc/WSAddressingServerHandler.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/extensions/addressing/metadata/AddressingOpMetaExt.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/extensions/eventing/deployment/EventingEndpoint.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/extensions/eventing/metadata/EventingEpMetaExt.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/extensions/security/WSSecurityDispatcher.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/extensions/security/jaxrpc/WSSecurityHandler.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/extensions/xop/XOPContext.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/jboss42/DeployerInterceptorEJB.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/jboss42/DeployerInterceptorEJB21.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/jboss42/DeployerInterceptorEJB3.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/jboss42/DeployerInterceptorJSE.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/jboss42/JBossServiceEndpointPublisher.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/jboss42/JBossServiceEndpointServlet.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/jboss42/ServiceEndpointGeneratorEJB.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/jboss42/ServiceEndpointInterceptor.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/jboss42/ServiceEndpointInvokerEJB21.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/jboss42/ServiceRefMetaDataAdaptor.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/jboss42/WebServiceClientDeployer.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/jboss42/jms/JMSMessageDispatcher.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/tomcat/TomcatServiceEndpointPublisher.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/config/WSCommonConfig.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/config/jaxrpc/WSCommonConfigJAXRPC.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/config/jaxrpc/WSConfigFactoryJAXRPC.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/config/jaxrpc/WSEndpointConfigJAXRPC.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/j2ee/UnifiedHandlerMetaData.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/jsr181/HandlerChainFactory.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/jsr181/HandlerChainMetaData.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/jsr181/HandlerChainsMetaData.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/wsdl/WSDLDefinitions.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/tools/JavaToWSDL.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/tools/JavaToWSDL11.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/tools/WSDLToJava.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/tools/WSDotXMLCreator.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/tools/helpers/JavaToWSDLHelper.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/tools/helpers/ToolsHelper.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/tools/metadata/ReflectiveMetaDataBuilder.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/tools/metadata/ToolsAnnotationMetaDataBuilder.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/tools/metadata/ToolsEndpointMetaData.java
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/tools/metadata/ToolsUnifiedMetaDataBuilder.java
branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/common/binding/SOAPBindingTestCase.java
branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/common/soap/attachment/GenericAttachmentTestCase.java
branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/samples/dynamichandler/DynamicHandlerTestCase.java
branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/xop/XOPTypeDefTestCase.java
branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxws/jsr181/oneway/JSR181OneWayTestCase.java
branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxws/jsr181/soapbinding/JSR181SOAPBindingTestCase.java
branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxws/jsr181/webparam/JSR181WebParamTestCase.java
branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/tools/metadata/WebServicesMetaDataTestCase.java
Log:
Modified: branches/tdiesler/jbossws-1.0/.classpath
===================================================================
--- branches/tdiesler/jbossws-1.0/.classpath 2006-12-07 12:05:41 UTC (rev 1603)
+++ branches/tdiesler/jbossws-1.0/.classpath 2006-12-07 12:36:23 UTC (rev 1604)
@@ -1,8 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src/main/java"/>
- <classpathentry kind="src" path="output/tests/wstools/java"/>
- <classpathentry excluding="org/jboss/test/ws/interop/" kind="src"
path="src/test/java"/>
<classpathentry kind="lib" path="thirdparty/activation.jar"/>
<classpathentry kind="lib" path="thirdparty/mailapi.jar"/>
<classpathentry kind="lib" path="thirdparty/qdox.jar"/>
Modified: branches/tdiesler/jbossws-1.0/build.xml
===================================================================
--- branches/tdiesler/jbossws-1.0/build.xml 2006-12-07 12:05:41 UTC (rev 1603)
+++ branches/tdiesler/jbossws-1.0/build.xml 2006-12-07 12:36:23 UTC (rev 1604)
@@ -527,7 +527,19 @@
<target name="deploy-to-server">
<copy todir="${jboss.deploy.home}/client"
file="${thirdparty.dir}/jboss-xml-binding.jar" overwrite="true"/>
<copy todir="${jboss.deploy.home}/lib"
file="${thirdparty.dir}/jboss-xml-binding.jar" overwrite="true"/>
- <copy todir="${jboss.deploy.home}/client"
file="${build.lib.dir}/${jbossws}-client.jar" overwrite="true"/>
+ <copy todir="${jboss.deploy.home}/client"
overwrite="true">
+ <fileset dir="${build.lib.dir}">
+ <include name="jboss-jaxrpc.jar"/>
+ <include name="jboss-saaj.jar"/>
+ <include name="${jbossws}-client.jar"/>
+ </fileset>
+ </copy>
+ <copy todir="${jboss.deploy.home}/server/${jboss.server.instance}/lib"
overwrite="true">
+ <fileset dir="${build.lib.dir}">
+ <include name="jboss-jaxrpc.jar"/>
+ <include name="jboss-saaj.jar"/>
+ </fileset>
+ </copy>
<delete
dir="${jboss.deploy.home}/server/${jboss.server.instance}/deploy/${jbossws}.sar"/>
<mkdir
dir="${jboss.deploy.home}/server/${jboss.server.instance}/deploy/${jbossws}.sar"/>
<unjar
dest="${jboss.deploy.home}/server/${jboss.server.instance}/deploy/${jbossws}.sar"
src="${build.lib.dir}/${jbossws}.sar"/>
Modified:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/CommonBinding.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/CommonBinding.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/CommonBinding.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -29,7 +29,7 @@
import org.jboss.ws.core.jaxrpc.binding.BindingException;
import org.jboss.ws.core.soap.UnboundHeader;
-import org.jboss.ws.metadata.OperationMetaData;
+import org.jboss.ws.metadata.umdm.OperationMetaData;
/**
* The base interface for protocol bindings.
Modified:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/CommonBindingProvider.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/CommonBindingProvider.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/CommonBindingProvider.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -24,7 +24,7 @@
// $Id$
import org.jboss.ws.WSException;
-import org.jboss.ws.metadata.EndpointMetaData;
+import org.jboss.ws.metadata.umdm.EndpointMetaData;
/**
* Provides access to the protocol binding.
Modified: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/CommonClient.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/CommonClient.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/CommonClient.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -49,14 +49,14 @@
import org.jboss.ws.core.utils.HolderUtils;
import org.jboss.ws.core.utils.JavaUtils;
import org.jboss.ws.extensions.addressing.AddressingConstantsImpl;
-import org.jboss.ws.metadata.ClientEndpointMetaData;
-import org.jboss.ws.metadata.EndpointMetaData;
-import org.jboss.ws.metadata.OperationMetaData;
-import org.jboss.ws.metadata.ParameterMetaData;
-import org.jboss.ws.metadata.ServiceMetaData;
-import org.jboss.ws.metadata.UnifiedMetaData;
-import org.jboss.ws.metadata.EndpointMetaData.Type;
-import org.jboss.ws.metadata.HandlerMetaData.HandlerType;
+import org.jboss.ws.metadata.umdm.ClientEndpointMetaData;
+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.ServiceMetaData;
+import org.jboss.ws.metadata.umdm.UnifiedMetaData;
+import org.jboss.ws.metadata.umdm.EndpointMetaData.Type;
+import org.jboss.ws.metadata.umdm.HandlerMetaData.HandlerType;
/**
* Provides support for the dynamic invocation of a service endpoint.
Modified:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/CommonMessageContext.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/CommonMessageContext.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/CommonMessageContext.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -31,8 +31,8 @@
import org.jboss.ws.core.jaxrpc.binding.SerializationContext;
import org.jboss.ws.core.server.MessageContextPropertyHelper;
-import org.jboss.ws.metadata.EndpointMetaData;
-import org.jboss.ws.metadata.OperationMetaData;
+import org.jboss.ws.metadata.umdm.EndpointMetaData;
+import org.jboss.ws.metadata.umdm.OperationMetaData;
import org.jboss.xb.binding.NamespaceRegistry;
/**
Modified:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/CommonSOAP11Binding.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/CommonSOAP11Binding.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/CommonSOAP11Binding.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -37,7 +37,7 @@
import org.jboss.ws.core.soap.MessageContextAssociation;
import org.jboss.ws.core.soap.MessageFactoryImpl;
import org.jboss.ws.core.soap.UnboundHeader;
-import org.jboss.ws.metadata.OperationMetaData;
+import org.jboss.ws.metadata.umdm.OperationMetaData;
/**
* The SOAP11Binding
Modified:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/CommonSOAP12Binding.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/CommonSOAP12Binding.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/CommonSOAP12Binding.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -35,7 +35,7 @@
import org.jboss.ws.core.soap.MessageContextAssociation;
import org.jboss.ws.core.soap.MessageFactoryImpl;
import org.jboss.ws.core.soap.UnboundHeader;
-import org.jboss.ws.metadata.OperationMetaData;
+import org.jboss.ws.metadata.umdm.OperationMetaData;
/**
* The SOAP11Binding
Modified:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/CommonSOAPBinding.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/CommonSOAPBinding.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/CommonSOAPBinding.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -76,9 +76,9 @@
import org.jboss.ws.core.utils.JavaUtils;
import org.jboss.ws.core.utils.MimeUtils;
import org.jboss.ws.extensions.xop.XOPContext;
-import org.jboss.ws.metadata.OperationMetaData;
-import org.jboss.ws.metadata.ParameterMetaData;
-import org.jboss.ws.metadata.TypesMetaData;
+import org.jboss.ws.metadata.umdm.OperationMetaData;
+import org.jboss.ws.metadata.umdm.ParameterMetaData;
+import org.jboss.ws.metadata.umdm.TypesMetaData;
import org.jboss.xb.binding.NamespaceRegistry;
import org.w3c.dom.Element;
Modified:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/EndpointInvocation.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/EndpointInvocation.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/EndpointInvocation.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -45,8 +45,8 @@
import org.jboss.ws.core.utils.HolderUtils;
import org.jboss.ws.core.utils.JavaUtils;
import org.jboss.ws.core.utils.MimeUtils;
-import org.jboss.ws.metadata.OperationMetaData;
-import org.jboss.ws.metadata.ParameterMetaData;
+import org.jboss.ws.metadata.umdm.OperationMetaData;
+import org.jboss.ws.metadata.umdm.ParameterMetaData;
/** A web service invocation.
*
Modified:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/CallImpl.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/CallImpl.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/CallImpl.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -46,20 +46,20 @@
import org.jboss.logging.Logger;
import org.jboss.ws.Constants;
import org.jboss.ws.core.CommonClient;
-import org.jboss.ws.core.jaxrpc.binding.jbossxb.JBossXBDeserializerFactory;
-import org.jboss.ws.core.jaxrpc.binding.jbossxb.JBossXBSerializerFactory;
+import org.jboss.ws.core.jaxrpc.binding.JBossXBDeserializerFactory;
+import org.jboss.ws.core.jaxrpc.binding.JBossXBSerializerFactory;
import org.jboss.ws.core.jaxrpc.handler.HandlerChainBaseImpl;
import org.jboss.ws.core.jaxrpc.handler.SOAPMessageContextJAXRPC;
import org.jboss.ws.core.soap.MessageContextAssociation;
import org.jboss.ws.core.soap.UnboundHeader;
import org.jboss.ws.core.utils.JavaUtils;
import org.jboss.ws.extensions.xop.XOPContext;
-import org.jboss.ws.metadata.EndpointMetaData;
-import org.jboss.ws.metadata.OperationMetaData;
-import org.jboss.ws.metadata.ParameterMetaData;
-import org.jboss.ws.metadata.ServiceMetaData;
-import org.jboss.ws.metadata.TypesMetaData;
-import org.jboss.ws.metadata.HandlerMetaData.HandlerType;
+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.ServiceMetaData;
+import org.jboss.ws.metadata.umdm.TypesMetaData;
+import org.jboss.ws.metadata.umdm.HandlerMetaData.HandlerType;
import org.jboss.ws.metadata.wsdl.xmlschema.JBossXSModel;
/** Provides support for the dynamic invocation of a service endpoint.
Modified:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/CallProxy.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/CallProxy.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/CallProxy.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -40,8 +40,8 @@
import org.jboss.logging.Logger;
import org.jboss.ws.WSException;
import org.jboss.ws.core.utils.JavaUtils;
-import org.jboss.ws.metadata.EndpointMetaData;
-import org.jboss.ws.metadata.OperationMetaData;
+import org.jboss.ws.metadata.umdm.EndpointMetaData;
+import org.jboss.ws.metadata.umdm.OperationMetaData;
/**
* The dynamic proxy that delegates to the underlying Call implementation
Modified:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/HandlerRegistryImpl.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/HandlerRegistryImpl.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/HandlerRegistryImpl.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -36,10 +36,10 @@
import org.jboss.logging.Logger;
import org.jboss.ws.core.jaxrpc.handler.ClientHandlerChain;
-import org.jboss.ws.metadata.EndpointMetaData;
-import org.jboss.ws.metadata.HandlerMetaDataJAXRPC;
-import org.jboss.ws.metadata.ServiceMetaData;
-import org.jboss.ws.metadata.HandlerMetaData.HandlerType;
+import org.jboss.ws.metadata.umdm.EndpointMetaData;
+import org.jboss.ws.metadata.umdm.HandlerMetaDataJAXRPC;
+import org.jboss.ws.metadata.umdm.ServiceMetaData;
+import org.jboss.ws.metadata.umdm.HandlerMetaData.HandlerType;
/**
* Provides support for the programmatic configuration of
Modified:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/LiteralTypeMapping.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/LiteralTypeMapping.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/LiteralTypeMapping.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -31,8 +31,6 @@
import org.jboss.util.NotImplementedException;
import org.jboss.ws.Constants;
import org.jboss.ws.core.jaxrpc.binding.*;
-import org.jboss.ws.core.jaxrpc.binding.jbossxb.JBossXBDeserializerFactory;
-import org.jboss.ws.core.jaxrpc.binding.jbossxb.JBossXBSerializerFactory;
import org.w3c.dom.Element;
import java.awt.*;
Modified:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/ParameterWrapping.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/ParameterWrapping.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/ParameterWrapping.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -40,15 +40,15 @@
import org.jboss.logging.Logger;
import org.jboss.ws.WSException;
-import org.jboss.ws.core.jaxrpc.binding.jbossxb.JBossXBDeserializerFactory;
-import org.jboss.ws.core.jaxrpc.binding.jbossxb.JBossXBSerializerFactory;
+import org.jboss.ws.core.jaxrpc.binding.JBossXBDeserializerFactory;
+import org.jboss.ws.core.jaxrpc.binding.JBossXBSerializerFactory;
import org.jboss.ws.core.utils.JavaUtils;
-import org.jboss.ws.metadata.EndpointMetaData;
-import org.jboss.ws.metadata.OperationMetaData;
-import org.jboss.ws.metadata.ParameterMetaData;
-import org.jboss.ws.metadata.ServiceMetaData;
-import org.jboss.ws.metadata.TypeMappingMetaData;
-import org.jboss.ws.metadata.TypesMetaData;
+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.ServiceMetaData;
+import org.jboss.ws.metadata.umdm.TypeMappingMetaData;
+import org.jboss.ws.metadata.umdm.TypesMetaData;
/** A helper class to wrap/unwrap ducument style request/response structures.
*
Modified:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/SOAPFaultExceptionHelper.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/SOAPFaultExceptionHelper.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/SOAPFaultExceptionHelper.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -59,8 +59,8 @@
import org.jboss.ws.core.soap.SOAPFactoryImpl;
import org.jboss.ws.core.utils.DOMUtils;
import org.jboss.ws.core.utils.DOMWriter;
-import org.jboss.ws.metadata.FaultMetaData;
-import org.jboss.ws.metadata.OperationMetaData;
+import org.jboss.ws.metadata.umdm.FaultMetaData;
+import org.jboss.ws.metadata.umdm.OperationMetaData;
import org.jboss.xb.binding.NamespaceRegistry;
import org.w3c.dom.Element;
Modified:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/SerializationContextJAXRPC.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/SerializationContextJAXRPC.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/SerializationContextJAXRPC.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -33,12 +33,12 @@
import org.jboss.ws.core.jaxrpc.handler.SOAPMessageContextJAXRPC;
import org.jboss.ws.core.soap.MessageContextAssociation;
import org.jboss.ws.core.utils.JavaUtils;
-import org.jboss.ws.metadata.OperationMetaData;
-import org.jboss.ws.metadata.ServiceMetaData;
-import org.jboss.ws.metadata.TypesMetaData;
import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping;
import org.jboss.ws.metadata.jaxrpcmapping.JavaXmlTypeMapping;
import org.jboss.ws.metadata.jaxrpcmapping.PackageMapping;
+import org.jboss.ws.metadata.umdm.OperationMetaData;
+import org.jboss.ws.metadata.umdm.ServiceMetaData;
+import org.jboss.ws.metadata.umdm.TypesMetaData;
/**
* The serialization context for JAXRPC endpoints/clients
Modified:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/ServiceImpl.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/ServiceImpl.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/ServiceImpl.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -40,12 +40,12 @@
import javax.xml.rpc.handler.HandlerRegistry;
import org.jboss.ws.deployment.JSR109ClientMetaDataBuilder;
-import org.jboss.ws.metadata.EndpointMetaData;
-import org.jboss.ws.metadata.OperationMetaData;
-import org.jboss.ws.metadata.ServiceMetaData;
-import org.jboss.ws.metadata.UnifiedMetaData;
import org.jboss.ws.metadata.j2ee.UnifiedServiceRefMetaData;
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.umdm.UnifiedMetaData;
import org.jboss.ws.metadata.wsse.WSSecurityConfiguration;
/**
Modified:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/ServiceObjectFactory.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/ServiceObjectFactory.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/ServiceObjectFactory.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -61,15 +61,15 @@
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.EndpointMetaData;
-import org.jboss.ws.metadata.HandlerMetaData;
-import org.jboss.ws.metadata.HandlerMetaDataJAXRPC;
-import org.jboss.ws.metadata.ServiceMetaData;
-import org.jboss.ws.metadata.HandlerMetaData.HandlerInitParam;
-import org.jboss.ws.metadata.HandlerMetaData.HandlerType;
import org.jboss.ws.metadata.j2ee.UnifiedPortComponentRefMetaData;
import org.jboss.ws.metadata.j2ee.UnifiedServiceRefMetaData;
import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping;
+import org.jboss.ws.metadata.umdm.EndpointMetaData;
+import org.jboss.ws.metadata.umdm.HandlerMetaData;
+import org.jboss.ws.metadata.umdm.HandlerMetaDataJAXRPC;
+import org.jboss.ws.metadata.umdm.ServiceMetaData;
+import org.jboss.ws.metadata.umdm.HandlerMetaData.HandlerInitParam;
+import org.jboss.ws.metadata.umdm.HandlerMetaData.HandlerType;
import org.jboss.ws.metadata.wsse.WSSecurityConfiguration;
/**
Modified:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/StubExt.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/StubExt.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/StubExt.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -26,7 +26,7 @@
import javax.xml.namespace.QName;
import javax.xml.rpc.ParameterMode;
-import org.jboss.ws.metadata.EndpointMetaData;
+import org.jboss.ws.metadata.umdm.EndpointMetaData;
// $Id$
Modified:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/binding/Base64Deserializer.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/binding/Base64Deserializer.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/binding/Base64Deserializer.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -28,7 +28,7 @@
import org.jboss.logging.Logger;
import org.jboss.ws.core.utils.DOMUtils;
import org.jboss.ws.extensions.xop.XOPContext;
-import org.jboss.ws.extensions.xop.XOPUnmarshallerImpl;
+import org.jboss.ws.extensions.xop.jaxrpc.XOPUnmarshallerImpl;
import org.jboss.ws.WSException;
import org.jboss.xb.binding.SimpleTypeBindings;
import org.jboss.xb.binding.sunday.xop.XOPUnmarshaller;
Modified:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/binding/Base64Serializer.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/binding/Base64Serializer.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/binding/Base64Serializer.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -28,7 +28,7 @@
import org.jboss.logging.Logger;
import org.jboss.ws.core.utils.JavaUtils;
import org.jboss.ws.extensions.xop.XOPContext;
-import org.jboss.ws.extensions.xop.XOPMarshallerImpl;
+import org.jboss.ws.extensions.xop.jaxrpc.XOPMarshallerImpl;
import org.jboss.xb.binding.NamespaceRegistry;
import org.jboss.xb.binding.SimpleTypeBindings;
import org.jboss.xb.binding.sunday.xop.XOPMarshaller;
Copied:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/binding/JBossXBDeserializer.java
(from rev 1601,
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/binding/jbossxb/JBossXBDeserializer.java)
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/binding/jbossxb/JBossXBDeserializer.java 2006-12-07
11:35:39 UTC (rev 1601)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/binding/JBossXBDeserializer.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -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.jaxrpc.binding;
+
+// $Id$
+
+import java.io.ByteArrayInputStream;
+
+import javax.xml.namespace.QName;
+
+import org.apache.xerces.xs.XSModel;
+import org.jboss.logging.Logger;
+import org.jboss.ws.core.jaxrpc.SerializationContextJAXRPC;
+import org.jboss.ws.core.jaxrpc.binding.jbossxb.JBossXBConstants;
+import org.jboss.ws.core.jaxrpc.binding.jbossxb.JBossXBUnmarshaller;
+import org.jboss.ws.core.jaxrpc.binding.jbossxb.JBossXBUnmarshallerImpl;
+import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping;
+
+/**
+ * A Deserializer that can handle complex types by delegating to JAXB.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 04-Dec-2004
+ */
+public class JBossXBDeserializer extends ComplexTypeDeserializer
+{
+ // provide logging
+ private static final Logger log = Logger.getLogger(JBossXBDeserializer.class);
+
+ private JBossXBUnmarshaller unmarshaller;
+
+ public JBossXBDeserializer() throws BindingException
+ {
+ // Get the JAXB marshaller for complex objects
+ unmarshaller = new JBossXBUnmarshallerImpl();
+ }
+
+ /**
+ * For unmarshalling the WS layer passes to the JAXB layer
+ *
+ * - required self contained xml content
+ * - required map of packaged or generated XSDSchema
+ * - optional QName of the root complex type
+ * - optional instance of JavaWsdlMapping
+ *
+ * The xmlType is redundant if the root element name corresponds to a global element
definition in schema.
+ * If the java mapping is null, default mapping rules apply.
+ *
+ * The result is an object instance or null.
+ * In case of an unmarshalling problem a descriptive exception is thrown.
+ */
+ public Object deserialize(QName xmlName, QName xmlType, String val,
SerializationContext serContext) throws BindingException
+ {
+ log.debug("deserialize: [xmlName=" + xmlName + ",xmlType=" +
xmlType + "]");
+
+ // Expect the specific JAXRPC serialization context
+ SerializationContextJAXRPC jaxrpcContext = (SerializationContextJAXRPC)serContext;
+
+ Object value = null;
+ String typeName = xmlType.getLocalPart();
+
+ try
+ {
+ // Get the parsed model
+ XSModel model = jaxrpcContext.getXsModel();
+
+ // Get the jaxrpc-mapping.xml meta data
+ JavaWsdlMapping jaxrpcMapping = jaxrpcContext.getJavaWsdlMapping();
+
+ unmarshaller.setProperty(JBossXBConstants.JBXB_XS_MODEL, model);
+ unmarshaller.setProperty(JBossXBConstants.JBXB_ROOT_QNAME, xmlName);
+ unmarshaller.setProperty(JBossXBConstants.JBXB_TYPE_QNAME, xmlType);
+ unmarshaller.setProperty(JBossXBConstants.JBXB_JAVA_MAPPING, jaxrpcMapping);
+
+ ByteArrayInputStream ins = new
ByteArrayInputStream(val.getBytes("UTF-8"));
+ value = unmarshaller.unmarshal(ins);
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (Exception ex)
+ {
+ throw new BindingException(ex);
+ }
+
+ log.debug("deserialized: " + (value != null ? value.getClass().getName()
: null));
+ return value;
+
+ }
+}
Copied:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/binding/JBossXBDeserializerFactory.java
(from rev 1601,
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/binding/jbossxb/JBossXBDeserializerFactory.java)
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/binding/jbossxb/JBossXBDeserializerFactory.java 2006-12-07
11:35:39 UTC (rev 1601)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/binding/JBossXBDeserializerFactory.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -0,0 +1,40 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+package org.jboss.ws.core.jaxrpc.binding;
+
+
+// $Id$
+
+/**
+ * A factory for a Deserializer that can handle complex types
+ * by delegating to JAXB.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 04-Dec-2004
+ */
+public class JBossXBDeserializerFactory extends DeserializerFactoryBase
+{
+ public DeserializerSupport getDeserializer() throws BindingException
+ {
+ return new JBossXBDeserializer();
+ }
+}
Copied:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/binding/JBossXBSerializer.java
(from rev 1601,
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/binding/jbossxb/JBossXBSerializer.java)
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/binding/jbossxb/JBossXBSerializer.java 2006-12-07
11:35:39 UTC (rev 1601)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/binding/JBossXBSerializer.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -0,0 +1,122 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ws.core.jaxrpc.binding;
+
+// $Id$
+
+import org.apache.xerces.xs.XSModel;
+import org.jboss.logging.Logger;
+import org.jboss.ws.core.jaxrpc.SerializationContextJAXRPC;
+import org.jboss.ws.core.jaxrpc.binding.jbossxb.JBossXBConstants;
+import org.jboss.ws.core.jaxrpc.binding.jbossxb.JBossXBMarshaller;
+import org.jboss.ws.core.jaxrpc.binding.jbossxb.JBossXBMarshallerImpl;
+import org.jboss.ws.core.jaxrpc.binding.jbossxb.XercesXSMarshallerImpl;
+import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping;
+import org.w3c.dom.NamedNodeMap;
+
+import javax.xml.namespace.QName;
+import java.io.StringWriter;
+
+/**
+ * A Serializer that can handle complex types by delegating to JAXB.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 04-Dec-2004
+ */
+public class JBossXBSerializer extends ComplexTypeSerializer
+{
+ // provide logging
+ private static final Logger log = Logger.getLogger(JBossXBSerializer.class);
+
+ private JBossXBMarshaller marshaller;
+
+ public JBossXBSerializer() throws BindingException
+ {
+ // Get the JAXB marshaller for complex objects
+ marshaller = new JBossXBMarshallerImpl();
+ }
+
+ /**
+ * For marshalling the WS layer passes to the JAXB layer
+ *
+ * - optional java object instance
+ * - required map of packaged or generated XSDSchema
+ * - required QName of the root element
+ * - optional QName of the root complex type
+ * - optional instance of JavaWsdlMapping
+ *
+ * If the object value is null, the corresponding XML representation of the nillable
element should be marshalled.
+ * The xmlType is redundant if the xmlName corresponds to a global element definition
in schema.
+ * If the java mapping is null, default mapping rules apply.
+ *
+ * The result is a self contained (i.e. contains all namespace definitions) XML
document without the XML declaration.
+ * In case of an marshalling problem a descriptive exception is thrown.
+ */
+ public String serialize(QName xmlName, QName xmlType, Object value,
SerializationContext serContext, NamedNodeMap attributes) throws BindingException
+ {
+ log.debug("serialize: [xmlName=" + xmlName + ",xmlType=" +
xmlType + "]");
+
+ // Expect the specific JAXRPC serialization context
+ SerializationContextJAXRPC jaxrpcContext = (SerializationContextJAXRPC)serContext;
+
+ try
+ {
+ // Get the parsed model
+ XSModel model = jaxrpcContext.getXsModel();
+
+ // Get the jaxrpc-mapping.xml object graph
+ JavaWsdlMapping jaxrpcMapping = jaxrpcContext.getJavaWsdlMapping();
+
+ // schemabinding marshaller is the default delegate
+ JBossXBMarshaller delegate = marshaller;
+
+ if(value instanceof Exception)
+ {
+ // todo: CTS workaround for custom exceptions, clarify when Alexey is back
+ // causes NPE in MarshallerImpl:458
+ delegate = new XercesXSMarshallerImpl();
+ }
+
+ // marshalling context
+ delegate.setProperty(JBossXBConstants.JBXB_XS_MODEL, model);
+ delegate.setProperty(JBossXBConstants.JBXB_TYPE_QNAME, xmlType);
+ delegate.setProperty(JBossXBConstants.JBXB_ROOT_QNAME, xmlName);
+ delegate.setProperty(JBossXBConstants.JBXB_JAVA_MAPPING, jaxrpcMapping);
+
+ // marshall
+ StringWriter strwr = new StringWriter();
+ delegate.marshal(value, strwr);
+ String xmlFragment = strwr.toString();
+
+ log.debug("serialized: " + xmlFragment);
+ return xmlFragment;
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (Exception ex)
+ {
+ throw new BindingException(ex);
+ }
+ }
+}
Copied:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/binding/JBossXBSerializerFactory.java
(from rev 1601,
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/binding/jbossxb/JBossXBSerializerFactory.java)
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/binding/jbossxb/JBossXBSerializerFactory.java 2006-12-07
11:35:39 UTC (rev 1601)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/binding/JBossXBSerializerFactory.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -0,0 +1,41 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+package org.jboss.ws.core.jaxrpc.binding;
+
+
+// $Id$
+
+
+/**
+ * A factory for a Serializer that can handle complex types
+ * by delegating to JAXB.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 04-Dec-2004
+ */
+public class JBossXBSerializerFactory extends SerializerFactoryBase
+{
+ public SerializerSupport getSerializer() throws BindingException
+ {
+ return new JBossXBSerializer();
+ }
+}
Modified:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/binding/SOAPArrayDeserializer.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/binding/SOAPArrayDeserializer.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/binding/SOAPArrayDeserializer.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -37,7 +37,7 @@
import org.jboss.ws.core.utils.DOMUtils;
import org.jboss.ws.core.utils.DOMWriter;
import org.jboss.ws.core.utils.JavaUtils;
-import org.jboss.ws.metadata.ParameterMetaData;
+import org.jboss.ws.metadata.umdm.ParameterMetaData;
import org.w3c.dom.Element;
/**
Modified:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/binding/SOAPArraySerializer.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/binding/SOAPArraySerializer.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/binding/SOAPArraySerializer.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -30,7 +30,7 @@
import org.jboss.ws.WSException;
import org.jboss.ws.core.jaxrpc.TypeMappingImpl;
import org.jboss.ws.core.utils.JavaUtils;
-import org.jboss.ws.metadata.ParameterMetaData;
+import org.jboss.ws.metadata.umdm.ParameterMetaData;
import org.w3c.dom.NamedNodeMap;
/**
Deleted:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/binding/jbossxb/JBossXBDeserializer.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/binding/jbossxb/JBossXBDeserializer.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/binding/jbossxb/JBossXBDeserializer.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -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.core.jaxrpc.binding.jbossxb;
-
-// $Id$
-
-import java.io.ByteArrayInputStream;
-
-import javax.xml.namespace.QName;
-
-import org.apache.xerces.xs.XSModel;
-import org.jboss.logging.Logger;
-import org.jboss.ws.core.jaxrpc.SerializationContextJAXRPC;
-import org.jboss.ws.core.jaxrpc.binding.BindingException;
-import org.jboss.ws.core.jaxrpc.binding.ComplexTypeDeserializer;
-import org.jboss.ws.core.jaxrpc.binding.SerializationContext;
-import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping;
-
-/**
- * A Deserializer that can handle complex types by delegating to JAXB.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 04-Dec-2004
- */
-public class JBossXBDeserializer extends ComplexTypeDeserializer
-{
- // provide logging
- private static final Logger log = Logger.getLogger(JBossXBDeserializer.class);
-
- private JBossXBUnmarshaller unmarshaller;
-
- public JBossXBDeserializer() throws BindingException
- {
- // Get the JAXB marshaller for complex objects
- unmarshaller = new JBossXBUnmarshallerImpl();
- }
-
- /**
- * For unmarshalling the WS layer passes to the JAXB layer
- *
- * - required self contained xml content
- * - required map of packaged or generated XSDSchema
- * - optional QName of the root complex type
- * - optional instance of JavaWsdlMapping
- *
- * The xmlType is redundant if the root element name corresponds to a global element
definition in schema.
- * If the java mapping is null, default mapping rules apply.
- *
- * The result is an object instance or null.
- * In case of an unmarshalling problem a descriptive exception is thrown.
- */
- public Object deserialize(QName xmlName, QName xmlType, String val,
SerializationContext serContext) throws BindingException
- {
- log.debug("deserialize: [xmlName=" + xmlName + ",xmlType=" +
xmlType + "]");
-
- // Expect the specific JAXRPC serialization context
- SerializationContextJAXRPC jaxrpcContext = (SerializationContextJAXRPC)serContext;
-
- Object value = null;
- String typeName = xmlType.getLocalPart();
-
- try
- {
- // Get the parsed model
- XSModel model = jaxrpcContext.getXsModel();
-
- // Get the jaxrpc-mapping.xml meta data
- JavaWsdlMapping jaxrpcMapping = jaxrpcContext.getJavaWsdlMapping();
-
- unmarshaller.setProperty(JBossXBConstants.JBXB_XS_MODEL, model);
- unmarshaller.setProperty(JBossXBConstants.JBXB_ROOT_QNAME, xmlName);
- unmarshaller.setProperty(JBossXBConstants.JBXB_TYPE_QNAME, xmlType);
- unmarshaller.setProperty(JBossXBConstants.JBXB_JAVA_MAPPING, jaxrpcMapping);
-
- ByteArrayInputStream ins = new
ByteArrayInputStream(val.getBytes("UTF-8"));
- value = unmarshaller.unmarshal(ins);
- }
- catch (RuntimeException rte)
- {
- throw rte;
- }
- catch (Exception ex)
- {
- throw new BindingException(ex);
- }
-
- log.debug("deserialized: " + (value != null ? value.getClass().getName()
: null));
- return value;
-
- }
-}
Deleted:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/binding/jbossxb/JBossXBDeserializerFactory.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/binding/jbossxb/JBossXBDeserializerFactory.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/binding/jbossxb/JBossXBDeserializerFactory.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -1,43 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
-*/
-package org.jboss.ws.core.jaxrpc.binding.jbossxb;
-
-import org.jboss.ws.core.jaxrpc.binding.BindingException;
-import org.jboss.ws.core.jaxrpc.binding.DeserializerFactoryBase;
-import org.jboss.ws.core.jaxrpc.binding.DeserializerSupport;
-
-// $Id$
-
-/**
- * A factory for a Deserializer that can handle complex types
- * by delegating to JAXB.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 04-Dec-2004
- */
-public class JBossXBDeserializerFactory extends DeserializerFactoryBase
-{
- public DeserializerSupport getDeserializer() throws BindingException
- {
- return new JBossXBDeserializer();
- }
-}
Modified:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/binding/jbossxb/JBossXBMarshallerImpl.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/binding/jbossxb/JBossXBMarshallerImpl.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/binding/jbossxb/JBossXBMarshallerImpl.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -27,7 +27,7 @@
import org.jboss.util.NotImplementedException;
import org.jboss.ws.WSException;
import org.jboss.ws.core.utils.JavaUtils;
-import org.jboss.ws.extensions.xop.XOPMarshallerImpl;
+import org.jboss.ws.extensions.xop.jaxrpc.XOPMarshallerImpl;
import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping;
import org.jboss.ws.metadata.jaxrpcmapping.JavaXmlTypeMapping;
import org.jboss.ws.metadata.jaxrpcmapping.VariableMapping;
Deleted:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/binding/jbossxb/JBossXBSerializer.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/binding/jbossxb/JBossXBSerializer.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/binding/jbossxb/JBossXBSerializer.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -1,121 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.ws.core.jaxrpc.binding.jbossxb;
-
-// $Id$
-
-import org.apache.xerces.xs.XSModel;
-import org.jboss.logging.Logger;
-import org.jboss.ws.core.jaxrpc.SerializationContextJAXRPC;
-import org.jboss.ws.core.jaxrpc.binding.BindingException;
-import org.jboss.ws.core.jaxrpc.binding.ComplexTypeSerializer;
-import org.jboss.ws.core.jaxrpc.binding.SerializationContext;
-import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping;
-import org.w3c.dom.NamedNodeMap;
-
-import javax.xml.namespace.QName;
-import java.io.StringWriter;
-
-/**
- * A Serializer that can handle complex types by delegating to JAXB.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 04-Dec-2004
- */
-public class JBossXBSerializer extends ComplexTypeSerializer
-{
- // provide logging
- private static final Logger log = Logger.getLogger(JBossXBSerializer.class);
-
- private JBossXBMarshaller marshaller;
-
- public JBossXBSerializer() throws BindingException
- {
- // Get the JAXB marshaller for complex objects
- marshaller = new JBossXBMarshallerImpl();
- }
-
- /**
- * For marshalling the WS layer passes to the JAXB layer
- *
- * - optional java object instance
- * - required map of packaged or generated XSDSchema
- * - required QName of the root element
- * - optional QName of the root complex type
- * - optional instance of JavaWsdlMapping
- *
- * If the object value is null, the corresponding XML representation of the nillable
element should be marshalled.
- * The xmlType is redundant if the xmlName corresponds to a global element definition
in schema.
- * If the java mapping is null, default mapping rules apply.
- *
- * The result is a self contained (i.e. contains all namespace definitions) XML
document without the XML declaration.
- * In case of an marshalling problem a descriptive exception is thrown.
- */
- public String serialize(QName xmlName, QName xmlType, Object value,
SerializationContext serContext, NamedNodeMap attributes) throws BindingException
- {
- log.debug("serialize: [xmlName=" + xmlName + ",xmlType=" +
xmlType + "]");
-
- // Expect the specific JAXRPC serialization context
- SerializationContextJAXRPC jaxrpcContext = (SerializationContextJAXRPC)serContext;
-
- try
- {
- // Get the parsed model
- XSModel model = jaxrpcContext.getXsModel();
-
- // Get the jaxrpc-mapping.xml object graph
- JavaWsdlMapping jaxrpcMapping = jaxrpcContext.getJavaWsdlMapping();
-
- // schemabinding marshaller is the default delegate
- JBossXBMarshaller delegate = marshaller;
-
- if(value instanceof Exception)
- {
- // todo: CTS workaround for custom exceptions, clarify when Alexey is back
- // causes NPE in MarshallerImpl:458
- delegate = new XercesXSMarshallerImpl();
- }
-
- // marshalling context
- delegate.setProperty(JBossXBConstants.JBXB_XS_MODEL, model);
- delegate.setProperty(JBossXBConstants.JBXB_TYPE_QNAME, xmlType);
- delegate.setProperty(JBossXBConstants.JBXB_ROOT_QNAME, xmlName);
- delegate.setProperty(JBossXBConstants.JBXB_JAVA_MAPPING, jaxrpcMapping);
-
- // marshall
- StringWriter strwr = new StringWriter();
- delegate.marshal(value, strwr);
- String xmlFragment = strwr.toString();
-
- log.debug("serialized: " + xmlFragment);
- return xmlFragment;
- }
- catch (RuntimeException rte)
- {
- throw rte;
- }
- catch (Exception ex)
- {
- throw new BindingException(ex);
- }
- }
-}
Deleted:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/binding/jbossxb/JBossXBSerializerFactory.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/binding/jbossxb/JBossXBSerializerFactory.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/binding/jbossxb/JBossXBSerializerFactory.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -1,44 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
-*/
-package org.jboss.ws.core.jaxrpc.binding.jbossxb;
-
-import org.jboss.ws.core.jaxrpc.binding.BindingException;
-import org.jboss.ws.core.jaxrpc.binding.SerializerFactoryBase;
-import org.jboss.ws.core.jaxrpc.binding.SerializerSupport;
-
-// $Id$
-
-
-/**
- * A factory for a Serializer that can handle complex types
- * by delegating to JAXB.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 04-Dec-2004
- */
-public class JBossXBSerializerFactory extends SerializerFactoryBase
-{
- public SerializerSupport getSerializer() throws BindingException
- {
- return new JBossXBSerializer();
- }
-}
Modified:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/binding/jbossxb/JBossXBSupport.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/binding/jbossxb/JBossXBSupport.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/binding/jbossxb/JBossXBSupport.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -6,10 +6,10 @@
import org.jboss.ws.core.CommonMessageContext;
import org.jboss.ws.core.soap.MessageContextAssociation;
-import org.jboss.ws.metadata.EndpointMetaData;
-import org.jboss.ws.metadata.OperationMetaData;
-import org.jboss.ws.metadata.ServiceMetaData;
import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping;
+import org.jboss.ws.metadata.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.xb.binding.MarshallingContext;
import org.jboss.xb.binding.ObjectLocalMarshaller;
Modified:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/binding/jbossxb/JBossXBUnmarshallerImpl.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/binding/jbossxb/JBossXBUnmarshallerImpl.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/binding/jbossxb/JBossXBUnmarshallerImpl.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -24,7 +24,7 @@
// $Id$
import org.jboss.ws.WSException;
-import org.jboss.ws.extensions.xop.XOPUnmarshallerImpl;
+import org.jboss.ws.extensions.xop.jaxrpc.XOPUnmarshallerImpl;
import org.jboss.xb.binding.JBossXBException;
import org.jboss.xb.binding.UnmarshallerFactory;
import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding;
Modified:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/binding/jbossxb/SchemaBindingBuilder.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/binding/jbossxb/SchemaBindingBuilder.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/binding/jbossxb/SchemaBindingBuilder.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -29,7 +29,7 @@
import org.jboss.ws.Constants;
import org.jboss.ws.WSException;
import org.jboss.ws.core.utils.JBossWSEntityResolver;
-import org.jboss.ws.extensions.xop.JBossXBContentAdapter;
+import org.jboss.ws.extensions.xop.jaxrpc.JBossXBContentAdapter;
import org.jboss.ws.metadata.jaxrpcmapping.*;
import org.jboss.xb.binding.metadata.ClassMetaData;
import org.jboss.xb.binding.metadata.PackageMetaData;
Modified:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/handler/HandlerChainBaseImpl.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/handler/HandlerChainBaseImpl.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/handler/HandlerChainBaseImpl.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -53,10 +53,10 @@
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.EndpointMetaData;
-import org.jboss.ws.metadata.OperationMetaData;
-import org.jboss.ws.metadata.ParameterMetaData;
-import org.jboss.ws.metadata.HandlerMetaData.HandlerType;
+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;
/**
* Represents a list of handlers. All elements in the
Modified:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/handler/HandlerDelegateJAXRPC.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/handler/HandlerDelegateJAXRPC.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/handler/HandlerDelegateJAXRPC.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -38,11 +38,11 @@
import org.jboss.ws.core.server.ServiceEndpointInfo;
import org.jboss.ws.core.soap.MessageContextAssociation;
import org.jboss.ws.extensions.xop.XOPContext;
-import org.jboss.ws.metadata.HandlerMetaData;
-import org.jboss.ws.metadata.HandlerMetaDataJAXRPC;
-import org.jboss.ws.metadata.ServerEndpointMetaData;
-import org.jboss.ws.metadata.HandlerMetaData.HandlerInitParam;
-import org.jboss.ws.metadata.HandlerMetaData.HandlerType;
+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;
/** Delegates to JAXRPC handlers
*
Modified:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/handler/MessageContextJAXRPC.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/handler/MessageContextJAXRPC.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/handler/MessageContextJAXRPC.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -29,8 +29,8 @@
import org.jboss.ws.core.CommonMessageContext;
import org.jboss.ws.core.jaxrpc.SerializationContextJAXRPC;
import org.jboss.ws.core.jaxrpc.binding.SerializationContext;
-import org.jboss.ws.metadata.EndpointMetaData;
-import org.jboss.ws.metadata.ServiceMetaData;
+import org.jboss.ws.metadata.umdm.EndpointMetaData;
+import org.jboss.ws.metadata.umdm.ServiceMetaData;
import org.jboss.xb.binding.NamespaceRegistry;
/**
Modified:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/handler/ServerHandlerChain.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/handler/ServerHandlerChain.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/jaxrpc/handler/ServerHandlerChain.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -28,7 +28,7 @@
import javax.xml.rpc.handler.MessageContext;
-import org.jboss.ws.metadata.HandlerMetaData.HandlerType;
+import org.jboss.ws.metadata.umdm.HandlerMetaData.HandlerType;
/**
* Represents a list of handlers. All elements in the
Modified:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/server/AbstractServiceEndpointInvoker.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/server/AbstractServiceEndpointInvoker.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/server/AbstractServiceEndpointInvoker.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -47,10 +47,10 @@
import org.jboss.ws.core.soap.MessageContextAssociation;
import org.jboss.ws.core.soap.SOAPMessageImpl;
import org.jboss.ws.core.utils.JavaUtils;
-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.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;
/** An implementation handles invocations on the endpoint
*
Modified:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/server/HandlerDelegate.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/server/HandlerDelegate.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/server/HandlerDelegate.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -23,7 +23,7 @@
// $Id$
-import org.jboss.ws.metadata.HandlerMetaData.HandlerType;
+import org.jboss.ws.metadata.umdm.HandlerMetaData.HandlerType;
/** An implementation of handles invocations on the endpoint
*
Modified:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/server/ServiceEndpoint.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/server/ServiceEndpoint.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/server/ServiceEndpoint.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -48,8 +48,8 @@
import org.jboss.ws.core.soap.SOAPMessageImpl;
import org.jboss.ws.core.utils.DOMWriter;
import org.jboss.ws.extensions.xop.XOPContext;
-import org.jboss.ws.metadata.EndpointMetaData;
-import org.jboss.ws.metadata.ServerEndpointMetaData;
+import org.jboss.ws.metadata.umdm.EndpointMetaData;
+import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
import org.w3c.dom.Document;
/**
Modified:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/server/ServiceEndpointInfo.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/server/ServiceEndpointInfo.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/server/ServiceEndpointInfo.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -28,11 +28,11 @@
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;
+import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
/**
* This object registered with the EndpointManager service.
Modified:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/server/ServiceEndpointInvokerJSE.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/server/ServiceEndpointInvokerJSE.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/server/ServiceEndpointInvokerJSE.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -34,7 +34,7 @@
import org.jboss.ws.WSException;
import org.jboss.ws.core.EndpointInvocation;
import org.jboss.ws.core.jaxrpc.ServletEndpointContextImpl;
-import org.jboss.ws.metadata.ServerEndpointMetaData;
+import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
/**
* Handles invocations on JSE endpoints.
Modified:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/server/ServiceEndpointManager.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/server/ServiceEndpointManager.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/server/ServiceEndpointManager.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -62,10 +62,10 @@
import org.jboss.ws.core.soap.SOAPConnectionImpl;
import org.jboss.ws.core.utils.ThreadLocalAssociation;
import org.jboss.ws.extensions.addressing.AddressingConstantsImpl;
-import org.jboss.ws.metadata.HandlerMetaData;
-import org.jboss.ws.metadata.ServerEndpointMetaData;
-import org.jboss.ws.metadata.UnifiedMetaData;
-import org.jboss.ws.metadata.HandlerMetaData.HandlerType;
+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.HandlerMetaData.HandlerType;
/**
* A service that manages JBossWS endpoints.
Modified:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/server/ServiceEndpointManagerMBean.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/server/ServiceEndpointManagerMBean.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/server/ServiceEndpointManagerMBean.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -27,7 +27,7 @@
import javax.management.ObjectName;
import org.jboss.ws.core.utils.ObjectNameFactory;
-import org.jboss.ws.metadata.HandlerMetaData;
+import org.jboss.ws.metadata.umdm.HandlerMetaData;
/**
* MBean interface.
Modified:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/server/StandardEndpointServlet.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/server/StandardEndpointServlet.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/server/StandardEndpointServlet.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -40,7 +40,7 @@
import org.jboss.ws.WSException;
import org.jboss.ws.core.jaxrpc.ServletEndpointContextImpl;
import org.jboss.ws.core.utils.ObjectNameFactory;
-import org.jboss.ws.metadata.ServerEndpointMetaData;
+import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
/**
* A servlet that is installed for every web service endpoint.
Modified:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/server/WSDLFilePublisher.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/server/WSDLFilePublisher.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/server/WSDLFilePublisher.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -37,7 +37,6 @@
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;
@@ -46,9 +45,10 @@
import org.jboss.ws.core.utils.DOMUtils;
import org.jboss.ws.core.utils.IOUtils;
import org.jboss.ws.deployment.UnifiedDeploymentInfo;
-import org.jboss.ws.metadata.ServiceMetaData;
-import org.jboss.ws.metadata.UnifiedMetaData;
+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.tools.wsdl.WSDLWriter;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -101,7 +101,7 @@
{
Writer fWriter = IOUtils.getCharsetFileWriter(targetFile,
Constants.DEFAULT_XML_CHARSET);
WSDLDefinitions wsdlDefinitions = serviceMetaData.getWsdlDefinitions();
- wsdlDefinitions.write(fWriter, Constants.DEFAULT_XML_CHARSET);
+ new WSDLWriter(wsdlDefinitions).write(fWriter,
Constants.DEFAULT_XML_CHARSET);
URL wsdlPublishURL = targetFile.toURL();
log.info("WSDL published to: " + wsdlPublishURL);
@@ -166,7 +166,7 @@
targetFile.getParentFile().mkdirs();
WSDLFactory wsdlFactory = WSDLFactory.newInstance();
- WSDLWriter wsdlWriter = wsdlFactory.newWSDLWriter();
+ javax.wsdl.xml.WSDLWriter wsdlWriter = wsdlFactory.newWSDLWriter();
FileWriter fw = new FileWriter(targetFile);
wsdlWriter.writeWSDL(subdef, fw);
fw.close();
Modified:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/server/WSDLRequestHandler.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/server/WSDLRequestHandler.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/server/WSDLRequestHandler.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -30,7 +30,7 @@
import org.jboss.logging.Logger;
import org.jboss.ws.core.utils.DOMUtils;
-import org.jboss.ws.metadata.EndpointMetaData;
+import org.jboss.ws.metadata.umdm.EndpointMetaData;
import org.w3c.dom.Attr;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
Modified:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/soap/EndpointInfo.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/soap/EndpointInfo.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/soap/EndpointInfo.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -28,7 +28,7 @@
import java.util.Map;
import java.util.Properties;
-import org.jboss.ws.metadata.EndpointMetaData;
+import org.jboss.ws.metadata.umdm.EndpointMetaData;
/** A wrapper object that associates the target address with some metadata
*
Modified:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/soap/SOAPContentElement.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/soap/SOAPContentElement.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/soap/SOAPContentElement.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -41,8 +41,8 @@
import org.jboss.ws.core.utils.JavaUtils;
import org.jboss.ws.core.utils.MimeUtils;
import org.jboss.ws.extensions.xop.XOPContext;
-import org.jboss.ws.metadata.ParameterMetaData;
-import org.jboss.ws.metadata.UnifiedMetaData;
+import org.jboss.ws.metadata.umdm.ParameterMetaData;
+import org.jboss.ws.metadata.umdm.UnifiedMetaData;
import org.w3c.dom.*;
import javax.xml.namespace.QName;
Modified:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/soap/SOAPMessageDispatcher.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/soap/SOAPMessageDispatcher.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/soap/SOAPMessageDispatcher.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -37,8 +37,8 @@
import org.jboss.logging.Logger;
import org.jboss.ws.core.CommonMessageContext;
import org.jboss.ws.core.jaxrpc.Style;
-import org.jboss.ws.metadata.EndpointMetaData;
-import org.jboss.ws.metadata.OperationMetaData;
+import org.jboss.ws.metadata.umdm.EndpointMetaData;
+import org.jboss.ws.metadata.umdm.OperationMetaData;
/**
* Derive the operation meta data from incomming SOAP message
Modified:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/soap/SOAPMessageImpl.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/soap/SOAPMessageImpl.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/soap/SOAPMessageImpl.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -48,8 +48,8 @@
import org.jboss.ws.core.soap.attachment.MultipartRelatedSwAEncoder;
import org.jboss.ws.core.soap.attachment.MultipartRelatedXOPEncoder;
import org.jboss.ws.extensions.xop.XOPContext;
-import org.jboss.ws.metadata.EndpointMetaData;
-import org.jboss.ws.metadata.OperationMetaData;
+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
Modified:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/soap/UnboundHeader.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/soap/UnboundHeader.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/core/soap/UnboundHeader.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -26,8 +26,8 @@
import javax.xml.namespace.QName;
import javax.xml.rpc.ParameterMode;
-import org.jboss.ws.metadata.OperationMetaData;
-import org.jboss.ws.metadata.ParameterMetaData;
+import org.jboss.ws.metadata.umdm.OperationMetaData;
+import org.jboss.ws.metadata.umdm.ParameterMetaData;
/**
* Represents an unbound SOAPHeaderElement
Modified:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/deployment/AnnotationsMetaDataBuilder.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/deployment/AnnotationsMetaDataBuilder.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/deployment/AnnotationsMetaDataBuilder.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -36,14 +36,15 @@
import org.jboss.ws.core.server.ServerConfig;
import org.jboss.ws.core.server.ServerConfigFactory;
import org.jboss.ws.core.utils.IOUtils;
-import org.jboss.ws.metadata.EndpointMetaData;
-import org.jboss.ws.metadata.ServerEndpointMetaData;
-import org.jboss.ws.metadata.ServiceMetaData;
-import org.jboss.ws.metadata.UnifiedMetaData;
import org.jboss.ws.metadata.j2ee.UnifiedWebMetaData;
import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping;
+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.metadata.wsdl.WSDLDefinitions;
import org.jboss.ws.tools.JavaToWSDL;
+import org.jboss.ws.tools.wsdl.WSDLWriter;
/** An abstract annotation meta data builder.
*
@@ -101,7 +102,7 @@
wsdlTmpFile.deleteOnExit();
Writer writer = IOUtils.getCharsetFileWriter(wsdlTmpFile,
Constants.DEFAULT_XML_CHARSET);
- wsdlDefinitions.write(writer, Constants.DEFAULT_XML_CHARSET);
+ new WSDLWriter(wsdlDefinitions).write(writer,
Constants.DEFAULT_XML_CHARSET);
writer.close();
wsdlLocation = wsdlTmpFile.toURL().toExternalForm();
Modified:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/deployment/JSR109ClientMetaDataBuilder.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/deployment/JSR109ClientMetaDataBuilder.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/deployment/JSR109ClientMetaDataBuilder.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -32,12 +32,6 @@
import org.jboss.logging.Logger;
import org.jboss.ws.Constants;
import org.jboss.ws.WSException;
-import org.jboss.ws.metadata.ClientEndpointMetaData;
-import org.jboss.ws.metadata.EndpointMetaData;
-import org.jboss.ws.metadata.ServiceMetaData;
-import org.jboss.ws.metadata.UnifiedMetaData;
-import org.jboss.ws.metadata.EndpointMetaData.Type;
-import org.jboss.ws.metadata.HandlerMetaData.HandlerType;
import org.jboss.ws.metadata.config.jaxrpc.WSClientConfigJAXRPC;
import org.jboss.ws.metadata.j2ee.UnifiedHandlerMetaData;
import org.jboss.ws.metadata.j2ee.UnifiedPortComponentRefMetaData;
@@ -45,6 +39,12 @@
import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping;
import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMappingFactory;
import org.jboss.ws.metadata.jaxrpcmapping.ServiceEndpointInterfaceMapping;
+import org.jboss.ws.metadata.umdm.ClientEndpointMetaData;
+import org.jboss.ws.metadata.umdm.EndpointMetaData;
+import org.jboss.ws.metadata.umdm.ServiceMetaData;
+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.metadata.wsdl.NCName;
import org.jboss.ws.metadata.wsdl.WSDLDefinitions;
import org.jboss.ws.metadata.wsdl.WSDLEndpoint;
Modified:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/deployment/JSR109Deployment.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/deployment/JSR109Deployment.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/deployment/JSR109Deployment.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -25,8 +25,8 @@
import java.io.InputStream;
import java.net.URL;
-import org.jboss.ws.metadata.jsr109.WebservicesFactory;
-import org.jboss.ws.metadata.jsr109.WebservicesMetaData;
+import org.jboss.ws.metadata.webservices.WebservicesFactory;
+import org.jboss.ws.metadata.webservices.WebservicesMetaData;
import org.jboss.xb.binding.ObjectModelFactory;
import org.jboss.xb.binding.Unmarshaller;
import org.jboss.xb.binding.UnmarshallerFactory;
Modified:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/deployment/JSR109MetaDataBuilder.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/deployment/JSR109MetaDataBuilder.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/deployment/JSR109MetaDataBuilder.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -43,13 +43,7 @@
import org.jboss.ws.core.jaxrpc.TypeMappingRegistryImpl;
import org.jboss.ws.core.jaxrpc.Use;
import org.jboss.ws.core.utils.JavaUtils;
-import org.jboss.ws.extensions.xop.XOPScanner;
-import org.jboss.ws.metadata.EndpointMetaData;
-import org.jboss.ws.metadata.OperationMetaData;
-import org.jboss.ws.metadata.ParameterMetaData;
-import org.jboss.ws.metadata.ServiceMetaData;
-import org.jboss.ws.metadata.TypeMappingMetaData;
-import org.jboss.ws.metadata.TypesMetaData;
+import org.jboss.ws.extensions.xop.jaxrpc.XOPScanner;
import org.jboss.ws.metadata.jaxrpcmapping.ExceptionMapping;
import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping;
import org.jboss.ws.metadata.jaxrpcmapping.JavaXmlTypeMapping;
@@ -59,6 +53,12 @@
import org.jboss.ws.metadata.jaxrpcmapping.VariableMapping;
import org.jboss.ws.metadata.jaxrpcmapping.WsdlMessageMapping;
import org.jboss.ws.metadata.jaxrpcmapping.WsdlReturnValueMapping;
+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.ServiceMetaData;
+import org.jboss.ws.metadata.umdm.TypeMappingMetaData;
+import org.jboss.ws.metadata.umdm.TypesMetaData;
import org.jboss.ws.metadata.wsdl.WSDLBinding;
import org.jboss.ws.metadata.wsdl.WSDLBindingOperation;
import org.jboss.ws.metadata.wsdl.WSDLDefinitions;
Modified:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/deployment/JSR109ServerMetaDataBuilder.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/deployment/JSR109ServerMetaDataBuilder.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/deployment/JSR109ServerMetaDataBuilder.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -32,12 +32,6 @@
import org.jboss.logging.Logger;
import org.jboss.ws.WSException;
-import org.jboss.ws.metadata.EndpointMetaData;
-import org.jboss.ws.metadata.ServerEndpointMetaData;
-import org.jboss.ws.metadata.ServiceMetaData;
-import org.jboss.ws.metadata.UnifiedMetaData;
-import org.jboss.ws.metadata.EndpointMetaData.Type;
-import org.jboss.ws.metadata.HandlerMetaData.HandlerType;
import org.jboss.ws.metadata.config.jaxrpc.WSEndpointConfigJAXRPC;
import org.jboss.ws.metadata.j2ee.UnifiedApplicationMetaData;
import org.jboss.ws.metadata.j2ee.UnifiedBeanMetaData;
@@ -48,8 +42,14 @@
import
org.jboss.ws.metadata.j2ee.UnifiedWebSecurityMetaData.UnifiedWebResourceCollection;
import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping;
import org.jboss.ws.metadata.jaxrpcmapping.ServiceEndpointInterfaceMapping;
-import org.jboss.ws.metadata.jsr109.PortComponentMetaData;
-import org.jboss.ws.metadata.jsr109.WebserviceDescriptionMetaData;
+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.metadata.umdm.EndpointMetaData.Type;
+import org.jboss.ws.metadata.umdm.HandlerMetaData.HandlerType;
+import org.jboss.ws.metadata.webservices.PortComponentMetaData;
+import org.jboss.ws.metadata.webservices.WebserviceDescriptionMetaData;
import org.jboss.ws.metadata.wsdl.WSDLDefinitions;
import org.jboss.ws.metadata.wsdl.WSDLEndpoint;
import org.jboss.ws.metadata.wsdl.WSDLService;
Modified:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/deployment/JSR181MetaDataBuilder.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/deployment/JSR181MetaDataBuilder.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/deployment/JSR181MetaDataBuilder.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -64,22 +64,22 @@
import org.jboss.ws.core.utils.JBossWSEntityResolver;
import org.jboss.ws.extensions.addressing.AddressingPropertiesImpl;
import org.jboss.ws.extensions.addressing.metadata.AddressingOpMetaExt;
-import org.jboss.ws.metadata.EndpointMetaData;
-import org.jboss.ws.metadata.FaultMetaData;
-import org.jboss.ws.metadata.OperationMetaData;
-import org.jboss.ws.metadata.ParameterMetaData;
-import org.jboss.ws.metadata.ServerEndpointMetaData;
-import org.jboss.ws.metadata.ServiceMetaData;
-import org.jboss.ws.metadata.TypeMappingMetaData;
-import org.jboss.ws.metadata.TypesMetaData;
-import org.jboss.ws.metadata.UnifiedMetaData;
-import org.jboss.ws.metadata.EndpointMetaData.Type;
-import org.jboss.ws.metadata.HandlerMetaData.HandlerType;
import org.jboss.ws.metadata.config.jaxrpc.WSEndpointConfigJAXRPC;
import org.jboss.ws.metadata.j2ee.UnifiedHandlerMetaData;
import org.jboss.ws.metadata.jsr181.HandlerChainFactory;
import org.jboss.ws.metadata.jsr181.HandlerChainMetaData;
import org.jboss.ws.metadata.jsr181.HandlerChainsMetaData;
+import org.jboss.ws.metadata.umdm.EndpointMetaData;
+import org.jboss.ws.metadata.umdm.FaultMetaData;
+import org.jboss.ws.metadata.umdm.OperationMetaData;
+import org.jboss.ws.metadata.umdm.ParameterMetaData;
+import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
+import org.jboss.ws.metadata.umdm.ServiceMetaData;
+import org.jboss.ws.metadata.umdm.TypeMappingMetaData;
+import org.jboss.ws.metadata.umdm.TypesMetaData;
+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.metadata.wsdl.WSDLDefinitions;
import org.jboss.ws.metadata.wsdl.WSDLUtils;
import org.jboss.ws.metadata.wsdl.xmlschema.JBossXSModel;
Modified:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/deployment/JSR181MetaDataBuilderEJB21.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/deployment/JSR181MetaDataBuilderEJB21.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/deployment/JSR181MetaDataBuilderEJB21.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -28,10 +28,10 @@
import org.jboss.logging.Logger;
import org.jboss.ws.WSException;
-import org.jboss.ws.metadata.ServerEndpointMetaData;
-import org.jboss.ws.metadata.UnifiedMetaData;
import org.jboss.ws.metadata.j2ee.UnifiedApplicationMetaData;
import org.jboss.ws.metadata.j2ee.UnifiedBeanMetaData;
+import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
+import org.jboss.ws.metadata.umdm.UnifiedMetaData;
/**
* A server side meta data builder that is based on JSR-181 annotations
Modified:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/deployment/JSR181MetaDataBuilderEJB3.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/deployment/JSR181MetaDataBuilderEJB3.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/deployment/JSR181MetaDataBuilderEJB3.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -29,9 +29,9 @@
import org.jboss.annotation.security.SecurityDomain;
import org.jboss.logging.Logger;
import org.jboss.ws.WSException;
-import org.jboss.ws.metadata.UnifiedMetaData;
import org.jboss.ws.metadata.j2ee.UnifiedApplicationMetaData;
import org.jboss.ws.metadata.j2ee.UnifiedBeanMetaData;
+import org.jboss.ws.metadata.umdm.UnifiedMetaData;
/**
* A server side meta data builder that is based on JSR-181 annotations
Modified:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/deployment/JSR181MetaDataBuilderJSE.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/deployment/JSR181MetaDataBuilderJSE.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/deployment/JSR181MetaDataBuilderJSE.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -28,8 +28,8 @@
import org.jboss.logging.Logger;
import org.jboss.ws.WSException;
-import org.jboss.ws.metadata.UnifiedMetaData;
import org.jboss.ws.metadata.j2ee.UnifiedWebMetaData;
+import org.jboss.ws.metadata.umdm.UnifiedMetaData;
/**
* A server side meta data builder that is based on JSR-181 annotations
Modified:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/deployment/MetaDataBuilder.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/deployment/MetaDataBuilder.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/deployment/MetaDataBuilder.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -58,18 +58,18 @@
import org.jboss.ws.extensions.eventing.EventingConstants;
import org.jboss.ws.extensions.eventing.deployment.EventingEndpoint;
import org.jboss.ws.extensions.eventing.metadata.EventingEpMetaExt;
-import org.jboss.ws.metadata.ClientEndpointMetaData;
-import org.jboss.ws.metadata.EndpointMetaData;
-import org.jboss.ws.metadata.FaultMetaData;
-import org.jboss.ws.metadata.OperationMetaData;
-import org.jboss.ws.metadata.ServerEndpointMetaData;
-import org.jboss.ws.metadata.TypesMetaData;
import org.jboss.ws.metadata.j2ee.UnifiedApplicationMetaData;
import org.jboss.ws.metadata.j2ee.UnifiedBeanMetaData;
import org.jboss.ws.metadata.j2ee.UnifiedMessageDrivenMetaData;
import org.jboss.ws.metadata.j2ee.UnifiedWebMetaData;
import org.jboss.ws.metadata.j2ee.UnifiedWebSecurityMetaData;
import
org.jboss.ws.metadata.j2ee.UnifiedWebSecurityMetaData.UnifiedWebResourceCollection;
+import org.jboss.ws.metadata.umdm.ClientEndpointMetaData;
+import org.jboss.ws.metadata.umdm.EndpointMetaData;
+import org.jboss.ws.metadata.umdm.FaultMetaData;
+import org.jboss.ws.metadata.umdm.OperationMetaData;
+import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
+import org.jboss.ws.metadata.umdm.TypesMetaData;
import org.jboss.ws.metadata.wsdl.NCName;
import org.jboss.ws.metadata.wsdl.WSDLBinding;
import org.jboss.ws.metadata.wsdl.WSDLBindingOperation;
Modified:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/deployment/ServiceEndpointDeployer.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/deployment/ServiceEndpointDeployer.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/deployment/ServiceEndpointDeployer.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -31,10 +31,10 @@
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.EndpointMetaData;
-import org.jboss.ws.metadata.ServerEndpointMetaData;
-import org.jboss.ws.metadata.ServiceMetaData;
-import org.jboss.ws.metadata.UnifiedMetaData;
+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;
/**
* The deployer for web service endpoints
Modified:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/extensions/addressing/jaxrpc/WSAddressingServerHandler.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/extensions/addressing/jaxrpc/WSAddressingServerHandler.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/extensions/addressing/jaxrpc/WSAddressingServerHandler.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -38,7 +38,7 @@
import org.jboss.ws.core.jaxrpc.handler.SOAPMessageContextJAXRPC;
import org.jboss.ws.extensions.addressing.AddressingConstantsImpl;
import org.jboss.ws.extensions.addressing.metadata.AddressingOpMetaExt;
-import org.jboss.ws.metadata.OperationMetaData;
+import org.jboss.ws.metadata.umdm.OperationMetaData;
/**
* A server side handler that reads/writes the addressing properties
Modified:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/extensions/addressing/metadata/AddressingOpMetaExt.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/extensions/addressing/metadata/AddressingOpMetaExt.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/extensions/addressing/metadata/AddressingOpMetaExt.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -23,7 +23,7 @@
// $Id$
-import org.jboss.ws.metadata.MetaDataExtension;
+import org.jboss.ws.metadata.umdm.MetaDataExtension;
/**
* Addressing meta data extensions:
Modified:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/extensions/eventing/deployment/EventingEndpoint.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/extensions/eventing/deployment/EventingEndpoint.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/extensions/eventing/deployment/EventingEndpoint.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -7,7 +7,7 @@
import org.jboss.ws.extensions.eventing.metadata.EventingEpMetaExt;
import org.jboss.ws.extensions.eventing.mgmt.SubscriptionManagerFactory;
import org.jboss.ws.extensions.eventing.mgmt.SubscriptionManagerMBean;
-import org.jboss.ws.metadata.ServerEndpointMetaData;
+import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
/**
* EventingEndpointLifecycle is responsible to create event sources
Modified:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/extensions/eventing/metadata/EventingEpMetaExt.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/extensions/eventing/metadata/EventingEpMetaExt.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/extensions/eventing/metadata/EventingEpMetaExt.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -3,7 +3,7 @@
import java.net.URI;
import java.net.URISyntaxException;
-import org.jboss.ws.metadata.MetaDataExtension;
+import org.jboss.ws.metadata.umdm.MetaDataExtension;
/**
* Eventing specific endpoint meta data extensions.
Modified:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/extensions/security/WSSecurityDispatcher.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/extensions/security/WSSecurityDispatcher.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/extensions/security/WSSecurityDispatcher.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -38,8 +38,8 @@
import org.jboss.ws.core.jaxrpc.StubExt;
import org.jboss.ws.core.soap.SOAPMessageImpl;
import org.jboss.ws.core.utils.DOMWriter;
-import org.jboss.ws.metadata.EndpointMetaData;
-import org.jboss.ws.metadata.OperationMetaData;
+import org.jboss.ws.metadata.umdm.EndpointMetaData;
+import org.jboss.ws.metadata.umdm.OperationMetaData;
import org.jboss.ws.metadata.wsse.Config;
import org.jboss.ws.metadata.wsse.Encrypt;
import org.jboss.ws.metadata.wsse.Operation;
Modified:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/extensions/security/jaxrpc/WSSecurityHandler.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/extensions/security/jaxrpc/WSSecurityHandler.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/extensions/security/jaxrpc/WSSecurityHandler.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -31,7 +31,7 @@
import org.jboss.logging.Logger;
import org.jboss.ws.core.jaxrpc.handler.SOAPMessageContextJAXRPC;
import org.jboss.ws.extensions.security.WSSecurityDispatcher;
-import org.jboss.ws.metadata.EndpointMetaData;
+import org.jboss.ws.metadata.umdm.EndpointMetaData;
import org.jboss.ws.metadata.wsse.WSSecurityConfiguration;
/**
Deleted:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/extensions/xop/JBossXBContentAdapter.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/extensions/xop/JBossXBContentAdapter.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/extensions/xop/JBossXBContentAdapter.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -1,234 +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.extensions.xop;
-
-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.core.utils.IOUtils;
-import org.jboss.ws.core.utils.MimeUtils;
-import org.jboss.xb.binding.sunday.marshalling.MarshallingContext;
-import org.jboss.xb.binding.sunday.marshalling.TermBeforeMarshallingCallback;
-import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding;
-import org.jboss.xb.binding.sunday.unmarshalling.TermBeforeSetParentCallback;
-import org.jboss.xb.binding.sunday.unmarshalling.TypeBinding;
-import org.jboss.xb.binding.sunday.unmarshalling.UnmarshallingContext;
-
-import javax.activation.DataHandler;
-import javax.activation.DataSource;
-import javax.xml.namespace.QName;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-
-/**
- * Adopts raw binary contents to java types.
- * This class works in conjunction with the <code>XOPUnmarshallerImpl</code>
- * and <code>XOPMarshallerImpl</code>.
- *
- * @see XOPUnmarshallerImpl
- * @see XOPMarshallerImpl
- *
- * @author Heiko Braun <heiko.braun(a)jboss.com>
- * @version $Id$
- * @since Oct 19, 2006
- */
-public class JBossXBContentAdapter implements TermBeforeMarshallingCallback,
TermBeforeSetParentCallback {
-
- private static final Logger log = Logger.getLogger(JBossXBContentAdapter.class);
- private static final QName XMIME_BASE_64 = new QName(Constants.NS_XML_MIME,
"base64Binary");
- private static final QName XOP_INCLUDE = new QName(Constants.NS_XOP,
"Include");
-
- static
- {
- // Load JAF content handlers
- ContentHandlerRegistry.register();
- }
-
- /**
- * When XOP is disabled we need to convert java types to byte[]
- * before handing off to XB.
- */
- public Object beforeMarshalling(Object object, MarshallingContext marshallingContext)
{
-
- boolean mtomDisabled = !XOPContext.isMTOMEnabled();
- boolean convertableType = object!=null && !(object instanceof byte[]);
-
- if( mtomDisabled && convertableType )
- {
- String contentType = MimeUtils.resolveMimeType(object);
- log.debug("Adopt " + object.getClass() + " to byte[], contentType
" + contentType);
-
- DataHandler dh = new DataHandler(object, contentType);
- ByteArrayOutputStream bout = new ByteArrayOutputStream();
- try
- {
- IOUtils.copyStream(bout, dh.getInputStream());
- object = bout.toByteArray();
- }
- catch (IOException e)
- {
- throw new WSException("Failed to adopt XOP content type", e);
- }
- }
-
- return object;
- }
-
- /**
- * When XOP is disabled (inlined request) we receive a byte[] from XB
- * that needs to be converted in to java type
- */
- public Object beforeSetParent(Object object, UnmarshallingContext ctx) {
-
- if(null==object)
- return object;
-
- // may be null when it's actually an encoded request ?!
- Class targetClass = ctx.resolvePropertyType();
-
- if(null==targetClass) {
- throw new WSException("Failed to resolve target property type on "+
ctx.getParticle());
- }
-
- boolean isRegularMessage = !XOPContext.isXOPMessage();
- boolean isSimpleType = (object instanceof byte[]);
- boolean doTypesMatch = ( targetClass.equals(object.getClass()) );
-
- // Handle inlined requests.
- // In this case XB treats binaries as simple types that are unmarshalled to byte[]
- // Still type conversion will be necessary.
- if( isRegularMessage && isSimpleType && !doTypesMatch)
- {
- String contentType = MimeUtils.resolveMimeType(targetClass);
- log.debug("Adopt byte[] to " + targetClass +", contentType
"+ contentType);
-
- try
- {
- DataHandler dh = new DataHandler(
- wrapAsDataSource(object, contentType)
- );
-
- if(targetClass.equals(DataHandler.class))
- object = dh;
- else
- object = dh.getContent();
- }
- catch (IOException e)
- {
- throw new WSException("Failed to adopt XOP content type", e);
- }
- }
-
- // Handle XOP encoded requests.
- // XB will use the XOPUnmarshaller callback and receive a DataHandler instance.
- // In this case we are be able to instantiate the correct content object
- // from the data handler, with the exception of content-type
'application/octet-stream'.
- // These attachments will be returned as DataHandler instances.
- else if(XOPContext.isXOPMessage() && (object instanceof DataHandler)
&& !doTypesMatch)
- {
- try
- {
- String contentType = MimeUtils.resolveMimeType(targetClass);
- log.debug("Adopt DataHandler to " + targetClass +",
contentType "+ contentType);
-
- DataHandler dh = new DataHandler(
- wrapAsDataSource(object, contentType)
- );
- object = dh.getContent();
-
- // 'application/octet-stream' will return a byte[] instead fo the
stream
- if(object instanceof InputStream)
- {
- ByteArrayOutputStream bout = new ByteArrayOutputStream();
- dh.writeTo(bout);
- object = bout.toByteArray();
- }
- }
- catch (IOException e)
- {
- throw new WSException("Failed to adopt XOP content type", e);
- }
- }
-
- return object;
- }
-
- private DataSource wrapAsDataSource(Object object, String contentType) throws
IOException {
-
- DataSource ds;
-
- if(object instanceof byte[])
- {
- ds = new SwapableMemoryDataSource(new ByteArrayInputStream((byte[])object),
contentType);
- }
- else if(object instanceof DataHandler)
- {
- ds = new SwapableMemoryDataSource(((DataHandler)object).getInputStream(),
contentType);
- }
- else
- {
- throw new IllegalArgumentException("Failed to wrap as data source:
"+object.getClass());
- }
-
- return ds;
- }
-
- /**
- * A factory method that registers the XB (un)marshalling adapters with schema
binding.
- * These adapters convert java types into byte[] and reverse,
- * in order to match the jaxrpc-mapping declaration in case we receive or send an
inlined request.
- */
- public static void register(SchemaBinding schemaBinding)
- {
- JBossXBContentAdapter contentAdapter = new JBossXBContentAdapter();
-
- // base64 simple types
- TypeBinding base64Type =
schemaBinding.getType(org.jboss.xb.binding.Constants.QNAME_BASE64BINARY);
- base64Type.setBeforeMarshallingCallback( contentAdapter );
- base64Type.setBeforeSetParentCallback( contentAdapter );
-
- // xmime complex types
- TypeBinding xmimeBase64Type = schemaBinding.getType(XMIME_BASE_64);
- if(xmimeBase64Type!=null)
- {
- xmimeBase64Type.setBeforeMarshallingCallback( contentAdapter );
- xmimeBase64Type.setBeforeSetParentCallback( contentAdapter );
-
- // xop:Include
- /*ModelGroupBinding modelGroup =
(ModelGroupBinding)xmimeBase64Type.getParticle().getTerm();
- ParticleBinding particle =
(ParticleBinding)modelGroup.getParticles().iterator().next();
- ElementBinding xopInclude = (ElementBinding)particle.getTerm();
-
- if(! xopInclude.getQName().equals(XOP_INCLUDE))
- throw new WSException("Looks like the JBossXB XOP implementation has
changed, please open a JIRA issue");
-
- xopInclude.setBeforeMarshallingCallback(contentAdapter);
- xopInclude.setBeforeSetParentCallback(contentAdapter);
- */
- }
- }
-
-}
Modified:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/extensions/xop/XOPContext.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/extensions/xop/XOPContext.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/extensions/xop/XOPContext.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -34,6 +34,8 @@
import org.jboss.ws.core.utils.DOMUtils;
import org.jboss.ws.core.utils.JavaUtils;
import org.jboss.ws.core.utils.MimeUtils;
+import org.jboss.ws.extensions.xop.jaxrpc.XOPMarshallerImpl;
+import org.jboss.ws.extensions.xop.jaxrpc.XOPUnmarshallerImpl;
import org.jboss.xb.binding.SimpleTypeBindings;
import org.jboss.xb.binding.sunday.xop.XOPMarshaller;
import org.jboss.xb.binding.sunday.xop.XOPObject;
Deleted:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/extensions/xop/XOPMarshallerImpl.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/extensions/xop/XOPMarshallerImpl.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/extensions/xop/XOPMarshallerImpl.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -1,105 +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.extensions.xop;
-
-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.xb.binding.sunday.xop.XOPMarshaller;
-import org.jboss.xb.binding.sunday.xop.XOPObject;
-
-import javax.activation.DataHandler;
-import javax.xml.namespace.QName;
-import javax.xml.soap.AttachmentPart;
-
-/**
- * The XOPUnmarshallerImpl allows callbacks from the binding layer towards the
- * soap processing components in order to optimize binary processing.
- *
- * @see org.jboss.ws.extensions.xop.XOPUnmarshallerImpl
- *
- * @author Heiko Braun <heiko.braun(a)jboss.com>
- * @since May 9, 2006
- * @version $Id$
- */
-public class XOPMarshallerImpl implements XOPMarshaller {
-
- private static final Logger log = Logger.getLogger(XOPMarshallerImpl.class);
-
- static
- {
- // Load JAF content handlers
- ContentHandlerRegistry.register();
- }
-
- public boolean isXOPPackage()
- {
- return XOPContext.isXOPMessage();
- }
-
- public String addMtomAttachment(XOPObject obj, String elementNamespace, String
elementName)
- {
-
- CommonMessageContext msgContext =
(CommonMessageContext)MessageContextAssociation.peekMessageContext();
- SOAPMessageImpl soapMessage = (SOAPMessageImpl)msgContext.getSOAPMessage();
-
- QName xmlName = new QName(elementNamespace, elementName);
- log.debug("serialize: [xmlName=" + xmlName + "]");
-
- String cid =
soapMessage.getCidGenerator().generateFromName(xmlName.getLocalPart());
-
- DataHandler dataHandler = XOPContext.createDataHandler(obj);
- AttachmentPart xopPart = soapMessage.createAttachmentPart(dataHandler);
- xopPart.addMimeHeader(MimeConstants.CONTENT_ID, '<'+cid+'>');
// RFC2392 requirement
- soapMessage.addAttachmentPart(xopPart);
-
- log.debug("Created attachment part " +cid+", with content-type
" +xopPart.getContentType());
-
- return "cid:" + cid;
-
- }
-
- public String addMtomAttachment(byte[] data, String elementNamespace, String
elementName)
- {
- /*
- TODO: this requires a java mail upgrade
- ByteArrayDataSource ds = new ByteArrayDataSource(data,
MimeConstants.TYPE_APPLICATION_OCTET_STREAM);
- return addMtomAttachment(
- new DataHandler(
- ds, MimeConstants.TYPE_APPLICATION_OCTET_STREAM),
- elementNamespace, elementName
- );*/
-
- throw new NotImplementedException("Not implemented yet");
- }
-
- public String addSwaRefAttachment(Object obj)
- {
- throw new NotImplementedException();
- }
-
-
-}
Deleted:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/extensions/xop/XOPScanner.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/extensions/xop/XOPScanner.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/extensions/xop/XOPScanner.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -1,146 +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.extensions.xop;
-
-import org.apache.xerces.xs.*;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Scans complex type definitions for nested XOP type declarations.
- * A XOP type declaration is identified as a complex type
- * that derives from xsd:base64Binary, i.e:
- *
- * <code> <pre>
- * <xs:complexType name="MyXOPElement" >
- * <xs:simpleContent>
- * <xs:extension base="xs:base64Binary" >
- * <xs:attribute ref="xmime:contentType" />
- * </xs:extension>
- * </xs:simpleContent>
- * </xs:complexType>
- * </pre></code>
- *
- * @author Heiko Braun <heiko.braun(a)jboss.com>
- * @since Jun 9, 2006
- * @version $Id$
- */
-public class XOPScanner {
-
- // avoid circular scans
- private List<String> scannedItems = new ArrayList<String>();
- private static final String BASE64_BINARY = "base64Binary";
-
- /**
- * Query a complex type for nested XOP type definitions.
- */
- public XSTypeDefinition findXOPTypeDef(XSTypeDefinition typeDef)
- {
- if(typeDef==null)
- return typeDef;
- XSTypeDefinition result = null;
- String name = typeDef.getName();
- String namespace = typeDef.getNamespace()!=null ?
typeDef.getNamespace():"";
-
- if(typeDef instanceof XSSimpleTypeDefinition &&
BASE64_BINARY.equals(name))
- {
- return typeDef;
- }
- else if(typeDef instanceof XSComplexTypeDefinition)
- {
- XSComplexTypeDefinition complexTypeDef = (XSComplexTypeDefinition)typeDef;
- if(name!=null)
- {
- String typeKey = namespace+":"+name;
-
- if(scannedItems.contains(typeKey))
- {
- return null;
- }
- else
- {
- scannedItems.add(typeKey);
- }
- }
-
- // An XOP parameter is detected if it is a complex type
- // that derives from xsd:base64Binary
- if (complexTypeDef.getSimpleType() != null)
- {
- String typeName = complexTypeDef.getSimpleType().getName();
- if (BASE64_BINARY.equals(typeName))
- return complexTypeDef;
- }
- else
- {
-
- XSModelGroup xm = null;
- if(complexTypeDef.getContentType() !=
XSComplexTypeDefinition.CONTENTTYPE_EMPTY)
- {
- XSParticle xp = complexTypeDef.getParticle();
- if (xp != null)
- {
- XSTerm xterm = xp.getTerm();
- if(xterm instanceof XSModelGroup)
- {
- xm = (XSModelGroup)xterm;
- //System.out.println("xm -> " + xm);
-
- XSObjectList xo = xm.getParticles();
-
- // interate over nested particles
- for(int i=0; i<xm.getParticles().getLength(); i++ )
- {
- XSTerm xsterm = ((XSParticle)xo.item(i)).getTerm();
-
- // Can be either XSModelGroup, XSWildcard, XSElementDeclaration
- // We only proceed with XSElementDeclaration
- if(xsterm instanceof XSElementDeclaration)
- {
- XSElementDeclaration xe = (XSElementDeclaration)xsterm;
- XSTypeDefinition nestedTypeDef = xe.getTypeDefinition();
-
- //System.out.println("Query nested -> " +
xe.getName());
- result = findXOPTypeDef(nestedTypeDef);
- }
- }
- }
- }
- }
-
- }
-
- //System.out.println("result -> " + result);
-
- }
-
- return result;
-
- }
-
- public void reset()
- {
- scannedItems.clear();
- }
-
-}
\ No newline at end of file
Deleted:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/extensions/xop/XOPUnmarshallerImpl.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/extensions/xop/XOPUnmarshallerImpl.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/extensions/xop/XOPUnmarshallerImpl.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -1,105 +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.extensions.xop;
-
-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.xb.binding.sunday.xop.XOPObject;
-import org.jboss.xb.binding.sunday.xop.XOPUnmarshaller;
-
-import javax.activation.DataHandler;
-import javax.xml.namespace.QName;
-import javax.xml.soap.AttachmentPart;
-import javax.xml.soap.SOAPException;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-
-/**
- * The XOPUnmarshallerImpl allows callbacks from the binding layer towards the
- * soap processing components in order to optimize binary processing.
- *
- * @see XOPMarshallerImpl
- *
- * @author Heiko Braun <heiko.braun(a)jboss.com>
- * @since May 9, 2006
- * @version $Id$
- */
-public class XOPUnmarshallerImpl implements XOPUnmarshaller {
-
- private static final Logger log = Logger.getLogger(XOPUnmarshallerImpl.class);
- private static final QName XOP_INCLUDE = new QName(Constants.NS_XOP,
"Include");
-
- static
- {
- // Load JAF content handlers
- ContentHandlerRegistry.register();
- }
-
- public boolean isXOPPackage()
- {
- return XOPContext.isXOPMessage();
- }
-
- public XOPObject getAttachmentAsDataHandler(String cid)
- {
- try
- {
- AttachmentPart part = XOPContext.getAttachmentByCID(cid);
- DataHandler dataHandler = part.getDataHandler();
- String contentType = dataHandler.getContentType();
-
- // Wrapping the DataHandler shields XB from the JAF dependency
- XOPObject xopObject = new XOPObject(dataHandler);
- xopObject.setContentType(contentType);
-
- return xopObject;
- }
- catch(SOAPException e)
- {
- throw new WSException("Failed to access attachment part", e);
- }
- }
-
- public byte[] getAttachmentAsByteArray(String cid)
- {
- try
- {
- AttachmentPart part = XOPContext.getAttachmentByCID(cid);
- DataHandler dh = part.getDataHandler();
- ByteArrayOutputStream bout = new ByteArrayOutputStream();
- dh.writeTo(bout);
-
- return bout.toByteArray();
- }
- catch (SOAPException ex)
- {
- throw new WSException(ex);
- }
- catch(IOException e)
- {
- throw new WSException(e);
- }
-
- }
-}
Copied:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/extensions/xop/jaxrpc/JBossXBContentAdapter.java
(from rev 1600,
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/extensions/xop/JBossXBContentAdapter.java)
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/extensions/xop/JBossXBContentAdapter.java 2006-12-07
10:43:36 UTC (rev 1600)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/extensions/xop/jaxrpc/JBossXBContentAdapter.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -0,0 +1,235 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+package org.jboss.ws.extensions.xop.jaxrpc;
+
+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.core.utils.IOUtils;
+import org.jboss.ws.core.utils.MimeUtils;
+import org.jboss.ws.extensions.xop.XOPContext;
+import org.jboss.xb.binding.sunday.marshalling.MarshallingContext;
+import org.jboss.xb.binding.sunday.marshalling.TermBeforeMarshallingCallback;
+import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding;
+import org.jboss.xb.binding.sunday.unmarshalling.TermBeforeSetParentCallback;
+import org.jboss.xb.binding.sunday.unmarshalling.TypeBinding;
+import org.jboss.xb.binding.sunday.unmarshalling.UnmarshallingContext;
+
+import javax.activation.DataHandler;
+import javax.activation.DataSource;
+import javax.xml.namespace.QName;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+
+/**
+ * Adopts raw binary contents to java types.
+ * This class works in conjunction with the <code>XOPUnmarshallerImpl</code>
+ * and <code>XOPMarshallerImpl</code>.
+ *
+ * @see XOPUnmarshallerImpl
+ * @see XOPMarshallerImpl
+ *
+ * @author Heiko Braun <heiko.braun(a)jboss.com>
+ * @version $Id$
+ * @since Oct 19, 2006
+ */
+public class JBossXBContentAdapter implements TermBeforeMarshallingCallback,
TermBeforeSetParentCallback {
+
+ private static final Logger log = Logger.getLogger(JBossXBContentAdapter.class);
+ private static final QName XMIME_BASE_64 = new QName(Constants.NS_XML_MIME,
"base64Binary");
+ private static final QName XOP_INCLUDE = new QName(Constants.NS_XOP,
"Include");
+
+ static
+ {
+ // Load JAF content handlers
+ ContentHandlerRegistry.register();
+ }
+
+ /**
+ * When XOP is disabled we need to convert java types to byte[]
+ * before handing off to XB.
+ */
+ public Object beforeMarshalling(Object object, MarshallingContext marshallingContext)
{
+
+ boolean mtomDisabled = !XOPContext.isMTOMEnabled();
+ boolean convertableType = object!=null && !(object instanceof byte[]);
+
+ if( mtomDisabled && convertableType )
+ {
+ String contentType = MimeUtils.resolveMimeType(object);
+ log.debug("Adopt " + object.getClass() + " to byte[], contentType
" + contentType);
+
+ DataHandler dh = new DataHandler(object, contentType);
+ ByteArrayOutputStream bout = new ByteArrayOutputStream();
+ try
+ {
+ IOUtils.copyStream(bout, dh.getInputStream());
+ object = bout.toByteArray();
+ }
+ catch (IOException e)
+ {
+ throw new WSException("Failed to adopt XOP content type", e);
+ }
+ }
+
+ return object;
+ }
+
+ /**
+ * When XOP is disabled (inlined request) we receive a byte[] from XB
+ * that needs to be converted in to java type
+ */
+ public Object beforeSetParent(Object object, UnmarshallingContext ctx) {
+
+ if(null==object)
+ return object;
+
+ // may be null when it's actually an encoded request ?!
+ Class targetClass = ctx.resolvePropertyType();
+
+ if(null==targetClass) {
+ throw new WSException("Failed to resolve target property type on "+
ctx.getParticle());
+ }
+
+ boolean isRegularMessage = !XOPContext.isXOPMessage();
+ boolean isSimpleType = (object instanceof byte[]);
+ boolean doTypesMatch = ( targetClass.equals(object.getClass()) );
+
+ // Handle inlined requests.
+ // In this case XB treats binaries as simple types that are unmarshalled to byte[]
+ // Still type conversion will be necessary.
+ if( isRegularMessage && isSimpleType && !doTypesMatch)
+ {
+ String contentType = MimeUtils.resolveMimeType(targetClass);
+ log.debug("Adopt byte[] to " + targetClass +", contentType
"+ contentType);
+
+ try
+ {
+ DataHandler dh = new DataHandler(
+ wrapAsDataSource(object, contentType)
+ );
+
+ if(targetClass.equals(DataHandler.class))
+ object = dh;
+ else
+ object = dh.getContent();
+ }
+ catch (IOException e)
+ {
+ throw new WSException("Failed to adopt XOP content type", e);
+ }
+ }
+
+ // Handle XOP encoded requests.
+ // XB will use the XOPUnmarshaller callback and receive a DataHandler instance.
+ // In this case we are be able to instantiate the correct content object
+ // from the data handler, with the exception of content-type
'application/octet-stream'.
+ // These attachments will be returned as DataHandler instances.
+ else if(XOPContext.isXOPMessage() && (object instanceof DataHandler)
&& !doTypesMatch)
+ {
+ try
+ {
+ String contentType = MimeUtils.resolveMimeType(targetClass);
+ log.debug("Adopt DataHandler to " + targetClass +",
contentType "+ contentType);
+
+ DataHandler dh = new DataHandler(
+ wrapAsDataSource(object, contentType)
+ );
+ object = dh.getContent();
+
+ // 'application/octet-stream' will return a byte[] instead fo the
stream
+ if(object instanceof InputStream)
+ {
+ ByteArrayOutputStream bout = new ByteArrayOutputStream();
+ dh.writeTo(bout);
+ object = bout.toByteArray();
+ }
+ }
+ catch (IOException e)
+ {
+ throw new WSException("Failed to adopt XOP content type", e);
+ }
+ }
+
+ return object;
+ }
+
+ private DataSource wrapAsDataSource(Object object, String contentType) throws
IOException {
+
+ DataSource ds;
+
+ if(object instanceof byte[])
+ {
+ ds = new SwapableMemoryDataSource(new ByteArrayInputStream((byte[])object),
contentType);
+ }
+ else if(object instanceof DataHandler)
+ {
+ ds = new SwapableMemoryDataSource(((DataHandler)object).getInputStream(),
contentType);
+ }
+ else
+ {
+ throw new IllegalArgumentException("Failed to wrap as data source:
"+object.getClass());
+ }
+
+ return ds;
+ }
+
+ /**
+ * A factory method that registers the XB (un)marshalling adapters with schema
binding.
+ * These adapters convert java types into byte[] and reverse,
+ * in order to match the jaxrpc-mapping declaration in case we receive or send an
inlined request.
+ */
+ public static void register(SchemaBinding schemaBinding)
+ {
+ JBossXBContentAdapter contentAdapter = new JBossXBContentAdapter();
+
+ // base64 simple types
+ TypeBinding base64Type =
schemaBinding.getType(org.jboss.xb.binding.Constants.QNAME_BASE64BINARY);
+ base64Type.setBeforeMarshallingCallback( contentAdapter );
+ base64Type.setBeforeSetParentCallback( contentAdapter );
+
+ // xmime complex types
+ TypeBinding xmimeBase64Type = schemaBinding.getType(XMIME_BASE_64);
+ if(xmimeBase64Type!=null)
+ {
+ xmimeBase64Type.setBeforeMarshallingCallback( contentAdapter );
+ xmimeBase64Type.setBeforeSetParentCallback( contentAdapter );
+
+ // xop:Include
+ /*ModelGroupBinding modelGroup =
(ModelGroupBinding)xmimeBase64Type.getParticle().getTerm();
+ ParticleBinding particle =
(ParticleBinding)modelGroup.getParticles().iterator().next();
+ ElementBinding xopInclude = (ElementBinding)particle.getTerm();
+
+ if(! xopInclude.getQName().equals(XOP_INCLUDE))
+ throw new WSException("Looks like the JBossXB XOP implementation has
changed, please open a JIRA issue");
+
+ xopInclude.setBeforeMarshallingCallback(contentAdapter);
+ xopInclude.setBeforeSetParentCallback(contentAdapter);
+ */
+ }
+ }
+
+}
Copied:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/extensions/xop/jaxrpc/XOPMarshallerImpl.java
(from rev 1601,
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/extensions/xop/XOPMarshallerImpl.java)
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/extensions/xop/XOPMarshallerImpl.java 2006-12-07
11:35:39 UTC (rev 1601)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/extensions/xop/jaxrpc/XOPMarshallerImpl.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -0,0 +1,106 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ws.extensions.xop.jaxrpc;
+
+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.extensions.xop.XOPContext;
+import org.jboss.xb.binding.sunday.xop.XOPMarshaller;
+import org.jboss.xb.binding.sunday.xop.XOPObject;
+
+import javax.activation.DataHandler;
+import javax.xml.namespace.QName;
+import javax.xml.soap.AttachmentPart;
+
+/**
+ * The XOPUnmarshallerImpl allows callbacks from the binding layer towards the
+ * soap processing components in order to optimize binary processing.
+ *
+ * @see org.jboss.ws.extensions.xop.jaxrpc.XOPUnmarshallerImpl
+ *
+ * @author Heiko Braun <heiko.braun(a)jboss.com>
+ * @since May 9, 2006
+ * @version $Id$
+ */
+public class XOPMarshallerImpl implements XOPMarshaller {
+
+ private static final Logger log = Logger.getLogger(XOPMarshallerImpl.class);
+
+ static
+ {
+ // Load JAF content handlers
+ ContentHandlerRegistry.register();
+ }
+
+ public boolean isXOPPackage()
+ {
+ return XOPContext.isXOPMessage();
+ }
+
+ public String addMtomAttachment(XOPObject obj, String elementNamespace, String
elementName)
+ {
+
+ CommonMessageContext msgContext =
(CommonMessageContext)MessageContextAssociation.peekMessageContext();
+ SOAPMessageImpl soapMessage = (SOAPMessageImpl)msgContext.getSOAPMessage();
+
+ QName xmlName = new QName(elementNamespace, elementName);
+ log.debug("serialize: [xmlName=" + xmlName + "]");
+
+ String cid =
soapMessage.getCidGenerator().generateFromName(xmlName.getLocalPart());
+
+ DataHandler dataHandler = XOPContext.createDataHandler(obj);
+ AttachmentPart xopPart = soapMessage.createAttachmentPart(dataHandler);
+ xopPart.addMimeHeader(MimeConstants.CONTENT_ID, '<'+cid+'>');
// RFC2392 requirement
+ soapMessage.addAttachmentPart(xopPart);
+
+ log.debug("Created attachment part " +cid+", with content-type
" +xopPart.getContentType());
+
+ return "cid:" + cid;
+
+ }
+
+ public String addMtomAttachment(byte[] data, String elementNamespace, String
elementName)
+ {
+ /*
+ TODO: this requires a java mail upgrade
+ ByteArrayDataSource ds = new ByteArrayDataSource(data,
MimeConstants.TYPE_APPLICATION_OCTET_STREAM);
+ return addMtomAttachment(
+ new DataHandler(
+ ds, MimeConstants.TYPE_APPLICATION_OCTET_STREAM),
+ elementNamespace, elementName
+ );*/
+
+ throw new NotImplementedException("Not implemented yet");
+ }
+
+ public String addSwaRefAttachment(Object obj)
+ {
+ throw new NotImplementedException();
+ }
+
+
+}
Copied:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/extensions/xop/jaxrpc/XOPScanner.java
(from rev 1600,
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/extensions/xop/XOPScanner.java)
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/extensions/xop/XOPScanner.java 2006-12-07
10:43:36 UTC (rev 1600)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/extensions/xop/jaxrpc/XOPScanner.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -0,0 +1,146 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+package org.jboss.ws.extensions.xop.jaxrpc;
+
+import org.apache.xerces.xs.*;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Scans complex type definitions for nested XOP type declarations.
+ * A XOP type declaration is identified as a complex type
+ * that derives from xsd:base64Binary, i.e:
+ *
+ * <code> <pre>
+ * <xs:complexType name="MyXOPElement" >
+ * <xs:simpleContent>
+ * <xs:extension base="xs:base64Binary" >
+ * <xs:attribute ref="xmime:contentType" />
+ * </xs:extension>
+ * </xs:simpleContent>
+ * </xs:complexType>
+ * </pre></code>
+ *
+ * @author Heiko Braun <heiko.braun(a)jboss.com>
+ * @since Jun 9, 2006
+ * @version $Id$
+ */
+public class XOPScanner {
+
+ // avoid circular scans
+ private List<String> scannedItems = new ArrayList<String>();
+ private static final String BASE64_BINARY = "base64Binary";
+
+ /**
+ * Query a complex type for nested XOP type definitions.
+ */
+ public XSTypeDefinition findXOPTypeDef(XSTypeDefinition typeDef)
+ {
+ if(typeDef==null)
+ return typeDef;
+ XSTypeDefinition result = null;
+ String name = typeDef.getName();
+ String namespace = typeDef.getNamespace()!=null ?
typeDef.getNamespace():"";
+
+ if(typeDef instanceof XSSimpleTypeDefinition &&
BASE64_BINARY.equals(name))
+ {
+ return typeDef;
+ }
+ else if(typeDef instanceof XSComplexTypeDefinition)
+ {
+ XSComplexTypeDefinition complexTypeDef = (XSComplexTypeDefinition)typeDef;
+ if(name!=null)
+ {
+ String typeKey = namespace+":"+name;
+
+ if(scannedItems.contains(typeKey))
+ {
+ return null;
+ }
+ else
+ {
+ scannedItems.add(typeKey);
+ }
+ }
+
+ // An XOP parameter is detected if it is a complex type
+ // that derives from xsd:base64Binary
+ if (complexTypeDef.getSimpleType() != null)
+ {
+ String typeName = complexTypeDef.getSimpleType().getName();
+ if (BASE64_BINARY.equals(typeName))
+ return complexTypeDef;
+ }
+ else
+ {
+
+ XSModelGroup xm = null;
+ if(complexTypeDef.getContentType() !=
XSComplexTypeDefinition.CONTENTTYPE_EMPTY)
+ {
+ XSParticle xp = complexTypeDef.getParticle();
+ if (xp != null)
+ {
+ XSTerm xterm = xp.getTerm();
+ if(xterm instanceof XSModelGroup)
+ {
+ xm = (XSModelGroup)xterm;
+ //System.out.println("xm -> " + xm);
+
+ XSObjectList xo = xm.getParticles();
+
+ // interate over nested particles
+ for(int i=0; i<xm.getParticles().getLength(); i++ )
+ {
+ XSTerm xsterm = ((XSParticle)xo.item(i)).getTerm();
+
+ // Can be either XSModelGroup, XSWildcard, XSElementDeclaration
+ // We only proceed with XSElementDeclaration
+ if(xsterm instanceof XSElementDeclaration)
+ {
+ XSElementDeclaration xe = (XSElementDeclaration)xsterm;
+ XSTypeDefinition nestedTypeDef = xe.getTypeDefinition();
+
+ //System.out.println("Query nested -> " +
xe.getName());
+ result = findXOPTypeDef(nestedTypeDef);
+ }
+ }
+ }
+ }
+ }
+
+ }
+
+ //System.out.println("result -> " + result);
+
+ }
+
+ return result;
+
+ }
+
+ public void reset()
+ {
+ scannedItems.clear();
+ }
+
+}
\ No newline at end of file
Copied:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/extensions/xop/jaxrpc/XOPUnmarshallerImpl.java
(from rev 1600,
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/extensions/xop/XOPUnmarshallerImpl.java)
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/extensions/xop/XOPUnmarshallerImpl.java 2006-12-07
10:43:36 UTC (rev 1600)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/extensions/xop/jaxrpc/XOPUnmarshallerImpl.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -0,0 +1,106 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ws.extensions.xop.jaxrpc;
+
+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.extensions.xop.XOPContext;
+import org.jboss.xb.binding.sunday.xop.XOPObject;
+import org.jboss.xb.binding.sunday.xop.XOPUnmarshaller;
+
+import javax.activation.DataHandler;
+import javax.xml.namespace.QName;
+import javax.xml.soap.AttachmentPart;
+import javax.xml.soap.SOAPException;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+
+/**
+ * The XOPUnmarshallerImpl allows callbacks from the binding layer towards the
+ * soap processing components in order to optimize binary processing.
+ *
+ * @see XOPMarshallerImpl
+ *
+ * @author Heiko Braun <heiko.braun(a)jboss.com>
+ * @since May 9, 2006
+ * @version $Id$
+ */
+public class XOPUnmarshallerImpl implements XOPUnmarshaller {
+
+ private static final Logger log = Logger.getLogger(XOPUnmarshallerImpl.class);
+ private static final QName XOP_INCLUDE = new QName(Constants.NS_XOP,
"Include");
+
+ static
+ {
+ // Load JAF content handlers
+ ContentHandlerRegistry.register();
+ }
+
+ public boolean isXOPPackage()
+ {
+ return XOPContext.isXOPMessage();
+ }
+
+ public XOPObject getAttachmentAsDataHandler(String cid)
+ {
+ try
+ {
+ AttachmentPart part = XOPContext.getAttachmentByCID(cid);
+ DataHandler dataHandler = part.getDataHandler();
+ String contentType = dataHandler.getContentType();
+
+ // Wrapping the DataHandler shields XB from the JAF dependency
+ XOPObject xopObject = new XOPObject(dataHandler);
+ xopObject.setContentType(contentType);
+
+ return xopObject;
+ }
+ catch(SOAPException e)
+ {
+ throw new WSException("Failed to access attachment part", e);
+ }
+ }
+
+ public byte[] getAttachmentAsByteArray(String cid)
+ {
+ try
+ {
+ AttachmentPart part = XOPContext.getAttachmentByCID(cid);
+ DataHandler dh = part.getDataHandler();
+ ByteArrayOutputStream bout = new ByteArrayOutputStream();
+ dh.writeTo(bout);
+
+ return bout.toByteArray();
+ }
+ catch (SOAPException ex)
+ {
+ throw new WSException(ex);
+ }
+ catch(IOException e)
+ {
+ throw new WSException(e);
+ }
+
+ }
+}
Modified:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/jboss42/DeployerInterceptorEJB.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/jboss42/DeployerInterceptorEJB.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/jboss42/DeployerInterceptorEJB.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -29,7 +29,7 @@
import org.jboss.deployment.DeploymentInfo;
import org.jboss.mx.server.Invocation;
import org.jboss.ws.deployment.UnifiedDeploymentInfo;
-import org.jboss.ws.metadata.UnifiedMetaData;
+import org.jboss.ws.metadata.umdm.UnifiedMetaData;
/**
* A deployer service that manages WS4EE compliant Web-Services for EJB Endpoints
Modified:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/jboss42/DeployerInterceptorEJB21.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/jboss42/DeployerInterceptorEJB21.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/jboss42/DeployerInterceptorEJB21.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -34,7 +34,7 @@
import org.jboss.ws.deployment.JSR109Deployment;
import org.jboss.ws.deployment.JSR181Deployment;
import org.jboss.ws.deployment.UnifiedDeploymentInfo;
-import org.jboss.ws.metadata.UnifiedMetaData;
+import org.jboss.ws.metadata.umdm.UnifiedMetaData;
/**
* A deployer service that manages WS4EE compliant Web-Services for EJB-2.1 Endpoints
Modified:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/jboss42/DeployerInterceptorEJB3.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/jboss42/DeployerInterceptorEJB3.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/jboss42/DeployerInterceptorEJB3.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -40,9 +40,9 @@
import org.jboss.ws.WSException;
import org.jboss.ws.deployment.JSR181Deployment;
import org.jboss.ws.deployment.UnifiedDeploymentInfo;
-import org.jboss.ws.metadata.UnifiedMetaData;
import org.jboss.ws.metadata.j2ee.UnifiedApplicationMetaData;
import org.jboss.ws.metadata.j2ee.UnifiedBeanMetaData;
+import org.jboss.ws.metadata.umdm.UnifiedMetaData;
/**
* A deployer service that manages WS4EE compliant Web-Services for EJB3 Endpoints
Modified:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/jboss42/DeployerInterceptorJSE.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/jboss42/DeployerInterceptorJSE.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/jboss42/DeployerInterceptorJSE.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -36,10 +36,10 @@
import org.jboss.ws.deployment.ServiceEndpointPublisher;
import org.jboss.ws.deployment.UnifiedDeploymentInfo;
import org.jboss.ws.deployment.UnifiedDeploymentInfo.DeploymentType;
-import org.jboss.ws.metadata.EndpointMetaData;
-import org.jboss.ws.metadata.ServerEndpointMetaData;
-import org.jboss.ws.metadata.ServiceMetaData;
-import org.jboss.ws.metadata.UnifiedMetaData;
+import org.jboss.ws.metadata.umdm.EndpointMetaData;
+import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
+import org.jboss.ws.metadata.umdm.ServiceMetaData;
+import org.jboss.ws.metadata.umdm.UnifiedMetaData;
/**
* A deployer service that manages WS4EE compliant Web Services for WAR
Modified:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/jboss42/JBossServiceEndpointPublisher.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/jboss42/JBossServiceEndpointPublisher.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/jboss42/JBossServiceEndpointPublisher.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -36,10 +36,10 @@
import org.jboss.mx.util.MBeanServerLocator;
import org.jboss.ws.deployment.ServiceEndpointPublisher;
import org.jboss.ws.deployment.UnifiedDeploymentInfo;
-import org.jboss.ws.metadata.EndpointMetaData;
-import org.jboss.ws.metadata.ServerEndpointMetaData;
-import org.jboss.ws.metadata.ServiceMetaData;
-import org.jboss.ws.metadata.UnifiedMetaData;
+import org.jboss.ws.metadata.umdm.EndpointMetaData;
+import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
+import org.jboss.ws.metadata.umdm.ServiceMetaData;
+import org.jboss.ws.metadata.umdm.UnifiedMetaData;
/**
* Publish the HTTP service endpoint to Tomcat
Modified:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/jboss42/JBossServiceEndpointServlet.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/jboss42/JBossServiceEndpointServlet.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/jboss42/JBossServiceEndpointServlet.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -31,10 +31,10 @@
import org.jboss.ws.WSException;
import org.jboss.ws.core.server.ServiceEndpoint;
import org.jboss.ws.core.server.StandardEndpointServlet;
-import org.jboss.ws.metadata.HandlerMetaData;
-import org.jboss.ws.metadata.ServerEndpointMetaData;
-import org.jboss.ws.metadata.HandlerMetaData.HandlerType;
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;
/**
* A servlet that is installed for every web service endpoint.
Modified:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/jboss42/ServiceEndpointGeneratorEJB.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/jboss42/ServiceEndpointGeneratorEJB.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/jboss42/ServiceEndpointGeneratorEJB.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -38,10 +38,10 @@
import org.jboss.ws.WSException;
import org.jboss.ws.core.utils.DOMUtils;
import org.jboss.ws.core.utils.DOMWriter;
-import org.jboss.ws.metadata.EndpointMetaData;
-import org.jboss.ws.metadata.ServerEndpointMetaData;
-import org.jboss.ws.metadata.ServiceMetaData;
-import org.jboss.ws.metadata.UnifiedMetaData;
+import org.jboss.ws.metadata.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.w3c.dom.Element;
/**
Modified:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/jboss42/ServiceEndpointInterceptor.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/jboss42/ServiceEndpointInterceptor.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/jboss42/ServiceEndpointInterceptor.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -34,8 +34,8 @@
import org.jboss.ws.core.CommonMessageContext;
import org.jboss.ws.core.EndpointInvocation;
import org.jboss.ws.core.jaxrpc.SOAPFaultExceptionHelper;
-import org.jboss.ws.metadata.OperationMetaData;
-import org.jboss.ws.metadata.HandlerMetaData.HandlerType;
+import org.jboss.ws.metadata.umdm.OperationMetaData;
+import org.jboss.ws.metadata.umdm.HandlerMetaData.HandlerType;
/**
* This Interceptor does the ws4ee handler processing.
Modified:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/jboss42/ServiceEndpointInvokerEJB21.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/jboss42/ServiceEndpointInvokerEJB21.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/jboss42/ServiceEndpointInvokerEJB21.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -48,11 +48,11 @@
import org.jboss.ws.core.server.ServiceEndpointInvoker;
import org.jboss.ws.core.soap.MessageContextAssociation;
import org.jboss.ws.core.utils.ObjectNameFactory;
-import org.jboss.ws.metadata.ServerEndpointMetaData;
-import org.jboss.ws.metadata.EndpointMetaData.Type;
-import org.jboss.ws.metadata.HandlerMetaData.HandlerType;
import org.jboss.ws.metadata.j2ee.UnifiedApplicationMetaData;
import org.jboss.ws.metadata.j2ee.UnifiedBeanMetaData;
+import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
+import org.jboss.ws.metadata.umdm.EndpointMetaData.Type;
+import org.jboss.ws.metadata.umdm.HandlerMetaData.HandlerType;
/**
* Handles invocations on EJB2.1 endpoints.
Modified:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/jboss42/ServiceRefMetaDataAdaptor.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/jboss42/ServiceRefMetaDataAdaptor.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/jboss42/ServiceRefMetaDataAdaptor.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -32,10 +32,10 @@
import org.jboss.webservice.metadata.serviceref.InitParamMetaData;
import org.jboss.webservice.metadata.serviceref.PortComponentRefMetaData;
import org.jboss.webservice.metadata.serviceref.ServiceRefMetaData;
-import org.jboss.ws.metadata.HandlerMetaData.HandlerInitParam;
import org.jboss.ws.metadata.j2ee.UnifiedHandlerMetaData;
import org.jboss.ws.metadata.j2ee.UnifiedPortComponentRefMetaData;
import org.jboss.ws.metadata.j2ee.UnifiedServiceRefMetaData;
+import org.jboss.ws.metadata.umdm.HandlerMetaData.HandlerInitParam;
/**
* Build container independent service ref meta data
Modified:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/jboss42/WebServiceClientDeployer.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/jboss42/WebServiceClientDeployer.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/jboss42/WebServiceClientDeployer.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -43,7 +43,7 @@
import org.jboss.ws.metadata.j2ee.UnifiedServiceRefMetaData;
import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping;
import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMappingFactory;
-import org.jboss.ws.metadata.wsdl.WSDL11DefinitionFactory;
+import org.jboss.ws.tools.wsdl.WSDL11DefinitionFactory;
/**
* Binds a JAXRPC Service object in the client's ENC for every service-ref element in
the
Modified:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/jboss42/jms/JMSMessageDispatcher.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/jboss42/jms/JMSMessageDispatcher.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/jboss42/jms/JMSMessageDispatcher.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -43,7 +43,7 @@
import org.jboss.ws.core.server.ServiceEndpointManagerFactory;
import org.jboss.ws.core.soap.MessageContextAssociation;
import org.jboss.ws.integration.jboss42.ServiceEndpointInvokerMDB;
-import org.jboss.ws.metadata.ServerEndpointMetaData;
+import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
/**
* A dispatcher for SOAPMessages
Modified:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/tomcat/TomcatServiceEndpointPublisher.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/tomcat/TomcatServiceEndpointPublisher.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/integration/tomcat/TomcatServiceEndpointPublisher.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -39,10 +39,10 @@
import org.jboss.ws.core.utils.JBossWSEntityResolver;
import org.jboss.ws.deployment.ServiceEndpointPublisher;
import org.jboss.ws.deployment.UnifiedDeploymentInfo;
-import org.jboss.ws.metadata.jsr109.PortComponentMetaData;
-import org.jboss.ws.metadata.jsr109.WebserviceDescriptionMetaData;
-import org.jboss.ws.metadata.jsr109.WebservicesFactory;
-import org.jboss.ws.metadata.jsr109.WebservicesMetaData;
+import org.jboss.ws.metadata.webservices.PortComponentMetaData;
+import org.jboss.ws.metadata.webservices.WebserviceDescriptionMetaData;
+import org.jboss.ws.metadata.webservices.WebservicesFactory;
+import org.jboss.ws.metadata.webservices.WebservicesMetaData;
import org.jboss.xb.binding.ObjectModelFactory;
import org.jboss.xb.binding.Unmarshaller;
import org.jboss.xb.binding.UnmarshallerFactory;
Deleted:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/ClientEndpointMetaData.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/ClientEndpointMetaData.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/ClientEndpointMetaData.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -1,154 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.ws.metadata;
-
-// $Id$
-
-import java.net.MalformedURLException;
-import java.net.URL;
-
-import javax.xml.namespace.QName;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.WSException;
-import org.jboss.ws.metadata.HandlerMetaData.HandlerType;
-import org.jboss.ws.metadata.config.WSConfigFactory;
-import org.jboss.ws.metadata.config.jaxrpc.WSConfigRootJAXRPC;
-
-/**
- * Client side endpoint meta data.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 12-May-2005
- */
-public class ClientEndpointMetaData extends EndpointMetaData
-{
- // provide logging
- private static Logger log = Logger.getLogger(ClientEndpointMetaData.class);
-
- public ClientEndpointMetaData(ServiceMetaData service, QName portName, Type type)
- {
- super(service, portName, type);
- }
-
- public void setConfigName(String configName)
- {
- super.setConfigName(configName);
- endpointConfig = null;
- }
-
- public void setConfigFile(String configFile)
- {
- super.setConfigFile(configFile);
- endpointConfig = null;
- }
-
- @Override
- public Object getEndpointConfig()
- {
- if (endpointConfig == null)
- {
- String configName = getConfigName();
- if (configName == null)
- {
- configName = "Standard Client";
- setConfigName(configName);
- }
-
- String configFile = getConfigFile();
- if (configFile == null)
- {
- configFile = "META-INF/standard-jaxrpc-client-config.xml";
- setConfigFile(configFile);
- }
-
- log.debug("getClientConfig: [name=" + configName + ",url=" +
configFile + "]");
-
- URL configURL = null;
- try
- {
- configURL = new URL(configFile);
- }
- catch (MalformedURLException ex)
- {
- // ignore
- }
-
- // Try to get the URL as resource
- if (configURL == null)
- {
- ClassLoader cl = Thread.currentThread().getContextClassLoader();
- configURL = cl.getResource(configFile);
- if (configURL == null)
- throw new WSException("Cannot get resource: " + configFile);
- }
-
- // Get the config root
- Object wsConfig;
- try
- {
- WSConfigFactory factory = WSConfigFactory.newInstance();
- wsConfig = factory.parseWithObjectModelFactory(configURL);
- }
- catch (RuntimeException rte)
- {
- throw rte;
- }
- catch (Exception ex)
- {
- throw new WSException("Cannot parse client config", ex);
- }
-
- // Get the client config
- endpointConfig =
((WSConfigRootJAXRPC)wsConfig).getClientConfigByName(configName);
- if (endpointConfig == null)
- throw new WSException("Cannot obtain client config: " +
configName);
- }
-
- return endpointConfig;
- }
-
- public String toString()
- {
- StringBuilder buffer = new StringBuilder("\nClientEndpointMetaData:");
- buffer.append("\n type=" + getType());
- buffer.append("\n qname=" + getQName());
- buffer.append("\n address=" + getEndpointAddress());
- buffer.append("\n binding=" + getBindingId());
- buffer.append("\n seiName=" + getServiceEndpointInterfaceName());
- buffer.append("\n configFile=" + getConfigFile());
- buffer.append("\n configName=" + getConfigName());
- buffer.append("\n authMethod=" + getAuthMethod());
- buffer.append("\n transportGuarantee=" + getTransportGuarantee());
- buffer.append("\n properties=" + getProperties());
-
- for (OperationMetaData opMetaData : getOperations())
- {
- buffer.append("\n" + opMetaData);
- }
- for (HandlerMetaData hdlMetaData : getHandlerMetaData(HandlerType.ALL))
- {
- buffer.append("\n" + hdlMetaData);
- }
- return buffer.toString();
- }
-}
Deleted:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/EndpointMetaData.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/EndpointMetaData.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/EndpointMetaData.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -1,485 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.ws.metadata;
-
-// $Id$
-
-import java.lang.reflect.Method;
-import java.net.URLClassLoader;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-
-import javax.jws.soap.SOAPBinding.ParameterStyle;
-import javax.xml.namespace.QName;
-import javax.xml.rpc.ParameterMode;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.WSException;
-import org.jboss.ws.core.CommonSOAPBinding;
-import org.jboss.ws.core.jaxrpc.Style;
-import org.jboss.ws.core.jaxrpc.Use;
-import org.jboss.ws.metadata.HandlerMetaData.HandlerType;
-import org.jboss.ws.metadata.config.WSCommonConfig;
-
-/**
- * A Service component describes a set of endpoints.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 12-May-2005
- */
-public abstract class EndpointMetaData extends ExtensibleMetaData
-{
- // provide logging
- private static Logger log = Logger.getLogger(EndpointMetaData.class);
-
- public enum Type
- {
- JAXRPC, JAXWS
- }
-
- // The parent meta data.
- private ServiceMetaData serviceMetaData;
-
- // The REQUIRED endpoint config
- protected WSCommonConfig endpointConfig;
-
- // The REQUIRED name
- private QName portName;
- // The REQUIRED binding id
- private String bindingId;
- // The REQUIRED config-name
- private String configName;
- // The REQUIRED config-file
- private String configFile;
- // The endpoint address
- private String endpointAddress;
- // The endpoint interface name
- private String seiName;
- // The endpoint interface
- private Class seiClass;
- // The optional authentication method
- private String authMethod;
- // The optional transport guarantee
- private String transportGuarantee;
- // Arbitrary properties given by <call-property>
- private Properties properties;
- // The SOAPBinding style
- private Style style;
- // The SOAPBinding use
- private Use use;
- // The SOAPBinding parameter style
- private ParameterStyle parameterStyle;
- // Whether the endpoint was deployed from annotations
- private Type type;
- // The list of service meta data
- private List<OperationMetaData> operations = new
ArrayList<OperationMetaData>();
- // The optional handlers
- private List<HandlerMetaData> handlers = new
ArrayList<HandlerMetaData>();
- // True if the handlers are initialized
- private boolean handlersInitialized;
- // Maps the java method to the operation meta data
- private Map<Method, OperationMetaData> opMetaDataCache = new HashMap<Method,
OperationMetaData>();
-
- public EndpointMetaData(ServiceMetaData service, QName portName, Type type)
- {
- this.serviceMetaData = service;
- this.portName = portName;
- this.type = type;
-
- // The default binding
- this.bindingId = CommonSOAPBinding.SOAP11HTTP_BINDING;
- }
-
- public ServiceMetaData getServiceMetaData()
- {
- return serviceMetaData;
- }
-
- public QName getQName()
- {
- return portName;
- }
-
- public String getConfigFile()
- {
- return configFile;
- }
-
- public void setConfigFile(String configFile)
- {
- this.configFile = configFile;
- this.endpointConfig = null;
- }
-
- public String getConfigName()
- {
- return configName;
- }
-
- public void setConfigName(String configName)
- {
- this.configName = configName;
- this.endpointConfig = null;
- }
-
- public abstract Object getEndpointConfig();
-
- public String getEndpointAddress()
- {
- return endpointAddress;
- }
-
- public void setEndpointAddress(String endpointAddress)
- {
- this.endpointAddress = endpointAddress;
- }
-
- public String getBindingId()
- {
- return bindingId;
- }
-
- public void setBindingId(String bindingId)
- {
- if (!CommonSOAPBinding.SOAP11HTTP_BINDING.equals(bindingId) &&
!CommonSOAPBinding.SOAP12HTTP_BINDING.equals(bindingId))
- throw new WSException("Unsupported binding: " + bindingId);
- this.bindingId = bindingId;
- }
-
- public String getServiceEndpointInterfaceName()
- {
- return seiName;
- }
-
- public void setServiceEndpointInterfaceName(String seiName)
- {
- this.seiName = seiName;
- this.seiClass = null;
-
- UnifiedMetaData wsMetaData = serviceMetaData.getUnifiedMetaData();
- if (wsMetaData.isEagerInitialized())
- {
- if (UnifiedMetaData.isFinalRelease() == false)
- log.warn("Set SEI name after eager initialization", new
IllegalStateException());
-
- // reinitialize
- initializeInternal();
- }
- }
-
- /** Get the class loader associated with the endpoint meta data */
- public ClassLoader getClassLoader()
- {
- ClassLoader classLoader =
getServiceMetaData().getUnifiedMetaData().getClassLoader();
- return classLoader;
- }
-
- /** Get the resource loader associated with the endpoint meta data */
- public URLClassLoader getResourceLoader()
- {
- URLClassLoader classLoader =
getServiceMetaData().getUnifiedMetaData().getResourceLoader();
- return classLoader;
- }
-
- /**
- * Load the service endpoint interface.
- * It should only be cached during eager initialization.
- */
- public Class getServiceEndpointInterface()
- {
- Class tmpClass = seiClass;
- if (tmpClass == null && seiName != null)
- {
- try
- {
- ClassLoader classLoader = getClassLoader();
- tmpClass = classLoader.loadClass(seiName);
- if (serviceMetaData.getUnifiedMetaData().isEagerInitialized())
- {
- log.warn("Loading SEI after eager initialization");
- seiClass = tmpClass;
- }
- }
- catch (ClassNotFoundException ex)
- {
- throw new WSException("Cannot load service endpoint interface: " +
seiName, ex);
- }
- }
- return tmpClass;
- }
-
- public Use getEncodingStyle()
- {
- if (use == null)
- {
- use = Use.getDefaultUse();
- log.debug("Using default encoding style: " + use);
- }
- return use;
- }
-
- public void setEncodingStyle(Use value)
- {
- if (value != null && use != null && !use.equals(value))
- throw new WSException("Mixed encoding styles not supported");
-
- log.trace("setEncodingStyle: " + value);
- this.use = value;
- }
-
- public Style getStyle()
- {
- if (style == null)
- {
- style = Style.getDefaultStyle();
- log.debug("Using default style: " + style);
- }
- return style;
- }
-
- public void setStyle(Style value)
- {
- if (value != null && style != null && !style.equals(value))
- throw new WSException("Mixed styles not supported");
-
- log.trace("setStyle: " + value);
- this.style = value;
- }
-
- public ParameterStyle getParameterStyle()
- {
- if (parameterStyle == null)
- {
- parameterStyle = ParameterStyle.WRAPPED;
- log.debug("Using default parameter style: " + parameterStyle);
- }
- return parameterStyle;
- }
-
- public void setParameterStyle(ParameterStyle value)
- {
- if (value != null && parameterStyle != null &&
!parameterStyle.equals(value))
- throw new WSException("Mixed SOAP parameter styles not supported");
-
- log.debug("setParameterStyle: " + value);
- this.parameterStyle = value;
- }
-
- public Type getType()
- {
- return type;
- }
-
- public String getAuthMethod()
- {
- return authMethod;
- }
-
- public void setAuthMethod(String authMethod)
- {
- this.authMethod = authMethod;
- }
-
- public String getTransportGuarantee()
- {
- return transportGuarantee;
- }
-
- public void setTransportGuarantee(String transportGuarantee)
- {
- this.transportGuarantee = transportGuarantee;
- }
-
- public Properties getProperties()
- {
- return properties;
- }
-
- public void setProperties(Properties properties)
- {
- this.properties = properties;
- }
-
- public List<OperationMetaData> getOperations()
- {
- return new ArrayList<OperationMetaData>(operations);
- }
-
- public OperationMetaData getOperation(QName xmlName)
- {
- OperationMetaData opMetaData = null;
- for (OperationMetaData auxOperation : operations)
- {
- QName opQName = auxOperation.getQName();
- if (opQName.equals(xmlName))
- {
- if (opMetaData == null)
- {
- opMetaData = auxOperation;
- }
- else
- {
- throw new WSException("Cannot uniquely indetify operation: " +
xmlName);
- }
- }
- }
-
- if (opMetaData == null && getStyle() == Style.DOCUMENT)
- {
- for (OperationMetaData auxOperation : operations)
- {
- ParameterMetaData paramMetaData = null;
- for (ParameterMetaData auxParam : auxOperation.getParameters())
- {
- ParameterMode mode = auxParam.getMode();
- if (auxParam.isInHeader() == false && mode == ParameterMode.IN)
- {
- paramMetaData = auxParam;
- break;
- }
- }
- if (paramMetaData != null &&
paramMetaData.getXmlName().equals(xmlName))
- {
- if (opMetaData == null)
- {
- opMetaData = auxOperation;
- }
- else
- {
- throw new WSException("Cannot uniquely indetify operation: "
+ xmlName);
- }
- }
- }
- }
-
- return opMetaData;
- }
-
- public OperationMetaData getOperation(Method method)
- {
- if (opMetaDataCache.size() == 0)
- {
- // This can happen when the SEI mapping was not found
- log.warn("Access to empty operation meta data cache,
reinitializing");
- initializeInternal();
- }
- OperationMetaData opMetaData = opMetaDataCache.get(method);
- return opMetaData;
- }
-
- public void addOperation(OperationMetaData opMetaData)
- {
- operations.add(opMetaData);
- }
-
- public void clearOperations()
- {
- operations.clear();
- }
-
- public void addHandlers(List<HandlerMetaData> configHandlers)
- {
- handlers.addAll(configHandlers);
- }
-
- public void addHandler(HandlerMetaData handler)
- {
- handlers.add(handler);
- }
-
- public void clearHandlers()
- {
- handlers.clear();
- handlersInitialized = false;
- }
-
- public List<HandlerMetaData> getHandlerMetaData(HandlerType type)
- {
- List<HandlerMetaData> typeHandlers = new ArrayList<HandlerMetaData>();
- for (HandlerMetaData hmd : handlers)
- {
- if (hmd.getHandlerType() == type || type == HandlerType.ALL)
- typeHandlers.add(hmd);
- }
- return typeHandlers;
- }
-
- public boolean isHandlersInitialized()
- {
- return handlersInitialized;
- }
-
- public void setHandlersInitialized(boolean flag)
- {
- this.handlersInitialized = flag;
- }
-
- public void validate()
- {
- for (HandlerMetaData handler : handlers)
- handler.validate();
-
- for (OperationMetaData opMetaData : operations)
- opMetaData.validate();
- }
-
- /**
- * @see UnifiedMetaData#eagerInitialize()
- */
- public void eagerInitialize()
- {
- initializeInternal();
- }
-
- private void initializeInternal()
- {
- // reset sei class
- seiClass = null;
-
- // Initialize handlers
- for (HandlerMetaData handler : handlers)
- handler.eagerInitialize();
-
- // Initialize operations
- seiClass = getServiceEndpointInterface();
- if (seiClass != null)
- {
- List<Method> unsynchronizedMethods = new ArrayList<Method>();
- unsynchronizedMethods.addAll(Arrays.asList(seiClass.getMethods()));
-
- for (OperationMetaData opMetaData : operations)
- {
- opMetaData.eagerInitialize(unsynchronizedMethods);
- Method method = opMetaData.getJavaMethod();
- if (method != null)
- {
- opMetaDataCache.put(method, opMetaData);
- unsynchronizedMethods.remove(method);
- }
- }
- }
- }
-}
Deleted:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/ExtensibleMetaData.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/ExtensibleMetaData.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/ExtensibleMetaData.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -1,28 +0,0 @@
-package org.jboss.ws.metadata;
-
-import java.util.Map;
-import java.util.HashMap;
-
-/**
- * Base class for UMD elements that are extensible.
- *
- * @author Heiko Braun, <heiko(a)openj.net>
- * @since 21-Mar-2006
- */
-public abstract class ExtensibleMetaData {
-
- private Map<String, MetaDataExtension> extensions = new HashMap<String,
MetaDataExtension>();
-
- public Map<String, MetaDataExtension> getExtensions() {
- return extensions;
- }
-
- public void addExtension(MetaDataExtension ext) {
- getExtensions().put(ext.getExtensionNameSpace(), ext);
- }
-
- public MetaDataExtension getExtension(String namespace) {
- return getExtensions().get(namespace);
- }
-
-}
Deleted:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/FaultMetaData.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/FaultMetaData.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/FaultMetaData.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -1,134 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
-*/
-package org.jboss.ws.metadata;
-
-// $Id$
-
-import javax.xml.namespace.QName;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.WSException;
-import org.jboss.ws.core.utils.JavaUtils;
-
-/**
- * A Fault component describes a fault that a given operation supports.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @author jason.greene(a)jboss.com
- * @since 12-May-2005
- */
-public class FaultMetaData
-{
- // provide logging
- private final Logger log = Logger.getLogger(FaultMetaData.class);
-
- // The parent operation
- private OperationMetaData opMetaData;
-
- private QName xmlName;
- private QName xmlType;
- private String javaTypeName;
- private Class javaType;
-
- public FaultMetaData(OperationMetaData operation, QName xmlName, QName xmlType, String
javaTypeName)
- {
- if (xmlName == null)
- throw new IllegalArgumentException("Invalid null xmlName argument");
- if (xmlType == null)
- throw new IllegalArgumentException("Invalid null xmlType argument, for:
" + xmlName);
- if (javaTypeName == null)
- throw new IllegalArgumentException("Invalid null javaTypeName argument,
for: " + xmlName);
-
- this.opMetaData = operation;
- this.xmlName = xmlName;
- this.xmlType = xmlType;
- this.javaTypeName = javaTypeName;
- }
-
- public OperationMetaData getOperationMetaData()
- {
- return opMetaData;
- }
-
- public QName getXmlName()
- {
- return xmlName;
- }
-
- public QName getXmlType()
- {
- return xmlType;
- }
-
- public String getJavaTypeName()
- {
- return javaTypeName;
- }
-
- /** Load the java type.
- * It should only be cached during eager initialization.
- */
- public Class getJavaType()
- {
- Class tmpJavaType = javaType;
- if (tmpJavaType == null && javaTypeName != null)
- {
- try
- {
- ClassLoader loader = opMetaData.getEndpointMetaData().getClassLoader();
- tmpJavaType = JavaUtils.loadJavaType(javaTypeName, loader);
-
- if
(opMetaData.getEndpointMetaData().getServiceMetaData().getUnifiedMetaData().isEagerInitialized())
- {
- log.warn("Loading java type after eager initialization");
- javaType = tmpJavaType;
- }
- }
- catch (ClassNotFoundException ex)
- {
- throw new WSException("Cannot load java type: " + javaTypeName,
ex);
- }
- }
- return tmpJavaType;
- }
-
- public void validate()
- {
- // nothing to do
- }
-
- public void eagerInitialize()
- {
- javaType = getJavaType();
- if (javaType == null)
- throw new WSException("Cannot load java type: " + javaTypeName);
- }
-
- public String toString()
- {
- StringBuilder buffer = new StringBuilder("\nFaultMetaData");
- buffer.append("\n xmlName=" + xmlName);
- buffer.append("\n xmlType=" + xmlType);
- buffer.append("\n javaType=" + javaTypeName);
- return buffer.toString();
- }
-}
\ No newline at end of file
Deleted:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/HandlerMetaData.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/HandlerMetaData.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/HandlerMetaData.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -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.metadata;
-
-// $Id:HandlerMetaData.java 915 2006-09-08 08:40:45Z thomas.diesler(a)jboss.com $
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import javax.xml.namespace.QName;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.WSException;
-import org.jboss.ws.extensions.security.jaxrpc.WSSecurityHandlerInbound;
-import org.jboss.ws.extensions.security.jaxrpc.WSSecurityHandlerOutbound;
-
-/**
- * The common metdata data for a handler element
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 05-May-2006
- */
-public abstract class HandlerMetaData implements Serializable
-{
- // provide logging
- private static final Logger log = Logger.getLogger(HandlerMetaData.class);
-
- public enum HandlerType
- {
- PRE, ENDPOINT, POST, ALL
- };
-
- private transient EndpointMetaData epMetaData;
-
- // The required <handler-name> element
- private String handlerName;
- // The required <handler-class> element
- private String handlerClassName;
- // The required handler type
- private HandlerType handlerType;
- // The optional <soap-header> elements
- private Set<QName> soapHeaders = new HashSet<QName>();
- // The optional <init-param> elements
- private List<HandlerInitParam> initParams = new
ArrayList<HandlerInitParam>();
- // The cached handler class
- private Class handlerClass;
-
- public HandlerMetaData(EndpointMetaData epMetaData, HandlerType type)
- {
- this.epMetaData = epMetaData;
- this.handlerType = type;
- }
-
- public void setEndpointMetaData(EndpointMetaData epMetaData)
- {
- this.epMetaData = epMetaData;
- }
-
- public EndpointMetaData getEndpointMetaData()
- {
- return epMetaData;
- }
-
- public void setHandlerName(String value)
- {
- this.handlerName = value;
- }
-
- public String getHandlerName()
- {
- return handlerName;
- }
-
- public void setHandlerClassName(String handlerClassName)
- {
- this.handlerClassName = handlerClassName;
- }
-
- public String getHandlerClassName()
- {
- return handlerClassName;
- }
-
- public Class getHandlerClass()
- {
- if (handlerClassName == null)
- throw new IllegalStateException("Handler class name cannot be null");
-
- Class localClass = handlerClass;
- if (localClass == null)
- {
- try
- {
- ClassLoader loader = epMetaData.getClassLoader();
- localClass = loader.loadClass(handlerClassName);
- }
- catch (ClassNotFoundException ex)
- {
- throw new WSException("Cannot load handler: " + handlerClassName,
ex);
- }
- }
- return localClass;
- }
-
- public HandlerType getHandlerType()
- {
- return handlerType;
- }
-
- public void setSoapHeaders(Set<QName> soapHeaders)
- {
- this.soapHeaders = soapHeaders;
- }
-
- public Set<QName> getSoapHeaders()
- {
- return soapHeaders;
- }
-
- public void seiInitParams(List<HandlerInitParam> initParams)
- {
- this.initParams = initParams;
- }
-
- public List<HandlerInitParam> getInitParams()
- {
- return initParams;
- }
-
- public void validate()
- {
- List<String> securityHandlers = new ArrayList<String>();
- securityHandlers.add(WSSecurityHandlerInbound.class.getName());
- securityHandlers.add(WSSecurityHandlerOutbound.class.getName());
-
- if (securityHandlers.contains(handlerClassName))
- {
- if (epMetaData.getServiceMetaData().getSecurityConfiguration() == null)
- log.warn("WS-Security requires security configuration");
- }
- }
-
- public void eagerInitialize()
- {
- handlerClass = getHandlerClass();
- }
-
- public static class HandlerInitParam implements Serializable
- {
- private static final long serialVersionUID = -8687875291620457318L;
-
- // The required <handler-name> element
- private String paramName;
- // The required <handler-class> element
- private String paramValue;
-
- public String getParamName()
- {
- return paramName;
- }
-
- public void setParamName(String paramName)
- {
- this.paramName = paramName;
- }
-
- public String getParamValue()
- {
- return paramValue;
- }
-
- public void setParamValue(String paramValue)
- {
- this.paramValue = paramValue;
- }
-
- public String toString()
- {
- return "[name=" + paramName + ",value=" + paramValue +
"]";
- }
- }
-}
Deleted:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/HandlerMetaDataJAXRPC.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/HandlerMetaDataJAXRPC.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/HandlerMetaDataJAXRPC.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -1,83 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.ws.metadata;
-
-//$Id:HandlerMetaDataJAXRPC.java 915 2006-09-08 08:40:45Z thomas.diesler(a)jboss.com $
-
-import java.util.HashSet;
-import java.util.Set;
-
-import javax.xml.namespace.QName;
-
-/**
- * The JAXRPC metdata data for a handler element
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 05-May-2006
- */
-public class HandlerMetaDataJAXRPC extends HandlerMetaData
-{
- private static final long serialVersionUID = -5232305815202943509L;
-
- // The optional <soap-role> elements
- private Set<String> soapRoles = new HashSet<String>();
- // The optional <port-name> elements
- private Set<String> portNames = new HashSet<String>();
-
- public HandlerMetaDataJAXRPC(EndpointMetaData epMetaData, HandlerType type)
- {
- super(epMetaData, type);
- }
-
- public void setSoapRoles(Set<String> soapRoles)
- {
- this.soapRoles = soapRoles;
- }
-
- public Set<String> getSoapRoles()
- {
- return soapRoles;
- }
-
- public void setPortNames(Set<String> portNames)
- {
- this.portNames = portNames;
- }
-
- public Set<String> getPortNames()
- {
- return portNames;
- }
-
- public String toString()
- {
- StringBuffer buffer = new StringBuffer("\nHandlerMetaDataJAXRPC:");
- buffer.append("\n type=" + getHandlerType());
- buffer.append("\n name=" + getHandlerName());
- buffer.append("\n class=" + getHandlerClassName());
- buffer.append("\n params=" + getInitParams());
- buffer.append("\n headers=" + getSoapHeaders());
- buffer.append("\n roles=" + getSoapRoles());
- buffer.append("\n ports=" + getPortNames());
- return buffer.toString();
- }
-}
Deleted:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/MetaDataExtension.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/MetaDataExtension.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/MetaDataExtension.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -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.metadata;
-
-// $Id$
-
-/**
- * Operation metaData extension.
- *
- * @author Heiko Braun, <heiko(a)openj.net>
- * @since 17-Mar-2006
- */
-public abstract class MetaDataExtension
-{
- private String extensionNameSpace;
-
- public MetaDataExtension(String extensionNameSpace)
- {
- this.extensionNameSpace = extensionNameSpace;
- }
-
- public String getExtensionNameSpace()
- {
- return extensionNameSpace;
- }
-}
Deleted:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/OperationMetaData.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/OperationMetaData.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/OperationMetaData.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -1,600 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.ws.metadata;
-
-// $Id$
-
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.jws.soap.SOAPBinding.ParameterStyle;
-import javax.xml.namespace.QName;
-import javax.xml.rpc.ParameterMode;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.WSException;
-import org.jboss.ws.core.jaxrpc.ParameterWrapping;
-import org.jboss.ws.core.jaxrpc.Style;
-import org.jboss.ws.core.jaxrpc.TypeMappingImpl;
-import org.jboss.ws.core.jaxrpc.Use;
-import org.jboss.ws.core.utils.HolderUtils;
-import org.jboss.ws.core.utils.JavaUtils;
-import org.jboss.ws.metadata.EndpointMetaData.Type;
-import org.w3c.dom.Element;
-
-/**
- * An Operation component describes an operation that a given interface supports.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @author <a href="mailto:jason.greene@jboss.com">Jason T.
Greene</a>
- * @since 12-May-2004
- */
-public class OperationMetaData extends ExtensibleMetaData
-{
- // provide logging
- private final Logger log = Logger.getLogger(OperationMetaData.class);
-
- // The parent interface
- private EndpointMetaData epMetaData;
-
- private QName qname;
- private QName responseName;
- private String javaName;
- private Method javaMethod;
- private boolean oneWay;
- private String soapAction;
- private List<ParameterMetaData> parameters = new
ArrayList<ParameterMetaData>();
- private List<FaultMetaData> faults = new ArrayList<FaultMetaData>();
- private ParameterMetaData returnParam;
-
- public OperationMetaData(QName qname, String javaName)
- {
- UnifiedMetaData umd = new UnifiedMetaData();
- ServiceMetaData smd = new ServiceMetaData(umd, new
QName("mock-service"));
- ServerEndpointMetaData epmd = new ServerEndpointMetaData(smd, new
QName("mock-endpoint"), Type.JAXRPC);
- initOperationMetaData(epmd, qname, javaName);
- }
-
- public OperationMetaData(EndpointMetaData epMetaData, QName qname, String javaName)
- {
- log.trace("new OperationMetaData: [xmlName=" + qname +
",javaName=" + javaName + "]");
- initOperationMetaData(epMetaData, qname, javaName);
- }
-
- private void initOperationMetaData(EndpointMetaData epMetaData, QName qname, String
javaName)
- {
- this.epMetaData = epMetaData;
- this.qname = qname;
- this.javaName = javaName;
-
- if (qname == null)
- throw new IllegalArgumentException("Invalid null qname argument");
- if (javaName == null)
- throw new IllegalArgumentException("Invalid null javaName argument, for:
" + qname);
-
- String nsURI = qname.getNamespaceURI();
- String localPart = qname.getLocalPart();
- this.responseName = new QName(nsURI, localPart + "Response");
- }
-
- public EndpointMetaData getEndpointMetaData()
- {
- return epMetaData;
- }
-
- public QName getQName()
- {
- return qname;
- }
-
- public QName getResponseName()
- {
- return responseName;
- }
-
- public String getSOAPAction()
- {
- return soapAction;
- }
-
- public void setSOAPAction(String soapAction)
- {
- this.soapAction = soapAction;
- }
-
- public Style getStyle()
- {
- return epMetaData.getStyle();
- }
-
- public Use getUse()
- {
- return epMetaData.getEncodingStyle();
- }
-
- public ParameterStyle getParameterStyle()
- {
- return epMetaData.getParameterStyle();
- }
-
- public boolean isRPCLiteral()
- {
- return getStyle() == Style.RPC && getUse() == Use.LITERAL;
- }
-
- public boolean isRPCEncoded()
- {
- return getStyle() == Style.RPC && getUse() == Use.ENCODED;
- }
-
- public boolean isDocumentBare()
- {
- return getStyle() == Style.DOCUMENT && getParameterStyle() ==
ParameterStyle.BARE;
- }
-
- public boolean isDocumentWrapped()
- {
- return getStyle() == Style.DOCUMENT && getParameterStyle() ==
ParameterStyle.WRAPPED;
- }
-
- public String getJavaName()
- {
- return javaName;
- }
-
- public Method getJavaMethod()
- {
- Method tmpMethod = javaMethod;
- Class seiClass = epMetaData.getServiceEndpointInterface();
- if (tmpMethod == null && seiClass != null)
- {
- for (Method method : seiClass.getMethods())
- {
- if (isJavaMethod(method))
- {
- tmpMethod = method;
-
- UnifiedMetaData wsMetaData =
epMetaData.getServiceMetaData().getUnifiedMetaData();
- if (wsMetaData.isEagerInitialized())
- {
- if (UnifiedMetaData.isFinalRelease() == false)
- log.warn("Loading java method after eager initialization",
new IllegalStateException());
-
- javaMethod = method;
- }
-
- break;
- }
- }
-
- if (tmpMethod == null)
- throw new WSException("Cannot find java method: " + javaName);
- }
- return tmpMethod;
- }
-
- public boolean isJavaMethod(Method method)
- {
- boolean isJavaMethod = method.equals(javaMethod);
- if (isJavaMethod == false)
- {
- String methodName = method.getName();
- Class[] methodTypes = method.getParameterTypes();
- Class returnType = method.getReturnType();
-
- if (javaName.equals(methodName))
- {
- log.trace("Found java method: " + method);
-
- // match document/literal/wrapped
- if (isDocumentWrapped())
- {
- if (ParameterWrapping.matchRequestParameters(this, methodTypes) &&
ParameterWrapping.matchResponseParameters(this, returnType))
- {
- log.debug("Found wrapped java method: " + method);
- isJavaMethod = true;
- }
- }
- else
- {
- // Match the return parameter
- ParameterMetaData returnMetaData = getReturnParameter();
- if (returnMetaData != null)
- {
- if (!matchParameter(returnMetaData, returnType, true) &&
!matchParameter(returnMetaData, returnType, false))
- {
- log.debug("Unmatched return meta data: " + returnType);
- }
- }
- else
- {
- if (returnType != void.class)
- {
- log.debug("Unmatched return meta data: " + returnType);
- }
- }
-
- // compare params by java type name
- if (compareMethodParams(methodTypes, true))
- {
- log.debug("Found best matching java method: " + method);
- isJavaMethod = true;
- }
-
- // compare params by assignability
- else if (compareMethodParams(methodTypes, false))
- {
- log.debug("Found possible matching java method: " + method);
- isJavaMethod = true;
- }
- }
- }
- }
-
- if (log.isTraceEnabled())
- log.trace("Synchronized java method:\n" + method + "\nwith:
" + toString());
-
- return isJavaMethod;
- }
-
- /** Return true if this is a generic message style destination that takes a
org.w3c.dom.Element
- */
- public boolean isMessageEndpoint()
- {
- boolean isMessageEndpoint = false;
- if (parameters.size() == 1)
- {
- ParameterMetaData inParam = parameters.get(0);
- if (JavaUtils.isAssignableFrom(Element.class, inParam.getJavaType()))
- {
- isMessageEndpoint = true;
- }
- }
- return isMessageEndpoint;
- }
-
- private boolean compareMethodParams(Class[] methodParams, boolean matchByTypeName)
- {
- log.trace("Compare method params by type name: " + matchByTypeName);
-
- boolean pass = (parameters.size() == methodParams.length);
- if (pass == false)
- log.trace("Unmatched parameter count: " + parameters.size() +
"!=" + methodParams.length);
-
- for (int i = 0; pass && i < methodParams.length; i++)
- {
- ParameterMetaData paramMetaData = parameters.get(i);
- pass = matchParameter(paramMetaData, methodParams[i], matchByTypeName);
- }
- return pass;
- }
-
- private boolean matchParameter(ParameterMetaData paramMetaData, Class methodParam,
boolean matchByTypeName)
- {
- QName xmlType = paramMetaData.getXmlType();
- String javaType = paramMetaData.getJavaTypeName();
-
- boolean pass = true;
- if (paramMetaData != returnParam && paramMetaData.getMode() !=
ParameterMode.IN)
- {
- if (HolderUtils.isHolderType(methodParam))
- {
- methodParam = HolderUtils.getValueType(methodParam);
- }
- else
- {
- pass = false;
- }
- }
-
- if (pass == true)
- {
- // In case the parameter java type has not been initialized
- // This happens when the UMDM is build from WSDL only (i.e. JAXWS Service)
- TypeMappingImpl typeMapping = epMetaData.getServiceMetaData().getTypeMapping();
- if (javaType == null)
- {
- javaType = methodParam.getName();
- paramMetaData.setJavaTypeName(javaType);
- log.debug("Set parameter java type from method param: " +
javaType);
- }
-
- if (matchByTypeName)
- {
- pass = methodParam.getName().equals(javaType);
- }
- else
- {
- String paramTypeName = methodParam.getName();
- Class paramType = paramMetaData.getJavaType();
- pass = JavaUtils.isAssignableFrom(methodParam, paramType);
-
- if (typeMapping.isRegistered(methodParam, xmlType))
- {
- log.debug("Adjust parameter type from " + paramType.getName() +
" to " + paramTypeName);
- paramMetaData.setJavaTypeName(paramTypeName);
- pass = true;
- }
- }
- }
-
- String name = (matchByTypeName) ? paramMetaData.getJavaTypeName() :
paramMetaData.getJavaType().getName();
- log.trace((pass ? "Matched" : "Unmatched") + " parameter:
" + name + " == " + methodParam.getName());
- return pass;
- }
-
- public boolean isOneWayOperation()
- {
- return oneWay;
- }
-
- public void setOneWayOperation(boolean oneWayOperation)
- {
- this.oneWay = oneWayOperation;
- assertOneWayOperation();
- }
-
- public ParameterMetaData getParameter(QName xmlName)
- {
- ParameterMetaData paramMetaData = null;
- for (int i = 0; paramMetaData == null && i < parameters.size(); i++)
- {
- ParameterMetaData aux = parameters.get(i);
- if (xmlName.equals(aux.getXmlName()))
- paramMetaData = aux;
- }
- return paramMetaData;
- }
-
- /** Get the IN or INOUT parameter list */
- public List<ParameterMetaData> getInputParameters()
- {
- List<ParameterMetaData> retList = new ArrayList<ParameterMetaData>();
- for (ParameterMetaData paramMetaData : parameters)
- {
- ParameterMode mode = paramMetaData.getMode();
- if (mode == ParameterMode.IN || mode == ParameterMode.INOUT)
- retList.add(paramMetaData);
- }
- return retList;
- }
-
- /** Get the OUT or INOUT parameter list */
- public List<ParameterMetaData> getOutputParameters()
- {
- List<ParameterMetaData> retList = new ArrayList<ParameterMetaData>();
- for (ParameterMetaData paramMetaData : parameters)
- {
- ParameterMode mode = paramMetaData.getMode();
- if (mode == ParameterMode.OUT || mode == ParameterMode.INOUT)
- retList.add(paramMetaData);
- }
- return retList;
- }
-
- /** Get the non header parameter list */
- public List<ParameterMetaData> getNonHeaderParameters()
- {
- List<ParameterMetaData> retList = new ArrayList<ParameterMetaData>();
- for (ParameterMetaData paramMetaData : parameters)
- {
- if (paramMetaData.isInHeader() == false)
- retList.add(paramMetaData);
- }
- return retList;
- }
-
- public List<ParameterMetaData> getParameters()
- {
- return new ArrayList<ParameterMetaData>(parameters);
- }
-
- public void addParameter(ParameterMetaData pmd)
- {
- log.trace("addParameter: [xmlName=" + pmd.getXmlName() +
",xmlType=" + pmd.getXmlType() + "]");
- parameters.add(pmd);
- assertOneWayOperation();
- }
-
- public void removeAllParameters()
- {
- parameters.clear();
- }
-
- public ParameterMetaData getReturnParameter()
- {
- return returnParam;
- }
-
- public void setReturnParameter(ParameterMetaData returnParam)
- {
- log.trace("setReturnParameter: " + returnParam);
- returnParam.setMode(ParameterMode.OUT);
- this.returnParam = returnParam;
- assertOneWayOperation();
- }
-
- public List<FaultMetaData> getFaults()
- {
- return new ArrayList<FaultMetaData>(faults);
- }
-
- public FaultMetaData getFault(QName xmlName)
- {
- FaultMetaData faultMetaData = null;
- for (int i = 0; faultMetaData == null && i < faults.size(); i++)
- {
- FaultMetaData aux = faults.get(i);
- if (aux.getXmlName().equals(xmlName))
- faultMetaData = aux;
- }
- return faultMetaData;
- }
-
- public FaultMetaData getFault(Class javaType)
- {
- FaultMetaData faultMetaData = null;
- for (FaultMetaData aux : faults)
- {
- if (aux.getJavaType().equals(javaType))
- {
- faultMetaData = aux;
- break;
- }
- }
- return faultMetaData;
- }
-
- public void addFault(FaultMetaData fault)
- {
- log.trace("addFault: " + fault);
- faults.add(fault);
- assertOneWayOperation();
- }
-
- // A JSR-181 processor is REQUIRED to report an error if an
- // operation marked @Oneway has a return value, declares any checked exceptions or has
any
- // INOUT or OUT parameters.
- private void assertOneWayOperation()
- {
- if (oneWay)
- {
- if (returnParam != null)
- throw new WSException("OneWay operations cannot have a return
parameter");
-
- if (faults.size() > 0)
- throw new WSException("OneWay operations cannot have checked
exceptions");
-
- for (ParameterMetaData paramMetaData : parameters)
- {
- if (paramMetaData.getMode() != ParameterMode.IN)
- throw new WSException("OneWay operations cannot have INOUT or OUT
parameters");
- }
- }
- }
-
- public void assertDocumentBare()
- {
- if (isDocumentBare())
- {
- int in = 0;
- int out = 0;
-
- for (ParameterMetaData paramMetaData : parameters)
- {
- if (paramMetaData.isInHeader())
- continue;
-
- ParameterMode mode = paramMetaData.getMode();
- if (mode != ParameterMode.OUT)
- in++;
- if (mode != ParameterMode.IN)
- out++;
- }
-
- if (returnParam != null && !returnParam.isInHeader())
- out++;
-
- if (!((oneWay && in == 1 && out == 0) || (in == 1 && out
== 1)))
- throw new WSException("The body of a documnet/literal bare message
requires only 1 input and only 1 output (or 0 if oneway). method: " + javaName +
" in: "
- + in + " out: " + out);
- }
- }
-
- public void validate()
- {
- for (ParameterMetaData parameter : parameters)
- parameter.validate();
-
- for (FaultMetaData fault : faults)
- fault.validate();
- }
-
- /**
- * @see UnifiedMetaData#eagerInitialize()
- */
- public void eagerInitialize(List<Method> unsynchronizedMethods)
- {
- // reset java method
- javaMethod = null;
-
- for (ParameterMetaData parameter : parameters)
- parameter.eagerInitialize();
-
- if (returnParam != null)
- returnParam.eagerInitialize();
-
- for (FaultMetaData fault : faults)
- fault.eagerInitialize();
-
- // Method initialization
- for (Method method : unsynchronizedMethods)
- {
- if (isJavaMethod(method))
- {
- javaMethod = method;
- break;
- }
- }
-
- // Report unsynchronized java method
- if (javaMethod == null)
- {
- StringBuilder errMsg = new StringBuilder("Cannot synchronize to any of
these methods:");
- for (Method method : unsynchronizedMethods)
- {
- errMsg.append("\n" + method);
- }
- errMsg.append("\n" + toString());
- throw new IllegalStateException(errMsg.toString());
- }
-
- }
-
- public String toString()
- {
- StringBuilder buffer = new StringBuilder("\nOperationMetaData:");
- buffer.append("\n qname=" + qname);
- buffer.append("\n javaName=" + javaName);
- buffer.append("\n style=" + getStyle() + "/" + getUse());
- if (getStyle() == Style.DOCUMENT)
- {
- buffer.append("/" + getParameterStyle());
- }
- buffer.append("\n oneWay=" + oneWay);
- buffer.append("\n soapAction=" + soapAction);
- for (ParameterMetaData param : parameters)
- {
- buffer.append(param);
- }
- if (returnParam != null)
- {
- buffer.append(returnParam.toString());
- }
- for (FaultMetaData fault : faults)
- {
- buffer.append(fault);
- }
- return buffer.toString();
- }
-}
Deleted:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/ParameterMetaData.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/ParameterMetaData.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/ParameterMetaData.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -1,355 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.ws.metadata;
-
-// $Id$
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import java.util.StringTokenizer;
-
-import javax.xml.namespace.QName;
-import javax.xml.rpc.ParameterMode;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.Constants;
-import org.jboss.ws.WSException;
-import org.jboss.ws.core.jaxrpc.ParameterWrapping;
-import org.jboss.ws.core.utils.JavaUtils;
-
-/**
- * A request/response parameter that a given operation supports.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @author <a href="mailto:jason.greene@jboss.com">Jason T.
Greene</a>
- * @since 12-May-2005
- */
-public class ParameterMetaData
-{
- // provide logging
- private final Logger log = Logger.getLogger(ParameterMetaData.class);
-
- // The parent operation
- private OperationMetaData opMetaData;
-
- private QName xmlName;
- private QName xmlType;
- private String javaTypeName;
- private Class javaType;
- private ParameterMode mode;
- private Set<String> mimeTypes;
- private boolean inHeader;
- private boolean isSwA;
- private boolean isXOP;
- private List<String> wrappedVariables = new ArrayList<String>();
- private List<String> wrappedTypes = new ArrayList<String>();
- private List<QName> wrappedElementNames = new ArrayList<QName>();
-
- // SOAP-ENC:Array
- private boolean soapArrayParam;
- private QName soapArrayCompType;
-
- private static final List<String> messageTypes = new ArrayList<String>();
- static
- {
- messageTypes.add("javax.xml.soap.SOAPElement");
- messageTypes.add("org.w3c.dom.Element");
- }
-
- public ParameterMetaData(OperationMetaData opMetaData, QName xmlName, QName xmlType,
String javaTypeName)
- {
- this.xmlName = xmlName;
- this.xmlType = xmlType;
- this.opMetaData = opMetaData;
- this.mode = ParameterMode.IN;
- this.javaTypeName = javaTypeName;
-
- if (xmlName == null)
- throw new IllegalArgumentException("Invalid null xmlName argument");
- if (xmlType == null)
- throw new IllegalArgumentException("Invalid null xmlType argument, for:
" + xmlName);
-
- // Remove the prefixes
- if (xmlName.getNamespaceURI().length() > 0)
- this.xmlName = new QName(xmlName.getNamespaceURI(), xmlName.getLocalPart());
-
- if (xmlType.getNamespaceURI().length() > 0)
- this.xmlType = new QName(xmlType.getNamespaceURI(), xmlType.getLocalPart());
-
- // Special case to identify attachments
- if (Constants.NS_ATTACHMENT_MIME_TYPE.equals(xmlType.getNamespaceURI()))
- {
- String mimeType = convertXmlTypeToMimeType(xmlType);
- setMimeTypes(mimeType);
- this.isSwA = true;
- }
- }
-
- public OperationMetaData getOperationMetaData()
- {
- return opMetaData;
- }
-
- public QName getXmlName()
- {
- return xmlName;
- }
-
- public QName getXmlType()
- {
- return xmlType;
- }
-
- public String getJavaTypeName()
- {
- return javaTypeName;
- }
-
-
- public void setJavaTypeName(String typeName)
- {
- // Warn if this is called after eager initialization
- UnifiedMetaData wsMetaData =
opMetaData.getEndpointMetaData().getServiceMetaData().getUnifiedMetaData();
- if (wsMetaData.isEagerInitialized() && UnifiedMetaData.isFinalRelease() ==
false)
- log.warn("Set java type name after eager initialization", new
IllegalStateException());
-
- javaTypeName = typeName;
- javaType = null;
- }
-
- /** Load the java type.
- * It should only be cached during eager initialization.
- */
- public Class getJavaType()
- {
- Class tmpJavaType = javaType;
- if (tmpJavaType == null && javaTypeName != null)
- {
- try
- {
- ClassLoader loader = opMetaData.getEndpointMetaData().getClassLoader();
- tmpJavaType = JavaUtils.loadJavaType(javaTypeName, loader);
-
- UnifiedMetaData wsMetaData =
opMetaData.getEndpointMetaData().getServiceMetaData().getUnifiedMetaData();
- if (wsMetaData.isEagerInitialized())
- {
- // This should not happen, see the warning in setJavaTypeName
- javaType = tmpJavaType;
- }
- }
- catch (ClassNotFoundException ex)
- {
- throw new WSException("Cannot load java type: " + javaTypeName,
ex);
- }
- }
- return tmpJavaType;
- }
-
-
- public ParameterMode getMode()
- {
- return mode;
- }
-
- public void setMode(String mode)
- {
- if("IN".equals(mode))
- setMode(ParameterMode.IN);
- else if("INOUT".equals(mode))
- setMode(ParameterMode.INOUT);
- else if("OUT".equals(mode))
- setMode(ParameterMode.OUT);
- else
- throw new IllegalArgumentException("Invalid mode: " + mode);
- }
-
- public void setMode(ParameterMode mode)
- {
- this.mode = mode;
- }
-
- public Set<String> getMimeTypes()
- {
- return mimeTypes;
- }
-
- public void setMimeTypes(String mimeStr)
- {
- mimeTypes = new HashSet<String>();
- StringTokenizer st = new StringTokenizer(mimeStr, ",");
- while (st.hasMoreTokens())
- mimeTypes.add(st.nextToken().trim());
- }
-
- public boolean isInHeader()
- {
- return inHeader;
- }
-
- public void setInHeader(boolean inHeader)
- {
- this.inHeader = inHeader;
- }
-
- public boolean isSwA()
- {
- return isSwA;
- }
-
- public void setSwA(boolean isSwA)
- {
- this.isSwA = isSwA;
- }
-
- public boolean isXOP()
- {
- return isXOP;
- }
-
- public void setXOP(boolean isXOP)
- {
- this.isXOP = isXOP;
- }
-
- public List<String> getWrappedTypes()
- {
- return wrappedTypes;
- }
-
- public List<String> getWrappedVariables()
- {
- return wrappedVariables;
- }
-
- public List<QName> getWrappedElementNames()
- {
- return wrappedElementNames;
- }
-
- public boolean isSOAPArrayParam()
- {
- return soapArrayParam;
- }
-
- public void setSOAPArrayParam(boolean soapArrayParam)
- {
- this.soapArrayParam = soapArrayParam;
- }
-
- public QName getSOAPArrayCompType()
- {
- return soapArrayCompType;
- }
-
- public void setSOAPArrayCompType(QName xmlType)
- {
- this.soapArrayCompType = xmlType;
- }
-
- public boolean isMessageType()
- {
- return messageTypes.contains(javaTypeName);
- }
-
- public static boolean isMessageType(String javaTypeName)
- {
- return messageTypes.contains(javaTypeName);
- }
-
- /** Converts a proprietary JBossWS attachment xml type to the MIME type that it
represents.
- */
- private String convertXmlTypeToMimeType(QName xmlType)
- {
- StringBuilder mimeName = new StringBuilder(xmlType.getLocalPart());
- int pos = mimeName.indexOf("_");
- if (pos == -1)
- throw new IllegalArgumentException("Invalid mime type: " + xmlType);
-
- mimeName.setCharAt(pos, '/');
- return mimeName.toString();
- }
-
- public void validate()
- {
- // nothing to do
- }
-
- /**
- * @see UnifiedMetaData#eagerInitialize()
- */
- public void eagerInitialize()
- {
- // reset java type
- javaType = null;
-
- TypesMetaData typesMetaData =
getOperationMetaData().getEndpointMetaData().getServiceMetaData().getTypesMetaData();
- if (getOperationMetaData().isDocumentWrapped() && isMessageType() ==
false)
- {
- TypeMappingMetaData tmMetaData =
typesMetaData.getTypeMappingByXMLType(xmlType);
- if (tmMetaData == null)
- ParameterWrapping.generateWrapper(this, true);
- }
-
- javaType = getJavaType();
- if (javaType == null)
- throw new WSException("Cannot load java type: " + javaTypeName);
- }
-
- public String toString()
- {
- boolean isReturn = (opMetaData.getReturnParameter() == this);
- StringBuilder buffer = new StringBuilder("\n" + (isReturn ?
"ReturnMetaData:" : "ParameterMetaData:"));
- buffer.append("\n xmlName=" + getXmlName());
- buffer.append("\n xmlType=" + getXmlType());
- buffer.append("\n javaType=" + getJavaTypeName());
- buffer.append("\n mode=" + getMode());
- buffer.append("\n inHeader=" + isInHeader());
-
- if (soapArrayParam)
- buffer.append("\n soapArrayCompType=" + soapArrayCompType);
-
- if (wrappedVariables != null)
- buffer.append("\n wrappedVariables=" + wrappedVariables);
-
- if (wrappedTypes != null)
- buffer.append("\n wrappedTypes=" + wrappedTypes);
-
- if (wrappedElementNames != null)
- buffer.append("\n wrappedElementNames=" + wrappedElementNames);
-
- if (isSwA())
- {
- buffer.append("\n isSwA=" + isSwA());
- buffer.append("\n mimeTypes=" + getMimeTypes());
- }
-
- if (isXOP())
- {
- buffer.append("\n isXOP=" + isXOP());
- buffer.append("\n mimeTypes=" + getMimeTypes());
- }
-
- return buffer.toString();
- }
-}
\ No newline at end of file
Deleted:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/ServerEndpointMetaData.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/ServerEndpointMetaData.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/ServerEndpointMetaData.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -1,265 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.ws.metadata;
-
-// $Id$
-
-import java.net.MalformedURLException;
-import java.net.URL;
-
-import javax.management.ObjectName;
-import javax.xml.namespace.QName;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.WSException;
-import org.jboss.ws.core.server.ServiceEndpoint;
-import org.jboss.ws.metadata.HandlerMetaData.HandlerType;
-import org.jboss.ws.metadata.config.WSCommonConfig;
-import org.jboss.ws.metadata.config.WSConfigFactory;
-import org.jboss.ws.metadata.config.jaxrpc.WSConfigRootJAXRPC;
-
-/**
- * Client side endpoint meta data.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @author <a href="mailto:jason.greene@jboss.com">Jason T.
Greene</a>
- * @since 12-May-2005
- */
-public class ServerEndpointMetaData extends EndpointMetaData
-{
- // provide logging
- private static Logger log = Logger.getLogger(ServerEndpointMetaData.class);
-
- public static final String SEPID_DOMAIN = "jboss.ws";
- public static final String SEPID_PROPERTY_CONTEXT = "context";
- public static final String SEPID_PROPERTY_ENDPOINT = "endpoint";
-
- // The REQUIRED link name
- private String linkName;
- // Legacy JSR-109 port component name
- private String portComponentName;
- // The endpoint implementation bean
- private String implName;
- // The unique service endpointID
- private ObjectName sepID;
- // The HTTP context root
- private String contextRoot;
- // The HTTP virtual hosts
- private String[] virtualHosts;
- // The HTTP url parttern
- private String urlPattern;
- // The bean that registers with the ServiceEndpointManager
- private String managedEndpointBean = ServiceEndpoint.class.getName();
-
- public ServerEndpointMetaData(ServiceMetaData service, QName portName, Type type)
- {
- super(service, portName, type);
- }
-
- public void setConfigName(String configName)
- {
- super.setConfigName(configName);
- endpointConfig = null;
- }
-
- public void setConfigFile(String configFile)
- {
- super.setConfigFile(configFile);
- endpointConfig = null;
- }
-
- public String getLinkName()
- {
- return linkName;
- }
-
- public void setLinkName(String linkName)
- {
- this.linkName = linkName;
- }
-
- public String getPortComponentName()
- {
- return portComponentName;
- }
-
- public void setPortComponentName(String portComponentName)
- {
- this.portComponentName = portComponentName;
- }
-
- public String getServiceEndpointImplName()
- {
- return implName;
- }
-
- public void setServiceEndpointImplName(String endpointImpl)
- {
- this.implName = endpointImpl;
- }
-
- public ObjectName getServiceEndpointID()
- {
- return sepID;
- }
-
- public void setServiceEndpointID(ObjectName endpointID)
- {
- this.sepID = endpointID;
- }
-
- public String getContextRoot()
- {
- return contextRoot;
- }
-
- public void setContextRoot(String contextRoot)
- {
- this.contextRoot = contextRoot;
- }
-
-
- public String[] getVirtualHosts()
- {
- return virtualHosts;
- }
-
- public void setVirtualHosts(String[] virtualHosts)
- {
- this.virtualHosts = virtualHosts;
- }
-
- public String getURLPattern()
- {
- return urlPattern;
- }
-
- public void setURLPattern(String urlPattern)
- {
- this.urlPattern = urlPattern;
- }
-
- public String getManagedEndpointBean()
- {
- return managedEndpointBean;
- }
-
- public void setManagedEndpointBean(String managedEndpointBean)
- {
- this.managedEndpointBean = managedEndpointBean;
- }
-
- @Override
- public WSCommonConfig getEndpointConfig()
- {
- if (endpointConfig == null)
- {
- String configName = getConfigName();
- if (configName == null)
- {
- configName = "Standard Endpoint";
- setConfigName(configName);
- }
-
- String configFile = getConfigFile();
- if (configFile == null)
- {
- configFile = "META-INF/standard-jaxrpc-endpoint-config.xml";
- setConfigFile(configFile);
- }
-
- log.debug("getEndpointConfig: [name=" + configName + ",url="
+ configFile + "]");
-
- URL configURL = null;
- try
- {
- configURL = new URL(configFile);
- }
- catch (MalformedURLException ex)
- {
- // ignore
- }
-
- // Try to get the URL as resource
- if (configURL == null)
- {
- ClassLoader cl = Thread.currentThread().getContextClassLoader();
- configURL = cl.getResource(configFile);
- if (configURL == null)
- throw new WSException("Cannot get resource: " + configFile);
- }
-
- // Get the config root
- Object wsConfig;
- try
- {
- WSConfigFactory factory = WSConfigFactory.newInstance();
- wsConfig = factory.parseWithObjectModelFactory(configURL);
- }
- catch (RuntimeException rte)
- {
- throw rte;
- }
- catch (Exception ex)
- {
- throw new WSException("Cannot parse client config", ex);
- }
-
- // Get the endpoint config
- endpointConfig =
((WSConfigRootJAXRPC)wsConfig).getEndpointConfigByName(configName);
- if (endpointConfig == null)
- throw new WSException("Cannot obtain endpoint config: " +
configName);
- }
- return endpointConfig;
- }
-
- public String toString()
- {
- StringBuilder buffer = new StringBuilder("\nServerEndpointMetaData:");
- buffer.append("\n type=" + getType());
- buffer.append("\n qname=" + getQName());
- buffer.append("\n id=" + getServiceEndpointID().getCanonicalName());
- buffer.append("\n address=" + getEndpointAddress());
- buffer.append("\n binding=" + getBindingId());
- buffer.append("\n linkName=" + getLinkName());
- buffer.append("\n implName=" + getServiceEndpointImplName());
- buffer.append("\n seiName=" + getServiceEndpointInterfaceName());
- buffer.append("\n portComponentName=" + getPortComponentName());
- buffer.append("\n contextRoot=" + getContextRoot());
- buffer.append("\n urlPattern=" + getURLPattern());
- buffer.append("\n configFile=" + getConfigFile());
- buffer.append("\n configName=" + getConfigName());
- buffer.append("\n authMethod=" + getAuthMethod());
- buffer.append("\n transportGuarantee=" + getTransportGuarantee());
- buffer.append("\n properties=" + getProperties());
-
- for (OperationMetaData opMetaData : getOperations())
- {
- buffer.append("\n" + opMetaData);
- }
- for (HandlerMetaData hdlMetaData : getHandlerMetaData(HandlerType.ALL))
- {
- buffer.append("\n" + hdlMetaData);
- }
- return buffer.toString();
- }
-}
Deleted:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/ServiceMetaData.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/ServiceMetaData.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/ServiceMetaData.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -1,469 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.ws.metadata;
-
-// $Id$
-
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-
-import javax.xml.namespace.QName;
-import javax.xml.rpc.encoding.TypeMappingRegistry;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.WSException;
-import org.jboss.ws.core.jaxrpc.TypeMappingImpl;
-import org.jboss.ws.core.jaxrpc.TypeMappingRegistryImpl;
-import org.jboss.ws.core.jaxrpc.Use;
-import org.jboss.ws.core.jaxrpc.binding.SOAPArrayDeserializerFactory;
-import org.jboss.ws.core.jaxrpc.binding.SOAPArraySerializerFactory;
-import org.jboss.ws.core.jaxrpc.binding.jbossxb.JBossXBDeserializerFactory;
-import org.jboss.ws.core.jaxrpc.binding.jbossxb.JBossXBSerializerFactory;
-import org.jboss.ws.core.jaxrpc.binding.jbossxb.SchemaBindingBuilder;
-import org.jboss.ws.core.utils.JavaUtils;
-import org.jboss.ws.metadata.HandlerMetaData.HandlerType;
-import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping;
-import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMappingFactory;
-import org.jboss.ws.metadata.wsdl.WSDLDefinitions;
-import org.jboss.ws.metadata.wsdl.WSDLDefinitionsFactory;
-import org.jboss.ws.metadata.wsdl.WSDLTypes;
-import org.jboss.ws.metadata.wsdl.WSDLUtils;
-import org.jboss.ws.metadata.wsdl.xmlschema.JBossXSModel;
-import org.jboss.ws.metadata.wsse.WSSecurityConfiguration;
-import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding;
-
-/**
- * A Service component describes a set of endpoints.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 12-May-2005
- */
-public class ServiceMetaData
-{
- // provide logging
- private static final Logger log = Logger.getLogger(ServiceMetaData.class);
-
- // The parent meta data.
- private UnifiedMetaData wsMetaData;
-
- // The service endpoints
- private Map<QName, EndpointMetaData> endpoints = new LinkedHashMap<QName,
EndpointMetaData>();
-
- private QName qname;
- private String wsdName;
- private String wsdlFile;
- private String jaxrpcMappingFile;
- private String wsdlPublishLocation;
-
- // The type mapping that is maintained by this service
- private TypesMetaData types;
- private TypeMappingRegistry tmRegistry = new TypeMappingRegistryImpl();
- private SchemaBinding schemaBinding;
-
- // Arbitrary properties given by <call-property>
- private Properties properties;
-
- // derived cached encoding style
- private Use encStyle;
-
- // The security configuration
- private WSSecurityConfiguration securityConfiguration;
-
- public ServiceMetaData(UnifiedMetaData wsMetaData, QName name)
- {
- this.wsMetaData = wsMetaData;
- this.qname = name;
- this.types = new TypesMetaData(this);
- }
-
- public UnifiedMetaData getUnifiedMetaData()
- {
- return wsMetaData;
- }
-
- public void setQName(QName name)
- {
- this.qname = name;
- }
-
- public QName getQName()
- {
- return qname;
- }
-
- public String getWebserviceDescriptionName()
- {
- return wsdName;
- }
-
- public void setWebserviceDescriptionName(String wsdName)
- {
- this.wsdName = wsdName;
- }
-
- public String getWsdlFile()
- {
- return wsdlFile;
- }
-
- public void setWsdlFile(String wsdlFile)
- {
- this.wsdlFile = wsdlFile;
- }
-
- public String getWsdlPublishLocation()
- {
- return wsdlPublishLocation;
- }
-
- public void setWsdlPublishLocation(String wsdlPublishLocation)
- {
- this.wsdlPublishLocation = wsdlPublishLocation;
- }
-
- public Properties getProperties()
- {
- return properties;
- }
-
- public void setProperties(Properties properties)
- {
- this.properties = properties;
- }
-
- public TypesMetaData getTypesMetaData()
- {
- return types;
- }
-
- public List<EndpointMetaData> getEndpoints()
- {
- return new ArrayList<EndpointMetaData>(endpoints.values());
- }
-
- public EndpointMetaData getEndpoint(QName portName)
- {
- return endpoints.get(portName);
- }
-
- public EndpointMetaData getEndpointByServiceEndpointInterface(String seiName)
- {
- EndpointMetaData epMetaData = null;
- for (EndpointMetaData epmd : endpoints.values())
- {
- if (seiName.equals(epmd.getServiceEndpointInterfaceName()))
- {
- if (epMetaData != null)
- {
- // The CTS uses Service.getPort(Class) with multiple endpoints
implementing the same SEI
- log.warn("Multiple possible endpoints implementing SEI: " +
seiName);
- }
- epMetaData = epmd;
- }
- }
- return epMetaData;
- }
-
- public void addEndpoint(EndpointMetaData epMetaData)
- {
- QName portName = epMetaData.getQName();
-
- // This happends when we have multiple port components in sharing the same wsdl
port
- // The EndpointMetaData name is the wsdl port, so we cannot have multiple meta data
for the same port.
- if (endpoints.get(portName) != null)
- throw new WSException("EndpointMetaData name must be unique: " +
portName);
-
- endpoints.put(portName, epMetaData);
- }
-
- public String getJaxrpcMappingFile()
- {
- return jaxrpcMappingFile;
- }
-
- public void setJaxrpcMappingFile(String jaxrpcMappingFile)
- {
- this.jaxrpcMappingFile = jaxrpcMappingFile;
- }
-
- public JavaWsdlMapping getJavaWsdlMapping()
- {
- JavaWsdlMapping javaWsdlMapping =
(JavaWsdlMapping)wsMetaData.getMappingDefinition(jaxrpcMappingFile);
- if (javaWsdlMapping == null && jaxrpcMappingFile != null)
- {
- URL mappingLocation = null;
- try
- {
- mappingLocation = new URL(jaxrpcMappingFile);
- }
- catch (MalformedURLException e)
- {
- // ignore
- }
- if (mappingLocation == null)
- {
- mappingLocation =
wsMetaData.getResourceLoader().getResource(jaxrpcMappingFile);
- }
-
- if (mappingLocation == null)
- throw new IllegalArgumentException("Cannot find jaxrpc-mapping.xml in
deployment: " + jaxrpcMappingFile);
-
- try
- {
- JavaWsdlMappingFactory mappingFactory =
JavaWsdlMappingFactory.newInstance();
- javaWsdlMapping = mappingFactory.parse(mappingLocation);
- wsMetaData.addMappingDefinition(jaxrpcMappingFile, javaWsdlMapping);
- }
- catch (IOException e)
- {
- throw new WSException("Cannot parse jaxrpc-mapping.xml", e);
- }
- }
- return javaWsdlMapping;
- }
-
- /**
- * Get the wsdl definition that corresponds to the wsdl-file element.
- */
- public WSDLDefinitions getWsdlDefinitions()
- {
- WSDLDefinitions wsdlDefinitions =
(WSDLDefinitions)wsMetaData.getWSDLDefinition(wsdlFile);
- if (wsdlDefinitions == null && wsdlFile != null)
- {
- URL wsdlLocation = getWsdlLocation();
- if (wsdlLocation == null)
- throw new IllegalArgumentException("Cannot find wsdl in deployment:
" + wsdlFile);
-
- WSDLDefinitionsFactory factory = WSDLDefinitionsFactory.newInstance();
- wsdlDefinitions = factory.parse(wsdlLocation);
- wsMetaData.addWSDLDefinition(wsdlFile, wsdlDefinitions);
- }
- return wsdlDefinitions;
- }
-
- public URL getWsdlLocation()
- {
- URL wsdlLocation = null;
- if (wsdlFile != null)
- {
- try
- {
- wsdlLocation = new URL(wsdlFile);
- }
- catch (MalformedURLException e)
- {
- // ignore
- }
- if (wsdlLocation == null)
- {
- wsdlLocation = wsMetaData.getResourceLoader().getResource(wsdlFile);
- }
- }
- return wsdlLocation;
- }
-
- public TypeMappingImpl getTypeMapping()
- {
- Use encStyle = getEncodingStyle();
- TypeMappingImpl typeMapping =
(TypeMappingImpl)tmRegistry.getTypeMapping(encStyle.toURI());
- if (typeMapping == null)
- throw new WSException("No type mapping for encoding style: " +
encStyle);
-
- return typeMapping;
- }
-
- public WSSecurityConfiguration getSecurityConfiguration()
- {
- return securityConfiguration;
- }
-
- public void setSecurityConfiguration(WSSecurityConfiguration securityConfiguration)
- {
- this.securityConfiguration = securityConfiguration;
- }
-
- public Use getEncodingStyle()
- {
- if (encStyle == null)
- {
- if (endpoints.size() > 0)
- {
- for (EndpointMetaData epMetaData : endpoints.values())
- {
- if (encStyle == null)
- {
- encStyle = epMetaData.getEncodingStyle();
- }
- else if (encStyle.equals(epMetaData.getEncodingStyle()) == false)
- {
- throw new WSException("Conflicting encoding styles not
supported");
- }
- }
- }
- else
- {
- encStyle = Use.LITERAL;
- }
- }
- return encStyle;
- }
-
- public SchemaBinding getSchemaBinding()
- {
- JavaWsdlMapping wsdlMapping = getJavaWsdlMapping();
- if (schemaBinding == null && getEncodingStyle() == Use.LITERAL &&
wsdlMapping != null)
- {
- JBossXSModel xsModel = types.getSchemaModel();
- SchemaBindingBuilder bindingBuilder = new SchemaBindingBuilder();
- schemaBinding = bindingBuilder.buildSchemaBinding(xsModel, wsdlMapping);
- }
- return schemaBinding;
- }
-
- public void validate()
- {
- // Validate that there is at least one handler configured
- // if we have a security configuration
- if (securityConfiguration != null)
- {
- int handlerCount = 0;
- for (EndpointMetaData epMetaData : endpoints.values())
- {
- handlerCount += epMetaData.getHandlerMetaData(HandlerType.ALL).size();
- }
- if (handlerCount == 0)
- log.warn("WS-Security requires a security handler to be
configured");
- }
-
- // Validate endpoints
- for (EndpointMetaData epMetaData : endpoints.values())
- epMetaData.validate();
- }
-
- /**
- * @see UnifiedMetaData#eagerInitialize()
- */
- public void eagerInitialize()
- {
- // Initialize all wsdl definitions and schema objects
- WSDLDefinitions definitions = getWsdlDefinitions();
- if (definitions != null)
- {
- WSDLTypes types = definitions.getWsdlTypes();
- if (types != null)
- {
- JBossXSModel model = WSDLUtils.getSchemaModel(types);
- ;
- if (model != null)
- model.eagerInitialize();
- }
- }
-
- // Initialize jaxrpc-mapping data
- getJavaWsdlMapping();
-
- // Initialize types
- TypeMappingImpl typeMapping = getTypeMapping();
- for (TypeMappingMetaData tmMetaData : types.getTypeMappings())
- {
- String javaTypeName = tmMetaData.getJavaTypeName();
- QName xmlType = tmMetaData.getXmlType();
- if (xmlType != null)
- {
- List<Class> registeredTypes = typeMapping.getJavaTypes(xmlType);
-
- boolean registered = false;
- for (Class current : registeredTypes)
- {
- if (current.getName().equals(javaTypeName))
- {
- registered = true;
- break;
- }
- }
-
- if (registered == false)
- {
- try
- {
- ClassLoader classLoader = wsMetaData.getClassLoader();
- Class javaType = JavaUtils.loadJavaType(javaTypeName, classLoader);
-
- if (JavaUtils.isPrimitive(javaTypeName))
- javaType = JavaUtils.getWrapperType(javaType);
-
- if (getEncodingStyle() == Use.ENCODED && javaType.isArray())
- {
- typeMapping.register(javaType, xmlType, new
SOAPArraySerializerFactory(), new SOAPArrayDeserializerFactory());
- }
- else
- {
- typeMapping.register(javaType, xmlType, new
JBossXBSerializerFactory(), new JBossXBDeserializerFactory());
- }
- }
- catch (ClassNotFoundException e)
- {
- log.warn("Cannot load class for type: " + xmlType +
"," + javaTypeName);
- }
- }
- }
- }
-
- // Initialize endpoints
- for (EndpointMetaData epMetaData : endpoints.values())
- epMetaData.eagerInitialize();
-
- // Initialize schema binding
- getSchemaBinding();
- }
-
- /** Assert that the given namespace is the WSDL's target namespace */
- public void assertTargetNamespace(String targetNS)
- {
- if (getQName().getNamespaceURI().equals(targetNS) == false)
- throw new WSException("Requested namespace is not WSDL target namespace:
" + targetNS);
- }
-
- public String toString()
- {
- StringBuilder buffer = new StringBuilder("\nServiceMetaData:");
- buffer.append("\n qname=" + qname);
- buffer.append("\n wsdName=" + wsdName);
- buffer.append("\n wsdlFile=" + wsdlFile);
- buffer.append("\n jaxrpcFile=" + jaxrpcMappingFile);
- buffer.append("\n publishLocation=" + wsdlPublishLocation);
- buffer.append("\n properties=" + properties);
- buffer.append("\n" + types);
- buffer.append("\n");
- for (EndpointMetaData epMetaData : endpoints.values())
- {
- buffer.append(epMetaData);
- }
- return buffer.toString();
- }
-}
Deleted:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/TypeMappingMetaData.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/TypeMappingMetaData.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/TypeMappingMetaData.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -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.metadata;
-
-// $Id$
-
-import java.util.Arrays;
-import java.util.List;
-
-import javax.xml.namespace.QName;
-
-/**
- * Type mapping meta data
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 12-May-2005
- */
-public class TypeMappingMetaData
-{
- // The parent meta data.
- private TypesMetaData typesMetaData;
-
- private QName xmlType;
- private String javaTypeName;
- private String qnameScope;
-
- // List of allowed qname scopes
- public static final String QNAME_SCOPE_SIMPLE_TYPE = "simpleType";
- public static final String QNAME_SCOPE_COMPLEX_TYPE = "complexType";
- public static final String QNAME_SCOPE_ELEMENT = "element";
- private static List<String> allowedScopes = Arrays.asList(new String[] {
QNAME_SCOPE_COMPLEX_TYPE, QNAME_SCOPE_SIMPLE_TYPE, QNAME_SCOPE_ELEMENT });
-
- public TypeMappingMetaData(TypesMetaData typesMetaData, QName xmlType, String
javaTypeName)
- {
- if (xmlType == null)
- throw new IllegalArgumentException("Invalid null xmlType");
- if (javaTypeName == null)
- throw new IllegalArgumentException("Invalid null javaTypeName");
-
- this.typesMetaData = typesMetaData;
- this.javaTypeName = javaTypeName;
- this.xmlType = xmlType;
- this.qnameScope = QNAME_SCOPE_COMPLEX_TYPE;
- }
-
- public TypesMetaData getTypesMetaData()
- {
- return typesMetaData;
- }
-
- public String getJavaTypeName()
- {
- return javaTypeName;
- }
-
- public QName getXmlType()
- {
- return xmlType;
- }
-
- public String getQNameScope()
- {
- return qnameScope;
- }
-
- public void setQNameScope(String qnameScope)
- {
- if (allowedScopes.contains(qnameScope) == false)
- throw new IllegalArgumentException("Invalid qname scope: " +
qnameScope);
-
- this.qnameScope = qnameScope;
- }
-
- public int hashCode()
- {
- return toString().hashCode();
- }
-
- public boolean equals(Object obj)
- {
- if (obj instanceof TypeMappingMetaData == false) return false;
- TypeMappingMetaData other = (TypeMappingMetaData)obj;
- return toString().equals(other.toString());
- }
-
- public String toString()
- {
- return "[" + qnameScope + "=" + xmlType +
",javaType=" + javaTypeName + "]";
- }
-}
Deleted:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/TypesMetaData.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/TypesMetaData.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/TypesMetaData.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -1,193 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
-*/
-package org.jboss.ws.metadata;
-
-// $Id$
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.xml.namespace.QName;
-
-import org.apache.xerces.xs.XSSimpleTypeDefinition;
-import org.apache.xerces.xs.XSTypeDefinition;
-import org.jboss.logging.Logger;
-import org.jboss.ws.WSException;
-import org.jboss.ws.core.jaxrpc.LiteralTypeMapping;
-import org.jboss.ws.metadata.wsdl.xmlschema.JBossXSModel;
-
-/**
- * Types meta data
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 12-May-2005
- */
-public class TypesMetaData
-{
- // provide logging
- private static final Logger log = Logger.getLogger(TypesMetaData.class);
-
- // The parent meta data.
- private ServiceMetaData serviceMetaData;
- // The list of type meta data
- private List<TypeMappingMetaData> typeList = new
ArrayList<TypeMappingMetaData>();
-
- private JBossXSModel schemaModel;
-
- public TypesMetaData(ServiceMetaData serviceMetaData)
- {
- this.serviceMetaData = serviceMetaData;
- }
-
- public ServiceMetaData getServiceMetaData()
- {
- return serviceMetaData;
- }
-
- public JBossXSModel getSchemaModel()
- {
- return schemaModel;
- }
-
- public void setSchemaModel(JBossXSModel model)
- {
- this.schemaModel = model;
- }
-
- public void addSchemaModel(JBossXSModel model)
- {
- if (this.schemaModel == null)
- {
- this.schemaModel = model;
- }
- else
- {
- this.schemaModel.merge(model);
- }
- }
-
- public List<TypeMappingMetaData> getTypeMappings()
- {
- return new ArrayList<TypeMappingMetaData>(typeList);
- }
-
- public void addTypeMapping(TypeMappingMetaData tmMetaData)
- {
- if (typeList.contains(tmMetaData) == false)
- {
- log.trace("Add type mapping: " + tmMetaData);
- typeList.add(tmMetaData);
- }
- }
-
- public TypeMappingMetaData getTypeMappingByXMLType(QName xmlType)
- {
- TypeMappingMetaData tmMetaData = null;
- for (TypeMappingMetaData aux : typeList)
- {
- boolean isElementScope =
TypeMappingMetaData.QNAME_SCOPE_ELEMENT.equals(aux.getQNameScope());
- if (aux.getXmlType().equals(xmlType) && isElementScope == false)
- {
- if (tmMetaData != null)
- {
- log.error(tmMetaData + "\n" + aux);
- throw new WSException("Ambiguous type mappping for: " +
xmlType);
- }
- tmMetaData = aux;
- }
- }
-
- if (tmMetaData == null && schemaModel != null)
- {
- // Simple types are not neccessary mapped in jaxrpc-mapping.xml, lazily add the
mapping here
- XSTypeDefinition xsType = schemaModel.getTypeDefinition(xmlType.getLocalPart(),
xmlType.getNamespaceURI());
- if (xsType instanceof XSSimpleTypeDefinition)
- {
- XSSimpleTypeDefinition xsSimpleType = (XSSimpleTypeDefinition)xsType;
- String javaTypeName = null;
-
- // <simpleType name="FooStringListType">
- // <list itemType="string"/>
- // </simpleType>
- if (xsSimpleType.getVariety() == XSSimpleTypeDefinition.VARIETY_LIST)
- {
- XSSimpleTypeDefinition itemType = xsSimpleType.getItemType();
- QName xmlBaseType = new QName(itemType.getNamespace(),
itemType.getName());
- javaTypeName = new LiteralTypeMapping().getJavaTypeName(xmlBaseType);
- if (javaTypeName != null)
- {
- javaTypeName += "[]";
- }
- }
-
- // <simpleType name="FooIType">
- // <restriction base="normalizedString">
- // <pattern value="\d{3}-[A-Z0-9]{5}"/>
- // </restriction>
- // </simpleType>
- XSTypeDefinition xsBaseType = xsType.getBaseType();
- while (javaTypeName == null && xsBaseType != null)
- {
- QName xmlBaseType = new QName(xsBaseType.getNamespace(),
xsBaseType.getName());
- javaTypeName = new LiteralTypeMapping().getJavaTypeName(xmlBaseType);
- xsBaseType = xsBaseType.getBaseType();
- }
-
- if (javaTypeName != null)
- {
- tmMetaData = new TypeMappingMetaData(this, xmlType, javaTypeName);
- tmMetaData.setQNameScope(TypeMappingMetaData.QNAME_SCOPE_SIMPLE_TYPE);
- log.debug("Adding a simpleType without jaxrpc-mapping: " +
tmMetaData);
- addTypeMapping(tmMetaData);
- }
- else
- {
- log.warn("Cannot obtain javaTypeName for xmlType: " + xmlType);
- }
- }
- }
-
- return tmMetaData;
- }
-
- public TypeMappingMetaData getTypeMappingByJavaType(String javaTypeName)
- {
- TypeMappingMetaData tmMetaData = null;
- for (TypeMappingMetaData aux : typeList)
- {
- if (aux.getJavaTypeName().equals(javaTypeName))
- tmMetaData = aux;
- }
- return tmMetaData;
- }
-
- public String toString()
- {
- StringBuilder buffer = new StringBuilder("\nTypesMetaData: ");
- for (TypeMappingMetaData tmd : typeList)
- {
- buffer.append("\n " + tmd);
- }
- buffer.append("\n" + (schemaModel != null ? schemaModel.serialize() :
"<schema/>"));
- return buffer.toString();
- }
-}
Deleted:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/UnifiedMetaData.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/UnifiedMetaData.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/UnifiedMetaData.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -1,220 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
-*/
-package org.jboss.ws.metadata;
-
-// $Id$
-
-import java.net.URLClassLoader;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-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;
-
-/**
- * The top level meta data.
- *
- * <h4>Thread safety</h4>
- * <p>A <code>UnifiedMetaData</code> instance may be shared accross
threads provided that the following conditions are met:
- * <ol>
- * <li>{@link #eagerInitialize() eagerInitialize()} is called from a single thread
on startup</li>
- * <li>Multi-thread access is limited to read-only calls</li>
- * </ol></p>
- *
- * @author Thomas.Diesler(a)jboss.org
- * @author <a href="mailto:jason.greene@jboss.com">Jason T.
Greene</a>
- * @since 12-May-2005
- */
-public class UnifiedMetaData
-{
- // provide logging
- private static Logger log = Logger.getLogger(UnifiedMetaData.class);
-
- // The modules resource class loader
- private URLClassLoader resourceLoader;
- // The modules class loader
- private ClassLoader classLoader;
- // The optional security domain
- private String securityDomain;
- // The implementation version
- private static String implementationVersion;
- // True if this is a final release
- private static boolean isFinalRelease;
- // Map<String, WSDLDefinitions> the wsdl-file to the wsdl Document
- // Note the same wsdl can be used in multiple webservice descriptions
- Map<String, WSDLDefinitions> wsdlMap = new HashMap<String,
WSDLDefinitions>();
- // Maps the jaxrpc-mapping-file to {@link JavaWsdlMapping} object
- // Note the same jaxrpc-mapping.xml can be used in multiple webservice descriptions
- Map<String, JavaWsdlMapping> jaxrpcMap = new HashMap<String,
JavaWsdlMapping>();
- // The list of service meta data
- private List<ServiceMetaData> services = new
ArrayList<ServiceMetaData>();
- // Used by eager initialization
- private boolean eagerInitialized;
- // Used by validate
- private boolean validated;
-
- public UnifiedMetaData()
- {
- }
-
- public URLClassLoader getResourceLoader()
- {
- if (resourceLoader == null)
- throw new IllegalStateException ("Resource loader not available");
-
- return resourceLoader;
- }
-
- public void setResourceLoader(URLClassLoader resourceLoader)
- {
- this.resourceLoader = resourceLoader;
- }
-
- public ClassLoader getClassLoader()
- {
- if (classLoader == null)
- throw new IllegalStateException ("Class loader not available");
-
- return classLoader;
- }
-
- public void setClassLoader(ClassLoader classLoader)
- {
- this.classLoader = classLoader;
- }
-
- public String getSecurityDomain()
- {
- return securityDomain;
- }
-
- public void setSecurityDomain(String domain)
- {
- String prefix = "java:/jaas/";
- if (domain != null && domain.startsWith(prefix))
- domain = domain.substring(prefix.length());
-
- this.securityDomain = domain;
- }
-
- public List<ServiceMetaData> getServices()
- {
- return new ArrayList<ServiceMetaData>(services);
- }
-
- public void addService(ServiceMetaData serviceMetaData)
- {
- services.add(serviceMetaData);
- }
-
- public void addWSDLDefinition(String wsdlFile, WSDLDefinitions wsdlDefinitions)
- {
- wsdlMap.put(wsdlFile, wsdlDefinitions);
- }
-
- public WSDLDefinitions getWSDLDefinition(String wsdlFile)
- {
- return wsdlMap.get(wsdlFile);
- }
-
- public void addMappingDefinition(String jaxrpcFile, JavaWsdlMapping javaWsdlMapping)
- {
- jaxrpcMap.put(jaxrpcFile, javaWsdlMapping);
- }
-
- public JavaWsdlMapping getMappingDefinition(String jaxrpcFile)
- {
- return jaxrpcMap.get(jaxrpcFile);
- }
-
- public void validate()
- {
- if (validated == false)
- {
- for (ServiceMetaData service : services)
- {
- service.validate();
- }
- validated = true;
- }
- }
-
- public boolean isEagerInitialized()
- {
- return eagerInitialized;
- }
-
- /**
- * Eagerly initialize all cache values that are normally lazy-loaded. This
- * allows for concurrent read-only access to a
<code>UnifiedMetaData</code>
- * instance. This method, however, must be called from a single thread.
- */
- public void eagerInitialize()
- {
- if (eagerInitialized == false)
- {
- log.debug("Eagerly initialize the meta data model");
- for (ServiceMetaData service : services)
- {
- service.eagerInitialize();
- }
- eagerInitialized = true;
- }
- }
-
- public static String getImplementationVersion()
- {
- if (implementationVersion == null)
- {
- implementationVersion =
ServiceEndpointManager.class.getPackage().getImplementationVersion();
- isFinalRelease = new
StringTokenizer(implementationVersion).nextToken().endsWith(".GA");
- }
- return implementationVersion;
- }
-
- public static boolean isFinalRelease()
- {
- getImplementationVersion();
- return isFinalRelease;
- }
-
- public String toString()
- {
- StringBuilder buffer = new StringBuilder("\nUnifiedMetaData: ");
- buffer.append("\n implementation: " + getImplementationVersion());
- buffer.append("\n securityDomain: " + getSecurityDomain());
- //buffer.append("\n resourceLoader: " + resourceLoader);
- //buffer.append("\n classLoader: " + classLoader);
- buffer.append("\n");
-
- for (ServiceMetaData serviceMetaData : services)
- {
- buffer.append(serviceMetaData);
- }
- return buffer.toString();
- }
-}
\ No newline at end of file
Modified:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/config/WSCommonConfig.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/config/WSCommonConfig.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/config/WSCommonConfig.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -25,9 +25,9 @@
import java.util.List;
-import org.jboss.ws.metadata.EndpointMetaData;
-import org.jboss.ws.metadata.HandlerMetaData;
-import org.jboss.ws.metadata.HandlerMetaData.HandlerType;
+import org.jboss.ws.metadata.umdm.EndpointMetaData;
+import org.jboss.ws.metadata.umdm.HandlerMetaData;
+import org.jboss.ws.metadata.umdm.HandlerMetaData.HandlerType;
/**
* A common configuration
Modified:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/config/jaxrpc/WSCommonConfigJAXRPC.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/config/jaxrpc/WSCommonConfigJAXRPC.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/config/jaxrpc/WSCommonConfigJAXRPC.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -24,12 +24,12 @@
import java.util.ArrayList;
import java.util.List;
-import org.jboss.ws.metadata.EndpointMetaData;
-import org.jboss.ws.metadata.HandlerMetaData;
-import org.jboss.ws.metadata.HandlerMetaData.HandlerType;
import org.jboss.ws.metadata.config.WSCommonConfig;
import org.jboss.ws.metadata.j2ee.UnifiedHandlerMetaData;
import org.jboss.ws.metadata.jsr181.HandlerChainMetaData;
+import org.jboss.ws.metadata.umdm.EndpointMetaData;
+import org.jboss.ws.metadata.umdm.HandlerMetaData;
+import org.jboss.ws.metadata.umdm.HandlerMetaData.HandlerType;
// $Id$
Modified:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/config/jaxrpc/WSConfigFactoryJAXRPC.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/config/jaxrpc/WSConfigFactoryJAXRPC.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/config/jaxrpc/WSConfigFactoryJAXRPC.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -26,10 +26,10 @@
import java.util.List;
import org.jboss.logging.Logger;
-import org.jboss.ws.metadata.HandlerMetaData.HandlerType;
-import org.jboss.ws.metadata.HandlerMetaData.HandlerInitParam;
import org.jboss.ws.metadata.j2ee.UnifiedHandlerMetaData;
import org.jboss.ws.metadata.jsr181.HandlerChainMetaData;
+import org.jboss.ws.metadata.umdm.HandlerMetaData.HandlerInitParam;
+import org.jboss.ws.metadata.umdm.HandlerMetaData.HandlerType;
import org.jboss.xb.binding.ObjectModelFactory;
import org.jboss.xb.binding.UnmarshallingContext;
import org.xml.sax.Attributes;
Modified:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/config/jaxrpc/WSEndpointConfigJAXRPC.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/config/jaxrpc/WSEndpointConfigJAXRPC.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/config/jaxrpc/WSEndpointConfigJAXRPC.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -24,11 +24,11 @@
import java.util.ArrayList;
import java.util.List;
-import org.jboss.ws.metadata.EndpointMetaData;
-import org.jboss.ws.metadata.HandlerMetaData;
-import org.jboss.ws.metadata.HandlerMetaData.HandlerType;
import org.jboss.ws.metadata.j2ee.UnifiedHandlerMetaData;
import org.jboss.ws.metadata.jsr181.HandlerChainMetaData;
+import org.jboss.ws.metadata.umdm.EndpointMetaData;
+import org.jboss.ws.metadata.umdm.HandlerMetaData;
+import org.jboss.ws.metadata.umdm.HandlerMetaData.HandlerType;
// $Id$
Modified:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/j2ee/UnifiedHandlerMetaData.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/j2ee/UnifiedHandlerMetaData.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/j2ee/UnifiedHandlerMetaData.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -31,11 +31,11 @@
import javax.xml.namespace.QName;
-import org.jboss.ws.metadata.EndpointMetaData;
-import org.jboss.ws.metadata.HandlerMetaDataJAXRPC;
-import org.jboss.ws.metadata.HandlerMetaData.HandlerInitParam;
-import org.jboss.ws.metadata.HandlerMetaData.HandlerType;
import org.jboss.ws.metadata.jsr181.HandlerChainMetaData;
+import org.jboss.ws.metadata.umdm.EndpointMetaData;
+import org.jboss.ws.metadata.umdm.HandlerMetaDataJAXRPC;
+import org.jboss.ws.metadata.umdm.HandlerMetaData.HandlerInitParam;
+import org.jboss.ws.metadata.umdm.HandlerMetaData.HandlerType;
/**
* The container independent metdata data for a handler element
Modified:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/jsr181/HandlerChainFactory.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/jsr181/HandlerChainFactory.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/jsr181/HandlerChainFactory.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -24,9 +24,9 @@
// $Id$
import org.jboss.logging.Logger;
-import org.jboss.ws.metadata.HandlerMetaData.HandlerType;
-import org.jboss.ws.metadata.HandlerMetaData.HandlerInitParam;
import org.jboss.ws.metadata.j2ee.UnifiedHandlerMetaData;
+import org.jboss.ws.metadata.umdm.HandlerMetaData.HandlerInitParam;
+import org.jboss.ws.metadata.umdm.HandlerMetaData.HandlerType;
import org.jboss.xb.binding.ObjectModelFactory;
import org.jboss.xb.binding.UnmarshallingContext;
import org.xml.sax.Attributes;
Modified:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/jsr181/HandlerChainMetaData.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/jsr181/HandlerChainMetaData.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/jsr181/HandlerChainMetaData.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -29,8 +29,8 @@
import javax.xml.namespace.QName;
import org.jboss.logging.Logger;
-import org.jboss.ws.metadata.HandlerMetaData.HandlerType;
import org.jboss.ws.metadata.j2ee.UnifiedHandlerMetaData;
+import org.jboss.ws.metadata.umdm.HandlerMetaData.HandlerType;
/**
* XML Binding element for handler-config/handler-chain elements
Modified:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/jsr181/HandlerChainsMetaData.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/jsr181/HandlerChainsMetaData.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/jsr181/HandlerChainsMetaData.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -26,7 +26,7 @@
import java.util.ArrayList;
-import org.jboss.ws.metadata.HandlerMetaData.HandlerType;
+import org.jboss.ws.metadata.umdm.HandlerMetaData.HandlerType;
/**
* XML Binding root element for JSR-181 HandlerChain
Copied:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/umdm/ClientEndpointMetaData.java
(from rev 1600,
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/ClientEndpointMetaData.java)
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/ClientEndpointMetaData.java 2006-12-07
10:43:36 UTC (rev 1600)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/umdm/ClientEndpointMetaData.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -0,0 +1,155 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ws.metadata.umdm;
+
+// $Id$
+
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.WSException;
+import org.jboss.ws.metadata.config.WSConfigFactory;
+import org.jboss.ws.metadata.config.jaxrpc.WSConfigRootJAXRPC;
+import org.jboss.ws.metadata.umdm.EndpointMetaData.Type;
+import org.jboss.ws.metadata.umdm.HandlerMetaData.HandlerType;
+
+/**
+ * Client side endpoint meta data.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 12-May-2005
+ */
+public class ClientEndpointMetaData extends EndpointMetaData
+{
+ // provide logging
+ private static Logger log = Logger.getLogger(ClientEndpointMetaData.class);
+
+ public ClientEndpointMetaData(ServiceMetaData service, QName portName, Type type)
+ {
+ super(service, portName, type);
+ }
+
+ public void setConfigName(String configName)
+ {
+ super.setConfigName(configName);
+ endpointConfig = null;
+ }
+
+ public void setConfigFile(String configFile)
+ {
+ super.setConfigFile(configFile);
+ endpointConfig = null;
+ }
+
+ @Override
+ public Object getEndpointConfig()
+ {
+ if (endpointConfig == null)
+ {
+ String configName = getConfigName();
+ if (configName == null)
+ {
+ configName = "Standard Client";
+ setConfigName(configName);
+ }
+
+ String configFile = getConfigFile();
+ if (configFile == null)
+ {
+ configFile = "META-INF/standard-jaxrpc-client-config.xml";
+ setConfigFile(configFile);
+ }
+
+ log.debug("getClientConfig: [name=" + configName + ",url=" +
configFile + "]");
+
+ URL configURL = null;
+ try
+ {
+ configURL = new URL(configFile);
+ }
+ catch (MalformedURLException ex)
+ {
+ // ignore
+ }
+
+ // Try to get the URL as resource
+ if (configURL == null)
+ {
+ ClassLoader cl = Thread.currentThread().getContextClassLoader();
+ configURL = cl.getResource(configFile);
+ if (configURL == null)
+ throw new WSException("Cannot get resource: " + configFile);
+ }
+
+ // Get the config root
+ Object wsConfig;
+ try
+ {
+ WSConfigFactory factory = WSConfigFactory.newInstance();
+ wsConfig = factory.parseWithObjectModelFactory(configURL);
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (Exception ex)
+ {
+ throw new WSException("Cannot parse client config", ex);
+ }
+
+ // Get the client config
+ endpointConfig =
((WSConfigRootJAXRPC)wsConfig).getClientConfigByName(configName);
+ if (endpointConfig == null)
+ throw new WSException("Cannot obtain client config: " +
configName);
+ }
+
+ return endpointConfig;
+ }
+
+ public String toString()
+ {
+ StringBuilder buffer = new StringBuilder("\nClientEndpointMetaData:");
+ buffer.append("\n type=" + getType());
+ buffer.append("\n qname=" + getQName());
+ buffer.append("\n address=" + getEndpointAddress());
+ buffer.append("\n binding=" + getBindingId());
+ buffer.append("\n seiName=" + getServiceEndpointInterfaceName());
+ buffer.append("\n configFile=" + getConfigFile());
+ buffer.append("\n configName=" + getConfigName());
+ buffer.append("\n authMethod=" + getAuthMethod());
+ buffer.append("\n transportGuarantee=" + getTransportGuarantee());
+ buffer.append("\n properties=" + getProperties());
+
+ for (OperationMetaData opMetaData : getOperations())
+ {
+ buffer.append("\n" + opMetaData);
+ }
+ for (HandlerMetaData hdlMetaData : getHandlerMetaData(HandlerType.ALL))
+ {
+ buffer.append("\n" + hdlMetaData);
+ }
+ return buffer.toString();
+ }
+}
Copied:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/umdm/EndpointMetaData.java
(from rev 1602,
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/EndpointMetaData.java)
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/EndpointMetaData.java 2006-12-07
11:54:16 UTC (rev 1602)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/umdm/EndpointMetaData.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -0,0 +1,485 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ws.metadata.umdm;
+
+// $Id$
+
+import java.lang.reflect.Method;
+import java.net.URLClassLoader;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+
+import javax.jws.soap.SOAPBinding.ParameterStyle;
+import javax.xml.namespace.QName;
+import javax.xml.rpc.ParameterMode;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.WSException;
+import org.jboss.ws.core.CommonSOAPBinding;
+import org.jboss.ws.core.jaxrpc.Style;
+import org.jboss.ws.core.jaxrpc.Use;
+import org.jboss.ws.metadata.config.WSCommonConfig;
+import org.jboss.ws.metadata.umdm.HandlerMetaData.HandlerType;
+
+/**
+ * A Service component describes a set of endpoints.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 12-May-2005
+ */
+public abstract class EndpointMetaData extends ExtensibleMetaData
+{
+ // provide logging
+ private static Logger log = Logger.getLogger(EndpointMetaData.class);
+
+ public enum Type
+ {
+ JAXRPC, JAXWS
+ }
+
+ // The parent meta data.
+ private ServiceMetaData serviceMetaData;
+
+ // The REQUIRED endpoint config
+ protected WSCommonConfig endpointConfig;
+
+ // The REQUIRED name
+ private QName portName;
+ // The REQUIRED binding id
+ private String bindingId;
+ // The REQUIRED config-name
+ private String configName;
+ // The REQUIRED config-file
+ private String configFile;
+ // The endpoint address
+ private String endpointAddress;
+ // The endpoint interface name
+ private String seiName;
+ // The endpoint interface
+ private Class seiClass;
+ // The optional authentication method
+ private String authMethod;
+ // The optional transport guarantee
+ private String transportGuarantee;
+ // Arbitrary properties given by <call-property>
+ private Properties properties;
+ // The SOAPBinding style
+ private Style style;
+ // The SOAPBinding use
+ private Use use;
+ // The SOAPBinding parameter style
+ private ParameterStyle parameterStyle;
+ // Whether the endpoint was deployed from annotations
+ private Type type;
+ // The list of service meta data
+ private List<OperationMetaData> operations = new
ArrayList<OperationMetaData>();
+ // The optional handlers
+ private List<HandlerMetaData> handlers = new
ArrayList<HandlerMetaData>();
+ // True if the handlers are initialized
+ private boolean handlersInitialized;
+ // Maps the java method to the operation meta data
+ private Map<Method, OperationMetaData> opMetaDataCache = new HashMap<Method,
OperationMetaData>();
+
+ public EndpointMetaData(ServiceMetaData service, QName portName, Type type)
+ {
+ this.serviceMetaData = service;
+ this.portName = portName;
+ this.type = type;
+
+ // The default binding
+ this.bindingId = CommonSOAPBinding.SOAP11HTTP_BINDING;
+ }
+
+ public ServiceMetaData getServiceMetaData()
+ {
+ return serviceMetaData;
+ }
+
+ public QName getQName()
+ {
+ return portName;
+ }
+
+ public String getConfigFile()
+ {
+ return configFile;
+ }
+
+ public void setConfigFile(String configFile)
+ {
+ this.configFile = configFile;
+ this.endpointConfig = null;
+ }
+
+ public String getConfigName()
+ {
+ return configName;
+ }
+
+ public void setConfigName(String configName)
+ {
+ this.configName = configName;
+ this.endpointConfig = null;
+ }
+
+ public abstract Object getEndpointConfig();
+
+ public String getEndpointAddress()
+ {
+ return endpointAddress;
+ }
+
+ public void setEndpointAddress(String endpointAddress)
+ {
+ this.endpointAddress = endpointAddress;
+ }
+
+ public String getBindingId()
+ {
+ return bindingId;
+ }
+
+ public void setBindingId(String bindingId)
+ {
+ if (!CommonSOAPBinding.SOAP11HTTP_BINDING.equals(bindingId) &&
!CommonSOAPBinding.SOAP12HTTP_BINDING.equals(bindingId))
+ throw new WSException("Unsupported binding: " + bindingId);
+ this.bindingId = bindingId;
+ }
+
+ public String getServiceEndpointInterfaceName()
+ {
+ return seiName;
+ }
+
+ public void setServiceEndpointInterfaceName(String seiName)
+ {
+ this.seiName = seiName;
+ this.seiClass = null;
+
+ UnifiedMetaData wsMetaData = serviceMetaData.getUnifiedMetaData();
+ if (wsMetaData.isEagerInitialized())
+ {
+ if (UnifiedMetaData.isFinalRelease() == false)
+ log.warn("Set SEI name after eager initialization", new
IllegalStateException());
+
+ // reinitialize
+ initializeInternal();
+ }
+ }
+
+ /** Get the class loader associated with the endpoint meta data */
+ public ClassLoader getClassLoader()
+ {
+ ClassLoader classLoader =
getServiceMetaData().getUnifiedMetaData().getClassLoader();
+ return classLoader;
+ }
+
+ /** Get the resource loader associated with the endpoint meta data */
+ public URLClassLoader getResourceLoader()
+ {
+ URLClassLoader classLoader =
getServiceMetaData().getUnifiedMetaData().getResourceLoader();
+ return classLoader;
+ }
+
+ /**
+ * Load the service endpoint interface.
+ * It should only be cached during eager initialization.
+ */
+ public Class getServiceEndpointInterface()
+ {
+ Class tmpClass = seiClass;
+ if (tmpClass == null && seiName != null)
+ {
+ try
+ {
+ ClassLoader classLoader = getClassLoader();
+ tmpClass = classLoader.loadClass(seiName);
+ if (serviceMetaData.getUnifiedMetaData().isEagerInitialized())
+ {
+ log.warn("Loading SEI after eager initialization");
+ seiClass = tmpClass;
+ }
+ }
+ catch (ClassNotFoundException ex)
+ {
+ throw new WSException("Cannot load service endpoint interface: " +
seiName, ex);
+ }
+ }
+ return tmpClass;
+ }
+
+ public Use getEncodingStyle()
+ {
+ if (use == null)
+ {
+ use = Use.getDefaultUse();
+ log.debug("Using default encoding style: " + use);
+ }
+ return use;
+ }
+
+ public void setEncodingStyle(Use value)
+ {
+ if (value != null && use != null && !use.equals(value))
+ throw new WSException("Mixed encoding styles not supported");
+
+ log.trace("setEncodingStyle: " + value);
+ this.use = value;
+ }
+
+ public Style getStyle()
+ {
+ if (style == null)
+ {
+ style = Style.getDefaultStyle();
+ log.debug("Using default style: " + style);
+ }
+ return style;
+ }
+
+ public void setStyle(Style value)
+ {
+ if (value != null && style != null && !style.equals(value))
+ throw new WSException("Mixed styles not supported");
+
+ log.trace("setStyle: " + value);
+ this.style = value;
+ }
+
+ public ParameterStyle getParameterStyle()
+ {
+ if (parameterStyle == null)
+ {
+ parameterStyle = ParameterStyle.WRAPPED;
+ log.debug("Using default parameter style: " + parameterStyle);
+ }
+ return parameterStyle;
+ }
+
+ public void setParameterStyle(ParameterStyle value)
+ {
+ if (value != null && parameterStyle != null &&
!parameterStyle.equals(value))
+ throw new WSException("Mixed SOAP parameter styles not supported");
+
+ log.debug("setParameterStyle: " + value);
+ this.parameterStyle = value;
+ }
+
+ public Type getType()
+ {
+ return type;
+ }
+
+ public String getAuthMethod()
+ {
+ return authMethod;
+ }
+
+ public void setAuthMethod(String authMethod)
+ {
+ this.authMethod = authMethod;
+ }
+
+ public String getTransportGuarantee()
+ {
+ return transportGuarantee;
+ }
+
+ public void setTransportGuarantee(String transportGuarantee)
+ {
+ this.transportGuarantee = transportGuarantee;
+ }
+
+ public Properties getProperties()
+ {
+ return properties;
+ }
+
+ public void setProperties(Properties properties)
+ {
+ this.properties = properties;
+ }
+
+ public List<OperationMetaData> getOperations()
+ {
+ return new ArrayList<OperationMetaData>(operations);
+ }
+
+ public OperationMetaData getOperation(QName xmlName)
+ {
+ OperationMetaData opMetaData = null;
+ for (OperationMetaData auxOperation : operations)
+ {
+ QName opQName = auxOperation.getQName();
+ if (opQName.equals(xmlName))
+ {
+ if (opMetaData == null)
+ {
+ opMetaData = auxOperation;
+ }
+ else
+ {
+ throw new WSException("Cannot uniquely indetify operation: " +
xmlName);
+ }
+ }
+ }
+
+ if (opMetaData == null && getStyle() == Style.DOCUMENT)
+ {
+ for (OperationMetaData auxOperation : operations)
+ {
+ ParameterMetaData paramMetaData = null;
+ for (ParameterMetaData auxParam : auxOperation.getParameters())
+ {
+ ParameterMode mode = auxParam.getMode();
+ if (auxParam.isInHeader() == false && mode == ParameterMode.IN)
+ {
+ paramMetaData = auxParam;
+ break;
+ }
+ }
+ if (paramMetaData != null &&
paramMetaData.getXmlName().equals(xmlName))
+ {
+ if (opMetaData == null)
+ {
+ opMetaData = auxOperation;
+ }
+ else
+ {
+ throw new WSException("Cannot uniquely indetify operation: "
+ xmlName);
+ }
+ }
+ }
+ }
+
+ return opMetaData;
+ }
+
+ public OperationMetaData getOperation(Method method)
+ {
+ if (opMetaDataCache.size() == 0)
+ {
+ // This can happen when the SEI mapping was not found
+ log.warn("Access to empty operation meta data cache,
reinitializing");
+ initializeInternal();
+ }
+ OperationMetaData opMetaData = opMetaDataCache.get(method);
+ return opMetaData;
+ }
+
+ public void addOperation(OperationMetaData opMetaData)
+ {
+ operations.add(opMetaData);
+ }
+
+ public void clearOperations()
+ {
+ operations.clear();
+ }
+
+ public void addHandlers(List<HandlerMetaData> configHandlers)
+ {
+ handlers.addAll(configHandlers);
+ }
+
+ public void addHandler(HandlerMetaData handler)
+ {
+ handlers.add(handler);
+ }
+
+ public void clearHandlers()
+ {
+ handlers.clear();
+ handlersInitialized = false;
+ }
+
+ public List<HandlerMetaData> getHandlerMetaData(HandlerType type)
+ {
+ List<HandlerMetaData> typeHandlers = new ArrayList<HandlerMetaData>();
+ for (HandlerMetaData hmd : handlers)
+ {
+ if (hmd.getHandlerType() == type || type == HandlerType.ALL)
+ typeHandlers.add(hmd);
+ }
+ return typeHandlers;
+ }
+
+ public boolean isHandlersInitialized()
+ {
+ return handlersInitialized;
+ }
+
+ public void setHandlersInitialized(boolean flag)
+ {
+ this.handlersInitialized = flag;
+ }
+
+ public void validate()
+ {
+ for (HandlerMetaData handler : handlers)
+ handler.validate();
+
+ for (OperationMetaData opMetaData : operations)
+ opMetaData.validate();
+ }
+
+ /**
+ * @see UnifiedMetaData#eagerInitialize()
+ */
+ public void eagerInitialize()
+ {
+ initializeInternal();
+ }
+
+ private void initializeInternal()
+ {
+ // reset sei class
+ seiClass = null;
+
+ // Initialize handlers
+ for (HandlerMetaData handler : handlers)
+ handler.eagerInitialize();
+
+ // Initialize operations
+ seiClass = getServiceEndpointInterface();
+ if (seiClass != null)
+ {
+ List<Method> unsynchronizedMethods = new ArrayList<Method>();
+ unsynchronizedMethods.addAll(Arrays.asList(seiClass.getMethods()));
+
+ for (OperationMetaData opMetaData : operations)
+ {
+ opMetaData.eagerInitialize(unsynchronizedMethods);
+ Method method = opMetaData.getJavaMethod();
+ if (method != null)
+ {
+ opMetaDataCache.put(method, opMetaData);
+ unsynchronizedMethods.remove(method);
+ }
+ }
+ }
+ }
+}
Copied:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/umdm/ExtensibleMetaData.java
(from rev 1600,
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/ExtensibleMetaData.java)
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/ExtensibleMetaData.java 2006-12-07
10:43:36 UTC (rev 1600)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/umdm/ExtensibleMetaData.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -0,0 +1,29 @@
+package org.jboss.ws.metadata.umdm;
+
+import java.util.Map;
+import java.util.HashMap;
+
+
+/**
+ * Base class for UMD elements that are extensible.
+ *
+ * @author Heiko Braun, <heiko(a)openj.net>
+ * @since 21-Mar-2006
+ */
+public abstract class ExtensibleMetaData {
+
+ private Map<String, MetaDataExtension> extensions = new HashMap<String,
MetaDataExtension>();
+
+ public Map<String, MetaDataExtension> getExtensions() {
+ return extensions;
+ }
+
+ public void addExtension(MetaDataExtension ext) {
+ getExtensions().put(ext.getExtensionNameSpace(), ext);
+ }
+
+ public MetaDataExtension getExtension(String namespace) {
+ return getExtensions().get(namespace);
+ }
+
+}
Copied:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/umdm/FaultMetaData.java
(from rev 1600,
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/FaultMetaData.java)
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/FaultMetaData.java 2006-12-07
10:43:36 UTC (rev 1600)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/umdm/FaultMetaData.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -0,0 +1,134 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+package org.jboss.ws.metadata.umdm;
+
+// $Id$
+
+import javax.xml.namespace.QName;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.WSException;
+import org.jboss.ws.core.utils.JavaUtils;
+
+/**
+ * A Fault component describes a fault that a given operation supports.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @author jason.greene(a)jboss.com
+ * @since 12-May-2005
+ */
+public class FaultMetaData
+{
+ // provide logging
+ private final Logger log = Logger.getLogger(FaultMetaData.class);
+
+ // The parent operation
+ private OperationMetaData opMetaData;
+
+ private QName xmlName;
+ private QName xmlType;
+ private String javaTypeName;
+ private Class javaType;
+
+ public FaultMetaData(OperationMetaData operation, QName xmlName, QName xmlType, String
javaTypeName)
+ {
+ if (xmlName == null)
+ throw new IllegalArgumentException("Invalid null xmlName argument");
+ if (xmlType == null)
+ throw new IllegalArgumentException("Invalid null xmlType argument, for:
" + xmlName);
+ if (javaTypeName == null)
+ throw new IllegalArgumentException("Invalid null javaTypeName argument,
for: " + xmlName);
+
+ this.opMetaData = operation;
+ this.xmlName = xmlName;
+ this.xmlType = xmlType;
+ this.javaTypeName = javaTypeName;
+ }
+
+ public OperationMetaData getOperationMetaData()
+ {
+ return opMetaData;
+ }
+
+ public QName getXmlName()
+ {
+ return xmlName;
+ }
+
+ public QName getXmlType()
+ {
+ return xmlType;
+ }
+
+ public String getJavaTypeName()
+ {
+ return javaTypeName;
+ }
+
+ /** Load the java type.
+ * It should only be cached during eager initialization.
+ */
+ public Class getJavaType()
+ {
+ Class tmpJavaType = javaType;
+ if (tmpJavaType == null && javaTypeName != null)
+ {
+ try
+ {
+ ClassLoader loader = opMetaData.getEndpointMetaData().getClassLoader();
+ tmpJavaType = JavaUtils.loadJavaType(javaTypeName, loader);
+
+ if
(opMetaData.getEndpointMetaData().getServiceMetaData().getUnifiedMetaData().isEagerInitialized())
+ {
+ log.warn("Loading java type after eager initialization");
+ javaType = tmpJavaType;
+ }
+ }
+ catch (ClassNotFoundException ex)
+ {
+ throw new WSException("Cannot load java type: " + javaTypeName,
ex);
+ }
+ }
+ return tmpJavaType;
+ }
+
+ public void validate()
+ {
+ // nothing to do
+ }
+
+ public void eagerInitialize()
+ {
+ javaType = getJavaType();
+ if (javaType == null)
+ throw new WSException("Cannot load java type: " + javaTypeName);
+ }
+
+ public String toString()
+ {
+ StringBuilder buffer = new StringBuilder("\nFaultMetaData");
+ buffer.append("\n xmlName=" + xmlName);
+ buffer.append("\n xmlType=" + xmlType);
+ buffer.append("\n javaType=" + javaTypeName);
+ return buffer.toString();
+ }
+}
\ No newline at end of file
Copied:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/umdm/HandlerMetaData.java
(from rev 1600,
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/HandlerMetaData.java)
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/HandlerMetaData.java 2006-12-07
10:43:36 UTC (rev 1600)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/umdm/HandlerMetaData.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -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.metadata.umdm;
+
+// $Id:HandlerMetaData.java 915 2006-09-08 08:40:45Z thomas.diesler(a)jboss.com $
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.WSException;
+import org.jboss.ws.extensions.security.jaxrpc.WSSecurityHandlerInbound;
+import org.jboss.ws.extensions.security.jaxrpc.WSSecurityHandlerOutbound;
+
+/**
+ * The common metdata data for a handler element
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 05-May-2006
+ */
+public abstract class HandlerMetaData implements Serializable
+{
+ // provide logging
+ private static final Logger log = Logger.getLogger(HandlerMetaData.class);
+
+ public enum HandlerType
+ {
+ PRE, ENDPOINT, POST, ALL
+ };
+
+ private transient EndpointMetaData epMetaData;
+
+ // The required <handler-name> element
+ private String handlerName;
+ // The required <handler-class> element
+ private String handlerClassName;
+ // The required handler type
+ private HandlerType handlerType;
+ // The optional <soap-header> elements
+ private Set<QName> soapHeaders = new HashSet<QName>();
+ // The optional <init-param> elements
+ private List<HandlerInitParam> initParams = new
ArrayList<HandlerInitParam>();
+ // The cached handler class
+ private Class handlerClass;
+
+ public HandlerMetaData(EndpointMetaData epMetaData, HandlerType type)
+ {
+ this.epMetaData = epMetaData;
+ this.handlerType = type;
+ }
+
+ public void setEndpointMetaData(EndpointMetaData epMetaData)
+ {
+ this.epMetaData = epMetaData;
+ }
+
+ public EndpointMetaData getEndpointMetaData()
+ {
+ return epMetaData;
+ }
+
+ public void setHandlerName(String value)
+ {
+ this.handlerName = value;
+ }
+
+ public String getHandlerName()
+ {
+ return handlerName;
+ }
+
+ public void setHandlerClassName(String handlerClassName)
+ {
+ this.handlerClassName = handlerClassName;
+ }
+
+ public String getHandlerClassName()
+ {
+ return handlerClassName;
+ }
+
+ public Class getHandlerClass()
+ {
+ if (handlerClassName == null)
+ throw new IllegalStateException("Handler class name cannot be null");
+
+ Class localClass = handlerClass;
+ if (localClass == null)
+ {
+ try
+ {
+ ClassLoader loader = epMetaData.getClassLoader();
+ localClass = loader.loadClass(handlerClassName);
+ }
+ catch (ClassNotFoundException ex)
+ {
+ throw new WSException("Cannot load handler: " + handlerClassName,
ex);
+ }
+ }
+ return localClass;
+ }
+
+ public HandlerType getHandlerType()
+ {
+ return handlerType;
+ }
+
+ public void setSoapHeaders(Set<QName> soapHeaders)
+ {
+ this.soapHeaders = soapHeaders;
+ }
+
+ public Set<QName> getSoapHeaders()
+ {
+ return soapHeaders;
+ }
+
+ public void seiInitParams(List<HandlerInitParam> initParams)
+ {
+ this.initParams = initParams;
+ }
+
+ public List<HandlerInitParam> getInitParams()
+ {
+ return initParams;
+ }
+
+ public void validate()
+ {
+ List<String> securityHandlers = new ArrayList<String>();
+ securityHandlers.add(WSSecurityHandlerInbound.class.getName());
+ securityHandlers.add(WSSecurityHandlerOutbound.class.getName());
+
+ if (securityHandlers.contains(handlerClassName))
+ {
+ if (epMetaData.getServiceMetaData().getSecurityConfiguration() == null)
+ log.warn("WS-Security requires security configuration");
+ }
+ }
+
+ public void eagerInitialize()
+ {
+ handlerClass = getHandlerClass();
+ }
+
+ public static class HandlerInitParam implements Serializable
+ {
+ private static final long serialVersionUID = -8687875291620457318L;
+
+ // The required <handler-name> element
+ private String paramName;
+ // The required <handler-class> element
+ private String paramValue;
+
+ public String getParamName()
+ {
+ return paramName;
+ }
+
+ public void setParamName(String paramName)
+ {
+ this.paramName = paramName;
+ }
+
+ public String getParamValue()
+ {
+ return paramValue;
+ }
+
+ public void setParamValue(String paramValue)
+ {
+ this.paramValue = paramValue;
+ }
+
+ public String toString()
+ {
+ return "[name=" + paramName + ",value=" + paramValue +
"]";
+ }
+ }
+}
Copied:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/umdm/HandlerMetaDataJAXRPC.java
(from rev 1600,
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/HandlerMetaDataJAXRPC.java)
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/HandlerMetaDataJAXRPC.java 2006-12-07
10:43:36 UTC (rev 1600)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/umdm/HandlerMetaDataJAXRPC.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -0,0 +1,84 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ws.metadata.umdm;
+
+//$Id:HandlerMetaDataJAXRPC.java 915 2006-09-08 08:40:45Z thomas.diesler(a)jboss.com $
+
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.xml.namespace.QName;
+
+
+/**
+ * The JAXRPC metdata data for a handler element
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 05-May-2006
+ */
+public class HandlerMetaDataJAXRPC extends HandlerMetaData
+{
+ private static final long serialVersionUID = -5232305815202943509L;
+
+ // The optional <soap-role> elements
+ private Set<String> soapRoles = new HashSet<String>();
+ // The optional <port-name> elements
+ private Set<String> portNames = new HashSet<String>();
+
+ public HandlerMetaDataJAXRPC(EndpointMetaData epMetaData, HandlerType type)
+ {
+ super(epMetaData, type);
+ }
+
+ public void setSoapRoles(Set<String> soapRoles)
+ {
+ this.soapRoles = soapRoles;
+ }
+
+ public Set<String> getSoapRoles()
+ {
+ return soapRoles;
+ }
+
+ public void setPortNames(Set<String> portNames)
+ {
+ this.portNames = portNames;
+ }
+
+ public Set<String> getPortNames()
+ {
+ return portNames;
+ }
+
+ public String toString()
+ {
+ StringBuffer buffer = new StringBuffer("\nHandlerMetaDataJAXRPC:");
+ buffer.append("\n type=" + getHandlerType());
+ buffer.append("\n name=" + getHandlerName());
+ buffer.append("\n class=" + getHandlerClassName());
+ buffer.append("\n params=" + getInitParams());
+ buffer.append("\n headers=" + getSoapHeaders());
+ buffer.append("\n roles=" + getSoapRoles());
+ buffer.append("\n ports=" + getPortNames());
+ return buffer.toString();
+ }
+}
Copied:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/umdm/MetaDataExtension.java
(from rev 1600,
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/MetaDataExtension.java)
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/MetaDataExtension.java 2006-12-07
10:43:36 UTC (rev 1600)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/umdm/MetaDataExtension.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -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.metadata.umdm;
+
+// $Id$
+
+/**
+ * Operation metaData extension.
+ *
+ * @author Heiko Braun, <heiko(a)openj.net>
+ * @since 17-Mar-2006
+ */
+public abstract class MetaDataExtension
+{
+ private String extensionNameSpace;
+
+ public MetaDataExtension(String extensionNameSpace)
+ {
+ this.extensionNameSpace = extensionNameSpace;
+ }
+
+ public String getExtensionNameSpace()
+ {
+ return extensionNameSpace;
+ }
+}
Copied:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/umdm/OperationMetaData.java
(from rev 1600,
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/OperationMetaData.java)
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/OperationMetaData.java 2006-12-07
10:43:36 UTC (rev 1600)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/umdm/OperationMetaData.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -0,0 +1,600 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ws.metadata.umdm;
+
+// $Id$
+
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.jws.soap.SOAPBinding.ParameterStyle;
+import javax.xml.namespace.QName;
+import javax.xml.rpc.ParameterMode;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.WSException;
+import org.jboss.ws.core.jaxrpc.ParameterWrapping;
+import org.jboss.ws.core.jaxrpc.Style;
+import org.jboss.ws.core.jaxrpc.TypeMappingImpl;
+import org.jboss.ws.core.jaxrpc.Use;
+import org.jboss.ws.core.utils.HolderUtils;
+import org.jboss.ws.core.utils.JavaUtils;
+import org.jboss.ws.metadata.umdm.EndpointMetaData.Type;
+import org.w3c.dom.Element;
+
+/**
+ * An Operation component describes an operation that a given interface supports.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @author <a href="mailto:jason.greene@jboss.com">Jason T.
Greene</a>
+ * @since 12-May-2004
+ */
+public class OperationMetaData extends ExtensibleMetaData
+{
+ // provide logging
+ private final Logger log = Logger.getLogger(OperationMetaData.class);
+
+ // The parent interface
+ private EndpointMetaData epMetaData;
+
+ private QName qname;
+ private QName responseName;
+ private String javaName;
+ private Method javaMethod;
+ private boolean oneWay;
+ private String soapAction;
+ private List<ParameterMetaData> parameters = new
ArrayList<ParameterMetaData>();
+ private List<FaultMetaData> faults = new ArrayList<FaultMetaData>();
+ private ParameterMetaData returnParam;
+
+ public OperationMetaData(QName qname, String javaName)
+ {
+ UnifiedMetaData umd = new UnifiedMetaData();
+ ServiceMetaData smd = new ServiceMetaData(umd, new
QName("mock-service"));
+ ServerEndpointMetaData epmd = new ServerEndpointMetaData(smd, new
QName("mock-endpoint"), Type.JAXRPC);
+ initOperationMetaData(epmd, qname, javaName);
+ }
+
+ public OperationMetaData(EndpointMetaData epMetaData, QName qname, String javaName)
+ {
+ log.trace("new OperationMetaData: [xmlName=" + qname +
",javaName=" + javaName + "]");
+ initOperationMetaData(epMetaData, qname, javaName);
+ }
+
+ private void initOperationMetaData(EndpointMetaData epMetaData, QName qname, String
javaName)
+ {
+ this.epMetaData = epMetaData;
+ this.qname = qname;
+ this.javaName = javaName;
+
+ if (qname == null)
+ throw new IllegalArgumentException("Invalid null qname argument");
+ if (javaName == null)
+ throw new IllegalArgumentException("Invalid null javaName argument, for:
" + qname);
+
+ String nsURI = qname.getNamespaceURI();
+ String localPart = qname.getLocalPart();
+ this.responseName = new QName(nsURI, localPart + "Response");
+ }
+
+ public EndpointMetaData getEndpointMetaData()
+ {
+ return epMetaData;
+ }
+
+ public QName getQName()
+ {
+ return qname;
+ }
+
+ public QName getResponseName()
+ {
+ return responseName;
+ }
+
+ public String getSOAPAction()
+ {
+ return soapAction;
+ }
+
+ public void setSOAPAction(String soapAction)
+ {
+ this.soapAction = soapAction;
+ }
+
+ public Style getStyle()
+ {
+ return epMetaData.getStyle();
+ }
+
+ public Use getUse()
+ {
+ return epMetaData.getEncodingStyle();
+ }
+
+ public ParameterStyle getParameterStyle()
+ {
+ return epMetaData.getParameterStyle();
+ }
+
+ public boolean isRPCLiteral()
+ {
+ return getStyle() == Style.RPC && getUse() == Use.LITERAL;
+ }
+
+ public boolean isRPCEncoded()
+ {
+ return getStyle() == Style.RPC && getUse() == Use.ENCODED;
+ }
+
+ public boolean isDocumentBare()
+ {
+ return getStyle() == Style.DOCUMENT && getParameterStyle() ==
ParameterStyle.BARE;
+ }
+
+ public boolean isDocumentWrapped()
+ {
+ return getStyle() == Style.DOCUMENT && getParameterStyle() ==
ParameterStyle.WRAPPED;
+ }
+
+ public String getJavaName()
+ {
+ return javaName;
+ }
+
+ public Method getJavaMethod()
+ {
+ Method tmpMethod = javaMethod;
+ Class seiClass = epMetaData.getServiceEndpointInterface();
+ if (tmpMethod == null && seiClass != null)
+ {
+ for (Method method : seiClass.getMethods())
+ {
+ if (isJavaMethod(method))
+ {
+ tmpMethod = method;
+
+ UnifiedMetaData wsMetaData =
epMetaData.getServiceMetaData().getUnifiedMetaData();
+ if (wsMetaData.isEagerInitialized())
+ {
+ if (UnifiedMetaData.isFinalRelease() == false)
+ log.warn("Loading java method after eager initialization",
new IllegalStateException());
+
+ javaMethod = method;
+ }
+
+ break;
+ }
+ }
+
+ if (tmpMethod == null)
+ throw new WSException("Cannot find java method: " + javaName);
+ }
+ return tmpMethod;
+ }
+
+ public boolean isJavaMethod(Method method)
+ {
+ boolean isJavaMethod = method.equals(javaMethod);
+ if (isJavaMethod == false)
+ {
+ String methodName = method.getName();
+ Class[] methodTypes = method.getParameterTypes();
+ Class returnType = method.getReturnType();
+
+ if (javaName.equals(methodName))
+ {
+ log.trace("Found java method: " + method);
+
+ // match document/literal/wrapped
+ if (isDocumentWrapped())
+ {
+ if (ParameterWrapping.matchRequestParameters(this, methodTypes) &&
ParameterWrapping.matchResponseParameters(this, returnType))
+ {
+ log.debug("Found wrapped java method: " + method);
+ isJavaMethod = true;
+ }
+ }
+ else
+ {
+ // Match the return parameter
+ ParameterMetaData returnMetaData = getReturnParameter();
+ if (returnMetaData != null)
+ {
+ if (!matchParameter(returnMetaData, returnType, true) &&
!matchParameter(returnMetaData, returnType, false))
+ {
+ log.debug("Unmatched return meta data: " + returnType);
+ }
+ }
+ else
+ {
+ if (returnType != void.class)
+ {
+ log.debug("Unmatched return meta data: " + returnType);
+ }
+ }
+
+ // compare params by java type name
+ if (compareMethodParams(methodTypes, true))
+ {
+ log.debug("Found best matching java method: " + method);
+ isJavaMethod = true;
+ }
+
+ // compare params by assignability
+ else if (compareMethodParams(methodTypes, false))
+ {
+ log.debug("Found possible matching java method: " + method);
+ isJavaMethod = true;
+ }
+ }
+ }
+ }
+
+ if (log.isTraceEnabled())
+ log.trace("Synchronized java method:\n" + method + "\nwith:
" + toString());
+
+ return isJavaMethod;
+ }
+
+ /** Return true if this is a generic message style destination that takes a
org.w3c.dom.Element
+ */
+ public boolean isMessageEndpoint()
+ {
+ boolean isMessageEndpoint = false;
+ if (parameters.size() == 1)
+ {
+ ParameterMetaData inParam = parameters.get(0);
+ if (JavaUtils.isAssignableFrom(Element.class, inParam.getJavaType()))
+ {
+ isMessageEndpoint = true;
+ }
+ }
+ return isMessageEndpoint;
+ }
+
+ private boolean compareMethodParams(Class[] methodParams, boolean matchByTypeName)
+ {
+ log.trace("Compare method params by type name: " + matchByTypeName);
+
+ boolean pass = (parameters.size() == methodParams.length);
+ if (pass == false)
+ log.trace("Unmatched parameter count: " + parameters.size() +
"!=" + methodParams.length);
+
+ for (int i = 0; pass && i < methodParams.length; i++)
+ {
+ ParameterMetaData paramMetaData = parameters.get(i);
+ pass = matchParameter(paramMetaData, methodParams[i], matchByTypeName);
+ }
+ return pass;
+ }
+
+ private boolean matchParameter(ParameterMetaData paramMetaData, Class methodParam,
boolean matchByTypeName)
+ {
+ QName xmlType = paramMetaData.getXmlType();
+ String javaType = paramMetaData.getJavaTypeName();
+
+ boolean pass = true;
+ if (paramMetaData != returnParam && paramMetaData.getMode() !=
ParameterMode.IN)
+ {
+ if (HolderUtils.isHolderType(methodParam))
+ {
+ methodParam = HolderUtils.getValueType(methodParam);
+ }
+ else
+ {
+ pass = false;
+ }
+ }
+
+ if (pass == true)
+ {
+ // In case the parameter java type has not been initialized
+ // This happens when the UMDM is build from WSDL only (i.e. JAXWS Service)
+ TypeMappingImpl typeMapping = epMetaData.getServiceMetaData().getTypeMapping();
+ if (javaType == null)
+ {
+ javaType = methodParam.getName();
+ paramMetaData.setJavaTypeName(javaType);
+ log.debug("Set parameter java type from method param: " +
javaType);
+ }
+
+ if (matchByTypeName)
+ {
+ pass = methodParam.getName().equals(javaType);
+ }
+ else
+ {
+ String paramTypeName = methodParam.getName();
+ Class paramType = paramMetaData.getJavaType();
+ pass = JavaUtils.isAssignableFrom(methodParam, paramType);
+
+ if (typeMapping.isRegistered(methodParam, xmlType))
+ {
+ log.debug("Adjust parameter type from " + paramType.getName() +
" to " + paramTypeName);
+ paramMetaData.setJavaTypeName(paramTypeName);
+ pass = true;
+ }
+ }
+ }
+
+ String name = (matchByTypeName) ? paramMetaData.getJavaTypeName() :
paramMetaData.getJavaType().getName();
+ log.trace((pass ? "Matched" : "Unmatched") + " parameter:
" + name + " == " + methodParam.getName());
+ return pass;
+ }
+
+ public boolean isOneWayOperation()
+ {
+ return oneWay;
+ }
+
+ public void setOneWayOperation(boolean oneWayOperation)
+ {
+ this.oneWay = oneWayOperation;
+ assertOneWayOperation();
+ }
+
+ public ParameterMetaData getParameter(QName xmlName)
+ {
+ ParameterMetaData paramMetaData = null;
+ for (int i = 0; paramMetaData == null && i < parameters.size(); i++)
+ {
+ ParameterMetaData aux = parameters.get(i);
+ if (xmlName.equals(aux.getXmlName()))
+ paramMetaData = aux;
+ }
+ return paramMetaData;
+ }
+
+ /** Get the IN or INOUT parameter list */
+ public List<ParameterMetaData> getInputParameters()
+ {
+ List<ParameterMetaData> retList = new ArrayList<ParameterMetaData>();
+ for (ParameterMetaData paramMetaData : parameters)
+ {
+ ParameterMode mode = paramMetaData.getMode();
+ if (mode == ParameterMode.IN || mode == ParameterMode.INOUT)
+ retList.add(paramMetaData);
+ }
+ return retList;
+ }
+
+ /** Get the OUT or INOUT parameter list */
+ public List<ParameterMetaData> getOutputParameters()
+ {
+ List<ParameterMetaData> retList = new ArrayList<ParameterMetaData>();
+ for (ParameterMetaData paramMetaData : parameters)
+ {
+ ParameterMode mode = paramMetaData.getMode();
+ if (mode == ParameterMode.OUT || mode == ParameterMode.INOUT)
+ retList.add(paramMetaData);
+ }
+ return retList;
+ }
+
+ /** Get the non header parameter list */
+ public List<ParameterMetaData> getNonHeaderParameters()
+ {
+ List<ParameterMetaData> retList = new ArrayList<ParameterMetaData>();
+ for (ParameterMetaData paramMetaData : parameters)
+ {
+ if (paramMetaData.isInHeader() == false)
+ retList.add(paramMetaData);
+ }
+ return retList;
+ }
+
+ public List<ParameterMetaData> getParameters()
+ {
+ return new ArrayList<ParameterMetaData>(parameters);
+ }
+
+ public void addParameter(ParameterMetaData pmd)
+ {
+ log.trace("addParameter: [xmlName=" + pmd.getXmlName() +
",xmlType=" + pmd.getXmlType() + "]");
+ parameters.add(pmd);
+ assertOneWayOperation();
+ }
+
+ public void removeAllParameters()
+ {
+ parameters.clear();
+ }
+
+ public ParameterMetaData getReturnParameter()
+ {
+ return returnParam;
+ }
+
+ public void setReturnParameter(ParameterMetaData returnParam)
+ {
+ log.trace("setReturnParameter: " + returnParam);
+ returnParam.setMode(ParameterMode.OUT);
+ this.returnParam = returnParam;
+ assertOneWayOperation();
+ }
+
+ public List<FaultMetaData> getFaults()
+ {
+ return new ArrayList<FaultMetaData>(faults);
+ }
+
+ public FaultMetaData getFault(QName xmlName)
+ {
+ FaultMetaData faultMetaData = null;
+ for (int i = 0; faultMetaData == null && i < faults.size(); i++)
+ {
+ FaultMetaData aux = faults.get(i);
+ if (aux.getXmlName().equals(xmlName))
+ faultMetaData = aux;
+ }
+ return faultMetaData;
+ }
+
+ public FaultMetaData getFault(Class javaType)
+ {
+ FaultMetaData faultMetaData = null;
+ for (FaultMetaData aux : faults)
+ {
+ if (aux.getJavaType().equals(javaType))
+ {
+ faultMetaData = aux;
+ break;
+ }
+ }
+ return faultMetaData;
+ }
+
+ public void addFault(FaultMetaData fault)
+ {
+ log.trace("addFault: " + fault);
+ faults.add(fault);
+ assertOneWayOperation();
+ }
+
+ // A JSR-181 processor is REQUIRED to report an error if an
+ // operation marked @Oneway has a return value, declares any checked exceptions or has
any
+ // INOUT or OUT parameters.
+ private void assertOneWayOperation()
+ {
+ if (oneWay)
+ {
+ if (returnParam != null)
+ throw new WSException("OneWay operations cannot have a return
parameter");
+
+ if (faults.size() > 0)
+ throw new WSException("OneWay operations cannot have checked
exceptions");
+
+ for (ParameterMetaData paramMetaData : parameters)
+ {
+ if (paramMetaData.getMode() != ParameterMode.IN)
+ throw new WSException("OneWay operations cannot have INOUT or OUT
parameters");
+ }
+ }
+ }
+
+ public void assertDocumentBare()
+ {
+ if (isDocumentBare())
+ {
+ int in = 0;
+ int out = 0;
+
+ for (ParameterMetaData paramMetaData : parameters)
+ {
+ if (paramMetaData.isInHeader())
+ continue;
+
+ ParameterMode mode = paramMetaData.getMode();
+ if (mode != ParameterMode.OUT)
+ in++;
+ if (mode != ParameterMode.IN)
+ out++;
+ }
+
+ if (returnParam != null && !returnParam.isInHeader())
+ out++;
+
+ if (!((oneWay && in == 1 && out == 0) || (in == 1 && out
== 1)))
+ throw new WSException("The body of a documnet/literal bare message
requires only 1 input and only 1 output (or 0 if oneway). method: " + javaName +
" in: "
+ + in + " out: " + out);
+ }
+ }
+
+ public void validate()
+ {
+ for (ParameterMetaData parameter : parameters)
+ parameter.validate();
+
+ for (FaultMetaData fault : faults)
+ fault.validate();
+ }
+
+ /**
+ * @see UnifiedMetaData#eagerInitialize()
+ */
+ public void eagerInitialize(List<Method> unsynchronizedMethods)
+ {
+ // reset java method
+ javaMethod = null;
+
+ for (ParameterMetaData parameter : parameters)
+ parameter.eagerInitialize();
+
+ if (returnParam != null)
+ returnParam.eagerInitialize();
+
+ for (FaultMetaData fault : faults)
+ fault.eagerInitialize();
+
+ // Method initialization
+ for (Method method : unsynchronizedMethods)
+ {
+ if (isJavaMethod(method))
+ {
+ javaMethod = method;
+ break;
+ }
+ }
+
+ // Report unsynchronized java method
+ if (javaMethod == null)
+ {
+ StringBuilder errMsg = new StringBuilder("Cannot synchronize to any of
these methods:");
+ for (Method method : unsynchronizedMethods)
+ {
+ errMsg.append("\n" + method);
+ }
+ errMsg.append("\n" + toString());
+ throw new IllegalStateException(errMsg.toString());
+ }
+
+ }
+
+ public String toString()
+ {
+ StringBuilder buffer = new StringBuilder("\nOperationMetaData:");
+ buffer.append("\n qname=" + qname);
+ buffer.append("\n javaName=" + javaName);
+ buffer.append("\n style=" + getStyle() + "/" + getUse());
+ if (getStyle() == Style.DOCUMENT)
+ {
+ buffer.append("/" + getParameterStyle());
+ }
+ buffer.append("\n oneWay=" + oneWay);
+ buffer.append("\n soapAction=" + soapAction);
+ for (ParameterMetaData param : parameters)
+ {
+ buffer.append(param);
+ }
+ if (returnParam != null)
+ {
+ buffer.append(returnParam.toString());
+ }
+ for (FaultMetaData fault : faults)
+ {
+ buffer.append(fault);
+ }
+ return buffer.toString();
+ }
+}
Copied:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/umdm/ParameterMetaData.java
(from rev 1600,
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/ParameterMetaData.java)
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/ParameterMetaData.java 2006-12-07
10:43:36 UTC (rev 1600)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/umdm/ParameterMetaData.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -0,0 +1,355 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ws.metadata.umdm;
+
+// $Id$
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.StringTokenizer;
+
+import javax.xml.namespace.QName;
+import javax.xml.rpc.ParameterMode;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.Constants;
+import org.jboss.ws.WSException;
+import org.jboss.ws.core.jaxrpc.ParameterWrapping;
+import org.jboss.ws.core.utils.JavaUtils;
+
+/**
+ * A request/response parameter that a given operation supports.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @author <a href="mailto:jason.greene@jboss.com">Jason T.
Greene</a>
+ * @since 12-May-2005
+ */
+public class ParameterMetaData
+{
+ // provide logging
+ private final Logger log = Logger.getLogger(ParameterMetaData.class);
+
+ // The parent operation
+ private OperationMetaData opMetaData;
+
+ private QName xmlName;
+ private QName xmlType;
+ private String javaTypeName;
+ private Class javaType;
+ private ParameterMode mode;
+ private Set<String> mimeTypes;
+ private boolean inHeader;
+ private boolean isSwA;
+ private boolean isXOP;
+ private List<String> wrappedVariables = new ArrayList<String>();
+ private List<String> wrappedTypes = new ArrayList<String>();
+ private List<QName> wrappedElementNames = new ArrayList<QName>();
+
+ // SOAP-ENC:Array
+ private boolean soapArrayParam;
+ private QName soapArrayCompType;
+
+ private static final List<String> messageTypes = new ArrayList<String>();
+ static
+ {
+ messageTypes.add("javax.xml.soap.SOAPElement");
+ messageTypes.add("org.w3c.dom.Element");
+ }
+
+ public ParameterMetaData(OperationMetaData opMetaData, QName xmlName, QName xmlType,
String javaTypeName)
+ {
+ this.xmlName = xmlName;
+ this.xmlType = xmlType;
+ this.opMetaData = opMetaData;
+ this.mode = ParameterMode.IN;
+ this.javaTypeName = javaTypeName;
+
+ if (xmlName == null)
+ throw new IllegalArgumentException("Invalid null xmlName argument");
+ if (xmlType == null)
+ throw new IllegalArgumentException("Invalid null xmlType argument, for:
" + xmlName);
+
+ // Remove the prefixes
+ if (xmlName.getNamespaceURI().length() > 0)
+ this.xmlName = new QName(xmlName.getNamespaceURI(), xmlName.getLocalPart());
+
+ if (xmlType.getNamespaceURI().length() > 0)
+ this.xmlType = new QName(xmlType.getNamespaceURI(), xmlType.getLocalPart());
+
+ // Special case to identify attachments
+ if (Constants.NS_ATTACHMENT_MIME_TYPE.equals(xmlType.getNamespaceURI()))
+ {
+ String mimeType = convertXmlTypeToMimeType(xmlType);
+ setMimeTypes(mimeType);
+ this.isSwA = true;
+ }
+ }
+
+ public OperationMetaData getOperationMetaData()
+ {
+ return opMetaData;
+ }
+
+ public QName getXmlName()
+ {
+ return xmlName;
+ }
+
+ public QName getXmlType()
+ {
+ return xmlType;
+ }
+
+ public String getJavaTypeName()
+ {
+ return javaTypeName;
+ }
+
+
+ public void setJavaTypeName(String typeName)
+ {
+ // Warn if this is called after eager initialization
+ UnifiedMetaData wsMetaData =
opMetaData.getEndpointMetaData().getServiceMetaData().getUnifiedMetaData();
+ if (wsMetaData.isEagerInitialized() && UnifiedMetaData.isFinalRelease() ==
false)
+ log.warn("Set java type name after eager initialization", new
IllegalStateException());
+
+ javaTypeName = typeName;
+ javaType = null;
+ }
+
+ /** Load the java type.
+ * It should only be cached during eager initialization.
+ */
+ public Class getJavaType()
+ {
+ Class tmpJavaType = javaType;
+ if (tmpJavaType == null && javaTypeName != null)
+ {
+ try
+ {
+ ClassLoader loader = opMetaData.getEndpointMetaData().getClassLoader();
+ tmpJavaType = JavaUtils.loadJavaType(javaTypeName, loader);
+
+ UnifiedMetaData wsMetaData =
opMetaData.getEndpointMetaData().getServiceMetaData().getUnifiedMetaData();
+ if (wsMetaData.isEagerInitialized())
+ {
+ // This should not happen, see the warning in setJavaTypeName
+ javaType = tmpJavaType;
+ }
+ }
+ catch (ClassNotFoundException ex)
+ {
+ throw new WSException("Cannot load java type: " + javaTypeName,
ex);
+ }
+ }
+ return tmpJavaType;
+ }
+
+
+ public ParameterMode getMode()
+ {
+ return mode;
+ }
+
+ public void setMode(String mode)
+ {
+ if("IN".equals(mode))
+ setMode(ParameterMode.IN);
+ else if("INOUT".equals(mode))
+ setMode(ParameterMode.INOUT);
+ else if("OUT".equals(mode))
+ setMode(ParameterMode.OUT);
+ else
+ throw new IllegalArgumentException("Invalid mode: " + mode);
+ }
+
+ public void setMode(ParameterMode mode)
+ {
+ this.mode = mode;
+ }
+
+ public Set<String> getMimeTypes()
+ {
+ return mimeTypes;
+ }
+
+ public void setMimeTypes(String mimeStr)
+ {
+ mimeTypes = new HashSet<String>();
+ StringTokenizer st = new StringTokenizer(mimeStr, ",");
+ while (st.hasMoreTokens())
+ mimeTypes.add(st.nextToken().trim());
+ }
+
+ public boolean isInHeader()
+ {
+ return inHeader;
+ }
+
+ public void setInHeader(boolean inHeader)
+ {
+ this.inHeader = inHeader;
+ }
+
+ public boolean isSwA()
+ {
+ return isSwA;
+ }
+
+ public void setSwA(boolean isSwA)
+ {
+ this.isSwA = isSwA;
+ }
+
+ public boolean isXOP()
+ {
+ return isXOP;
+ }
+
+ public void setXOP(boolean isXOP)
+ {
+ this.isXOP = isXOP;
+ }
+
+ public List<String> getWrappedTypes()
+ {
+ return wrappedTypes;
+ }
+
+ public List<String> getWrappedVariables()
+ {
+ return wrappedVariables;
+ }
+
+ public List<QName> getWrappedElementNames()
+ {
+ return wrappedElementNames;
+ }
+
+ public boolean isSOAPArrayParam()
+ {
+ return soapArrayParam;
+ }
+
+ public void setSOAPArrayParam(boolean soapArrayParam)
+ {
+ this.soapArrayParam = soapArrayParam;
+ }
+
+ public QName getSOAPArrayCompType()
+ {
+ return soapArrayCompType;
+ }
+
+ public void setSOAPArrayCompType(QName xmlType)
+ {
+ this.soapArrayCompType = xmlType;
+ }
+
+ public boolean isMessageType()
+ {
+ return messageTypes.contains(javaTypeName);
+ }
+
+ public static boolean isMessageType(String javaTypeName)
+ {
+ return messageTypes.contains(javaTypeName);
+ }
+
+ /** Converts a proprietary JBossWS attachment xml type to the MIME type that it
represents.
+ */
+ private String convertXmlTypeToMimeType(QName xmlType)
+ {
+ StringBuilder mimeName = new StringBuilder(xmlType.getLocalPart());
+ int pos = mimeName.indexOf("_");
+ if (pos == -1)
+ throw new IllegalArgumentException("Invalid mime type: " + xmlType);
+
+ mimeName.setCharAt(pos, '/');
+ return mimeName.toString();
+ }
+
+ public void validate()
+ {
+ // nothing to do
+ }
+
+ /**
+ * @see UnifiedMetaData#eagerInitialize()
+ */
+ public void eagerInitialize()
+ {
+ // reset java type
+ javaType = null;
+
+ TypesMetaData typesMetaData =
getOperationMetaData().getEndpointMetaData().getServiceMetaData().getTypesMetaData();
+ if (getOperationMetaData().isDocumentWrapped() && isMessageType() ==
false)
+ {
+ TypeMappingMetaData tmMetaData =
typesMetaData.getTypeMappingByXMLType(xmlType);
+ if (tmMetaData == null)
+ ParameterWrapping.generateWrapper(this, true);
+ }
+
+ javaType = getJavaType();
+ if (javaType == null)
+ throw new WSException("Cannot load java type: " + javaTypeName);
+ }
+
+ public String toString()
+ {
+ boolean isReturn = (opMetaData.getReturnParameter() == this);
+ StringBuilder buffer = new StringBuilder("\n" + (isReturn ?
"ReturnMetaData:" : "ParameterMetaData:"));
+ buffer.append("\n xmlName=" + getXmlName());
+ buffer.append("\n xmlType=" + getXmlType());
+ buffer.append("\n javaType=" + getJavaTypeName());
+ buffer.append("\n mode=" + getMode());
+ buffer.append("\n inHeader=" + isInHeader());
+
+ if (soapArrayParam)
+ buffer.append("\n soapArrayCompType=" + soapArrayCompType);
+
+ if (wrappedVariables != null)
+ buffer.append("\n wrappedVariables=" + wrappedVariables);
+
+ if (wrappedTypes != null)
+ buffer.append("\n wrappedTypes=" + wrappedTypes);
+
+ if (wrappedElementNames != null)
+ buffer.append("\n wrappedElementNames=" + wrappedElementNames);
+
+ if (isSwA())
+ {
+ buffer.append("\n isSwA=" + isSwA());
+ buffer.append("\n mimeTypes=" + getMimeTypes());
+ }
+
+ if (isXOP())
+ {
+ buffer.append("\n isXOP=" + isXOP());
+ buffer.append("\n mimeTypes=" + getMimeTypes());
+ }
+
+ return buffer.toString();
+ }
+}
\ No newline at end of file
Copied:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/umdm/ServerEndpointMetaData.java
(from rev 1600,
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/ServerEndpointMetaData.java)
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/ServerEndpointMetaData.java 2006-12-07
10:43:36 UTC (rev 1600)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/umdm/ServerEndpointMetaData.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -0,0 +1,265 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ws.metadata.umdm;
+
+// $Id$
+
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import javax.management.ObjectName;
+import javax.xml.namespace.QName;
+
+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.umdm.HandlerMetaData.HandlerType;
+
+/**
+ * Client side endpoint meta data.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @author <a href="mailto:jason.greene@jboss.com">Jason T.
Greene</a>
+ * @since 12-May-2005
+ */
+public class ServerEndpointMetaData extends EndpointMetaData
+{
+ // provide logging
+ private static Logger log = Logger.getLogger(ServerEndpointMetaData.class);
+
+ public static final String SEPID_DOMAIN = "jboss.ws";
+ public static final String SEPID_PROPERTY_CONTEXT = "context";
+ public static final String SEPID_PROPERTY_ENDPOINT = "endpoint";
+
+ // The REQUIRED link name
+ private String linkName;
+ // Legacy JSR-109 port component name
+ private String portComponentName;
+ // The endpoint implementation bean
+ private String implName;
+ // The unique service endpointID
+ private ObjectName sepID;
+ // The HTTP context root
+ private String contextRoot;
+ // The HTTP virtual hosts
+ private String[] virtualHosts;
+ // The HTTP url parttern
+ private String urlPattern;
+ // The bean that registers with the ServiceEndpointManager
+ private String managedEndpointBean = ServiceEndpoint.class.getName();
+
+ public ServerEndpointMetaData(ServiceMetaData service, QName portName, Type type)
+ {
+ super(service, portName, type);
+ }
+
+ public void setConfigName(String configName)
+ {
+ super.setConfigName(configName);
+ endpointConfig = null;
+ }
+
+ public void setConfigFile(String configFile)
+ {
+ super.setConfigFile(configFile);
+ endpointConfig = null;
+ }
+
+ public String getLinkName()
+ {
+ return linkName;
+ }
+
+ public void setLinkName(String linkName)
+ {
+ this.linkName = linkName;
+ }
+
+ public String getPortComponentName()
+ {
+ return portComponentName;
+ }
+
+ public void setPortComponentName(String portComponentName)
+ {
+ this.portComponentName = portComponentName;
+ }
+
+ public String getServiceEndpointImplName()
+ {
+ return implName;
+ }
+
+ public void setServiceEndpointImplName(String endpointImpl)
+ {
+ this.implName = endpointImpl;
+ }
+
+ public ObjectName getServiceEndpointID()
+ {
+ return sepID;
+ }
+
+ public void setServiceEndpointID(ObjectName endpointID)
+ {
+ this.sepID = endpointID;
+ }
+
+ public String getContextRoot()
+ {
+ return contextRoot;
+ }
+
+ public void setContextRoot(String contextRoot)
+ {
+ this.contextRoot = contextRoot;
+ }
+
+
+ public String[] getVirtualHosts()
+ {
+ return virtualHosts;
+ }
+
+ public void setVirtualHosts(String[] virtualHosts)
+ {
+ this.virtualHosts = virtualHosts;
+ }
+
+ public String getURLPattern()
+ {
+ return urlPattern;
+ }
+
+ public void setURLPattern(String urlPattern)
+ {
+ this.urlPattern = urlPattern;
+ }
+
+ public String getManagedEndpointBean()
+ {
+ return managedEndpointBean;
+ }
+
+ public void setManagedEndpointBean(String managedEndpointBean)
+ {
+ this.managedEndpointBean = managedEndpointBean;
+ }
+
+ @Override
+ public WSCommonConfig getEndpointConfig()
+ {
+ if (endpointConfig == null)
+ {
+ String configName = getConfigName();
+ if (configName == null)
+ {
+ configName = "Standard Endpoint";
+ setConfigName(configName);
+ }
+
+ String configFile = getConfigFile();
+ if (configFile == null)
+ {
+ configFile = "META-INF/standard-jaxrpc-endpoint-config.xml";
+ setConfigFile(configFile);
+ }
+
+ log.debug("getEndpointConfig: [name=" + configName + ",url="
+ configFile + "]");
+
+ URL configURL = null;
+ try
+ {
+ configURL = new URL(configFile);
+ }
+ catch (MalformedURLException ex)
+ {
+ // ignore
+ }
+
+ // Try to get the URL as resource
+ if (configURL == null)
+ {
+ ClassLoader cl = Thread.currentThread().getContextClassLoader();
+ configURL = cl.getResource(configFile);
+ if (configURL == null)
+ throw new WSException("Cannot get resource: " + configFile);
+ }
+
+ // Get the config root
+ Object wsConfig;
+ try
+ {
+ WSConfigFactory factory = WSConfigFactory.newInstance();
+ wsConfig = factory.parseWithObjectModelFactory(configURL);
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (Exception ex)
+ {
+ throw new WSException("Cannot parse client config", ex);
+ }
+
+ // Get the endpoint config
+ endpointConfig =
((WSConfigRootJAXRPC)wsConfig).getEndpointConfigByName(configName);
+ if (endpointConfig == null)
+ throw new WSException("Cannot obtain endpoint config: " +
configName);
+ }
+ return endpointConfig;
+ }
+
+ public String toString()
+ {
+ StringBuilder buffer = new StringBuilder("\nServerEndpointMetaData:");
+ buffer.append("\n type=" + getType());
+ buffer.append("\n qname=" + getQName());
+ buffer.append("\n id=" + getServiceEndpointID().getCanonicalName());
+ buffer.append("\n address=" + getEndpointAddress());
+ buffer.append("\n binding=" + getBindingId());
+ buffer.append("\n linkName=" + getLinkName());
+ buffer.append("\n implName=" + getServiceEndpointImplName());
+ buffer.append("\n seiName=" + getServiceEndpointInterfaceName());
+ buffer.append("\n portComponentName=" + getPortComponentName());
+ buffer.append("\n contextRoot=" + getContextRoot());
+ buffer.append("\n urlPattern=" + getURLPattern());
+ buffer.append("\n configFile=" + getConfigFile());
+ buffer.append("\n configName=" + getConfigName());
+ buffer.append("\n authMethod=" + getAuthMethod());
+ buffer.append("\n transportGuarantee=" + getTransportGuarantee());
+ buffer.append("\n properties=" + getProperties());
+
+ for (OperationMetaData opMetaData : getOperations())
+ {
+ buffer.append("\n" + opMetaData);
+ }
+ for (HandlerMetaData hdlMetaData : getHandlerMetaData(HandlerType.ALL))
+ {
+ buffer.append("\n" + hdlMetaData);
+ }
+ return buffer.toString();
+ }
+}
Copied:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/umdm/ServiceMetaData.java
(from rev 1601,
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/ServiceMetaData.java)
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/ServiceMetaData.java 2006-12-07
11:35:39 UTC (rev 1601)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/umdm/ServiceMetaData.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -0,0 +1,469 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ws.metadata.umdm;
+
+// $Id$
+
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+
+import javax.xml.namespace.QName;
+import javax.xml.rpc.encoding.TypeMappingRegistry;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.WSException;
+import org.jboss.ws.core.jaxrpc.TypeMappingImpl;
+import org.jboss.ws.core.jaxrpc.TypeMappingRegistryImpl;
+import org.jboss.ws.core.jaxrpc.Use;
+import org.jboss.ws.core.jaxrpc.binding.JBossXBDeserializerFactory;
+import org.jboss.ws.core.jaxrpc.binding.JBossXBSerializerFactory;
+import org.jboss.ws.core.jaxrpc.binding.SOAPArrayDeserializerFactory;
+import org.jboss.ws.core.jaxrpc.binding.SOAPArraySerializerFactory;
+import org.jboss.ws.core.jaxrpc.binding.jbossxb.SchemaBindingBuilder;
+import org.jboss.ws.core.utils.JavaUtils;
+import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping;
+import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMappingFactory;
+import org.jboss.ws.metadata.umdm.HandlerMetaData.HandlerType;
+import org.jboss.ws.metadata.wsdl.WSDLDefinitions;
+import org.jboss.ws.metadata.wsdl.WSDLTypes;
+import org.jboss.ws.metadata.wsdl.WSDLUtils;
+import org.jboss.ws.metadata.wsdl.xmlschema.JBossXSModel;
+import org.jboss.ws.metadata.wsse.WSSecurityConfiguration;
+import org.jboss.ws.tools.wsdl.WSDLDefinitionsFactory;
+import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding;
+
+/**
+ * A Service component describes a set of endpoints.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 12-May-2005
+ */
+public class ServiceMetaData
+{
+ // provide logging
+ private static final Logger log = Logger.getLogger(ServiceMetaData.class);
+
+ // The parent meta data.
+ private UnifiedMetaData wsMetaData;
+
+ // The service endpoints
+ private Map<QName, EndpointMetaData> endpoints = new LinkedHashMap<QName,
EndpointMetaData>();
+
+ private QName qname;
+ private String wsdName;
+ private String wsdlFile;
+ private String jaxrpcMappingFile;
+ private String wsdlPublishLocation;
+
+ // The type mapping that is maintained by this service
+ private TypesMetaData types;
+ private TypeMappingRegistry tmRegistry = new TypeMappingRegistryImpl();
+ private SchemaBinding schemaBinding;
+
+ // Arbitrary properties given by <call-property>
+ private Properties properties;
+
+ // derived cached encoding style
+ private Use encStyle;
+
+ // The security configuration
+ private WSSecurityConfiguration securityConfiguration;
+
+ public ServiceMetaData(UnifiedMetaData wsMetaData, QName name)
+ {
+ this.wsMetaData = wsMetaData;
+ this.qname = name;
+ this.types = new TypesMetaData(this);
+ }
+
+ public UnifiedMetaData getUnifiedMetaData()
+ {
+ return wsMetaData;
+ }
+
+ public void setQName(QName name)
+ {
+ this.qname = name;
+ }
+
+ public QName getQName()
+ {
+ return qname;
+ }
+
+ public String getWebserviceDescriptionName()
+ {
+ return wsdName;
+ }
+
+ public void setWebserviceDescriptionName(String wsdName)
+ {
+ this.wsdName = wsdName;
+ }
+
+ public String getWsdlFile()
+ {
+ return wsdlFile;
+ }
+
+ public void setWsdlFile(String wsdlFile)
+ {
+ this.wsdlFile = wsdlFile;
+ }
+
+ public String getWsdlPublishLocation()
+ {
+ return wsdlPublishLocation;
+ }
+
+ public void setWsdlPublishLocation(String wsdlPublishLocation)
+ {
+ this.wsdlPublishLocation = wsdlPublishLocation;
+ }
+
+ public Properties getProperties()
+ {
+ return properties;
+ }
+
+ public void setProperties(Properties properties)
+ {
+ this.properties = properties;
+ }
+
+ public TypesMetaData getTypesMetaData()
+ {
+ return types;
+ }
+
+ public List<EndpointMetaData> getEndpoints()
+ {
+ return new ArrayList<EndpointMetaData>(endpoints.values());
+ }
+
+ public EndpointMetaData getEndpoint(QName portName)
+ {
+ return endpoints.get(portName);
+ }
+
+ public EndpointMetaData getEndpointByServiceEndpointInterface(String seiName)
+ {
+ EndpointMetaData epMetaData = null;
+ for (EndpointMetaData epmd : endpoints.values())
+ {
+ if (seiName.equals(epmd.getServiceEndpointInterfaceName()))
+ {
+ if (epMetaData != null)
+ {
+ // The CTS uses Service.getPort(Class) with multiple endpoints
implementing the same SEI
+ log.warn("Multiple possible endpoints implementing SEI: " +
seiName);
+ }
+ epMetaData = epmd;
+ }
+ }
+ return epMetaData;
+ }
+
+ public void addEndpoint(EndpointMetaData epMetaData)
+ {
+ QName portName = epMetaData.getQName();
+
+ // This happends when we have multiple port components in sharing the same wsdl
port
+ // The EndpointMetaData name is the wsdl port, so we cannot have multiple meta data
for the same port.
+ if (endpoints.get(portName) != null)
+ throw new WSException("EndpointMetaData name must be unique: " +
portName);
+
+ endpoints.put(portName, epMetaData);
+ }
+
+ public String getJaxrpcMappingFile()
+ {
+ return jaxrpcMappingFile;
+ }
+
+ public void setJaxrpcMappingFile(String jaxrpcMappingFile)
+ {
+ this.jaxrpcMappingFile = jaxrpcMappingFile;
+ }
+
+ public JavaWsdlMapping getJavaWsdlMapping()
+ {
+ JavaWsdlMapping javaWsdlMapping =
(JavaWsdlMapping)wsMetaData.getMappingDefinition(jaxrpcMappingFile);
+ if (javaWsdlMapping == null && jaxrpcMappingFile != null)
+ {
+ URL mappingLocation = null;
+ try
+ {
+ mappingLocation = new URL(jaxrpcMappingFile);
+ }
+ catch (MalformedURLException e)
+ {
+ // ignore
+ }
+ if (mappingLocation == null)
+ {
+ mappingLocation =
wsMetaData.getResourceLoader().getResource(jaxrpcMappingFile);
+ }
+
+ if (mappingLocation == null)
+ throw new IllegalArgumentException("Cannot find jaxrpc-mapping.xml in
deployment: " + jaxrpcMappingFile);
+
+ try
+ {
+ JavaWsdlMappingFactory mappingFactory =
JavaWsdlMappingFactory.newInstance();
+ javaWsdlMapping = mappingFactory.parse(mappingLocation);
+ wsMetaData.addMappingDefinition(jaxrpcMappingFile, javaWsdlMapping);
+ }
+ catch (IOException e)
+ {
+ throw new WSException("Cannot parse jaxrpc-mapping.xml", e);
+ }
+ }
+ return javaWsdlMapping;
+ }
+
+ /**
+ * Get the wsdl definition that corresponds to the wsdl-file element.
+ */
+ public WSDLDefinitions getWsdlDefinitions()
+ {
+ WSDLDefinitions wsdlDefinitions =
(WSDLDefinitions)wsMetaData.getWSDLDefinition(wsdlFile);
+ if (wsdlDefinitions == null && wsdlFile != null)
+ {
+ URL wsdlLocation = getWsdlLocation();
+ if (wsdlLocation == null)
+ throw new IllegalArgumentException("Cannot find wsdl in deployment:
" + wsdlFile);
+
+ WSDLDefinitionsFactory factory = WSDLDefinitionsFactory.newInstance();
+ wsdlDefinitions = factory.parse(wsdlLocation);
+ wsMetaData.addWSDLDefinition(wsdlFile, wsdlDefinitions);
+ }
+ return wsdlDefinitions;
+ }
+
+ public URL getWsdlLocation()
+ {
+ URL wsdlLocation = null;
+ if (wsdlFile != null)
+ {
+ try
+ {
+ wsdlLocation = new URL(wsdlFile);
+ }
+ catch (MalformedURLException e)
+ {
+ // ignore
+ }
+ if (wsdlLocation == null)
+ {
+ wsdlLocation = wsMetaData.getResourceLoader().getResource(wsdlFile);
+ }
+ }
+ return wsdlLocation;
+ }
+
+ public TypeMappingImpl getTypeMapping()
+ {
+ Use encStyle = getEncodingStyle();
+ TypeMappingImpl typeMapping =
(TypeMappingImpl)tmRegistry.getTypeMapping(encStyle.toURI());
+ if (typeMapping == null)
+ throw new WSException("No type mapping for encoding style: " +
encStyle);
+
+ return typeMapping;
+ }
+
+ public WSSecurityConfiguration getSecurityConfiguration()
+ {
+ return securityConfiguration;
+ }
+
+ public void setSecurityConfiguration(WSSecurityConfiguration securityConfiguration)
+ {
+ this.securityConfiguration = securityConfiguration;
+ }
+
+ public Use getEncodingStyle()
+ {
+ if (encStyle == null)
+ {
+ if (endpoints.size() > 0)
+ {
+ for (EndpointMetaData epMetaData : endpoints.values())
+ {
+ if (encStyle == null)
+ {
+ encStyle = epMetaData.getEncodingStyle();
+ }
+ else if (encStyle.equals(epMetaData.getEncodingStyle()) == false)
+ {
+ throw new WSException("Conflicting encoding styles not
supported");
+ }
+ }
+ }
+ else
+ {
+ encStyle = Use.LITERAL;
+ }
+ }
+ return encStyle;
+ }
+
+ public SchemaBinding getSchemaBinding()
+ {
+ JavaWsdlMapping wsdlMapping = getJavaWsdlMapping();
+ if (schemaBinding == null && getEncodingStyle() == Use.LITERAL &&
wsdlMapping != null)
+ {
+ JBossXSModel xsModel = types.getSchemaModel();
+ SchemaBindingBuilder bindingBuilder = new SchemaBindingBuilder();
+ schemaBinding = bindingBuilder.buildSchemaBinding(xsModel, wsdlMapping);
+ }
+ return schemaBinding;
+ }
+
+ public void validate()
+ {
+ // Validate that there is at least one handler configured
+ // if we have a security configuration
+ if (securityConfiguration != null)
+ {
+ int handlerCount = 0;
+ for (EndpointMetaData epMetaData : endpoints.values())
+ {
+ handlerCount += epMetaData.getHandlerMetaData(HandlerType.ALL).size();
+ }
+ if (handlerCount == 0)
+ log.warn("WS-Security requires a security handler to be
configured");
+ }
+
+ // Validate endpoints
+ for (EndpointMetaData epMetaData : endpoints.values())
+ epMetaData.validate();
+ }
+
+ /**
+ * @see UnifiedMetaData#eagerInitialize()
+ */
+ public void eagerInitialize()
+ {
+ // Initialize all wsdl definitions and schema objects
+ WSDLDefinitions definitions = getWsdlDefinitions();
+ if (definitions != null)
+ {
+ WSDLTypes types = definitions.getWsdlTypes();
+ if (types != null)
+ {
+ JBossXSModel model = WSDLUtils.getSchemaModel(types);
+ ;
+ if (model != null)
+ model.eagerInitialize();
+ }
+ }
+
+ // Initialize jaxrpc-mapping data
+ getJavaWsdlMapping();
+
+ // Initialize types
+ TypeMappingImpl typeMapping = getTypeMapping();
+ for (TypeMappingMetaData tmMetaData : types.getTypeMappings())
+ {
+ String javaTypeName = tmMetaData.getJavaTypeName();
+ QName xmlType = tmMetaData.getXmlType();
+ if (xmlType != null)
+ {
+ List<Class> registeredTypes = typeMapping.getJavaTypes(xmlType);
+
+ boolean registered = false;
+ for (Class current : registeredTypes)
+ {
+ if (current.getName().equals(javaTypeName))
+ {
+ registered = true;
+ break;
+ }
+ }
+
+ if (registered == false)
+ {
+ try
+ {
+ ClassLoader classLoader = wsMetaData.getClassLoader();
+ Class javaType = JavaUtils.loadJavaType(javaTypeName, classLoader);
+
+ if (JavaUtils.isPrimitive(javaTypeName))
+ javaType = JavaUtils.getWrapperType(javaType);
+
+ if (getEncodingStyle() == Use.ENCODED && javaType.isArray())
+ {
+ typeMapping.register(javaType, xmlType, new
SOAPArraySerializerFactory(), new SOAPArrayDeserializerFactory());
+ }
+ else
+ {
+ typeMapping.register(javaType, xmlType, new
JBossXBSerializerFactory(), new JBossXBDeserializerFactory());
+ }
+ }
+ catch (ClassNotFoundException e)
+ {
+ log.warn("Cannot load class for type: " + xmlType +
"," + javaTypeName);
+ }
+ }
+ }
+ }
+
+ // Initialize endpoints
+ for (EndpointMetaData epMetaData : endpoints.values())
+ epMetaData.eagerInitialize();
+
+ // Initialize schema binding
+ getSchemaBinding();
+ }
+
+ /** Assert that the given namespace is the WSDL's target namespace */
+ public void assertTargetNamespace(String targetNS)
+ {
+ if (getQName().getNamespaceURI().equals(targetNS) == false)
+ throw new WSException("Requested namespace is not WSDL target namespace:
" + targetNS);
+ }
+
+ public String toString()
+ {
+ StringBuilder buffer = new StringBuilder("\nServiceMetaData:");
+ buffer.append("\n qname=" + qname);
+ buffer.append("\n wsdName=" + wsdName);
+ buffer.append("\n wsdlFile=" + wsdlFile);
+ buffer.append("\n jaxrpcFile=" + jaxrpcMappingFile);
+ buffer.append("\n publishLocation=" + wsdlPublishLocation);
+ buffer.append("\n properties=" + properties);
+ buffer.append("\n" + types);
+ buffer.append("\n");
+ for (EndpointMetaData epMetaData : endpoints.values())
+ {
+ buffer.append(epMetaData);
+ }
+ return buffer.toString();
+ }
+}
Copied:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/umdm/TypeMappingMetaData.java
(from rev 1600,
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/TypeMappingMetaData.java)
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/TypeMappingMetaData.java 2006-12-07
10:43:36 UTC (rev 1600)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/umdm/TypeMappingMetaData.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -0,0 +1,110 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+package org.jboss.ws.metadata.umdm;
+
+// $Id$
+
+import java.util.Arrays;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+
+/**
+ * Type mapping meta data
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 12-May-2005
+ */
+public class TypeMappingMetaData
+{
+ // The parent meta data.
+ private TypesMetaData typesMetaData;
+
+ private QName xmlType;
+ private String javaTypeName;
+ private String qnameScope;
+
+ // List of allowed qname scopes
+ public static final String QNAME_SCOPE_SIMPLE_TYPE = "simpleType";
+ public static final String QNAME_SCOPE_COMPLEX_TYPE = "complexType";
+ public static final String QNAME_SCOPE_ELEMENT = "element";
+ private static List<String> allowedScopes = Arrays.asList(new String[] {
QNAME_SCOPE_COMPLEX_TYPE, QNAME_SCOPE_SIMPLE_TYPE, QNAME_SCOPE_ELEMENT });
+
+ public TypeMappingMetaData(TypesMetaData typesMetaData, QName xmlType, String
javaTypeName)
+ {
+ if (xmlType == null)
+ throw new IllegalArgumentException("Invalid null xmlType");
+ if (javaTypeName == null)
+ throw new IllegalArgumentException("Invalid null javaTypeName");
+
+ this.typesMetaData = typesMetaData;
+ this.javaTypeName = javaTypeName;
+ this.xmlType = xmlType;
+ this.qnameScope = QNAME_SCOPE_COMPLEX_TYPE;
+ }
+
+ public TypesMetaData getTypesMetaData()
+ {
+ return typesMetaData;
+ }
+
+ public String getJavaTypeName()
+ {
+ return javaTypeName;
+ }
+
+ public QName getXmlType()
+ {
+ return xmlType;
+ }
+
+ public String getQNameScope()
+ {
+ return qnameScope;
+ }
+
+ public void setQNameScope(String qnameScope)
+ {
+ if (allowedScopes.contains(qnameScope) == false)
+ throw new IllegalArgumentException("Invalid qname scope: " +
qnameScope);
+
+ this.qnameScope = qnameScope;
+ }
+
+ public int hashCode()
+ {
+ return toString().hashCode();
+ }
+
+ public boolean equals(Object obj)
+ {
+ if (obj instanceof TypeMappingMetaData == false) return false;
+ TypeMappingMetaData other = (TypeMappingMetaData)obj;
+ return toString().equals(other.toString());
+ }
+
+ public String toString()
+ {
+ return "[" + qnameScope + "=" + xmlType +
",javaType=" + javaTypeName + "]";
+ }
+}
Copied:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/umdm/TypesMetaData.java
(from rev 1600,
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/TypesMetaData.java)
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/TypesMetaData.java 2006-12-07
10:43:36 UTC (rev 1600)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/umdm/TypesMetaData.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -0,0 +1,193 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+package org.jboss.ws.metadata.umdm;
+
+// $Id$
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.apache.xerces.xs.XSSimpleTypeDefinition;
+import org.apache.xerces.xs.XSTypeDefinition;
+import org.jboss.logging.Logger;
+import org.jboss.ws.WSException;
+import org.jboss.ws.core.jaxrpc.LiteralTypeMapping;
+import org.jboss.ws.metadata.wsdl.xmlschema.JBossXSModel;
+
+/**
+ * Types meta data
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 12-May-2005
+ */
+public class TypesMetaData
+{
+ // provide logging
+ private static final Logger log = Logger.getLogger(TypesMetaData.class);
+
+ // The parent meta data.
+ private ServiceMetaData serviceMetaData;
+ // The list of type meta data
+ private List<TypeMappingMetaData> typeList = new
ArrayList<TypeMappingMetaData>();
+
+ private JBossXSModel schemaModel;
+
+ public TypesMetaData(ServiceMetaData serviceMetaData)
+ {
+ this.serviceMetaData = serviceMetaData;
+ }
+
+ public ServiceMetaData getServiceMetaData()
+ {
+ return serviceMetaData;
+ }
+
+ public JBossXSModel getSchemaModel()
+ {
+ return schemaModel;
+ }
+
+ public void setSchemaModel(JBossXSModel model)
+ {
+ this.schemaModel = model;
+ }
+
+ public void addSchemaModel(JBossXSModel model)
+ {
+ if (this.schemaModel == null)
+ {
+ this.schemaModel = model;
+ }
+ else
+ {
+ this.schemaModel.merge(model);
+ }
+ }
+
+ public List<TypeMappingMetaData> getTypeMappings()
+ {
+ return new ArrayList<TypeMappingMetaData>(typeList);
+ }
+
+ public void addTypeMapping(TypeMappingMetaData tmMetaData)
+ {
+ if (typeList.contains(tmMetaData) == false)
+ {
+ log.trace("Add type mapping: " + tmMetaData);
+ typeList.add(tmMetaData);
+ }
+ }
+
+ public TypeMappingMetaData getTypeMappingByXMLType(QName xmlType)
+ {
+ TypeMappingMetaData tmMetaData = null;
+ for (TypeMappingMetaData aux : typeList)
+ {
+ boolean isElementScope =
TypeMappingMetaData.QNAME_SCOPE_ELEMENT.equals(aux.getQNameScope());
+ if (aux.getXmlType().equals(xmlType) && isElementScope == false)
+ {
+ if (tmMetaData != null)
+ {
+ log.error(tmMetaData + "\n" + aux);
+ throw new WSException("Ambiguous type mappping for: " +
xmlType);
+ }
+ tmMetaData = aux;
+ }
+ }
+
+ if (tmMetaData == null && schemaModel != null)
+ {
+ // Simple types are not neccessary mapped in jaxrpc-mapping.xml, lazily add the
mapping here
+ XSTypeDefinition xsType = schemaModel.getTypeDefinition(xmlType.getLocalPart(),
xmlType.getNamespaceURI());
+ if (xsType instanceof XSSimpleTypeDefinition)
+ {
+ XSSimpleTypeDefinition xsSimpleType = (XSSimpleTypeDefinition)xsType;
+ String javaTypeName = null;
+
+ // <simpleType name="FooStringListType">
+ // <list itemType="string"/>
+ // </simpleType>
+ if (xsSimpleType.getVariety() == XSSimpleTypeDefinition.VARIETY_LIST)
+ {
+ XSSimpleTypeDefinition itemType = xsSimpleType.getItemType();
+ QName xmlBaseType = new QName(itemType.getNamespace(),
itemType.getName());
+ javaTypeName = new LiteralTypeMapping().getJavaTypeName(xmlBaseType);
+ if (javaTypeName != null)
+ {
+ javaTypeName += "[]";
+ }
+ }
+
+ // <simpleType name="FooIType">
+ // <restriction base="normalizedString">
+ // <pattern value="\d{3}-[A-Z0-9]{5}"/>
+ // </restriction>
+ // </simpleType>
+ XSTypeDefinition xsBaseType = xsType.getBaseType();
+ while (javaTypeName == null && xsBaseType != null)
+ {
+ QName xmlBaseType = new QName(xsBaseType.getNamespace(),
xsBaseType.getName());
+ javaTypeName = new LiteralTypeMapping().getJavaTypeName(xmlBaseType);
+ xsBaseType = xsBaseType.getBaseType();
+ }
+
+ if (javaTypeName != null)
+ {
+ tmMetaData = new TypeMappingMetaData(this, xmlType, javaTypeName);
+ tmMetaData.setQNameScope(TypeMappingMetaData.QNAME_SCOPE_SIMPLE_TYPE);
+ log.debug("Adding a simpleType without jaxrpc-mapping: " +
tmMetaData);
+ addTypeMapping(tmMetaData);
+ }
+ else
+ {
+ log.warn("Cannot obtain javaTypeName for xmlType: " + xmlType);
+ }
+ }
+ }
+
+ return tmMetaData;
+ }
+
+ public TypeMappingMetaData getTypeMappingByJavaType(String javaTypeName)
+ {
+ TypeMappingMetaData tmMetaData = null;
+ for (TypeMappingMetaData aux : typeList)
+ {
+ if (aux.getJavaTypeName().equals(javaTypeName))
+ tmMetaData = aux;
+ }
+ return tmMetaData;
+ }
+
+ public String toString()
+ {
+ StringBuilder buffer = new StringBuilder("\nTypesMetaData: ");
+ for (TypeMappingMetaData tmd : typeList)
+ {
+ buffer.append("\n " + tmd);
+ }
+ buffer.append("\n" + (schemaModel != null ? schemaModel.serialize() :
"<schema/>"));
+ return buffer.toString();
+ }
+}
Copied:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/umdm/UnifiedMetaData.java
(from rev 1600,
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/UnifiedMetaData.java)
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/UnifiedMetaData.java 2006-12-07
10:43:36 UTC (rev 1600)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/umdm/UnifiedMetaData.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -0,0 +1,220 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+package org.jboss.ws.metadata.umdm;
+
+// $Id$
+
+import java.net.URLClassLoader;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+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;
+
+/**
+ * The top level meta data.
+ *
+ * <h4>Thread safety</h4>
+ * <p>A <code>UnifiedMetaData</code> instance may be shared accross
threads provided that the following conditions are met:
+ * <ol>
+ * <li>{@link #eagerInitialize() eagerInitialize()} is called from a single thread
on startup</li>
+ * <li>Multi-thread access is limited to read-only calls</li>
+ * </ol></p>
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @author <a href="mailto:jason.greene@jboss.com">Jason T.
Greene</a>
+ * @since 12-May-2005
+ */
+public class UnifiedMetaData
+{
+ // provide logging
+ private static Logger log = Logger.getLogger(UnifiedMetaData.class);
+
+ // The modules resource class loader
+ private URLClassLoader resourceLoader;
+ // The modules class loader
+ private ClassLoader classLoader;
+ // The optional security domain
+ private String securityDomain;
+ // The implementation version
+ private static String implementationVersion;
+ // True if this is a final release
+ private static boolean isFinalRelease;
+ // Map<String, WSDLDefinitions> the wsdl-file to the wsdl Document
+ // Note the same wsdl can be used in multiple webservice descriptions
+ Map<String, WSDLDefinitions> wsdlMap = new HashMap<String,
WSDLDefinitions>();
+ // Maps the jaxrpc-mapping-file to {@link JavaWsdlMapping} object
+ // Note the same jaxrpc-mapping.xml can be used in multiple webservice descriptions
+ Map<String, JavaWsdlMapping> jaxrpcMap = new HashMap<String,
JavaWsdlMapping>();
+ // The list of service meta data
+ private List<ServiceMetaData> services = new
ArrayList<ServiceMetaData>();
+ // Used by eager initialization
+ private boolean eagerInitialized;
+ // Used by validate
+ private boolean validated;
+
+ public UnifiedMetaData()
+ {
+ }
+
+ public URLClassLoader getResourceLoader()
+ {
+ if (resourceLoader == null)
+ throw new IllegalStateException ("Resource loader not available");
+
+ return resourceLoader;
+ }
+
+ public void setResourceLoader(URLClassLoader resourceLoader)
+ {
+ this.resourceLoader = resourceLoader;
+ }
+
+ public ClassLoader getClassLoader()
+ {
+ if (classLoader == null)
+ throw new IllegalStateException ("Class loader not available");
+
+ return classLoader;
+ }
+
+ public void setClassLoader(ClassLoader classLoader)
+ {
+ this.classLoader = classLoader;
+ }
+
+ public String getSecurityDomain()
+ {
+ return securityDomain;
+ }
+
+ public void setSecurityDomain(String domain)
+ {
+ String prefix = "java:/jaas/";
+ if (domain != null && domain.startsWith(prefix))
+ domain = domain.substring(prefix.length());
+
+ this.securityDomain = domain;
+ }
+
+ public List<ServiceMetaData> getServices()
+ {
+ return new ArrayList<ServiceMetaData>(services);
+ }
+
+ public void addService(ServiceMetaData serviceMetaData)
+ {
+ services.add(serviceMetaData);
+ }
+
+ public void addWSDLDefinition(String wsdlFile, WSDLDefinitions wsdlDefinitions)
+ {
+ wsdlMap.put(wsdlFile, wsdlDefinitions);
+ }
+
+ public WSDLDefinitions getWSDLDefinition(String wsdlFile)
+ {
+ return wsdlMap.get(wsdlFile);
+ }
+
+ public void addMappingDefinition(String jaxrpcFile, JavaWsdlMapping javaWsdlMapping)
+ {
+ jaxrpcMap.put(jaxrpcFile, javaWsdlMapping);
+ }
+
+ public JavaWsdlMapping getMappingDefinition(String jaxrpcFile)
+ {
+ return jaxrpcMap.get(jaxrpcFile);
+ }
+
+ public void validate()
+ {
+ if (validated == false)
+ {
+ for (ServiceMetaData service : services)
+ {
+ service.validate();
+ }
+ validated = true;
+ }
+ }
+
+ public boolean isEagerInitialized()
+ {
+ return eagerInitialized;
+ }
+
+ /**
+ * Eagerly initialize all cache values that are normally lazy-loaded. This
+ * allows for concurrent read-only access to a
<code>UnifiedMetaData</code>
+ * instance. This method, however, must be called from a single thread.
+ */
+ public void eagerInitialize()
+ {
+ if (eagerInitialized == false)
+ {
+ log.debug("Eagerly initialize the meta data model");
+ for (ServiceMetaData service : services)
+ {
+ service.eagerInitialize();
+ }
+ eagerInitialized = true;
+ }
+ }
+
+ public static String getImplementationVersion()
+ {
+ if (implementationVersion == null)
+ {
+ implementationVersion =
ServiceEndpointManager.class.getPackage().getImplementationVersion();
+ isFinalRelease = new
StringTokenizer(implementationVersion).nextToken().endsWith(".GA");
+ }
+ return implementationVersion;
+ }
+
+ public static boolean isFinalRelease()
+ {
+ getImplementationVersion();
+ return isFinalRelease;
+ }
+
+ public String toString()
+ {
+ StringBuilder buffer = new StringBuilder("\nUnifiedMetaData: ");
+ buffer.append("\n implementation: " + getImplementationVersion());
+ buffer.append("\n securityDomain: " + getSecurityDomain());
+ //buffer.append("\n resourceLoader: " + resourceLoader);
+ //buffer.append("\n classLoader: " + classLoader);
+ buffer.append("\n");
+
+ for (ServiceMetaData serviceMetaData : services)
+ {
+ buffer.append(serviceMetaData);
+ }
+ return buffer.toString();
+ }
+}
\ No newline at end of file
Copied: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/webservices
(from rev 1600, branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/jsr109)
Deleted:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/webservices/PortComponentMetaData.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/jsr109/PortComponentMetaData.java 2006-12-07
10:43:36 UTC (rev 1600)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/webservices/PortComponentMetaData.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -1,194 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-// $Id$
-package org.jboss.ws.metadata.jsr109;
-
-// $Id$
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.xml.namespace.QName;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.metadata.j2ee.UnifiedHandlerMetaData;
-
-/**
- * XML Binding and ws4ee meta-data element for
- * <code>webservices/webservice-description/port-component</code>
- * <p/>
- * A port component is the equivalent of an ordinary Axis service (and
- * as such it constitutes the building blocks for jaxrpc services).
- * <p/>
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 15-April-2004
- */
-public class PortComponentMetaData
-{
- /**
- * The index of the webservice-description in webservices.xml
- */
- public static final String PARAMETER_WEBSERVICE_ID = "webserviceID";
-
- // provide logging
- private static final Logger log = Logger.getLogger(PortComponentMetaData.class);
-
- // The parent <webservice-description> element
- private WebserviceDescriptionMetaData webserviceDescription;
-
- /** The required <port-component-name> element
- * This name bears no relationship to the WSDL port name.
- * This name must be unique amongst all port component names in a module.
- */
- private String portComponentName;
- // The required <wsdl-port> element
- private QName wsdlPort;
- // The required <service-endpoint-interface> element
- private String serviceEndpointInterface;
- // The required <ejb-link> or <servlet-link> in the
<service-impl-bean> element
- private String ejbLink;
- private String servletLink;
- // The optional <handler> elements
- private List<UnifiedHandlerMetaData> handlers = new
ArrayList<UnifiedHandlerMetaData>();
-
- // The HTTP context root
- private String contextRoot;
-
- /** Construct a new PortComponentMetaData for a given WebserviceDescriptionMetaData
- */
- public PortComponentMetaData(WebserviceDescriptionMetaData webserviceDescription)
- {
- this.webserviceDescription = webserviceDescription;
- }
-
- public WebserviceDescriptionMetaData getWebserviceDescription()
- {
- return webserviceDescription;
- }
-
- public String getPortComponentName()
- {
- return portComponentName;
- }
-
- public void setPortComponentName(String portComponentName)
- {
- this.portComponentName = portComponentName;
- }
-
- public QName getWsdlPort()
- {
- return wsdlPort;
- }
-
- public void setWsdlPort(QName wsdlPort)
- {
- if (wsdlPort.getNamespaceURI().length() == 0)
- log.warn("<wsdl-port> element in webservices.xml not namespace
qualified: " + wsdlPort);
-
- this.wsdlPort = wsdlPort;
- }
-
- public String getEjbLink()
- {
- return ejbLink;
- }
-
- public void setEjbLink(String ejbLink)
- {
- this.ejbLink = ejbLink;
- }
-
- public String getServletLink()
- {
- return servletLink;
- }
-
- public void setServletLink(String servletLink)
- {
- this.servletLink = servletLink;
- }
-
- public String getServiceEndpointInterface()
- {
- return serviceEndpointInterface;
- }
-
- public void setServiceEndpointInterface(String serviceEndpointInterface)
- {
- this.serviceEndpointInterface = serviceEndpointInterface;
- }
-
- public void addHandler(UnifiedHandlerMetaData handler)
- {
- handlers.add(handler);
- }
-
- public UnifiedHandlerMetaData[] getHandlers()
- {
- UnifiedHandlerMetaData[] array = new UnifiedHandlerMetaData[handlers.size()];
- handlers.toArray(array);
- return array;
- }
-
- public String getContextRoot()
- {
- return contextRoot;
- }
-
- public void setContextRoot(String contextRoot)
- {
- this.contextRoot = contextRoot;
- }
-
- /**
- * Serialize as a String
- *
- * @return
- */
- public String serialize()
- {
- StringBuilder builder = new StringBuilder("<port-component>
<port-component-name>");
- builder.append(portComponentName +
"</port-component-name><wsdl-port>impl:");
- builder.append(wsdlPort.getLocalPart() +
"</wsdl-port><service-endpoint-interface>");
- builder.append(serviceEndpointInterface);
- builder.append("</service-endpoint-interface>");
- builder.append("<service-impl-bean>");
- if (ejbLink != null)
- {
- builder.append("<ejb-link>");
- builder.append(ejbLink);
- builder.append("</ejb-link>");
-
- }
- else
- {
- builder.append("<servlet-link>");
- builder.append(servletLink);
- builder.append("</servlet-link>");
- }
- builder.append("</service-impl-bean>");
- builder.append("</port-component>");
- return builder.toString();
- }
-}
Copied:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/webservices/PortComponentMetaData.java
(from rev 1603,
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/jsr109/PortComponentMetaData.java)
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/jsr109/PortComponentMetaData.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/webservices/PortComponentMetaData.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -0,0 +1,194 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+// $Id$
+package org.jboss.ws.metadata.webservices;
+
+// $Id$
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.metadata.j2ee.UnifiedHandlerMetaData;
+
+/**
+ * XML Binding and ws4ee meta-data element for
+ * <code>webservices/webservice-description/port-component</code>
+ * <p/>
+ * A port component is the equivalent of an ordinary Axis service (and
+ * as such it constitutes the building blocks for jaxrpc services).
+ * <p/>
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 15-April-2004
+ */
+public class PortComponentMetaData
+{
+ /**
+ * The index of the webservice-description in webservices.xml
+ */
+ public static final String PARAMETER_WEBSERVICE_ID = "webserviceID";
+
+ // provide logging
+ private static final Logger log = Logger.getLogger(PortComponentMetaData.class);
+
+ // The parent <webservice-description> element
+ private WebserviceDescriptionMetaData webserviceDescription;
+
+ /** The required <port-component-name> element
+ * This name bears no relationship to the WSDL port name.
+ * This name must be unique amongst all port component names in a module.
+ */
+ private String portComponentName;
+ // The required <wsdl-port> element
+ private QName wsdlPort;
+ // The required <service-endpoint-interface> element
+ private String serviceEndpointInterface;
+ // The required <ejb-link> or <servlet-link> in the
<service-impl-bean> element
+ private String ejbLink;
+ private String servletLink;
+ // The optional <handler> elements
+ private List<UnifiedHandlerMetaData> handlers = new
ArrayList<UnifiedHandlerMetaData>();
+
+ // The HTTP context root
+ private String contextRoot;
+
+ /** Construct a new PortComponentMetaData for a given WebserviceDescriptionMetaData
+ */
+ public PortComponentMetaData(WebserviceDescriptionMetaData webserviceDescription)
+ {
+ this.webserviceDescription = webserviceDescription;
+ }
+
+ public WebserviceDescriptionMetaData getWebserviceDescription()
+ {
+ return webserviceDescription;
+ }
+
+ public String getPortComponentName()
+ {
+ return portComponentName;
+ }
+
+ public void setPortComponentName(String portComponentName)
+ {
+ this.portComponentName = portComponentName;
+ }
+
+ public QName getWsdlPort()
+ {
+ return wsdlPort;
+ }
+
+ public void setWsdlPort(QName wsdlPort)
+ {
+ if (wsdlPort.getNamespaceURI().length() == 0)
+ log.warn("<wsdl-port> element in webservices.xml not namespace
qualified: " + wsdlPort);
+
+ this.wsdlPort = wsdlPort;
+ }
+
+ public String getEjbLink()
+ {
+ return ejbLink;
+ }
+
+ public void setEjbLink(String ejbLink)
+ {
+ this.ejbLink = ejbLink;
+ }
+
+ public String getServletLink()
+ {
+ return servletLink;
+ }
+
+ public void setServletLink(String servletLink)
+ {
+ this.servletLink = servletLink;
+ }
+
+ public String getServiceEndpointInterface()
+ {
+ return serviceEndpointInterface;
+ }
+
+ public void setServiceEndpointInterface(String serviceEndpointInterface)
+ {
+ this.serviceEndpointInterface = serviceEndpointInterface;
+ }
+
+ public void addHandler(UnifiedHandlerMetaData handler)
+ {
+ handlers.add(handler);
+ }
+
+ public UnifiedHandlerMetaData[] getHandlers()
+ {
+ UnifiedHandlerMetaData[] array = new UnifiedHandlerMetaData[handlers.size()];
+ handlers.toArray(array);
+ return array;
+ }
+
+ public String getContextRoot()
+ {
+ return contextRoot;
+ }
+
+ public void setContextRoot(String contextRoot)
+ {
+ this.contextRoot = contextRoot;
+ }
+
+ /**
+ * Serialize as a String
+ *
+ * @return
+ */
+ public String serialize()
+ {
+ StringBuilder builder = new StringBuilder("<port-component>
<port-component-name>");
+ builder.append(portComponentName +
"</port-component-name><wsdl-port>impl:");
+ builder.append(wsdlPort.getLocalPart() +
"</wsdl-port><service-endpoint-interface>");
+ builder.append(serviceEndpointInterface);
+ builder.append("</service-endpoint-interface>");
+ builder.append("<service-impl-bean>");
+ if (ejbLink != null)
+ {
+ builder.append("<ejb-link>");
+ builder.append(ejbLink);
+ builder.append("</ejb-link>");
+
+ }
+ else
+ {
+ builder.append("<servlet-link>");
+ builder.append(servletLink);
+ builder.append("</servlet-link>");
+ }
+ builder.append("</service-impl-bean>");
+ builder.append("</port-component>");
+ return builder.toString();
+ }
+}
Deleted:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/webservices/WebserviceDescriptionMetaData.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/jsr109/WebserviceDescriptionMetaData.java 2006-12-07
10:43:36 UTC (rev 1600)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/webservices/WebserviceDescriptionMetaData.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -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.metadata.jsr109;
-
-// $Id$
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-import javax.xml.namespace.QName;
-
-import org.jboss.logging.Logger;
-
-/**
- * XML Binding element for <code>webservices/webservice-description</code>
- *
- * @author Thomas.Diesler(a)jboss.org
- * @version $Revision$
- * @since 15-April-2004
- */
-public class WebserviceDescriptionMetaData
-{
- // provide logging
- private static final Logger log =
Logger.getLogger(WebserviceDescriptionMetaData.class);
-
- // The parent <webservices> element
- private WebservicesMetaData webservices;
-
- // The required <webservice-description-name> element
- private String webserviceDescriptionName;
- // The required <wsdl-file> element
- private String wsdlFile;
- // The required <jaxrpc-mapping-file> element
- private String jaxrpcMappingFile;
- // The required <port-component> elements
- private ArrayList<PortComponentMetaData> portComponents = new
ArrayList<PortComponentMetaData>();
-
- public WebserviceDescriptionMetaData(WebservicesMetaData webservices)
- {
- this.webservices = webservices;
- }
-
- public WebservicesMetaData getWebservices()
- {
- return webservices;
- }
-
- public void addPortComponent(PortComponentMetaData portComponent)
- {
- portComponents.add(portComponent);
- }
-
- public PortComponentMetaData[] getPortComponents()
- {
- PortComponentMetaData[] array = new PortComponentMetaData[portComponents.size()];
- portComponents.toArray(array);
- return array;
- }
-
- /**
- * Get the QNames of the port components to be declared
- * in the namespaces
- *
- * @return
- */
- public Collection getPortComponentQNames()
- {
- //TODO:Check if there is just one QName that drives all portcomponents
- //or each port component can have a distinct QName (namespace/prefix)
- //Maintain uniqueness of the QName
- Map map = new HashMap();
- Iterator iter = portComponents.iterator();
- while(iter != null && iter.hasNext())
- {
- PortComponentMetaData pcm = (PortComponentMetaData)iter.next();
- QName qname = pcm.getWsdlPort();
- map.put(qname.getPrefix(),qname);
- }
- return map.values();
- }
-
- /**
- * Lookup a PortComponentMetaData by wsdl-port local part
- *
- * @param name - the wsdl-port local part
- * @return PortComponentMetaData if found, null otherwise
- */
- public PortComponentMetaData getPortComponentByWsdlPort(String name)
- {
- ArrayList pcNames = new ArrayList();
- Iterator it = portComponents.iterator();
- while (it.hasNext())
- {
- PortComponentMetaData pc = (PortComponentMetaData)it.next();
- String wsdlPortName = pc.getWsdlPort().getLocalPart();
- if (wsdlPortName.equals(name))
- {
- return pc;
- }
- pcNames.add(wsdlPortName);
- }
-
- log.error("Cannot get port component name '" + name + "', we
have: " + pcNames);
- return null;
- }
-
- public String getWebserviceDescriptionName()
- {
- return webserviceDescriptionName;
- }
-
- public void setWebserviceDescriptionName(String webserviceDescriptionName)
- {
- this.webserviceDescriptionName = webserviceDescriptionName;
- }
-
- public String getWsdlFile()
- {
- return wsdlFile;
- }
-
- public void setWsdlFile(String wsdlFile)
- {
- this.wsdlFile = wsdlFile;
- }
-
- public String getJaxrpcMappingFile()
- {
- return jaxrpcMappingFile;
- }
-
- public void setJaxrpcMappingFile(String jaxrpcMappingFile)
- {
- this.jaxrpcMappingFile = jaxrpcMappingFile;
- }
-
- /**
- * Serialize as a String
- *
- * @return
- */
- public String serialize()
- {
- StringBuilder buffer = new StringBuilder("<webservice-description>
<webservice-description-name>");
- buffer.append(this.webserviceDescriptionName);
- buffer.append("</webservice-description-name>");
-
buffer.append("<wsdl-file>"+wsdlFile+"</wsdl-file>");
-
buffer.append("<jaxrpc-mapping-file>"+jaxrpcMappingFile+"</jaxrpc-mapping-file>");
- for(PortComponentMetaData pm:portComponents)
- buffer.append(pm.serialize());
- buffer.append("</webservice-description>");
- return buffer.toString();
- }
-}
Copied:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/webservices/WebserviceDescriptionMetaData.java
(from rev 1603,
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/jsr109/WebserviceDescriptionMetaData.java)
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/jsr109/WebserviceDescriptionMetaData.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/webservices/WebserviceDescriptionMetaData.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -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.metadata.webservices;
+
+// $Id$
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.logging.Logger;
+
+/**
+ * XML Binding element for <code>webservices/webservice-description</code>
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @version $Revision$
+ * @since 15-April-2004
+ */
+public class WebserviceDescriptionMetaData
+{
+ // provide logging
+ private static final Logger log =
Logger.getLogger(WebserviceDescriptionMetaData.class);
+
+ // The parent <webservices> element
+ private WebservicesMetaData webservices;
+
+ // The required <webservice-description-name> element
+ private String webserviceDescriptionName;
+ // The required <wsdl-file> element
+ private String wsdlFile;
+ // The required <jaxrpc-mapping-file> element
+ private String jaxrpcMappingFile;
+ // The required <port-component> elements
+ private ArrayList<PortComponentMetaData> portComponents = new
ArrayList<PortComponentMetaData>();
+
+ public WebserviceDescriptionMetaData(WebservicesMetaData webservices)
+ {
+ this.webservices = webservices;
+ }
+
+ public WebservicesMetaData getWebservices()
+ {
+ return webservices;
+ }
+
+ public void addPortComponent(PortComponentMetaData portComponent)
+ {
+ portComponents.add(portComponent);
+ }
+
+ public PortComponentMetaData[] getPortComponents()
+ {
+ PortComponentMetaData[] array = new PortComponentMetaData[portComponents.size()];
+ portComponents.toArray(array);
+ return array;
+ }
+
+ /**
+ * Get the QNames of the port components to be declared
+ * in the namespaces
+ *
+ * @return
+ */
+ public Collection getPortComponentQNames()
+ {
+ //TODO:Check if there is just one QName that drives all portcomponents
+ //or each port component can have a distinct QName (namespace/prefix)
+ //Maintain uniqueness of the QName
+ Map map = new HashMap();
+ Iterator iter = portComponents.iterator();
+ while(iter != null && iter.hasNext())
+ {
+ PortComponentMetaData pcm = (PortComponentMetaData)iter.next();
+ QName qname = pcm.getWsdlPort();
+ map.put(qname.getPrefix(),qname);
+ }
+ return map.values();
+ }
+
+ /**
+ * Lookup a PortComponentMetaData by wsdl-port local part
+ *
+ * @param name - the wsdl-port local part
+ * @return PortComponentMetaData if found, null otherwise
+ */
+ public PortComponentMetaData getPortComponentByWsdlPort(String name)
+ {
+ ArrayList pcNames = new ArrayList();
+ Iterator it = portComponents.iterator();
+ while (it.hasNext())
+ {
+ PortComponentMetaData pc = (PortComponentMetaData)it.next();
+ String wsdlPortName = pc.getWsdlPort().getLocalPart();
+ if (wsdlPortName.equals(name))
+ {
+ return pc;
+ }
+ pcNames.add(wsdlPortName);
+ }
+
+ log.error("Cannot get port component name '" + name + "', we
have: " + pcNames);
+ return null;
+ }
+
+ public String getWebserviceDescriptionName()
+ {
+ return webserviceDescriptionName;
+ }
+
+ public void setWebserviceDescriptionName(String webserviceDescriptionName)
+ {
+ this.webserviceDescriptionName = webserviceDescriptionName;
+ }
+
+ public String getWsdlFile()
+ {
+ return wsdlFile;
+ }
+
+ public void setWsdlFile(String wsdlFile)
+ {
+ this.wsdlFile = wsdlFile;
+ }
+
+ public String getJaxrpcMappingFile()
+ {
+ return jaxrpcMappingFile;
+ }
+
+ public void setJaxrpcMappingFile(String jaxrpcMappingFile)
+ {
+ this.jaxrpcMappingFile = jaxrpcMappingFile;
+ }
+
+ /**
+ * Serialize as a String
+ *
+ * @return
+ */
+ public String serialize()
+ {
+ StringBuilder buffer = new StringBuilder("<webservice-description>
<webservice-description-name>");
+ buffer.append(this.webserviceDescriptionName);
+ buffer.append("</webservice-description-name>");
+
buffer.append("<wsdl-file>"+wsdlFile+"</wsdl-file>");
+
buffer.append("<jaxrpc-mapping-file>"+jaxrpcMappingFile+"</jaxrpc-mapping-file>");
+ for(PortComponentMetaData pm:portComponents)
+ buffer.append(pm.serialize());
+ buffer.append("</webservice-description>");
+ return buffer.toString();
+ }
+}
Deleted:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/webservices/WebservicesFactory.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/jsr109/WebservicesFactory.java 2006-12-07
10:43:36 UTC (rev 1600)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/webservices/WebservicesFactory.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -1,214 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.ws.metadata.jsr109;
-
-// $Id$
-
-import java.net.URL;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.metadata.HandlerMetaData.HandlerType;
-import org.jboss.ws.metadata.HandlerMetaData.HandlerInitParam;
-import org.jboss.ws.metadata.j2ee.UnifiedHandlerMetaData;
-import org.jboss.xb.binding.ObjectModelFactory;
-import org.jboss.xb.binding.UnmarshallingContext;
-import org.xml.sax.Attributes;
-
-/**
- * A JBossXB factory for {@link WebservicesMetaData}
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 16-Apr-2004
- */
-public class WebservicesFactory implements ObjectModelFactory
-{
- // provide logging
- private static final Logger log = Logger.getLogger(WebservicesFactory.class);
-
- // The URL to the webservices.xml descriptor
- private URL descriptorURL;
-
- public WebservicesFactory(URL descriptorURL)
- {
- this.descriptorURL = descriptorURL;
- }
-
- /**
- * This method is called on the factory by the object model builder when the parsing
starts.
- *
- * @return the root of the object model.
- */
- public Object newRoot(Object root, UnmarshallingContext navigator, String
namespaceURI, String localName, Attributes attrs)
- {
- WebservicesMetaData webservicesMetaData = new WebservicesMetaData(descriptorURL);
- return webservicesMetaData;
- }
-
- public Object completeRoot(Object root, UnmarshallingContext ctx, String uri, String
name)
- {
- return root;
- }
-
- /**
- * Called when parsing of a new element started.
- */
- public Object newChild(WebservicesMetaData webservices, UnmarshallingContext
navigator, String namespaceURI, String localName, Attributes attrs)
- {
- if ("webservice-description".equals(localName))
- return new WebserviceDescriptionMetaData(webservices);
- else return null;
- }
-
- /**
- * Called when parsing character is complete.
- */
- public void addChild(WebservicesMetaData webservices, WebserviceDescriptionMetaData
webserviceDescription, UnmarshallingContext navigator, String namespaceURI,
- String localName)
- {
- webservices.addWebserviceDescription(webserviceDescription);
- }
-
- /**
- * Called when parsing of a new element started.
- */
- public Object newChild(WebserviceDescriptionMetaData webserviceDescription,
UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs)
- {
- if ("port-component".equals(localName))
- return new PortComponentMetaData(webserviceDescription);
- else return null;
- }
-
- /**
- * Called when parsing character is complete.
- */
- public void addChild(WebserviceDescriptionMetaData webserviceDescription,
PortComponentMetaData portComponent, UnmarshallingContext navigator, String namespaceURI,
- String localName)
- {
- webserviceDescription.addPortComponent(portComponent);
- }
-
- /**
- * Called when parsing of a new element started.
- */
- public Object newChild(PortComponentMetaData portComponent, UnmarshallingContext
navigator, String namespaceURI, String localName, Attributes attrs)
- {
- if ("handler".equals(localName))
- return new UnifiedHandlerMetaData(null);
- else return null;
- }
-
- /**
- * Called when parsing character is complete.
- */
- public void addChild(PortComponentMetaData portComponent, UnifiedHandlerMetaData
handler, UnmarshallingContext navigator, String namespaceURI, String localName)
- {
- portComponent.addHandler(handler);
- }
-
- /**
- * Called when parsing of a new element started.
- */
- public Object newChild(UnifiedHandlerMetaData handler, UnmarshallingContext navigator,
String namespaceURI, String localName, Attributes attrs)
- {
- if ("init-param".equals(localName))
- return new HandlerInitParam();
- else return null;
- }
-
- /**
- * Called when parsing character is complete.
- */
- public void addChild(UnifiedHandlerMetaData handler, HandlerInitParam param,
UnmarshallingContext navigator, String namespaceURI, String localName)
- {
- handler.addInitParam(param);
- }
-
- /**
- * Called when a new simple child element with text value was read from the XML
content.
- */
- public void setValue(WebserviceDescriptionMetaData webserviceDescription,
UnmarshallingContext navigator, String namespaceURI, String localName, String value)
- {
- if (log.isTraceEnabled())
- log.trace("WebserviceDescriptionMetaData setValue: nuri=" +
namespaceURI + " localName=" + localName + " value=" + value);
-
- if (localName.equals("webservice-description-name"))
- webserviceDescription.setWebserviceDescriptionName(value);
- else if (localName.equals("wsdl-file"))
- webserviceDescription.setWsdlFile(value);
- else if (localName.equals("jaxrpc-mapping-file"))
- webserviceDescription.setJaxrpcMappingFile(value);
- }
-
- /**
- * Called when a new simple child element with text value was read from the XML
content.
- */
- public void setValue(PortComponentMetaData portComponent, UnmarshallingContext
navigator, String namespaceURI, String localName, String value)
- {
- if (log.isTraceEnabled())
- log.trace("PortComponentMetaData setValue: nuri=" + namespaceURI +
" localName=" + localName + " value=" + value);
-
- if (localName.equals("port-component-name"))
- portComponent.setPortComponentName(value);
- else if (localName.equals("wsdl-port"))
- portComponent.setWsdlPort(navigator.resolveQName(value));
- else if (localName.equals("service-endpoint-interface"))
- portComponent.setServiceEndpointInterface(value);
- else if (localName.equals("ejb-link"))
- portComponent.setEjbLink(value);
- else if (localName.equals("servlet-link"))
- portComponent.setServletLink(value);
- }
-
- /**
- * Called when a new simple child element with text value was read from the XML
content.
- */
- public void setValue(UnifiedHandlerMetaData handler, UnmarshallingContext navigator,
String namespaceURI, String localName, String value)
- {
- if (log.isTraceEnabled())
- log.trace("UnifiedHandlerMetaData setValue: nuri=" + namespaceURI +
" localName=" + localName + " value=" + value);
-
- if (localName.equals("handler-name"))
- handler.setHandlerName(value);
- else if (localName.equals("handler-class"))
- handler.setHandlerClass(value);
- else if (localName.equals("soap-header"))
- handler.addSoapHeader(navigator.resolveQName(value));
- else if (localName.equals("soap-role"))
- handler.addSoapRole(value);
- else if (localName.equals("port-name"))
- handler.addPortName(value);
- }
-
- /**
- * Called when a new simple child element with text value was read from the XML
content.
- */
- public void setValue(HandlerInitParam param, UnmarshallingContext navigator, String
namespaceURI, String localName, String value)
- {
- if (log.isTraceEnabled())
- log.trace("UnifiedInitParamMetaData setValue: nuri=" + namespaceURI +
" localName=" + localName + " value=" + value);
-
- if (localName.equals("param-name"))
- param.setParamName(value);
- else if (localName.equals("param-value"))
- param.setParamValue(value);
- }
-}
Copied:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/webservices/WebservicesFactory.java
(from rev 1603,
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/jsr109/WebservicesFactory.java)
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/jsr109/WebservicesFactory.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/webservices/WebservicesFactory.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -0,0 +1,214 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ws.metadata.webservices;
+
+// $Id$
+
+import java.net.URL;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.metadata.j2ee.UnifiedHandlerMetaData;
+import org.jboss.ws.metadata.umdm.HandlerMetaData.HandlerInitParam;
+import org.jboss.ws.metadata.umdm.HandlerMetaData.HandlerType;
+import org.jboss.xb.binding.ObjectModelFactory;
+import org.jboss.xb.binding.UnmarshallingContext;
+import org.xml.sax.Attributes;
+
+/**
+ * A JBossXB factory for {@link WebservicesMetaData}
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 16-Apr-2004
+ */
+public class WebservicesFactory implements ObjectModelFactory
+{
+ // provide logging
+ private static final Logger log = Logger.getLogger(WebservicesFactory.class);
+
+ // The URL to the webservices.xml descriptor
+ private URL descriptorURL;
+
+ public WebservicesFactory(URL descriptorURL)
+ {
+ this.descriptorURL = descriptorURL;
+ }
+
+ /**
+ * This method is called on the factory by the object model builder when the parsing
starts.
+ *
+ * @return the root of the object model.
+ */
+ public Object newRoot(Object root, UnmarshallingContext navigator, String
namespaceURI, String localName, Attributes attrs)
+ {
+ WebservicesMetaData webservicesMetaData = new WebservicesMetaData(descriptorURL);
+ return webservicesMetaData;
+ }
+
+ public Object completeRoot(Object root, UnmarshallingContext ctx, String uri, String
name)
+ {
+ return root;
+ }
+
+ /**
+ * Called when parsing of a new element started.
+ */
+ public Object newChild(WebservicesMetaData webservices, UnmarshallingContext
navigator, String namespaceURI, String localName, Attributes attrs)
+ {
+ if ("webservice-description".equals(localName))
+ return new WebserviceDescriptionMetaData(webservices);
+ else return null;
+ }
+
+ /**
+ * Called when parsing character is complete.
+ */
+ public void addChild(WebservicesMetaData webservices, WebserviceDescriptionMetaData
webserviceDescription, UnmarshallingContext navigator, String namespaceURI,
+ String localName)
+ {
+ webservices.addWebserviceDescription(webserviceDescription);
+ }
+
+ /**
+ * Called when parsing of a new element started.
+ */
+ public Object newChild(WebserviceDescriptionMetaData webserviceDescription,
UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs)
+ {
+ if ("port-component".equals(localName))
+ return new PortComponentMetaData(webserviceDescription);
+ else return null;
+ }
+
+ /**
+ * Called when parsing character is complete.
+ */
+ public void addChild(WebserviceDescriptionMetaData webserviceDescription,
PortComponentMetaData portComponent, UnmarshallingContext navigator, String namespaceURI,
+ String localName)
+ {
+ webserviceDescription.addPortComponent(portComponent);
+ }
+
+ /**
+ * Called when parsing of a new element started.
+ */
+ public Object newChild(PortComponentMetaData portComponent, UnmarshallingContext
navigator, String namespaceURI, String localName, Attributes attrs)
+ {
+ if ("handler".equals(localName))
+ return new UnifiedHandlerMetaData(null);
+ else return null;
+ }
+
+ /**
+ * Called when parsing character is complete.
+ */
+ public void addChild(PortComponentMetaData portComponent, UnifiedHandlerMetaData
handler, UnmarshallingContext navigator, String namespaceURI, String localName)
+ {
+ portComponent.addHandler(handler);
+ }
+
+ /**
+ * Called when parsing of a new element started.
+ */
+ public Object newChild(UnifiedHandlerMetaData handler, UnmarshallingContext navigator,
String namespaceURI, String localName, Attributes attrs)
+ {
+ if ("init-param".equals(localName))
+ return new HandlerInitParam();
+ else return null;
+ }
+
+ /**
+ * Called when parsing character is complete.
+ */
+ public void addChild(UnifiedHandlerMetaData handler, HandlerInitParam param,
UnmarshallingContext navigator, String namespaceURI, String localName)
+ {
+ handler.addInitParam(param);
+ }
+
+ /**
+ * Called when a new simple child element with text value was read from the XML
content.
+ */
+ public void setValue(WebserviceDescriptionMetaData webserviceDescription,
UnmarshallingContext navigator, String namespaceURI, String localName, String value)
+ {
+ if (log.isTraceEnabled())
+ log.trace("WebserviceDescriptionMetaData setValue: nuri=" +
namespaceURI + " localName=" + localName + " value=" + value);
+
+ if (localName.equals("webservice-description-name"))
+ webserviceDescription.setWebserviceDescriptionName(value);
+ else if (localName.equals("wsdl-file"))
+ webserviceDescription.setWsdlFile(value);
+ else if (localName.equals("jaxrpc-mapping-file"))
+ webserviceDescription.setJaxrpcMappingFile(value);
+ }
+
+ /**
+ * Called when a new simple child element with text value was read from the XML
content.
+ */
+ public void setValue(PortComponentMetaData portComponent, UnmarshallingContext
navigator, String namespaceURI, String localName, String value)
+ {
+ if (log.isTraceEnabled())
+ log.trace("PortComponentMetaData setValue: nuri=" + namespaceURI +
" localName=" + localName + " value=" + value);
+
+ if (localName.equals("port-component-name"))
+ portComponent.setPortComponentName(value);
+ else if (localName.equals("wsdl-port"))
+ portComponent.setWsdlPort(navigator.resolveQName(value));
+ else if (localName.equals("service-endpoint-interface"))
+ portComponent.setServiceEndpointInterface(value);
+ else if (localName.equals("ejb-link"))
+ portComponent.setEjbLink(value);
+ else if (localName.equals("servlet-link"))
+ portComponent.setServletLink(value);
+ }
+
+ /**
+ * Called when a new simple child element with text value was read from the XML
content.
+ */
+ public void setValue(UnifiedHandlerMetaData handler, UnmarshallingContext navigator,
String namespaceURI, String localName, String value)
+ {
+ if (log.isTraceEnabled())
+ log.trace("UnifiedHandlerMetaData setValue: nuri=" + namespaceURI +
" localName=" + localName + " value=" + value);
+
+ if (localName.equals("handler-name"))
+ handler.setHandlerName(value);
+ else if (localName.equals("handler-class"))
+ handler.setHandlerClass(value);
+ else if (localName.equals("soap-header"))
+ handler.addSoapHeader(navigator.resolveQName(value));
+ else if (localName.equals("soap-role"))
+ handler.addSoapRole(value);
+ else if (localName.equals("port-name"))
+ handler.addPortName(value);
+ }
+
+ /**
+ * Called when a new simple child element with text value was read from the XML
content.
+ */
+ public void setValue(HandlerInitParam param, UnmarshallingContext navigator, String
namespaceURI, String localName, String value)
+ {
+ if (log.isTraceEnabled())
+ log.trace("UnifiedInitParamMetaData setValue: nuri=" + namespaceURI +
" localName=" + localName + " value=" + value);
+
+ if (localName.equals("param-name"))
+ param.setParamName(value);
+ else if (localName.equals("param-value"))
+ param.setParamValue(value);
+ }
+}
Deleted:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/webservices/WebservicesMetaData.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/jsr109/WebservicesMetaData.java 2006-12-07
10:43:36 UTC (rev 1600)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/webservices/WebservicesMetaData.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -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.
-*/
-// $Id$
-package org.jboss.ws.metadata.jsr109;
-
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import javax.xml.namespace.QName;
-
-import org.jboss.ws.Constants;
-
-// $Id$
-
-/**
- * XML Binding root element for <code>webservices.xml</code>
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 15-April-2004
- */
-public class WebservicesMetaData
-{
- // The required <webservice-description> elements
- private ArrayList<WebserviceDescriptionMetaData> webserviceDescriptions = new
ArrayList<WebserviceDescriptionMetaData>();
-
- // The URL to the webservices.xml descriptor
- private URL descriptorURL;
-
- public WebservicesMetaData()
- {
- }
-
- public WebservicesMetaData(URL descriptorURL)
- {
- this.descriptorURL = descriptorURL;
- }
-
- public URL getDescriptorURL()
- {
- return descriptorURL;
- }
-
- public void addWebserviceDescription(WebserviceDescriptionMetaData
webserviceDescription)
- {
- webserviceDescriptions.add(webserviceDescription);
- }
-
- public WebserviceDescriptionMetaData[] getWebserviceDescriptions()
- {
- WebserviceDescriptionMetaData[] array = new
WebserviceDescriptionMetaData[webserviceDescriptions.size()];
- webserviceDescriptions.toArray(array);
- return array;
- }
-
- //Serialize as a String
- public String serialize()
- {
- StringBuilder buffer = new StringBuilder();
- //Construct the webservices.xml definitions
- List qnames = new ArrayList();
- Iterator iter = webserviceDescriptions.iterator();
- while(iter != null && iter.hasNext())
- {
- WebserviceDescriptionMetaData wmd = (WebserviceDescriptionMetaData)iter.next();
- qnames.addAll(wmd.getPortComponentQNames());
- }
- createHeader( buffer,qnames );
- for(WebserviceDescriptionMetaData wm:webserviceDescriptions)
- buffer.append(wm.serialize());
- buffer.append("</webservices>");
- return buffer.toString();
- }
-
- private void createHeader( StringBuilder buf, List qnames)
- {
- buf.append("<webservices
xmlns='http://java.sun.com/xml/ns/j2ee'");
- buf.append("
xmlns:xsi='"+Constants.NS_SCHEMA_XSI+"'");
- //Lets append the port type namespaces
- Iterator iter = qnames.iterator();
- while(iter != null && iter.hasNext())
- {
- QName qn = (QName)iter.next();
- buf.append("
xmlns:").append(qn.getPrefix()).append("='").append(qn.getNamespaceURI()).append("'");
- }
- buf.append("
xsi:schemaLocation='http://java.sun.com/xml/ns/j2ee
http://www.ibm.com/webservices/xsd/j2ee_web_services_1_1.xsd'");
- buf.append(" version='1.1' >");
- }
-}
Copied:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/webservices/WebservicesMetaData.java
(from rev 1603,
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/jsr109/WebservicesMetaData.java)
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/jsr109/WebservicesMetaData.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/webservices/WebservicesMetaData.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -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.
+*/
+// $Id$
+package org.jboss.ws.metadata.webservices;
+
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.ws.Constants;
+
+// $Id$
+
+/**
+ * XML Binding root element for <code>webservices.xml</code>
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 15-April-2004
+ */
+public class WebservicesMetaData
+{
+ // The required <webservice-description> elements
+ private ArrayList<WebserviceDescriptionMetaData> webserviceDescriptions = new
ArrayList<WebserviceDescriptionMetaData>();
+
+ // The URL to the webservices.xml descriptor
+ private URL descriptorURL;
+
+ public WebservicesMetaData()
+ {
+ }
+
+ public WebservicesMetaData(URL descriptorURL)
+ {
+ this.descriptorURL = descriptorURL;
+ }
+
+ public URL getDescriptorURL()
+ {
+ return descriptorURL;
+ }
+
+ public void addWebserviceDescription(WebserviceDescriptionMetaData
webserviceDescription)
+ {
+ webserviceDescriptions.add(webserviceDescription);
+ }
+
+ public WebserviceDescriptionMetaData[] getWebserviceDescriptions()
+ {
+ WebserviceDescriptionMetaData[] array = new
WebserviceDescriptionMetaData[webserviceDescriptions.size()];
+ webserviceDescriptions.toArray(array);
+ return array;
+ }
+
+ //Serialize as a String
+ public String serialize()
+ {
+ StringBuilder buffer = new StringBuilder();
+ //Construct the webservices.xml definitions
+ List qnames = new ArrayList();
+ Iterator iter = webserviceDescriptions.iterator();
+ while(iter != null && iter.hasNext())
+ {
+ WebserviceDescriptionMetaData wmd = (WebserviceDescriptionMetaData)iter.next();
+ qnames.addAll(wmd.getPortComponentQNames());
+ }
+ createHeader( buffer,qnames );
+ for(WebserviceDescriptionMetaData wm:webserviceDescriptions)
+ buffer.append(wm.serialize());
+ buffer.append("</webservices>");
+ return buffer.toString();
+ }
+
+ private void createHeader( StringBuilder buf, List qnames)
+ {
+ buf.append("<webservices
xmlns='http://java.sun.com/xml/ns/j2ee'");
+ buf.append("
xmlns:xsi='"+Constants.NS_SCHEMA_XSI+"'");
+ //Lets append the port type namespaces
+ Iterator iter = qnames.iterator();
+ while(iter != null && iter.hasNext())
+ {
+ QName qn = (QName)iter.next();
+ buf.append("
xmlns:").append(qn.getPrefix()).append("='").append(qn.getNamespaceURI()).append("'");
+ }
+ buf.append("
xsi:schemaLocation='http://java.sun.com/xml/ns/j2ee
http://www.ibm.com/webservices/xsd/j2ee_web_services_1_1.xsd'");
+ buf.append(" version='1.1' >");
+ }
+}
Deleted:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/wsdl/WSDL11DefinitionFactory.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/wsdl/WSDL11DefinitionFactory.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/wsdl/WSDL11DefinitionFactory.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -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.metadata.wsdl;
-
-// $Id: WSDL11DefinitionFactory.java 906 2006-09-06 18:57:40Z thomas.diesler(a)jboss.com $
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.core.utils.JBossWSEntityResolver;
-import org.xml.sax.EntityResolver;
-import org.xml.sax.InputSource;
-
-import com.ibm.wsdl.xml.WSDLReaderImpl;
-
-import javax.wsdl.Definition;
-import javax.wsdl.WSDLException;
-import javax.wsdl.factory.WSDLFactory;
-import javax.wsdl.xml.WSDLLocator;
-import javax.wsdl.xml.WSDLReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.MalformedURLException;
-import java.net.URL;
-
-/**
- * A factory that creates a WSDL-1.1 <code>Definition</code> from an URL.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 15-April-2004
- */
-public class WSDL11DefinitionFactory
-{
- // provide logging
- private static Logger log = Logger.getLogger(WSDL11DefinitionFactory.class);
-
- // This feature is set by default in wsdl4j, it means the object structore contains
the imported arguments
- public static final String FEATURE_IMPORT_DOCUMENTS =
"javax.wsdl.importDocuments";
- // Set this feature for additional debugging output
- public static final String FEATURE_VERBOSE = "javax.wsdl.verbose";
-
- // The WSDLReader that is used by this factory
- private WSDLReader wsdlReader;
-
- // Hide constructor
- private WSDL11DefinitionFactory() throws WSDLException
- {
- WSDLFactory wsdlFactory = WSDLFactory.newInstance();
- wsdlReader = wsdlFactory.newWSDLReader();
- wsdlReader.setFeature(WSDL11DefinitionFactory.FEATURE_VERBOSE, false);
- }
-
- /** Create a new instance of a wsdl factory */
- public static WSDL11DefinitionFactory newInstance() throws WSDLException
- {
- return new WSDL11DefinitionFactory();
- }
-
- /** Set a feature on the underlying reader */
- public void setFeature(String name, boolean value) throws IllegalArgumentException
- {
- wsdlReader.setFeature(name, value);
- }
-
- /**
- * Read the wsdl document from the given URL
- */
- public Definition parse(URL wsdlLocation) throws WSDLException
- {
- if (wsdlLocation == null)
- throw new IllegalArgumentException("URL cannot be null");
-
- log.trace("parse: " + wsdlLocation.toExternalForm());
-
- EntityResolver entityResolver = new JBossWSEntityResolver();
-
- // Set EntityResolver in patched version of wsdl4j-1.5.2jboss
- ((WSDLReaderImpl)wsdlReader).setEntityResolver(entityResolver);
-
- Definition wsdlDefinition = wsdlReader.readWSDL(new WSDLLocatorImpl(entityResolver,
wsdlLocation));
- return wsdlDefinition;
- }
-}
Deleted:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/wsdl/WSDL11Reader.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/wsdl/WSDL11Reader.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/wsdl/WSDL11Reader.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -1,1154 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.ws.metadata.wsdl;
-
-// $Id$
-
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.wsdl.Binding;
-import javax.wsdl.BindingInput;
-import javax.wsdl.BindingOperation;
-import javax.wsdl.BindingOutput;
-import javax.wsdl.Definition;
-import javax.wsdl.Fault;
-import javax.wsdl.Import;
-import javax.wsdl.Input;
-import javax.wsdl.Message;
-import javax.wsdl.Operation;
-import javax.wsdl.Output;
-import javax.wsdl.Part;
-import javax.wsdl.Port;
-import javax.wsdl.PortType;
-import javax.wsdl.Service;
-import javax.wsdl.Types;
-import javax.wsdl.extensions.ExtensibilityElement;
-import javax.wsdl.extensions.UnknownExtensibilityElement;
-import javax.wsdl.extensions.mime.MIMEContent;
-import javax.wsdl.extensions.mime.MIMEMultipartRelated;
-import javax.wsdl.extensions.mime.MIMEPart;
-import javax.wsdl.extensions.schema.Schema;
-import javax.wsdl.extensions.soap.SOAPAddress;
-import javax.wsdl.extensions.soap.SOAPBinding;
-import javax.wsdl.extensions.soap.SOAPBody;
-import javax.wsdl.extensions.soap.SOAPHeader;
-import javax.wsdl.extensions.soap.SOAPOperation;
-import javax.xml.namespace.QName;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.Constants;
-import org.jboss.ws.WSException;
-import org.jboss.ws.core.jaxrpc.Style;
-import org.jboss.ws.core.utils.DOMUtils;
-import org.jboss.ws.core.utils.DOMWriter;
-import org.jboss.ws.metadata.wsdl.xmlschema.JBossXSModel;
-import org.jboss.ws.metadata.wsdl.xsd.SchemaUtils;
-import org.jboss.ws.tools.JavaToXSD;
-import org.w3c.dom.Attr;
-import org.w3c.dom.Element;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-
-/**
- * A helper that translates a WSDL-1.1 object graph into a WSDL-2.0 object graph.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @author Anil.Saldhana(a)jboss.org
- * @since 10-Oct-2004
- */
-public class WSDL11Reader
-{
- // provide logging
- private static final Logger log = Logger.getLogger(WSDL11Reader.class);
-
- private static QName SOAP12_BINDING = new QName(Constants.NS_SOAP12,
"binding");
- private static QName SOAP12_BODY = new QName(Constants.NS_SOAP12, "body");
- private static QName SOAP12_OPERATION = new QName(Constants.NS_SOAP12,
"operation");
- private static QName SOAP12_ADDRESS = new QName(Constants.NS_SOAP12,
"address");
-
- private WSDLDefinitions destWsdl;
-
- // Maps wsdl message parts to their corresponding element names
- private Map<String, QName> messagePartToElementMap = new HashMap<String,
QName>();
-
- // Map of <ns,URL> for schemalocation keyed by namespace
- private Map<String, URL> schemaLocationsMap = new HashMap<String, URL>();
-
- // Temporary files used by this reader.
- private List<File> tempFiles = new ArrayList<File>();
-
- /**
- * Takes a WSDL11 Definition element and converts into
- * our object graph that has been developed for WSDL20
- *
- * @param srcWsdl The src WSDL11 definition
- * @param wsdlLoc The source location, if null we cannot process imports or includes
- */
- public WSDLDefinitions processDefinition(Definition srcWsdl, URL wsdlLoc) throws
IOException
- {
- log.trace("processDefinition: " + wsdlLoc);
-
- destWsdl = new WSDLDefinitions();
- destWsdl.setWsdlTypes(new XSModelTypes());
- destWsdl.setWsdlOneOneDefinition(srcWsdl);
- destWsdl.setWsdlNamespace(Constants.NS_WSDL11);
-
- processNamespaces(srcWsdl);
- processTypes(srcWsdl, wsdlLoc);
- processServices(srcWsdl);
-
- if (getAllDefinedBindings(srcWsdl).size() != destWsdl.getBindings().length)
- processUnreachableBindings(srcWsdl);
-
- cleanupTemporaryFiles();
-
- return destWsdl;
- }
-
- private void cleanupTemporaryFiles()
- {
- for (File current : tempFiles)
- {
- current.delete();
- }
- }
-
- // process all bindings not within service separetly
- private void processUnreachableBindings(Definition srcWsdl)
- {
- log.trace("processUnreachableBindings");
-
- Iterator it = getAllDefinedBindings(srcWsdl).values().iterator();
- while (it.hasNext())
- {
- Binding srcBinding = (Binding)it.next();
- QName srcQName = srcBinding.getQName();
-
- WSDLBinding destBinding = destWsdl.getBinding(new NCName(srcQName));
- if (destBinding == null)
- {
- processBinding(srcWsdl, srcBinding);
- }
- }
- }
-
- private void processNamespaces(Definition srcWsdl)
- {
- String targetNS = srcWsdl.getTargetNamespace();
- destWsdl.setTargetNamespace(targetNS);
-
- // Copy wsdl namespaces
- Map nsMap = srcWsdl.getNamespaces();
- Iterator iter = nsMap.entrySet().iterator();
- while (iter.hasNext())
- {
- Map.Entry entry = (Map.Entry)iter.next();
- String prefix = (String)entry.getKey();
- String nsURI = (String)entry.getValue();
- destWsdl.registerNamespaceURI(nsURI, prefix);
- }
- }
-
- private void processTypes(Definition srcWsdl, URL wsdlLoc) throws IOException
- {
- log.trace("BEGIN processTypes: " + wsdlLoc);
-
- WSDLTypes destTypes = destWsdl.getWsdlTypes();
-
- Types srcTypes = srcWsdl.getTypes();
- if (srcTypes != null && srcTypes.getExtensibilityElements().size() > 0)
- {
- List extElements = srcTypes.getExtensibilityElements();
- int len = extElements.size();
-
- for (int i = 0; i < len; i++)
- {
- ExtensibilityElement extElement = (ExtensibilityElement)extElements.get(i);
-
- Element domElement;
- if (extElement instanceof Schema)
- {
- domElement = ((Schema)extElement).getElement();
- }
- else if (extElement instanceof UnknownExtensibilityElement)
- {
- domElement = ((UnknownExtensibilityElement)extElement).getElement();
- }
- else
- {
- throw new WSException("Unsupported extensibility element: " +
extElement);
- }
-
- Element domElementClone = (Element)domElement.cloneNode(true);
- copyParentNamespaceDeclarations(domElementClone, domElement);
-
- String localname = domElementClone.getLocalName();
- try
- {
- if ("import".equals(localname))
- {
- processSchemaImport(destTypes, wsdlLoc, domElementClone);
- }
- else if ("schema".equals(localname))
- {
- processSchemaInclude(destTypes, wsdlLoc, domElementClone);
- }
- else
- {
- throw new IllegalArgumentException("Unsuported schema element:
" + localname);
- }
- }
- catch (IOException e)
- {
- throw new WSException("Cannot extract schema definition", e);
- }
- }
-
- if (len > 0)
- {
- JavaToXSD jxsd = new JavaToXSD();
- JBossXSModel xsmodel = jxsd.parseSchema(schemaLocationsMap);
- WSDLUtils.addSchemaModel(destTypes, destWsdl.getTargetNamespace(), xsmodel);
- }
- }
- else
- {
- log.trace("Empty wsdl types element, processing imports");
- Iterator it = srcWsdl.getImports().values().iterator();
- while (it.hasNext())
- {
- List<Import> srcImports = (List<Import>)it.next();
- for (Import srcImport : srcImports)
- {
- Definition impDefinition = srcImport.getDefinition();
- String impLoc = impDefinition.getDocumentBaseURI();
- processTypes(impDefinition, new URL(impLoc));
- }
- }
- }
-
- log.trace("END processTypes: " + wsdlLoc + "\n" + destTypes);
- }
-
- private void copyParentNamespaceDeclarations(Element destElement, Element srcElement)
- {
- Node parent = srcElement.getParentNode();
- while (parent != null)
- {
- if (parent.hasAttributes())
- {
- NamedNodeMap attributes = parent.getAttributes();
- for (int i = 0; i < attributes.getLength(); i++)
- {
- Attr attr = (Attr)attributes.item(i);
- String name = attr.getName();
- String value = attr.getValue();
- if (name.startsWith("xmlns:") &&
destElement.hasAttribute(name) == false)
- destElement.setAttribute(name, value);
- }
- }
- parent = parent.getParentNode();
- }
- }
-
- private void processSchemaImport(WSDLTypes types, URL wsdlLoc, Element importEl)
throws IOException
- {
- if (wsdlLoc == null)
- throw new IllegalArgumentException("Cannot process import, parent location
not set");
-
- log.trace("processSchemaImport: " + wsdlLoc);
-
- String location = getOptionalAttribute(importEl, "schemaLocation");
- if (location == null)
- throw new IllegalArgumentException("schemaLocation is null for
xsd:import");
-
- URL locationURL = getLocationURL(wsdlLoc, location);
- Element rootElement = DOMUtils.parse(locationURL.openStream());
- URL newloc = processSchemaInclude(types, locationURL, rootElement);
- if (newloc != null)
- importEl.setAttribute("schemaLocation", newloc.toExternalForm());
- }
-
- private URL processSchemaInclude(WSDLTypes types, URL wsdlLoc, Element schemaEl)
throws IOException
- {
- if (wsdlLoc == null)
- throw new IllegalArgumentException("Cannot process iclude, parent location
not set");
-
- File tmpFile = null;
- if (wsdlLoc == null)
- throw new IllegalArgumentException("Cannot process include, parent location
not set");
-
- log.trace("processSchemaInclude: " + wsdlLoc);
-
- String schemaPrefix = schemaEl.getPrefix();
-
- String importTag = (schemaPrefix == null) ? "import" : schemaPrefix +
":import";
- Element importElement =
schemaEl.getOwnerDocument().createElementNS(Constants.NS_SCHEMA_XSD, importTag);
- importElement.setAttribute("namespace", Constants.URI_SOAP11_ENC);
- schemaEl.insertBefore(importElement, DOMUtils.getFirstChildElement(schemaEl));
-
- // Handle schema includes
- Iterator it = DOMUtils.getChildElements(schemaEl, new
QName(Constants.NS_SCHEMA_XSD, "include"));
- while (it.hasNext())
- {
- Element includeEl = (Element)it.next();
- String location = getOptionalAttribute(includeEl, "schemaLocation");
- if (location == null)
- throw new IllegalArgumentException("schemaLocation is null for
xsd:include");
-
- URL locationURL = getLocationURL(wsdlLoc, location);
- Element rootElement = DOMUtils.parse(locationURL.openStream());
- URL newloc = processSchemaInclude(types, locationURL, rootElement);
- if (newloc != null)
- includeEl.setAttribute("schemaLocation", newloc.toExternalForm());
- }
-
- String targetNS = getOptionalAttribute(schemaEl, "targetNamespace");
- if (targetNS != null)
- {
- log.trace("processSchemaInclude: [targetNS=" + targetNS +
",parentURL=" + wsdlLoc + "]");
-
- tmpFile = SchemaUtils.getSchemaTempFile(targetNS);
- tempFiles.add(tmpFile);
-
- FileWriter fwrite = new FileWriter(tmpFile);
- new DOMWriter(fwrite).setPrettyprint(true).print(schemaEl);
- fwrite.close();
-
- schemaLocationsMap.put(targetNS, tmpFile.toURL());
- }
-
- // schema elements that have no target namespace are skipped
- //
- // <xsd:schema>
- // <xsd:import
namespace="http://org.jboss.webservice/example/types"
schemaLocation="Hello.xsd"/>
- // <xsd:import
namespace="http://org.jboss.webservice/example/types/arrays/org/jboss/test/webservice/admindevel"
schemaLocation="subdir/HelloArr.xsd"/>
- // </xsd:schema>
- if (targetNS == null)
- {
- log.trace("Schema element without target namespace in: " + wsdlLoc);
- }
-
- handleSchemaImports(schemaEl, wsdlLoc);
-
- return tmpFile != null ? tmpFile.toURL() : null;
- }
-
- private void handleSchemaImports(Element schemaEl, URL wsdlLoc) throws
MalformedURLException
- {
- if (wsdlLoc == null)
- throw new IllegalArgumentException("Cannot process import, parent location
not set");
-
- Iterator it = DOMUtils.getChildElements(schemaEl, new
QName(Constants.NS_SCHEMA_XSD, "import"));
- while (it.hasNext())
- {
- Element includeEl = (Element)it.next();
- String schemaLocation = getOptionalAttribute(includeEl,
"schemaLocation");
- String namespace = getOptionalAttribute(includeEl, "namespace");
-
- log.trace("handleSchemaImport: [namespace=" + namespace +
",schemaLocation=" + schemaLocation + "]");
-
- // Skip, let the entity resolver resolve these
- if (namespace != null && schemaLocation != null)
- {
- URL currLoc = getLocationURL(wsdlLoc, schemaLocation);
- schemaLocationsMap.put(namespace, currLoc);
- }
- else
- {
- log.trace("Skip schema import: [namespace=" + namespace +
",schemaLocation=" + schemaLocation + "]");
- }
- }
- }
-
- private URL getLocationURL(URL parentURL, String location) throws
MalformedURLException
- {
- log.trace("getLocationURL: [location=" + location + ",parent="
+ parentURL + "]");
-
- URL locationURL = null;
- try
- {
- locationURL = new URL(location);
- }
- catch (MalformedURLException e)
- {
- // ignore malformed URL
- }
-
- if (locationURL == null)
- {
- String parentProtocol = parentURL.getProtocol();
- if (parentProtocol.equals("file") &&
!location.startsWith("/"))
- {
- String path = parentURL.toExternalForm();
- path = path.substring(0, path.lastIndexOf("/"));
- locationURL = new URL(path + "/" + location);
- }
- else if (parentProtocol.startsWith("http") &&
location.startsWith("/"))
- {
- String path = parentProtocol + "://" + parentURL.getHost() +
":" + parentURL.getPort();
- locationURL = new URL(path + location);
- }
- else if (parentProtocol.equals("jar") &&
!location.startsWith("/"))
- {
- String path = parentURL.toExternalForm();
- path = path.substring(0, path.lastIndexOf("/"));
- locationURL = new URL(path + "/" + location);
- }
- else
- {
- throw new WSException("Unsupported schemaLocation: " + location);
- }
- }
-
- log.trace("Modified schemaLocation: " + locationURL);
- return locationURL;
- }
-
- private void processPortType(Definition srcWsdl, PortType srcPortType)
- {
- log.trace("processPortType: " + srcPortType.getQName());
-
- QName qname = srcPortType.getQName();
- NCName ncName = new NCName(qname);
- if (destWsdl.getInterface(ncName) == null)
- {
- WSDLInterface destInterface = new WSDLInterface(destWsdl);
- destInterface.setName(ncName);
- destInterface.setQName(qname);
-
- // eventing extensions
- QName eventSourceProp =
(QName)srcPortType.getExtensionAttribute(Constants.WSDL_ATTRIBUTE_WSE_EVENTSOURCE);
- if (eventSourceProp != null &&
eventSourceProp.getLocalPart().equals(Boolean.TRUE.toString()))
- {
- destInterface.addProperty(new
WSDLProperty(Constants.WSDL_PROPERTY_EVENTSOURCE, eventSourceProp.getLocalPart()));
- }
-
- destWsdl.addInterface(destInterface);
-
- processPortTypeOperations(srcWsdl, destInterface, srcPortType);
- }
- }
-
- private void processPortTypeOperations(Definition srcWsdl, WSDLInterface
destInterface, PortType srcPortType)
- {
- Iterator itOperations = srcPortType.getOperations().iterator();
- while (itOperations.hasNext())
- {
- Operation srcOperation = (Operation)itOperations.next();
-
- WSDLInterfaceOperation destOperation = new
WSDLInterfaceOperation(destInterface);
- destOperation.setName(new NCName(srcOperation.getName()));
-
- processOperationInput(srcWsdl, srcOperation, destOperation, srcPortType);
- processOperationOutput(srcWsdl, srcOperation, destOperation, srcPortType);
- processOperationFaults(srcOperation, destOperation, destInterface);
-
- destInterface.addOperation(destOperation);
- }
- }
-
- private void processOperationInput(Definition srcWsdl, Operation srcOperation,
WSDLInterfaceOperation destOperation, PortType srcPortType)
- {
- Input srcInput = srcOperation.getInput();
- if (srcInput != null)
- {
- Message srcMessage = srcInput.getMessage();
- log.trace("processOperationInput: " + srcMessage.getQName());
-
- QName wsaAction =
(QName)srcInput.getExtensionAttribute(Constants.WSDL_ATTRIBUTE_WSA_ACTION);
- if (wsaAction != null)
- destOperation.addProperty(new WSDLProperty(Constants.WSDL_PROPERTY_ACTION_IN,
wsaAction.getLocalPart()));
-
- List paramOrder = srcOperation.getParameterOrdering();
- Iterator itMessageParts = srcMessage.getOrderedParts(paramOrder).iterator();
- while (itMessageParts.hasNext())
- {
- WSDLInterfaceOperationInput destInput = new
WSDLInterfaceOperationInput(destOperation);
-
- Part srcPart = (Part)itMessageParts.next();
- QName elementName = messagePartToElementName(srcWsdl, srcPortType,
srcOperation, srcMessage, srcPart);
- destInput.setElement(elementName);
-
- //Lets remember the Message name
- destInput.addProperty(new WSDLProperty(Constants.WSDL_PROPERTY_MESSAGE_NAME,
srcMessage.getQName().getLocalPart()));
- destOperation.addProperty(new
WSDLProperty(Constants.WSDL_PROPERTY_MESSAGE_NAME_IN,
srcMessage.getQName().getLocalPart()));
-
- // Remember the original part name
- WSDLProperty wsdlProperty = new
WSDLProperty(Constants.WSDL_PROPERTY_PART_NAME, srcPart.getName());
- destInput.addProperty(wsdlProperty);
-
- // If the Part references a type rather than an element
- // we transport the xmlType as property
- QName xmlType = srcPart.getTypeName();
- if (xmlType != null)
- {
- xmlType = destWsdl.registerQName(xmlType);
- String value = xmlType.getPrefix() + ":" +
xmlType.getLocalPart();
- wsdlProperty = new WSDLProperty(Constants.WSDL_PROPERTY_RPC_XMLTYPE,
value);
- destInput.addProperty(wsdlProperty);
- }
-
- destOperation.addInput(destInput);
- }
- }
- }
-
- private void processOperationOutput(Definition srcWsdl, Operation srcOperation,
WSDLInterfaceOperation destOperation, PortType srcPortType)
- {
- Output srcOutput = srcOperation.getOutput();
- if (srcOutput != null)
- {
- Message srcMessage = srcOutput.getMessage();
- log.trace("processOperationOutput: " + srcMessage.getQName());
-
- destOperation.setPattern(Constants.WSDL20_PATTERN_IN_OUT);
- QName wsaAction =
(QName)srcOutput.getExtensionAttribute(Constants.WSDL_ATTRIBUTE_WSA_ACTION);
- if (wsaAction != null)
- destOperation.addProperty(new
WSDLProperty(Constants.WSDL_PROPERTY_ACTION_OUT, wsaAction.getLocalPart()));
-
- Iterator itMessageParts = srcMessage.getOrderedParts(null).iterator();
- while (itMessageParts.hasNext())
- {
- WSDLInterfaceOperationOutput destOutput = new
WSDLInterfaceOperationOutput(destOperation);
-
- Part srcPart = (Part)itMessageParts.next();
- QName elementName = messagePartToElementName(srcWsdl, srcPortType,
srcOperation, srcMessage, srcPart);
- destOutput.setElement(elementName);
-
- //Lets remember the Message name
- destOutput.addProperty(new WSDLProperty(Constants.WSDL_PROPERTY_MESSAGE_NAME,
srcMessage.getQName().getLocalPart()));
- destOperation.addProperty(new
WSDLProperty(Constants.WSDL_PROPERTY_MESSAGE_NAME_OUT,
srcMessage.getQName().getLocalPart()));
-
- // Remember the original part name
- WSDLProperty wsdlProperty = new
WSDLProperty(Constants.WSDL_PROPERTY_PART_NAME, srcPart.getName());
- destOutput.addProperty(wsdlProperty);
-
- // If the Part references a type rather than an element
- // we transport the xmlType as property
- QName xmlType = srcPart.getTypeName();
- if (xmlType != null)
- {
- xmlType = destWsdl.registerQName(xmlType);
- String value = xmlType.getPrefix() + ":" +
xmlType.getLocalPart();
- wsdlProperty = new WSDLProperty(Constants.WSDL_PROPERTY_RPC_XMLTYPE,
value);
- destOutput.addProperty(wsdlProperty);
- }
-
- destOperation.addOutput(destOutput);
- }
- }
- else
- {
- destOperation.setPattern(Constants.WSDL20_PATTERN_IN_ONLY);
- }
- }
-
- private void processOperationFaults(Operation srcOperation, WSDLInterfaceOperation
destOperation, WSDLInterface destInterface)
- {
-
- Map faults = srcOperation.getFaults();
- Iterator itFaults = faults.values().iterator();
- while (itFaults.hasNext())
- {
- Fault srcFault = (Fault)itFaults.next();
- processOperationFault(destOperation, destInterface, srcFault);
- }
- }
-
- private void processOperationFault(WSDLInterfaceOperation destOperation, WSDLInterface
destInterface, Fault srcFault)
- {
- String faultName = srcFault.getName();
- log.trace("processOperationFault: " + faultName);
-
- WSDLInterfaceFault destFault = new WSDLInterfaceFault(destInterface);
- NCName ncName = new NCName(faultName);
- destFault.setName(ncName);
-
- Message message = srcFault.getMessage();
- QName messageName = message.getQName();
-
- Map partsMap = message.getParts();
- if (partsMap.size() != 1)
- throw new WSException("Unsupported number of fault parts in message "
+ messageName);
-
- Part part = (Part)partsMap.values().iterator().next();
- QName xmlName = part.getElementName();
- QName xmlType = part.getTypeName();
-
- destFault.setXmlType(xmlType);
- if (xmlName != null)
- {
- destFault.setXmlName(xmlName);
- }
- else
- {
- destFault.setXmlName(messageName);
- log.warn("Unsupported fault message part in message: " +
messageName);
- }
-
- WSDLInterfaceFault prevFault = destInterface.getFault(ncName);
- if (prevFault != null && prevFault.getName().equals(ncName) == false)
- throw new WSException("Fault name must be unique: " + faultName);
-
- // Add the fault to the interface
- destInterface.addFault(destFault);
-
- // Add the fault refererence to the operation
- WSDLInterfaceOperationOutfault opOutFault = new
WSDLInterfaceOperationOutfault(destOperation);
- opOutFault.setRef(new QName(destWsdl.getTargetNamespace(), faultName));
- destOperation.addOutfault(opOutFault);
- }
-
- /** Translate the message part name into an XML element name.
- */
- private QName messagePartToElementName(Definition srcWsdl, PortType srcPortType,
Operation srcOperation, Message srcMessage, Part srcPart)
- {
- // <part name="param" element="tns:SomeType" />
- QName xmlName = srcPart.getElementName();
- if (xmlName != null)
- xmlName = destWsdl.registerQName(xmlName);
-
- // <part name="param" type="xsd:string" />
- if (xmlName == null)
- {
- // Use the part name as fallback
- xmlName = new QName(srcPart.getName());
-
- // The binding may define a different xmlName for this message part (i.e. in
case of header parts)
- // The rest of this implementation tries to discover that binding.
-
- // Find the binding for this portType
- Binding srcBinding = null;
- Iterator itBindings = getAllDefinedBindings(srcWsdl).values().iterator();
- while (srcBinding == null && itBindings.hasNext())
- {
- Binding binding = (Binding)itBindings.next();
- if (binding.getPortType().equals(srcPortType))
- srcBinding = binding;
- }
-
- if (srcBinding == null)
- throw new WSException("Cannot find binding for: " +
srcPortType.getQName());
-
- String srcOperationName = srcOperation.getName();
- BindingOperation srcBindingOperation =
srcBinding.getBindingOperation(srcOperationName, null, null);
- if (srcBindingOperation == null)
- throw new WSException("Cannot find binding operation for: " +
srcOperationName);
-
- // Scan the binding input for a <soap:header> for this message part
- BindingInput srcBindingInput = srcBindingOperation.getBindingInput();
- if (srcBindingInput != null)
- {
- Iterator itExt = srcBindingInput.getExtensibilityElements().iterator();
- while (itExt.hasNext())
- {
- ExtensibilityElement extEl = (ExtensibilityElement)itExt.next();
- if (extEl instanceof SOAPHeader)
- {
- SOAPHeader header = (SOAPHeader)extEl;
- QName messageQName = header.getMessage();
- String partName = header.getPart();
- if (messageQName.equals(srcMessage.getQName()) &&
partName.equals(srcPart.getName()))
- {
- String namespaceURI = header.getNamespaceURI();
- if (namespaceURI != null)
- {
- xmlName = new QName(namespaceURI, partName);
- xmlName = destWsdl.registerQName(xmlName);
- }
- }
- }
- }
- }
-
- // Scan the binding output for a <soap:header> for this message part
- BindingOutput srcBindingOutput = srcBindingOperation.getBindingOutput();
- if (srcBindingOutput != null)
- {
- Iterator itExt = srcBindingOutput.getExtensibilityElements().iterator();
- while (itExt.hasNext())
- {
- ExtensibilityElement extEl = (ExtensibilityElement)itExt.next();
- if (extEl instanceof SOAPHeader)
- {
- SOAPHeader header = (SOAPHeader)extEl;
- QName messageQName = header.getMessage();
- String partName = header.getPart();
- if (messageQName.equals(srcMessage.getQName()) &&
partName.equals(srcPart.getName()))
- {
- String namespaceURI = header.getNamespaceURI();
- if (namespaceURI != null)
- {
- xmlName = new QName(namespaceURI, partName);
- xmlName = destWsdl.registerQName(xmlName);
- }
- }
- }
- }
- }
- }
-
- // cache the element name for processing of the bindings
- String key = srcMessage.getQName() + "->" + srcPart.getName();
- messagePartToElementMap.put(key, xmlName);
-
- return xmlName;
- }
-
- private void processBinding(Definition srcWsdl, Binding srcBinding)
- {
- QName srcBindingQName = srcBinding.getQName();
- log.trace("processBinding: " + srcBindingQName);
-
- NCName ncName = new NCName(srcBindingQName);
- if (destWsdl.getBinding(ncName) == null)
- {
- PortType srcPortType = srcBinding.getPortType();
- if (srcPortType == null)
- throw new WSException("Cannot find port type for binding: " +
ncName);
-
- processPortType(srcWsdl, srcPortType);
-
- WSDLBinding destBinding = new WSDLBinding(destWsdl);
- destBinding.setQName(srcBindingQName);
- destBinding.setName(ncName);
- destBinding.setInterfaceName(srcPortType.getQName());
-
- String bindingStyle = Style.getDefaultStyle().toString();
- List<ExtensibilityElement> extList =
srcBinding.getExtensibilityElements();
- for (ExtensibilityElement extElement : extList)
- {
- QName elementType = extElement.getElementType();
- if (extElement instanceof SOAPBinding)
- {
- destBinding.setType(Constants.NS_SOAP11);
- SOAPBinding soapBinding = (SOAPBinding)extElement;
- bindingStyle = soapBinding.getStyle();
- }
- else if (SOAP12_BINDING.equals(elementType))
- {
- destBinding.setType(Constants.NS_SOAP12);
- Element domElement =
((UnknownExtensibilityElement)extElement).getElement();
- bindingStyle = getOptionalAttribute(domElement, "style");
- }
- }
- destWsdl.addBinding(destBinding);
- processBindingOperations(destBinding, srcBinding, bindingStyle);
- }
- }
-
- private Map getAllDefinedBindings(Definition srcWsdl)
- {
- Map<QName, Binding> retMap = new LinkedHashMap<QName, Binding>();
- Map srcBindings = srcWsdl.getBindings();
- Iterator itBinding = srcBindings.values().iterator();
- while (itBinding.hasNext())
- {
- Binding srcBinding = (Binding)itBinding.next();
- retMap.put(srcBinding.getQName(), srcBinding);
- }
-
- // Bindings not available when pulled in through <wsdl:import>
- //
http://sourceforge.net/tracker/index.php?func=detail&aid=1240323&...
- Iterator itService = srcWsdl.getServices().values().iterator();
- while (itService.hasNext())
- {
- Service srcService = (Service)itService.next();
- Iterator itPort = srcService.getPorts().values().iterator();
- while (itPort.hasNext())
- {
- Port srcPort = (Port)itPort.next();
- Binding srcBinding = srcPort.getBinding();
- retMap.put(srcBinding.getQName(), srcBinding);
- }
- }
- return retMap;
- }
-
- private void processBindingOperations(WSDLBinding destBinding, Binding srcBinding,
String bindingStyle)
- {
- Iterator it = srcBinding.getBindingOperations().iterator();
- while (it.hasNext())
- {
- BindingOperation srcBindingOperation = (BindingOperation)it.next();
- processBindingOperation(destBinding, bindingStyle, srcBindingOperation);
- }
- }
-
- private void processBindingOperation(WSDLBinding destBinding, String bindingStyle,
BindingOperation srcBindingOperation)
- {
- String srcBindingName = srcBindingOperation.getName();
- log.trace("processBindingOperation: " + srcBindingName);
-
- WSDLInterface destInterface = destBinding.getInterface();
- String namespaceURI = destInterface.getQName().getNamespaceURI();
-
- WSDLBindingOperation destBindingOperation = new WSDLBindingOperation(destBinding);
- QName refQName = new QName(namespaceURI, srcBindingName);
- destBindingOperation.setRef(refQName);
- destBinding.addOperation(destBindingOperation);
-
- String opName = srcBindingName;
- WSDLInterfaceOperation destIntfOperation = destInterface.getOperation(new
NCName(opName));
-
- // Process soap:operation@soapAction, soap:operation@style
- String operationStyle = null;
- List<ExtensibilityElement> extList =
srcBindingOperation.getExtensibilityElements();
- for (ExtensibilityElement extElement : extList)
- {
- QName elementType = extElement.getElementType();
- if (extElement instanceof SOAPOperation)
- {
- SOAPOperation soapOp = (SOAPOperation)extElement;
- destBindingOperation.setSOAPAction(soapOp.getSoapActionURI());
- operationStyle = soapOp.getStyle();
- }
- else if (SOAP12_OPERATION.equals(elementType))
- {
- Element domElement = ((UnknownExtensibilityElement)extElement).getElement();
- operationStyle = getOptionalAttribute(domElement, "style");
- destBindingOperation.setSOAPAction(getOptionalAttribute(domElement,
"soapAction"));
- }
- }
- destIntfOperation.setStyle(operationStyle != null ? operationStyle :
bindingStyle);
-
- BindingInput srcBindingInput = srcBindingOperation.getBindingInput();
- if (srcBindingInput != null)
- {
- processBindingInput(destBindingOperation, destIntfOperation, srcBindingInput);
- }
-
- BindingOutput srcBindingOutput = srcBindingOperation.getBindingOutput();
- if (srcBindingOutput != null)
- {
- processBindingOutput(destBindingOperation, destIntfOperation,
srcBindingOutput);
- }
- }
-
- private void processBindingInput(WSDLBindingOperation destBindingOperation,
WSDLInterfaceOperation destIntfOperation, BindingInput srcBindingInput)
- {
- log.trace("processBindingInput");
-
- QName soap11Body = new QName(Constants.NS_SOAP11, "body");
- List<ExtensibilityElement> extList =
srcBindingInput.getExtensibilityElements();
- for (ExtensibilityElement extElement : extList)
- {
- QName elementType = extElement.getElementType();
- if (soap11Body.equals(elementType) || SOAP12_BODY.equals(elementType))
- {
- processEncodingStyle(extElement, destBindingOperation);
- }
- else if (extElement instanceof SOAPHeader)
- {
- SOAPHeader header = (SOAPHeader)extElement;
- QName messageQName = header.getMessage();
- String partName = header.getPart();
-
- // get cached element name for processing of the bindings
- String key = messageQName + "->" + partName;
- QName elementName = (QName)messagePartToElementMap.get(key);
- if (elementName != null)
- {
- WSDLInterfaceOperationInput destIntfInput =
destIntfOperation.getInput(elementName);
- if (destIntfInput == null)
- throw new WSException("Cannot find interface input for element:
" + elementName);
-
- WSDLProperty wsdlProperty = new
WSDLProperty(Constants.WSDL_PROPERTY_APPLICATION_DATA, false, null, null);
- destIntfInput.addProperty(wsdlProperty);
- }
- }
- else if (extElement instanceof MIMEMultipartRelated)
- {
- MIMEMultipartRelated related = (MIMEMultipartRelated)extElement;
- Iterator i = related.getMIMEParts().iterator();
- while (i.hasNext())
- {
- MIMEPart part = (MIMEPart)i.next();
- Iterator j = part.getExtensibilityElements().iterator();
- String name = null;
- String types = null;
-
- while (j.hasNext())
- {
- ExtensibilityElement inner = (ExtensibilityElement)j.next();
- if (inner instanceof MIMEContent)
- {
- MIMEContent content = (MIMEContent)inner;
- name = content.getPart();
- if (types == null)
- {
- types = content.getType();
- }
- else
- {
- types += "," + content.getType();
- }
- }
- }
-
- // Found content types in this part
- if (name != null)
- {
- // A mime part must be defined as <part type="">
- QName elementName = new QName(name);
- WSDLInterfaceOperationInput destIntfInput =
destIntfOperation.getInput(elementName);
- if (destIntfInput == null)
- throw new WSException("Cannot find interface input for element:
" + elementName);
-
- WSDLProperty wsdlProperty = new
WSDLProperty(Constants.WSDL_PROPERTY_WSDL11_MIME_TYPE, false, types, null);
- destIntfInput.addProperty(wsdlProperty);
- }
- }
- }
- }
- }
-
- private void processBindingOutput(WSDLBindingOperation destBindingOperation,
WSDLInterfaceOperation destIntfOperation, BindingOutput srcBindingOutput)
- {
- log.trace("processBindingOutput");
-
- List<ExtensibilityElement> extList =
srcBindingOutput.getExtensibilityElements();
- for (ExtensibilityElement extElement : extList)
- {
- QName elementType = extElement.getElementType();
- if (extElement instanceof SOAPBody || SOAP12_BODY.equals(elementType))
- {
- processEncodingStyle(extElement, destBindingOperation);
- }
- else if (extElement instanceof SOAPHeader)
- {
- SOAPHeader header = (SOAPHeader)extElement;
- QName messageQName = header.getMessage();
- String partName = header.getPart();
-
- // get cached element name for processing of the bindings
- String key = messageQName + "->" + partName;
- QName elementName = (QName)messagePartToElementMap.get(key);
- if (elementName != null)
- {
- WSDLInterfaceOperationOutput destIntfOutput =
destIntfOperation.getOutput(elementName);
- if (destIntfOutput == null)
- throw new WSException("Cannot find interface output for element:
" + elementName);
-
- WSDLProperty wsdlProperty = new
WSDLProperty(Constants.WSDL_PROPERTY_APPLICATION_DATA, false, null, null);
- destIntfOutput.addProperty(wsdlProperty);
- }
- }
- else if (extElement instanceof MIMEMultipartRelated)
- {
- MIMEMultipartRelated related = (MIMEMultipartRelated)extElement;
- Iterator i = related.getMIMEParts().iterator();
- while (i.hasNext())
- {
- MIMEPart part = (MIMEPart)i.next();
- Iterator j = part.getExtensibilityElements().iterator();
- String name = null;
- String types = null;
-
- while (j.hasNext())
- {
- ExtensibilityElement inner = (ExtensibilityElement)j.next();
- if (inner instanceof MIMEContent)
- {
- MIMEContent content = (MIMEContent)inner;
- name = content.getPart();
- if (types == null)
- {
- types = content.getType();
- }
- else
- {
- types += "," + content.getType();
- }
- }
- }
-
- // Found content types in this part
- if (name != null)
- {
- // A mime part must be defined as <part type="">
- QName elementName = new QName(name);
- WSDLInterfaceOperationOutput destIntfOutput =
destIntfOperation.getOutput(elementName);
- if (destIntfOutput == null)
- throw new WSException("Cannot find interface output for
element: " + elementName);
-
- WSDLProperty wsdlProperty = new
WSDLProperty(Constants.WSDL_PROPERTY_WSDL11_MIME_TYPE, false, types, null);
- destIntfOutput.addProperty(wsdlProperty);
- }
- }
- }
- }
- }
-
- private void processEncodingStyle(ExtensibilityElement extElement,
WSDLBindingOperation destBindingOperation)
- {
- log.trace("processEncodingStyle");
-
- String encStyle = null;
- QName elementType = extElement.getElementType();
- if (extElement instanceof SOAPBody)
- {
- SOAPBody body = (SOAPBody)extElement;
- List encStyleList = body.getEncodingStyles();
- if (encStyleList != null)
- {
- if (encStyleList.size() > 1)
- log.warn("Multiple encoding styles not supported: " +
encStyleList);
-
- if (encStyleList.size() > 0)
- {
- encStyle = (String)encStyleList.get(0);
- }
- }
- }
- else if (SOAP12_BODY.equals(elementType))
- {
- Element domElement = ((UnknownExtensibilityElement)extElement).getElement();
- encStyle = getOptionalAttribute(domElement, "encodingStyle");
- }
-
- if (encStyle != null)
- {
- String setStyle = destBindingOperation.getEncodingStyle();
- if (encStyle.equals(setStyle) == false)
- log.warn("Encoding style '" + encStyle + "' not
supported for: " + destBindingOperation.getRef());
-
- destBindingOperation.setEncodingStyle(encStyle);
- }
- }
-
- private void processServices(Definition srcWsdl)
- {
- log.trace("BEGIN processServices: " + srcWsdl.getDocumentBaseURI());
-
- if (srcWsdl.getServices().size() > 0)
- {
- Iterator it = srcWsdl.getServices().values().iterator();
- while (it.hasNext())
- {
- Service srcService = (Service)it.next();
- QName qname = srcService.getQName();
- WSDLService destService = new WSDLService(destWsdl);
- destService.setName(new NCName(qname));
- destService.setQName(qname);
- destWsdl.addService(destService);
- processPorts(srcWsdl, destService, srcService);
- }
- }
- else
- {
- log.trace("Empty wsdl services, processing imports");
- Iterator it = srcWsdl.getImports().values().iterator();
- while (it.hasNext())
- {
- List<Import> srcImports = (List<Import>)it.next();
- for (Import srcImport : srcImports)
- {
- Definition importDefinition = srcImport.getDefinition();
- processServices(importDefinition);
- }
- }
- }
-
- log.trace("END processServices: " + srcWsdl.getDocumentBaseURI());
- }
-
- private void processPorts(Definition srcWsdl, WSDLService destService, Service
srcService)
- {
- Iterator it = srcService.getPorts().values().iterator();
- while (it.hasNext())
- {
- Port srcPort = (Port)it.next();
- processPort(srcWsdl, destService, srcPort);
- }
- }
-
- private void processPort(Definition srcWsdl, WSDLService destService, Port srcPort)
- {
- log.trace("processPort: " + srcPort.getName());
-
- Binding srcBinding = srcPort.getBinding();
-
- WSDLEndpoint destEndpoint = new WSDLEndpoint(destService);
- destEndpoint.setName(new NCName(srcPort.getName()));
- destEndpoint.setBinding(srcBinding.getQName());
- destEndpoint.setQName(new QName(srcWsdl.getTargetNamespace(), srcPort.getName()));
- destEndpoint.setAddress(getSOAPAddress(srcPort));
- destService.addEndpoint(destEndpoint);
-
- processBinding(srcWsdl, srcBinding);
- }
-
- /** Get the endpoint address from the ports extensible element
- */
- private String getSOAPAddress(Port srcPort)
- {
- String soapAddress = "dummy";
-
- Iterator it = srcPort.getExtensibilityElements().iterator();
- while (it.hasNext())
- {
- ExtensibilityElement extElement = (ExtensibilityElement)it.next();
- QName elementType = extElement.getElementType();
-
- if (extElement instanceof SOAPAddress)
- {
- SOAPAddress addr = (SOAPAddress)extElement;
- soapAddress = addr.getLocationURI();
- break;
- }
- else if (SOAP12_ADDRESS.equals(elementType))
- {
- Element domElement = ((UnknownExtensibilityElement)extElement).getElement();
- soapAddress = getOptionalAttribute(domElement, "location");
- break;
- }
- else if ("address".equals(elementType.getLocalPart()))
- {
- log.warn("Unprocessed extension element: " + elementType);
- }
- }
-
- if (soapAddress == null)
- throw new WSException("Cannot obtain SOAP address");
-
- return soapAddress;
- }
-
- private String getOptionalAttribute(Element domElement, String attrName)
- {
- String attrValue = domElement.getAttribute(attrName);
- return (attrValue.length() > 0 ? attrValue : null);
- }
-}
Deleted:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/wsdl/WSDL11Writer.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/wsdl/WSDL11Writer.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/wsdl/WSDL11Writer.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -1,558 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
-*/
-package org.jboss.ws.metadata.wsdl;
-
-import java.io.IOException;
-import java.io.Writer;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Set;
-
-import javax.wsdl.Definition;
-import javax.wsdl.WSDLException;
-import javax.wsdl.factory.WSDLFactory;
-import javax.xml.namespace.QName;
-
-import org.jboss.ws.core.utils.DOMUtils;
-import org.jboss.ws.core.utils.DOMWriter;
-import org.jboss.ws.Constants;
-import org.jboss.ws.WSException;
-import org.w3c.dom.Element;
-
-/**
- * A WSDL Writer that writes a WSDL 1.1 file. It works off
- * of the WSDL20 Object Graph.
- * @author <mailto:Anil.Saldhana@jboss.org>Anil Saldhana
- */
-public class WSDL11Writer extends WSDLWriter
-{
- //Used Internally
- private String wsdlStyle = Constants.RPC_LITERAL;
-
- // Used to prevent duplicates
- private HashSet<String> writtenFaultMessages = new HashSet<String>();
-
- /** Use WSDLDefinitions.writeWSDL instead. */
- public WSDL11Writer(WSDLDefinitions wsdl)
- {
- super(wsdl);
- }
-
- public void write(Writer writer) throws IOException
- {
- write(writer, null);
- }
-
- public void write(Writer writer, String charset) throws IOException
- {
- // Write out the wsdl-1.1 represention (only path to obtain is from WSDL11Reader)
- if (wsdl.getWsdlOneOneDefinition() != null)
- {
- Definition wsdlDefinition = wsdl.getWsdlOneOneDefinition();
- try
- {
- WSDLFactory wsdlFactory = WSDLFactory.newInstance();
- javax.wsdl.xml.WSDLWriter wsdlWriter = wsdlFactory.newWSDLWriter();
- wsdlWriter.writeWSDL(wsdlDefinition, writer);
- }
- catch (WSDLException e)
- {
- this.logException(e);
- throw new IOException(e.toString());
- }
- }
- else
- {
- StringBuilder buffer = new StringBuilder();
-
- //Detect the WSDL Style early
- wsdlStyle = utils.getWSDLStyle(wsdl);
-
- writtenFaultMessages.clear();
-
- appendDefinitions(buffer);
- appendTypes(buffer);
- appendMessages(buffer);
- appendPortTypes(buffer);
- appendBindings(buffer);
- appendServices(buffer);
-
- buffer.append("</definitions>");
- Element element = DOMUtils.parse(buffer.toString());
-
- if (charset != null)
- writer.write("<?xml version=\"1.0\" encoding=\""
+ charset + "\"?>\n");
- new DOMWriter(writer).setPrettyprint(true).print(element);
- }
- }
-
- protected void appendMessages(StringBuilder buffer)
- {
- WSDLInterface[] interfaces = wsdl.getInterfaces();
- int len = interfaces != null ? interfaces.length : 0;
- for (int i = 0; i < len; i++)
- {
- WSDLInterface intf = interfaces[i];
- WSDLInterfaceOperation[] operations = intf.getSortedOperations();
- int lenOps = operations.length;
- for (int j = 0; j < lenOps; j++)
- {
- appendMessage(buffer, operations[j]);
- appendMessagesForExceptions(buffer, operations[j]);
- }//end for
- }//end for
- }
-
- private void appendMessage(StringBuilder buffer, WSDLInterfaceOperation operation)
- {
- String opname = operation.getName().toString();
- //Determine the style of the wsdl
- if (Constants.URI_STYLE_RPC.equals(operation.getStyle()) == false)
- wsdlStyle = Constants.DOCUMENT_LITERAL; //Not RPC/Literal
-
- String interfaceName = operation.getWsdlInterface().getName().toString();
- buffer.append("<message name='" + interfaceName + "_" +
opname + "' >");
- WSDLInterfaceOperationInput[] inputs = operation.getInputs();
- int lenin = inputs.length;
- for (int i = 0; i < lenin; i++)
- {
- WSDLInterfaceOperationInput input = inputs[i];
- appendInputParts(buffer, input, i);
- }
-
- buffer.append("</message>");
-
- //Now the return type
- WSDLInterfaceOperationOutput[] outputs = operation.getOutputs();
- int lenout = outputs != null ? outputs.length : 0;
-
- if (Constants.WSDL20_PATTERN_IN_ONLY.equals(operation.getPattern()))
- return;
-
- buffer.append("<message name='" + interfaceName + "_" +
opname + "Response' >");
- if (lenout > 0)
- {
- //Since the outputs have been obtained from a linkedhashmap
- //they will be in the order of insertion i.e. in case of
- //holders, the holder types will be inserted first. So let
- //us iterate in the reverse order
- String str = "";
- for (int i = 0; i < lenout; i++)
- {
- WSDLInterfaceOperationOutput out = outputs[i];
- str += appendOutputParts(out, i);
- }
- buffer.append(str);
- }//end if
- buffer.append("</message>");
- }
-
- private void appendMessagesForExceptions(StringBuilder buffer, WSDLInterfaceOperation
operation)
- {
- //Get the outfaults
- WSDLInterfaceOperationOutfault[] faults = operation.getOutfaults();
- int len = faults != null ? faults.length : 0;
-
- for (int i = 0; i < len; i++)
- {
- WSDLInterfaceOperationOutfault fault = faults[i];
- QName xmlName = fault.getRef();
- String exceptionName = xmlName.getLocalPart();
- if (writtenFaultMessages.contains(exceptionName))
- continue;
-
- buffer.append("<message name='" + exceptionName + "'
>");
- String prefix = wsdl.getPrefix(xmlName.getNamespaceURI());
- String xmlNameStr = prefix + ":" + xmlName.getLocalPart();
- buffer.append("<part name='" + exceptionName + "'
element='" + xmlNameStr + "' />");
- buffer.append("</message>");
-
- writtenFaultMessages.add(exceptionName);
- }
- }
-
- private void appendInputParts(StringBuilder buffer, WSDLInterfaceOperationInput input,
int index)
- {
- boolean header = input.getProperty(Constants.WSDL_PROPERTY_APPLICATION_DATA) !=
null;
- if (wsdlStyle.equals(Constants.RPC_LITERAL) && !header)
- {
- QName el = input.getElement();
- QName xmlType = input.getXMLType();
- String prefix = wsdl.getPrefix(xmlType.getNamespaceURI() );
- buffer.append("<part name='" + el.getLocalPart() +
"'");
- buffer.append(" type='" + prefix + ":" +
xmlType.getLocalPart() + "'>");
- buffer.append("</part>");
- }
- //Doc-literal case
- else
- {
- //TODO:Handle this better later
- //In the case of doc/lit, the input element will give the partname
- QName elm = input.getElement();
- buffer.append("<part name='").append(header ?
elm.getLocalPart() : "parameters").append("'");
- String part = wsdl.getPrefix(elm.getNamespaceURI()) + ":" +
elm.getLocalPart();
- buffer.append(" element='" + part + "'>");
- buffer.append("</part>");
- }
- }
-
- private String appendOutputParts(WSDLInterfaceOperationOutput out, int index)
- {
- boolean header = out.getProperty(Constants.WSDL_PROPERTY_APPLICATION_DATA) !=
null;
- StringBuilder buf = new StringBuilder("");
- if (wsdlStyle.equals(Constants.RPC_LITERAL) && !header)
- {
- //Get the XMLName
- QName xmlName = out.getElement();
- QName xmlType = out.getXMLType();
- String prefix = wsdl.getPrefix(xmlType.getNamespaceURI() );
-
- buf.append("<part name='" + xmlName.getLocalPart() +
"'");
- buf.append(" type='" + prefix + ":" +
xmlType.getLocalPart() + "'>");
- buf.append("</part>");
- }
- else
- {
- QName elm = out.getElement();
- buf.append("<part name='").append(header ? elm.getLocalPart() :
Constants.DEFAULT_RPC_RETURN_NAME).append("'");
- String value = wsdl.getPrefix(elm.getNamespaceURI()) + ":" +
elm.getLocalPart();
- //String value = this.getXMLTypeFromWSDLProperty(out);
- buf.append(" element='" + value + "'>");
- buf.append("</part>");
- }
- return buf.toString();
- }
-
- protected void appendInterfaces(StringBuilder buffer)
- {
- }
-
- protected void appendPortTypes(StringBuilder buffer)
- {
- WSDLInterface[] intfs = wsdl.getInterfaces();
- for (int i = 0; i < intfs.length; i++)
- {
- WSDLInterface intf = intfs[i];
- if (i == 0)
- buffer.append("<portType name='" + intf.getName() +
"'>");
- appendPortOperations(buffer, intf);
- }
- buffer.append("</portType>");
- }
-
- protected void appendPortOperations(StringBuilder buffer, WSDLInterface intf)
- {
- String targetPrefix = wsdl.getTargetPrefix();
- WSDLInterfaceOperation[] operations = intf.getSortedOperations();
- for (int i = 0; i < operations.length; i++)
- {
- WSDLInterfaceOperation operation = operations[i];
- WSDLInterfaceOperationInput[] inputs = operation.getInputs();
- WSDLInterfaceOperationOutput[] outputs = operation.getOutputs();
- buffer.append("<operation name='" +
operation.getName().toString() + "'");
-
- if (wsdlStyle.equals(Constants.RPC_LITERAL))
- {
- StringBuilder order = new StringBuilder();
- Set<QName> inParameters = new HashSet<QName>();
- for (int j = 0; j < inputs.length; j++)
- {
- WSDLInterfaceOperationInput input = inputs[j];
- if (order.length() > 0)
- order.append(" ");
- QName el = input.getElement();
- order.append(el.getLocalPart());
- inParameters.add(el);
- }
-
- for (int j = 0; j < outputs.length; j++)
- {
- WSDLInterfaceOperationOutput output = outputs[j];
- // The return value is ommitted as a hint to other parameter based binding
layers.
- // Also, INOUT parameters need to only appear once
- if (output.getProperty(Constants.WSDL_PROPERTY_RETURN_PART) == null)
- {
- QName el = output.getElement();
- if (! inParameters.contains(el))
- {
- if (order.length() > 0)
- order.append(" ");
- order.append(el.getLocalPart());
- }
- }
- }
-
- if (order.length() > 0)
- buffer.append("
parameterOrder='").append(order.toString()).append("'");
- }
-
- buffer.append(">"); //End operation element
-
- String opname = operation.getName().toString();
- String interfaceName = operation.getWsdlInterface().getName().toString();
- String msgEl = targetPrefix + ":" + interfaceName + "_" +
opname;
-
- buffer.append("<input message='" + msgEl +
"'>").append("</input>");
-
- if (! Constants.WSDL20_PATTERN_IN_ONLY.equals(operation.getPattern()))
- {
- buffer.append("<output message='" + msgEl +
"Response'>");
- buffer.append("</output>");
- }
-
- //Append the Faults
- WSDLInterfaceOperationOutfault[] faults = operation.getOutfaults();
- //WSDLInterfaceFault[] faults = intf.getFaults();
- int lenf = faults != null ? faults.length : 0;
- for (int k = 0; k < lenf; k++)
- {
- //WSDLInterfaceFault flt = faults[k];
- WSDLInterfaceOperationOutfault flt = faults[k];
- QName elt = flt.getRef();
-
- String targetNS = wsdl.getTargetNamespace();
- //Writing the fault, the prefix should always be the one for wsdl target
namespace
- elt = new QName(targetNS, elt.getLocalPart(), wsdl.getPrefix(targetNS));
- //Remove Fault or Error appended to the name
- String cleanname = utils.chop(utils.chop(elt.getLocalPart(),
"Error"), "Fault");
-
- String n = "name='" + cleanname + "'";
-
- String cleanref = utils.chop(utils.getFormattedString(elt),
"Error");
- buffer.append("<fault message='" + cleanref + "'
" + n + ">");
- buffer.append("</fault>");
- }
-
- buffer.append("</operation>");
- }
- }
-
- protected void appendBindings(StringBuilder buffer)
- {
- WSDLBinding[] bindings = wsdl.getBindings();
- for (int i = 0; i < bindings.length; i++)
- {
- WSDLBinding binding = bindings[i];
- buffer.append("<binding name='" + binding.getName() +
"' type='" + getQNameRef(binding.getInterfaceName()) +
"'>");
- //TODO:Need to derive the WSDLStyle from the Style attribute of
InterfaceOperation
- if (wsdlStyle == null)
- throw new IllegalArgumentException("WSDL Style is null (should be rpc or
document");
- String style = "rpc";
- if (wsdlStyle.equals(Constants.DOCUMENT_LITERAL))
- style = "document";
- buffer.append("<" + soapPrefix + ":binding
transport='http://schemas.xmlsoap.org/soap/http' style='" + style +
"'/>");
- appendBindingOperations(buffer, binding);
- buffer.append("</binding>");
- }
- }
-
- private boolean isHeaderInput(WSDLBindingOperationInput input)
- {
- WSDLBindingOperation operation = input.getWsdlBindingOperation();
- WSDLBinding binding = operation.getWsdlBinding();
- WSDLInterface wsdlInterface = binding.getInterface();
- if (wsdlInterface == null)
- return false;
-
- WSDLInterfaceOperation interfaceOperation = wsdlInterface.getOperation(new
NCName(operation.getRef().getLocalPart()));
- if (interfaceOperation == null)
- return false;
-
- WSDLInterfaceOperationInput interfaceInput =
interfaceOperation.getInputByPartName(input.getMessageLabel().toString());
- if (interfaceInput == null)
- return false;
-
- if (interfaceInput.getProperty(Constants.WSDL_PROPERTY_APPLICATION_DATA) == null)
- return false;
- else
- return true;
- }
-
- private boolean isHeaderOutput(WSDLBindingOperationOutput output)
- {
- WSDLBindingOperation operation = output.getWsdlBindingOperation();
- WSDLBinding binding = operation.getWsdlBinding();
- WSDLInterface wsdlInterface = binding.getInterface();
- if (wsdlInterface == null)
- return false;
-
- WSDLInterfaceOperation interfaceOperation = wsdlInterface.getOperation(new
NCName(operation.getRef().getLocalPart()));
- if (interfaceOperation == null)
- return false;
-
- WSDLInterfaceOperationOutput interfaceOutput =
interfaceOperation.getOutputByPartName(output.getMessageLabel().toString());
- if (interfaceOutput == null)
- return false;
-
- if (interfaceOutput.getProperty(Constants.WSDL_PROPERTY_APPLICATION_DATA) == null)
- return false;
- else
- return true;
- }
-
- protected void appendBindingOperations(StringBuilder buffer, WSDLBinding binding)
- {
- WSDLBindingOperation[] operations = binding.getOperations();
- Arrays.sort(operations);
-
- String tns = wsdl.getTargetNamespace();
- for (int i = 0; i < operations.length; i++)
- {
- WSDLBindingOperation operation = operations[i];
- String interfaceName =
operation.getWsdlBinding().getInterfaceName().getLocalPart();
-
- buffer.append("<operation name='" +
operation.getRef().getLocalPart() + "'>");
- String soapAction = (operation.getSOAPAction() != null ?
operation.getSOAPAction() : "");
- buffer.append("<" + soapPrefix + ":operation
soapAction=\"" + soapAction + "\"/>");
- buffer.append("<input>");
-
- StringBuilder bodyParts = new StringBuilder();
- boolean hasHeader = false;
- WSDLBindingOperationInput[] inputs = operation.getInputs();
- for (int j = 0; j < inputs.length; j++)
- {
- WSDLBindingOperationInput input = inputs[j];
- if (isHeaderInput(input))
- {
- String messageName = interfaceName + "_" +
input.getWsdlBindingOperation().getRef().getLocalPart();
- buffer.append("<" + soapPrefix + ":header
use='literal' message='tns:" + messageName + "' part='"
+ input.getMessageLabel() + "'/>");
- hasHeader = true;
- }
- else
- {
- if (bodyParts.length() > 0)
- bodyParts.append(" ");
- bodyParts.append(input.getMessageLabel());
- }
- }
-
- buffer.append("<" + soapPrefix + ":body
use='literal'");
- if (hasHeader)
- buffer.append("
parts='").append(bodyParts.toString()).append("'");
- if (wsdlStyle != Constants.DOCUMENT_LITERAL)
- buffer.append(" namespace='" + tns + "'");
- buffer.append("/>");
-
- buffer.append("</input>");
-
- if (!
Constants.WSDL20_PATTERN_IN_ONLY.equals(getBindingOperationPattern(operation)))
- {
- buffer.append("<output>");
- bodyParts = new StringBuilder();
- hasHeader = false;
- WSDLBindingOperationOutput[] outputs = operation.getOutputs();
- for (int j = 0; j < outputs.length; j++)
- {
- WSDLBindingOperationOutput output = outputs[j];
- if (isHeaderOutput(output))
- {
- String messageName = interfaceName + "_" +
output.getWsdlBindingOperation().getRef().getLocalPart() + "Response";
-
- buffer.append("<" + soapPrefix + ":header
use='literal' message='tns:" + messageName + "' part='"
+ output.getMessageLabel() + "'/>");
- hasHeader = true;
- }
- else
- {
- if (bodyParts.length() > 0)
- bodyParts.append(" ");
- bodyParts.append(output.getMessageLabel());
- }
- }
-
- buffer.append("<" + soapPrefix + ":body
use='literal'");
- if (hasHeader)
- buffer.append("
parts='").append(bodyParts.toString()).append("'");
- if (wsdlStyle != Constants.DOCUMENT_LITERAL)
- buffer.append(" namespace='" + tns + "'");
- buffer.append("/>");
-
- buffer.append("</output>");
- }
-
- //Append faults
- QName intfname = operation.getWsdlBinding().getInterfaceName();
- WSDLInterface intf = wsdl.getInterface(new NCName(intfname.getLocalPart()));
- if (intf == null)
- throw new WSException("WSDL Interface should not be null");
- WSDLInterfaceOperation interfaceOperation = intf.getOperation(new
NCName(operation.getRef().getLocalPart()));
- WSDLInterfaceOperationOutfault[] faults = interfaceOperation.getOutfaults();
- int lenf = faults != null ? faults.length : 0;
- for (int k = 0; k < lenf; k++)
- {
- WSDLInterfaceOperationOutfault flt = faults[k];
- //Remove Fault or Error appended to the name
- String cleanname = utils.chop(utils.chop(flt.getRef().getLocalPart(),
"Error"), "Fault");
- String n = "name='" + cleanname + "'";
-
- //String cleanref = utils.chop(utils.getFormattedString(elt),
"Error");
- buffer.append("<fault " + n + ">");
- buffer.append("<" + soapPrefix + ":fault " + n +
" use='literal' />");
- buffer.append("</fault>");
- }
-
- buffer.append("</operation>");
- }
- }
-
- private String getBindingOperationPattern(WSDLBindingOperation operation)
- {
- WSDLBinding binding = operation.getWsdlBinding();
- String pattern = binding.getInterface().getOperation(new
NCName(operation.getRef().getLocalPart())).getPattern();
-
- return pattern;
- }
-
- protected void appendServices(StringBuilder buffer)
- {
- WSDLService[] services = wsdl.getServices();
- int len = services.length;
- for (int i = 0; i < len; i++)
- {
-
- WSDLService service = services[i];
- buffer.append("<service name='" + service.getName() +
"'>");
- WSDLEndpoint[] endpoints = service.getEndpoints();
- int lenend = endpoints.length;
- for (int j = 0; j < lenend; j++)
- {
- WSDLEndpoint endpoint = endpoints[j];
- appendServicePort(buffer, endpoint);
- }
-
- buffer.append("</service>");
- }
- }
-
- protected void appendServicePort(StringBuilder buffer, WSDLEndpoint endpoint)
- {
- String name = endpoint.getName().toString();
- QName endpointBinding = endpoint.getBinding();
- String prefix = endpointBinding.getPrefix();
- if (prefix == null || prefix == "")
- prefix = wsdl.getTargetPrefix();
- String ebname = prefix + ":" + endpointBinding.getLocalPart();
- buffer.append("<port name='" + name + "'
binding='" + ebname + "'>");
- buffer.append("<" + soapPrefix + ":address location='" +
endpoint.getAddress() + "'/>");
- buffer.append("</port>");
- }
-
-}
Deleted:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/wsdl/WSDL20Reader.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/wsdl/WSDL20Reader.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/wsdl/WSDL20Reader.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -1,557 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
-*/
-package org.jboss.ws.metadata.wsdl;
-
-// $Id$
-
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Iterator;
-
-import javax.wsdl.xml.WSDLLocator;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.Constants;
-import org.jboss.ws.WSException;
-import org.jboss.ws.metadata.wsdl.xsd.SchemaUtils;
-import org.jboss.xb.binding.ObjectModelFactory;
-import org.jboss.xb.binding.Unmarshaller;
-import org.jboss.xb.binding.UnmarshallerFactory;
-import org.jboss.xb.binding.UnmarshallingContext;
-import org.xml.sax.Attributes;
-import org.xml.sax.InputSource;
-
-/**
- * A factory that creates a WSDL <code>Definition</code> from an URL.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @author Anil.Saldhana(a)jboss.org
- * @since 10-Oct-2004
- */
-public class WSDL20Reader implements ObjectModelFactory
-{
- // provide logging
- private static final Logger log = Logger.getLogger(WSDL20Reader.class);
-
- private WSDLLocator locator = null;
-
- public WSDLDefinitions readWSDL(WSDLLocator wsdlLocator) throws WSDLException,
IOException
- {
- locator = wsdlLocator;
-
- String wsdlURI = wsdlLocator.getBaseURI();
- InputSource inputSource = wsdlLocator.getBaseInputSource();
- if (inputSource == null)
- throw new WSException("Cannot obtain WSDL input source for: " +
wsdlURI);
-
- InputStream is = inputSource.getByteStream();
- try
- {
- Unmarshaller unmarshaller =
UnmarshallerFactory.newInstance().newUnmarshaller();
- unmarshaller.setNamespaceAware(true);
- unmarshaller.setValidation(true);
-
- WSDLDefinitions wsdl = new WSDLDefinitions();
- wsdl.setWsdlNamespace(Constants.NS_WSDL20);
-
- unmarshaller.unmarshal(is, this, wsdl);
- return wsdl;
- }
- catch (RuntimeException re)
- {
- throw re;
- }
- catch (Exception e)
- {
- throw new WSDLException("Cannot unmarshal: " + wsdlURI, e);
- }
- finally
- {
- is.close();
- }
- }
-
- public void setFeature(String name, boolean value)
- {
- }
-
- /**
- * This method is called by the object model factory and returns the root of the
object graph.
- */
- public Object newRoot(Object root, UnmarshallingContext navigator, String
namespaceURI, String localName, Attributes attrs)
- {
- /**
- * WSDL2.0 Assertions (
http://www.w3.org/TR/wsdl20-primer)
- * The value of the WSDL target namespace MUST be an absolute URI.
- */
- WSDLDefinitions wsdl = null;
-
- StringBuilder buf = null;
-
- if (root instanceof WSDLDefinitions)
- {
- wsdl = (WSDLDefinitions)root;
-
- String targetNamespace = attrs.getValue("targetNamespace");
- boolean abs = (targetNamespace.startsWith("http"));
- if (targetNamespace == null || abs == false)
- throw new RuntimeException("WSDL 2.0 Assertion: targetNamespace must be
an absolute uri");
-
- wsdl.setWsdlNamespace(Constants.NS_WSDL20);
- wsdl.setTargetNamespace(targetNamespace);
-
- Iterator uris = navigator.getNamespaceURIs();
- while (uris.hasNext())
- {
- String namespace = (String)uris.next();
- String prefix = navigator.getNamespaceContext().getPrefix(namespace);
- if (prefix.length() > 0)
- wsdl.registerNamespaceURI(namespace, prefix);
- }
- return wsdl;
- }
- else if (root instanceof WSDLTypes)
- {
- wsdl = ((WSDLTypes)root).getWsdlDefinitions();
- if ("import".equalsIgnoreCase(localName))
- {
- importTypes(wsdl, attrs);
- return null;
- }
- if ("schema".equalsIgnoreCase(localName))
- {
- //Included Schema - wsdl 2.0
- //We will start writing whatever the parser has obtained
- buf = new StringBuilder("<schema ");
- Iterator uris = navigator.getNamespaceURIs();
- String targetNS = attrs.getValue("targetNamespace");
- buf.append(" targetNamespace='" + targetNS +
"'");
- while (uris.hasNext())
- {
- String namespace = (String)uris.next();
- Iterator iter = navigator.getNamespaceContext().getPrefixes(namespace);
- if (namespace.equals(Constants.NS_WSDL20))
- continue;
- if (iter == null)
- buf.append(" xmlns='" + namespace + "'");
- else
- {
- while (iter.hasNext())
- {
- String prefix = (String)iter.next();
- if (prefix.length() == 0)
- buf.append(" xmlns='" + namespace +
"'");
- else buf.append(" xmlns:" + prefix + "='" +
namespace + "'");
- }
- }
- }
- buf.append(">");
- return buf;
- }
- }
- else if (root instanceof StringBuilder)
- {
- return newChild((StringBuilder)root, navigator, namespaceURI, localName,
attrs);
- }
- else
- {
- throw new IllegalArgumentException("Invalid root for namespace: " +
namespaceURI);
- }
-
- return null;
- }
-
- /**
- * This method is called by the object model factory and returns the root of the
object graph.
- */
- public Object newChild(WSDLTypes types, UnmarshallingContext navigator, String
namespaceURI, String localName, Attributes attrs)
- {
- /**
- * WSDL2.0 Assertions (
http://www.w3.org/TR/wsdl20-primer)
- * The value of the WSDL target namespace MUST be an absolute URI.
- */
- WSDLDefinitions wsdl = types.getWsdlDefinitions();
-
- StringBuilder buf = null;
- if ("import".equalsIgnoreCase(localName))
- {
- importTypes(wsdl, attrs);
- return null;
- }
- if ("schema".equalsIgnoreCase(localName))
- {
- //Included Schema - wsdl 2.0
- //We will start writing whatever the parser has obtained
- buf = new StringBuilder("<schema ");
- Iterator uris = navigator.getNamespaceURIs();
- String targetNS = attrs.getValue("targetNamespace");
- buf.append(" targetNamespace='" + targetNS + "'");
- while (uris.hasNext())
- {
- String namespace = (String)uris.next();
- Iterator iter = navigator.getNamespaceContext().getPrefixes(namespace);
- if (namespace.equals(Constants.NS_WSDL20))
- continue;
- if (iter == null)
- buf.append(" xmlns='" + namespace + "'");
- else
- {
- while (iter.hasNext())
- {
- String prefix = (String)iter.next();
- if (prefix.length() == 0)
- buf.append(" xmlns='" + namespace +
"'");
- else buf.append(" xmlns:" + prefix + "='" +
namespace + "'");
- }
- }
- }
- buf.append(">");
- return buf;
- }
-
- return null;
- }
-
- /**
- * The JBossXB has completed the parsing of the WSDL 2.0 document
- * @param root
- * @param ctx
- * @param uri
- * @param name
- * @return
- */
- public Object completeRoot(Object root, UnmarshallingContext ctx, String uri, String
name)
- {
- return root;
- }
-
- /**
- * Used in the parsing of the included XML Schema in WSDL 2.0
- * @param buf
- * @param navigator
- * @param namespaceURI
- * @param localName
- * @param attrs
- * @return
- */
- public Object newChild(StringBuilder buf, UnmarshallingContext navigator, String
namespaceURI, String localName, Attributes attrs)
- {
- int len = attrs.getLength();
- buf.append("<" + localName);
- for (int i = 0; i < len; i++)
- {
- String val = attrs.getValue(i);
- String attrname = attrs.getLocalName(i);
- buf.append(" " + attrname + "='" + val +
"'");
- }
- buf.append(">");
- return buf;
- }
-
- /**
- * Used in the parsing of the included XML Schema in WSDL 2.0
- * We have reached the end of an xml element.
- * @param buf
- * @param navigator
- * @param namespaceURI
- * @param localName
- * @return
- */
- public Object addChild(StringBuilder buf, StringBuilder buf1, UnmarshallingContext
navigator, String namespaceURI, String localName) throws WSDLException
- {
- buf.append("</" + localName + ">");
- return buf;
-
- }
-
- /**
- * Used in the parsing of the included XML Schema in WSDL 2.0
- * We have parsed the schema completely. Write it into a file and update WSDLTypes
(schemaLocation)
- * @param types
- * @param buf
- * @param navigator
- * @param namespaceURI
- * @param localName
- * @return
- * @throws WSDLException
- */
- public Object addChild(WSDLTypes types, StringBuilder buf, UnmarshallingContext
navigator, String namespaceURI, String localName) throws WSDLException
- {
- buf.append("</schema>");
- String targetNS = types.getWsdlDefinitions().getTargetNamespace();
- try
- {
- File file = SchemaUtils.getSchemaTempFile(targetNS);
- file.deleteOnExit();
- FileWriter fwrite = new FileWriter(file);
- fwrite.write(buf.toString());
- fwrite.flush();
- fwrite.close();
- }
- catch (IOException e)
- {
- String msg = "Cannot extract schema definition for target namespace: "
+ targetNS;
- log.error(msg, e);
- throw new WSException(msg);
- }
- return types;
- }
-
- /**
- * Parsing the WSDL 2.0 document
- * @param wsdl20
- * @param navigator
- * @param namespaceURI
- * @param localName
- * @param attrs
- * @return
- * @throws WSDLException
- */
- public Object newChild(WSDLDefinitions wsdl20, UnmarshallingContext navigator, String
namespaceURI, String localName, Attributes attrs) throws WSDLException
- {
- /**
- * WSDL 20 Assertions
- * Each interface must be given a name that is unique within the set of interfaces
defined in this WSDL target NS
- * Interface names are tokens that must not contain a space or colon
(":")
- */
- String defaultNamespace = wsdl20.getWsdlNamespace();
- if (Constants.NS_WSDL20.equals(defaultNamespace))
- {
- if ("types".equals(localName))
- {
- WSDLTypes wsdlTypes = new XSModelTypes();
- wsdl20.setWsdlTypes(wsdlTypes);
- return wsdlTypes;
- }
- else if ("interface".equals(localName))
- {
- WSDLInterface wsdlInterface = new WSDLInterface(wsdl20);
- String name = attrs.getValue("name");
- if (name == null)
- throw new RuntimeException("Interface name should not be
null");
- if (name.indexOf(" ") > -1 || name.indexOf(":") >
-1)
- throw new RuntimeException("WSDL 2.0 Assertion:Interface names are
tokens " + "that must not contain a space or colon");
-
- NCName ncname = new NCName(name);
- if (wsdl20.getInterface(ncname) != null)
- throw new RuntimeException("WSDL 2.0 Assertion:Each interface must be
given a name that is "
- + "unique within the set of interfaces defined in this WSDL
target namespace");
-
- wsdlInterface.setName(ncname);
- wsdl20.addInterface(wsdlInterface);
-
- return wsdlInterface;
- }
- else if ("binding".equals(localName))
- {
- /**
- * WSDL 2.0 Assertion: Each name must be unique among all bindings in this
WSDL target namespace
- */
- String name = attrs.getValue("name");
- NCName ncname = new NCName(name);
- if (wsdl20.getBinding(ncname) != null)
- throw new RuntimeException("WSDL 2.0 Assertion:Each name must be
unique among " + "all bindings in this WSDL target namespace");
- WSDLBinding wsdlBinding = new WSDLBinding(wsdl20);
- wsdlBinding.setName(ncname);
- wsdl20.addBinding(wsdlBinding);
-
- return wsdlBinding;
- }
- else if ("service".equals(localName))
- {
- WSDLService wsdlService = new WSDLService(wsdl20);
- wsdlService.setName(new NCName(attrs.getValue("name")));
- wsdl20.addService(wsdlService);
-
wsdlService.setInterfaceName(navigator.resolveQName(attrs.getValue("interface")));
- return wsdlService;
- }
- else log.warn("Unrecogized child element: " + localName);
- }
- else throw new WSDLException("Invalid default namespace: " +
defaultNamespace);
-
- return null;
- }
-
- /**
- * Parsing the WSDL 2.0 document
- * @param wsdlInterface
- * @param navigator
- * @param namespaceURI
- * @param localName
- * @param attrs
- * @return
- */
- public Object newChild(WSDLInterface wsdlInterface, UnmarshallingContext navigator,
String namespaceURI, String localName, Attributes attrs)
- {
- /**
- * WSDL .0 Assertion: Operation names must also be unique within an interface
- */
- if ("operation".equals(localName))
- {
- String name = attrs.getValue("name");
- if (name == null)
- throw new RuntimeException("Operation name must not be null");
- NCName ncname = new NCName(name);
- if (wsdlInterface.containsInterfaceOperation(ncname))
- throw new RuntimeException("WSDL 2.0 Assertion:Each operation must be
given a name that is "
- + "unique within an interface defined in this WSDL target
namespace");
- WSDLInterfaceOperation wsdlOperation = new
WSDLInterfaceOperation(wsdlInterface);
- wsdlOperation.setName(ncname);
- wsdlInterface.addOperation(wsdlOperation);
- return wsdlOperation;
- }
-
- log.warn("Unrecogized child element: " + localName);
- return null;
- }
-
- /**
- * Parsing the WSDL 2.0 document
- * @param wsdlOperation
- * @param navigator
- * @param namespaceURI
- * @param localName
- * @param attrs
- * @return
- */
- public Object newChild(WSDLInterfaceOperation wsdlOperation, UnmarshallingContext
navigator, String namespaceURI, String localName, Attributes attrs)
- {
- if ("input".equals(localName))
- {
- WSDLInterfaceOperationInput wsdlInterfaceOperationInput = new
WSDLInterfaceOperationInput(wsdlOperation);
-
wsdlInterfaceOperationInput.setElement(navigator.resolveQName(attrs.getValue("element")));
- wsdlInterfaceOperationInput.setMessageLabel(new
NCName(attrs.getValue("messageLabel")));
- wsdlOperation.addInput(wsdlInterfaceOperationInput);
- return wsdlInterfaceOperationInput;
- }
- else if ("output".equals(localName))
- {
- WSDLInterfaceOperationOutput output = new
WSDLInterfaceOperationOutput(wsdlOperation);
- output.setElement(navigator.resolveQName(attrs.getValue("element")));
- output.setMessageLabel(new NCName(attrs.getValue("messageLabel")));
- wsdlOperation.addOutput(output);
- return output;
- }
- else if ("outfault".equals(localName))
- {
- WSDLInterfaceOperationOutfault fault = new
WSDLInterfaceOperationOutfault(wsdlOperation);
- String messageLabel = attrs.getValue("messageLabel");
- fault.setRef(navigator.resolveQName(attrs.getValue("ref")));
- if (messageLabel != null)
- fault.setMessageLabel(new NCName(messageLabel));
- wsdlOperation.addOutfault(fault);
- return wsdlOperation;
- }
-
- log.warn("Unrecogized child element: " + localName);
- return null;
- }
-
- /**
- * Parsing the WSDL 2.0 document
- * @param wsdlBinding
- * @param navigator
- * @param namespaceURI
- * @param localName
- * @param attrs
- * @return
- */
- public Object newChild(WSDLBinding wsdlBinding, UnmarshallingContext navigator, String
namespaceURI, String localName, Attributes attrs)
- {
- if ("operation".equals(localName))
- {
- WSDLBindingOperation wsdlBindingOperation = new
WSDLBindingOperation(wsdlBinding);
-
wsdlBindingOperation.setRef(navigator.resolveQName(attrs.getValue("ref")));
- wsdlBinding.addOperation(wsdlBindingOperation);
- return wsdlBindingOperation;
- }
-
- log.warn("Unrecogized child element: " + localName);
- return null;
- }
-
- /**
- * Parsing the WSDL 2.0 document
- * @param wsdlBindingOperation
- * @param navigator
- * @param namespaceURI
- * @param localName
- * @param attrs
- * @return
- */
- public Object newChild(WSDLBindingOperation wsdlBindingOperation, UnmarshallingContext
navigator, String namespaceURI, String localName, Attributes attrs)
- {
- if ("input".equals(localName))
- {
- WSDLBindingOperationInput wsdlBindingOperationInput = new
WSDLBindingOperationInput(wsdlBindingOperation);
- wsdlBindingOperationInput.setMessageLabel(new
NCName(attrs.getValue("messageLabel")));
- wsdlBindingOperation.addInput(wsdlBindingOperationInput);
- return wsdlBindingOperationInput;
- }
- if ("output".equals(localName))
- {
- WSDLBindingOperationOutput wsdlBindingOperationOutput = new
WSDLBindingOperationOutput(wsdlBindingOperation);
- wsdlBindingOperationOutput.setMessageLabel(new
NCName(attrs.getValue("messageLabel")));
- wsdlBindingOperation.addOutput(wsdlBindingOperationOutput);
- return wsdlBindingOperationOutput;
- }
-
- log.warn("Unrecogized child element: " + localName);
- return null;
- }
-
- /**
- * Parsing the WSDL 2.0 document
- * @param wsdlService
- * @param navigator
- * @param namespaceURI
- * @param localName
- * @param attrs
- * @return
- */
- public Object newChild(WSDLService wsdlService, UnmarshallingContext navigator, String
namespaceURI, String localName, Attributes attrs)
- {
- if ("endpoint".equals(localName))
- {
- WSDLEndpoint wsdlEndpoint = new WSDLEndpoint(wsdlService);
- wsdlEndpoint.setName(new NCName(attrs.getValue("name")));
-
wsdlEndpoint.setBinding(navigator.resolveQName(attrs.getValue("binding")));
- wsdlService.addEndpoint(wsdlEndpoint);
- return wsdlEndpoint;
- }
-
- log.warn("Unrecogized child element: " + localName);
- return null;
- }
-
- /**
- * Method that deals with importing schema
- * @param wsdl
- * @param attrs
- */
- private void importTypes(WSDLDefinitions wsdl, Attributes attrs)
- {
- // [TODO]
- }
-}
\ No newline at end of file
Deleted:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/wsdl/WSDL20Writer.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/wsdl/WSDL20Writer.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/wsdl/WSDL20Writer.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -1,200 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
-*/
-package org.jboss.ws.metadata.wsdl;
-
-// $Id$
-
-import org.jboss.logging.Logger;
-
-/**
- * A WSDL writer that writes out a WSDL-2.0 compliant wsdl.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @author Anil.Saldhana(a)jboss.org
- * @since 10-Oct-2004
- */
-public class WSDL20Writer extends WSDLWriter
-{
- // provide logging
- protected static final Logger log = Logger.getLogger(WSDL20Writer.class);
-
- protected WSDLUtils utils = WSDLUtils.getInstance();
-
- /** Use WSDLDefinitions.writeWSDL instead. */
- public WSDL20Writer(WSDLDefinitions wsdl)
- {
- super(wsdl);
- }
-
-
- protected void appendInterfaces(StringBuilder buffer)
- {
- WSDLInterface[] interfaces = wsdl.getInterfaces();
- for (int i = 0; i < interfaces.length; i++)
- {
- WSDLInterface intf = interfaces[i];
- buffer.append("<interface name='" + intf.getName() +
"'>");
- appendInterfaceFaults(buffer, intf);
- appendInterfaceOperations(buffer, intf);
- buffer.append("</interface>");
- }
- }
-
- private void appendInterfaceFaults(StringBuilder buffer, WSDLInterface intf)
- {
- WSDLInterfaceFault[] faults = intf.getFaults();
- for (int i = 0; i < faults.length; i++)
- {
- WSDLInterfaceFault fault = faults[i];
- buffer.append("<fault name='" + fault.getName() +
"'");
- buffer.append(" element='" + getQNameRef(fault.getXmlName()) +
"'>");
- if (fault.getDocumentation() != null)
- {
- buffer.append(fault.getDocumentation());
- }
- buffer.append("</fault>");
- }
- }
-
- private void appendInterfaceOperations(StringBuilder buffer, WSDLInterface intf)
- {
- WSDLInterfaceOperation[] operations = intf.getOperations();
- for (int i = 0; i < operations.length; i++)
- {
- WSDLInterfaceOperation operation = operations[i];
- buffer.append("<operation name='" + operation.getName() +
"'>");
-
- WSDLInterfaceOperationInput[] inputs = operation.getInputs();
- for (int j = 0; j < inputs.length; j++)
- {
- WSDLInterfaceOperationInput ip = inputs[j];
- buffer.append("<input element='" +
getQNameRef(ip.getElement()) + "'");
- if (ip.getMessageLabel() != null)
- {
- buffer.append(" messageLabel='" + ip.getMessageLabel() +
"'");
- }
- buffer.append(">");
- appendProperties(buffer, ip.getProperties());
- buffer.append("</input>");
- }
-
- WSDLInterfaceOperationOutput[] outputs = operation.getOutputs();
- for (int j = 0; j < outputs.length; j++)
- {
- WSDLInterfaceOperationOutput op = outputs[j];
- buffer.append("<output element='" +
getQNameRef(op.getElement()) + "'");
- if (op.getMessageLabel() != null)
- {
- buffer.append(" messageLabel='" + op.getMessageLabel() +
"'");
- }
- buffer.append(">");
- appendProperties(buffer, op.getProperties());
- buffer.append("</output>");
- }
-
- WSDLInterfaceOperationOutfault[] outfaults = operation.getOutfaults();
- for (int j = 0; j < outfaults.length; j++)
- {
- WSDLInterfaceOperationOutfault outfault = outfaults[j];
- buffer.append("<outfault ref='" +
getQNameRef(outfault.getRef()) + "'>");
- if (outfault.getMessageLabel() != null)
- {
- buffer.append(" messageLabel='" + outfault.getMessageLabel()
+ "'");
- }
- buffer.append("</outfault>");
- }
- buffer.append("</operation>");
- }
- }
-
- private void appendProperties(StringBuilder buffer, WSDLProperty[] wsdlProperties)
- {
- for (int i = 0; i < wsdlProperties.length; i++)
- {
- WSDLProperty wsdlProperty = wsdlProperties[i];
- String uri = wsdlProperty.getURI();
- String value = wsdlProperty.getValue();
- buffer.append("<property uri='" + uri + "'>" +
(value != null ? "<value>" + value + "</value>" :
"") + "</property>");
- }
- }
-
- protected void appendBindings(StringBuilder buffer)
- {
- WSDLBinding[] bindings = wsdl.getBindings();
- for (int i = 0; i < bindings.length; i++)
- {
- WSDLBinding binding = bindings[i];
- buffer.append("<binding name='" + binding.getName() +
"'");
- if (binding.getInterfaceName() != null)
- {
- buffer.append(" interface='" +
getQNameRef(binding.getInterfaceName()) + "'");
- }
- buffer.append(">");
- appendBindingOperations(buffer, binding);
- buffer.append("</binding>");
- }
- }
-
- protected void appendBindingOperations(StringBuilder buffer, WSDLBinding binding)
- {
- WSDLBindingOperation[] operations = binding.getOperations();
- for (int i = 0; i < operations.length; i++)
- {
- WSDLBindingOperation operation = operations[i];
- buffer.append("<operation ref='" +
getQNameRef(operation.getRef()) + "'>");
- buffer.append("</operation>");
- }
- }
-
- protected void appendServices(StringBuilder buffer)
- {
- WSDLService[] services = wsdl.getServices();
- for (int i = 0; i < services.length; i++)
- {
- WSDLService service = services[i];
- buffer.append("<service name='" + service.getName() +
"'");
- if (service.getInterfaceName() != null)
- {
- buffer.append(" interface='" +
getQNameRef(service.getInterfaceName()) + "'");
- }
- buffer.append(">");
-
- WSDLEndpoint[] endpoints = service.getEndpoints();
- for (int j = 0; j < endpoints.length; j++)
- {
- WSDLEndpoint endpoint = endpoints[j];
- buffer.append("<endpoint name='" + endpoint.getName() +
"'");
- if (endpoint.getBinding() != null)
- {
- buffer.append(" binding='" +
getQNameRef(endpoint.getBinding()) + "'");
- }
- if (endpoint.getAddress() != null)
- {
- buffer.append(" address='" + endpoint.getAddress() +
"'");
- }
- buffer.append("></endpoint>");
- }
-
- buffer.append("</service>");
- }
- }
-}
Modified:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/wsdl/WSDLDefinitions.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/wsdl/WSDLDefinitions.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/wsdl/WSDLDefinitions.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -23,9 +23,7 @@
// $Id$
-import java.io.IOException;
import java.io.Serializable;
-import java.io.Writer;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedHashMap;
@@ -37,7 +35,6 @@
import org.jboss.logging.Logger;
import org.jboss.ws.Constants;
-import org.jboss.ws.WSException;
import org.jboss.xb.binding.NamespaceRegistry;
import org.w3c.dom.Document;
@@ -298,23 +295,4 @@
if(pre != null && pre.equals(prefix))
namespaces.removePrefixMapping(prefix);
}
-
- /** Write the wsdl definition to the given writer, clients should not care about the
wsdl version. */
- public void write(Writer writer, String charset) throws IOException
- {
- if (Constants.NS_WSDL11.equals(wsdlNamespace))
- {
- WSDL11Writer wsdl11Writer = new WSDL11Writer(this);
- wsdl11Writer.write(writer, charset);
- }
- else if (Constants.NS_WSDL20.equals(wsdlNamespace))
- {
- WSDL20Writer wsdl20Writer = new WSDL20Writer(this);
- wsdl20Writer.write(writer);
- }
- else
- {
- throw new WSException("Unsupported wsdl version: " + wsdlNamespace);
- }
- }
}
\ No newline at end of file
Deleted:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/wsdl/WSDLDefinitionsFactory.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/wsdl/WSDLDefinitionsFactory.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/wsdl/WSDLDefinitionsFactory.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -1,210 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
-*/
-package org.jboss.ws.metadata.wsdl;
-
-// $Id$
-
-import java.io.InputStream;
-import java.io.StringWriter;
-import java.net.URL;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-import javax.wsdl.Definition;
-import javax.wsdl.factory.WSDLFactory;
-import javax.wsdl.xml.WSDLReader;
-import javax.xml.parsers.DocumentBuilder;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.core.utils.DOMUtils;
-import org.jboss.ws.core.utils.JBossWSEntityResolver;
-import org.jboss.ws.Constants;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.xml.sax.EntityResolver;
-
-import com.ibm.wsdl.xml.WSDLReaderImpl;
-
-/**
- * A factory that creates a <code>WSDLDefinitions</code> object from an URL.
- *
- * This implementations deals with different WSDL versions so that clients of this
- * factory do need to know about WSDL version specifics. The Java object view of the
- * WSDL document (WSDLDefinitions) is modeled on WSDL-2.0
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 10-Oct-2004
- */
-public class WSDLDefinitionsFactory
-{
- // provide logging
- private static final Logger log = Logger.getLogger(WSDLDefinitionsFactory.class);
-
- // This feature is set by default in wsdl4j, it means the object structure contains
the imported arguments
- public static final String FEATURE_IMPORT_DOCUMENTS =
"javax.wsdl.importDocuments";
- // Set this feature for additional debugging output
- public static final String FEATURE_VERBOSE = "javax.wsdl.verbose";
-
- // The WSDL reader features
- private Map features = new HashMap();
-
- // Hide constructor
- private WSDLDefinitionsFactory()
- {
- }
-
- /**
- * Create a new instance of a wsdl factory
- */
- public static WSDLDefinitionsFactory newInstance()
- {
- return new WSDLDefinitionsFactory();
- }
-
- /**
- * Set a feature on the underlying reader
- */
- public void setFeature(String name, boolean value) throws IllegalArgumentException
- {
- features.put(name, new Boolean(value));
- }
-
- /**
- * Read the wsdl document from the given URL
- */
- public WSDLDefinitions parse(URL wsdlLocation) throws WSDLException
- {
- if (wsdlLocation == null)
- throw new IllegalArgumentException("URL cannot be null");
-
- log.trace("parse: " + wsdlLocation.toExternalForm());
-
- EntityResolver entityResolver = new JBossWSEntityResolver();
- WSDLDefinitions wsdlDefinitions = null;
- try
- {
- Document wsdlDoc = getDocument(wsdlLocation);
- String defaultNamespace = getDefaultNamespace(wsdlDoc);
- if (Constants.NS_WSDL20.equals(defaultNamespace))
- {
- WSDL20Reader wsdlReader = new WSDL20Reader();
-
- // Setup reader features
- Iterator it = features.entrySet().iterator();
- while (it.hasNext())
- {
- Map.Entry entry = (Map.Entry)it.next();
- String key = (String)entry.getKey();
- Boolean flag = (Boolean)entry.getValue();
- wsdlReader.setFeature(key, flag.booleanValue());
- }
-
- wsdlDefinitions = wsdlReader.readWSDL(new WSDLLocatorImpl(entityResolver,
wsdlLocation));
- wsdlDefinitions.setWsdlDocument(wsdlDoc);
- }
- else if (Constants.NS_WSDL11.equals(defaultNamespace))
- {
- WSDLFactory wsdlFactory = WSDLFactory.newInstance();
- WSDLReader wsdlReader = wsdlFactory.newWSDLReader();
- wsdlReader.setFeature("javax.wsdl.verbose", false);
-
- // Setup reader features
- Iterator it = features.entrySet().iterator();
- while (it.hasNext())
- {
- Map.Entry entry = (Map.Entry)it.next();
- String key = (String)entry.getKey();
- Boolean flag = (Boolean)entry.getValue();
- wsdlReader.setFeature(key, flag.booleanValue());
- }
-
- // Set EntityResolver in patched version of wsdl4j-1.5.2jboss
- ((WSDLReaderImpl)wsdlReader).setEntityResolver(entityResolver);
-
- Definition definition = wsdlReader.readWSDL(new
WSDLLocatorImpl(entityResolver, wsdlLocation));
- wsdlDefinitions = new WSDL11Reader().processDefinition(definition,
wsdlLocation);
- wsdlDefinitions.setWsdlDocument(wsdlDoc);
- }
- else
- throw new WSDLException("Invalid default namespace: " +
defaultNamespace);
-
- if (log.isTraceEnabled())
- {
- StringWriter stwr = new StringWriter();
- WSDL20Writer wsdl20Writer = new WSDL20Writer(wsdlDefinitions);
- wsdl20Writer.write(stwr);
- log.trace("\n" + stwr.toString());
- }
- }
- catch (WSDLException e)
- {
- throw e;
- }
- catch (RuntimeException rte)
- {
- throw rte;
- }
- catch (Exception e)
- {
- throw new WSDLException(e);
- }
-
- return wsdlDefinitions;
- }
-
- /** Get the WSDL document.
- */
- private Document getDocument(URL wsdlLocation) throws WSDLException
- {
- try
- {
- InputStream wsdlInputStream = wsdlLocation.openStream();
- try
- {
- DocumentBuilder builder = DOMUtils.getDocumentBuilder();
- return builder.parse(wsdlInputStream);
- }
- finally
- {
- wsdlInputStream.close();
- }
- }
- catch (RuntimeException rte)
- {
- throw rte;
- }
- catch (Exception e)
- {
- throw new WSDLException(e);
- }
- }
-
- /** Get the default namespace for the given WSDL
- */
- private String getDefaultNamespace(Document wsdlDoc) throws WSDLException
- {
- Element root = wsdlDoc.getDocumentElement();
- String defaultNamespace = root.getNamespaceURI();
- return defaultNamespace;
- }
-}
Deleted:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/wsdl/WSDLLocatorImpl.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/wsdl/WSDLLocatorImpl.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/wsdl/WSDLLocatorImpl.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -1,159 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.ws.metadata.wsdl;
-
-// $Id$
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.MalformedURLException;
-import java.net.URL;
-
-import javax.wsdl.xml.WSDLLocator;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.WSException;
-import org.xml.sax.EntityResolver;
-import org.xml.sax.InputSource;
-
-/* A WSDLLocator that can handle wsdl imports
- */
-class WSDLLocatorImpl implements WSDLLocator
-{
- // provide logging
- private static final Logger log = Logger.getLogger(WSDLDefinitionsFactory.class);
-
- private EntityResolver entityResolver;
- private URL wsdlURL;
- private String latestImportURI;
-
- public WSDLLocatorImpl(EntityResolver entityResolver, URL wsdlFile)
- {
- if (wsdlFile == null)
- throw new IllegalArgumentException("WSDL file argument cannot be
null");
-
- this.entityResolver = entityResolver;
- this.wsdlURL = wsdlFile;
- }
-
- public InputSource getBaseInputSource()
- {
- log.trace("getBaseInputSource [wsdlUrl=" + wsdlURL + "]");
- try
- {
- InputStream is = wsdlURL.openStream();
- if (is == null)
- throw new IllegalArgumentException("Cannot obtain wsdl from [" +
wsdlURL + "]");
-
- return new InputSource(is);
- }
- catch (IOException e)
- {
- throw new RuntimeException("Cannot access wsdl from [" + wsdlURL +
"], " + e.getMessage());
- }
- }
-
- public String getBaseURI()
- {
- return wsdlURL.toExternalForm();
- }
-
- public InputSource getImportInputSource(String parent, String resource)
- {
- log.trace("getImportInputSource [parent=" + parent +
",resource=" + resource + "]");
-
- URL parentURL = null;
- try
- {
- parentURL = new URL(parent);
- }
- catch (MalformedURLException e)
- {
- log.error("Not a valid URL: " + parent);
- return null;
- }
-
- String wsdlImport = null;
- String external = parentURL.toExternalForm();
-
- // An external URL
- if (resource.startsWith("http://") ||
resource.startsWith("https://"))
- {
- wsdlImport = resource;
- }
-
- // Absolute path
- else if (resource.startsWith("/"))
- {
- String beforePath = external.substring(0,
external.indexOf(parentURL.getPath()));
- wsdlImport = beforePath + resource;
- }
-
- // A relative path
- else
- {
- String parentDir = external.substring(0, external.lastIndexOf("/"));
-
- // remove references to current dir
- while (resource.startsWith("./"))
- resource = resource.substring(2);
-
- // remove references to parentdir
- while (resource.startsWith("../"))
- {
- parentDir = parentDir.substring(0, parentDir.lastIndexOf("/"));
- resource = resource.substring(3);
- }
-
- wsdlImport = parentDir + "/" + resource;
- }
-
- try
- {
- log.trace("Trying to resolve: " + wsdlImport);
- InputSource inputSource = entityResolver.resolveEntity(wsdlImport, wsdlImport);
- if (inputSource != null)
- {
- latestImportURI = wsdlImport;
- }
- else
- {
- throw new IllegalArgumentException("Cannot resolve imported resource:
" + wsdlImport);
- }
-
- return inputSource;
- }
- catch (RuntimeException rte)
- {
- throw rte;
- }
- catch (Exception e)
- {
- throw new WSException("Cannot access imported wsdl [" + wsdlImport +
"], " + e.getMessage());
- }
- }
-
- public String getLatestImportURI()
- {
- return latestImportURI;
- }
-}
Deleted:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/wsdl/WSDLWriter.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/wsdl/WSDLWriter.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/wsdl/WSDLWriter.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -1,179 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
-*/
-package org.jboss.ws.metadata.wsdl;
-
-// $Id$
-
-import java.io.IOException;
-import java.io.Writer;
-import java.util.Iterator;
-
-import javax.xml.namespace.QName;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.Constants;
-import org.jboss.ws.core.utils.DOMUtils;
-import org.jboss.ws.core.utils.DOMWriter;
-import org.jboss.ws.metadata.wsdl.xmlschema.JBossXSModel;
-import org.w3c.dom.Element;
-
-/**
- * A helper that writes out a WSDL definition
- *
- * @author Thomas.Diesler(a)jboss.org
- * @author Anil.Saldhana(a)jboss.org
- * @since 10-Oct-2004
- */
-public abstract class WSDLWriter
-{
- // provide logging
- protected static final Logger log = Logger.getLogger(WSDLWriter.class);
-
- protected WSDLDefinitions wsdl;
- protected WSDLUtils utils = WSDLUtils.getInstance();
-
- // The soap prefix
- protected String soapPrefix = "soap";
-
- /**
- * Include or import WSDL Types
- */
- protected boolean includeSchemaInWSDL = true;
-
- /** Use WSDLDefinitions.writeWSDL instead. */
- protected WSDLWriter(WSDLDefinitions wsdl)
- {
- if (wsdl == null)
- throw new IllegalArgumentException("WSDL definitions is NULL");
-
- this.wsdl = wsdl;
- }
-
- public void write(Writer writer) throws IOException
- {
- StringBuilder buffer = new StringBuilder();
- buffer.append(Constants.XML_HEADER);
-
- appendDefinitions(buffer);
- appendTypes(buffer);
- appendInterfaces(buffer);
- appendBindings(buffer);
- appendServices(buffer);
-
- buffer.append("</definitions>");
-
- Element element = DOMUtils.parse(buffer.toString());
- new DOMWriter(writer).setPrettyprint(true).print(element);
- }
-
- protected void appendDefinitions(StringBuilder buffer)
- {
- buffer.append("<definitions");
- //Append service name as done by wscompile, if there is just one
- WSDLService[] services = wsdl.getServices();
- if (services != null && services.length == 1)
- {
- WSDLService ser = services[0];
- buffer.append(" name='" + ser.getName() + "'");
- }
- buffer.append(" targetNamespace='" + wsdl.getTargetNamespace() +
"'");
- buffer.append(" xmlns='" + wsdl.getWsdlNamespace() +
"'");
- Iterator it = wsdl.getRegisteredNamespaceURIs();
- while (it.hasNext())
- {
- String namespaceURI = (String)it.next();
- String prefix = wsdl.getPrefix(namespaceURI);
- if (prefix.length() > 0)
- {
- buffer.append(" xmlns:" + prefix + "='" +
namespaceURI + "'");
- if (Constants.PREFIX_SOAP11.equals(prefix) ||
Constants.PREFIX_SOAP12.equals(prefix))
- soapPrefix = prefix;
- }
- }
- buffer.append(">");
- }
-
- protected void appendTypes(StringBuilder buffer)
- {
- buffer.append("<types>");
- JBossXSModel xsM = WSDLUtils.getSchemaModel(wsdl.getWsdlTypes());
- String schema = xsM.serialize();
- buffer.append(schema);
- buffer.append("</types>");
- }
-
- protected abstract void appendInterfaces(StringBuilder buffer);
-
- protected abstract void appendBindings(StringBuilder buffer);
-
- protected abstract void appendServices(StringBuilder buffer);
-
- /** Get a prefixed name of form prefix:localPart */
- protected String getQNameRef(QName qname)
- {
- String retStr = qname.getLocalPart();
-
- String prefix = qname.getPrefix();
- String nsURI = qname.getNamespaceURI();
- if (prefix.length() == 0 && nsURI.length() > 0)
- {
- qname = wsdl.registerQName(qname);
- prefix = qname.getPrefix();
- }
-
- if (prefix.length() > 0)
- retStr = prefix + ":" + retStr;
-
- return retStr;
- }
-
- public WSDLDefinitions getWsdl()
- {
- return wsdl;
- }
-
- public void setWsdl(WSDLDefinitions wsdl)
- {
- this.wsdl = wsdl;
- }
-
- public boolean isIncludeTypesInWSDL()
- {
- return includeSchemaInWSDL;
- }
-
- public void logException(Exception e)
- {
- if (log.isTraceEnabled())
- {
- log.trace(e);
- }
- }
-
- public void logMessage(String msg)
- {
- if (log.isTraceEnabled())
- {
- log.trace(msg);
- }
- }
-}
Modified: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/tools/JavaToWSDL.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/tools/JavaToWSDL.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/tools/JavaToWSDL.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -37,11 +37,12 @@
import org.jboss.ws.core.jaxrpc.Style;
import org.jboss.ws.core.utils.DOMUtils;
import org.jboss.ws.core.utils.DOMWriter;
-import org.jboss.ws.metadata.UnifiedMetaData;
import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping;
+import org.jboss.ws.metadata.umdm.UnifiedMetaData;
import org.jboss.ws.metadata.wsdl.WSDLDefinitions;
import org.jboss.ws.tools.Configuration.OperationConfig;
import org.jboss.ws.tools.metadata.ToolsUnifiedMetaDataBuilder;
+import org.jboss.ws.tools.wsdl.WSDLWriter;
import org.w3c.dom.Element;
/**
@@ -339,7 +340,7 @@
// Debug the generated wsdl
StringWriter sw = new StringWriter();
- wsdlDefinitions.write(sw, Constants.DEFAULT_XML_CHARSET);
+ new WSDLWriter(wsdlDefinitions).write(sw, Constants.DEFAULT_XML_CHARSET);
log.debug("Generated WSDL:\n" + sw.toString());
// Debug the generated mapping file
Modified:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/tools/JavaToWSDL11.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/tools/JavaToWSDL11.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/tools/JavaToWSDL11.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -31,13 +31,13 @@
import org.jboss.logging.Logger;
import org.jboss.ws.Constants;
import org.jboss.ws.WSException;
-import org.jboss.ws.metadata.EndpointMetaData;
-import org.jboss.ws.metadata.FaultMetaData;
-import org.jboss.ws.metadata.OperationMetaData;
-import org.jboss.ws.metadata.ParameterMetaData;
-import org.jboss.ws.metadata.ServiceMetaData;
-import org.jboss.ws.metadata.UnifiedMetaData;
import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping;
+import org.jboss.ws.metadata.umdm.EndpointMetaData;
+import org.jboss.ws.metadata.umdm.FaultMetaData;
+import org.jboss.ws.metadata.umdm.OperationMetaData;
+import org.jboss.ws.metadata.umdm.ParameterMetaData;
+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.metadata.wsdl.WSDLUtils;
import org.jboss.ws.metadata.wsdl.XSModelTypes;
Modified: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/tools/WSDLToJava.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/tools/WSDLToJava.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/tools/WSDLToJava.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -47,7 +47,6 @@
import org.jboss.ws.core.utils.JavaUtils;
import org.jboss.ws.metadata.wsdl.NCName;
import org.jboss.ws.metadata.wsdl.WSDLDefinitions;
-import org.jboss.ws.metadata.wsdl.WSDLDefinitionsFactory;
import org.jboss.ws.metadata.wsdl.WSDLException;
import org.jboss.ws.metadata.wsdl.WSDLInterface;
import org.jboss.ws.metadata.wsdl.WSDLInterfaceFault;
@@ -59,6 +58,7 @@
import org.jboss.ws.metadata.wsdl.xmlschema.JBossXSModel;
import org.jboss.ws.metadata.wsdl.xsd.SchemaUtils;
import org.jboss.ws.tools.interfaces.WSDLToJavaIntf;
+import org.jboss.ws.tools.wsdl.WSDLDefinitionsFactory;
import org.w3c.dom.Element;
/**
Modified:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/tools/WSDotXMLCreator.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/tools/WSDotXMLCreator.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/tools/WSDotXMLCreator.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -33,9 +33,9 @@
import org.jboss.ws.WSException;
import org.jboss.ws.core.utils.DOMUtils;
import org.jboss.ws.core.utils.DOMWriter;
-import org.jboss.ws.metadata.jsr109.PortComponentMetaData;
-import org.jboss.ws.metadata.jsr109.WebserviceDescriptionMetaData;
-import org.jboss.ws.metadata.jsr109.WebservicesMetaData;
+import org.jboss.ws.metadata.webservices.PortComponentMetaData;
+import org.jboss.ws.metadata.webservices.WebserviceDescriptionMetaData;
+import org.jboss.ws.metadata.webservices.WebservicesMetaData;
import org.jboss.ws.tools.interfaces.WSDotXMLCreatorIntf;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
Modified:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/tools/helpers/JavaToWSDLHelper.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/tools/helpers/JavaToWSDLHelper.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/tools/helpers/JavaToWSDLHelper.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -44,10 +44,6 @@
import org.jboss.ws.core.jaxrpc.LiteralTypeMapping;
import org.jboss.ws.core.jaxrpc.Style;
import org.jboss.ws.core.utils.JavaUtils;
-import org.jboss.ws.metadata.EndpointMetaData;
-import org.jboss.ws.metadata.FaultMetaData;
-import org.jboss.ws.metadata.OperationMetaData;
-import org.jboss.ws.metadata.ParameterMetaData;
import org.jboss.ws.metadata.jaxrpcmapping.ExceptionMapping;
import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping;
import org.jboss.ws.metadata.jaxrpcmapping.JavaXmlTypeMapping;
@@ -60,6 +56,10 @@
import org.jboss.ws.metadata.jaxrpcmapping.VariableMapping;
import org.jboss.ws.metadata.jaxrpcmapping.WsdlMessageMapping;
import org.jboss.ws.metadata.jaxrpcmapping.WsdlReturnValueMapping;
+import org.jboss.ws.metadata.umdm.EndpointMetaData;
+import org.jboss.ws.metadata.umdm.FaultMetaData;
+import org.jboss.ws.metadata.umdm.OperationMetaData;
+import org.jboss.ws.metadata.umdm.ParameterMetaData;
import org.jboss.ws.metadata.wsdl.NCName;
import org.jboss.ws.metadata.wsdl.WSDLBinding;
import org.jboss.ws.metadata.wsdl.WSDLBindingFault;
Modified:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/tools/helpers/ToolsHelper.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/tools/helpers/ToolsHelper.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/tools/helpers/ToolsHelper.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -44,13 +44,13 @@
import org.jboss.ws.core.utils.DOMWriter;
import org.jboss.ws.core.utils.IOUtils;
import org.jboss.ws.core.utils.JavaUtils;
-import org.jboss.ws.metadata.EndpointMetaData;
-import org.jboss.ws.metadata.OperationMetaData;
-import org.jboss.ws.metadata.ParameterMetaData;
-import org.jboss.ws.metadata.ServiceMetaData;
-import org.jboss.ws.metadata.UnifiedMetaData;
import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping;
import org.jboss.ws.metadata.jaxrpcmapping.JavaXmlTypeMapping;
+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.ServiceMetaData;
+import org.jboss.ws.metadata.umdm.UnifiedMetaData;
import org.jboss.ws.metadata.wsdl.NCName;
import org.jboss.ws.metadata.wsdl.WSDLDefinitions;
import org.jboss.ws.metadata.wsdl.WSDLService;
@@ -67,6 +67,7 @@
import org.jboss.ws.tools.client.ServiceCreator;
import org.jboss.ws.tools.interfaces.WSDotXMLCreatorIntf;
import org.jboss.ws.tools.mapping.MappingFileGenerator;
+import org.jboss.ws.tools.wsdl.WSDLWriter;
/**
* Helper class used by the command line tool "jbossws"
@@ -124,7 +125,7 @@
String wsdlPath = outDir + "/wsdl/" + j2wc.serviceName +
".wsdl";
//Generate the WSDL
Writer fw = IOUtils.getCharsetFileWriter(new File(wsdlPath),
Constants.DEFAULT_XML_CHARSET);
- wsdl.write(fw, Constants.DEFAULT_XML_CHARSET);
+ new WSDLWriter(wsdl).write(fw, Constants.DEFAULT_XML_CHARSET);
fw.close();
//Generate the Mapping File
Modified:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/tools/metadata/ReflectiveMetaDataBuilder.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/tools/metadata/ReflectiveMetaDataBuilder.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/tools/metadata/ReflectiveMetaDataBuilder.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -37,9 +37,9 @@
import org.jboss.ws.core.jaxrpc.ParameterWrapping;
import org.jboss.ws.core.utils.HolderUtils;
import org.jboss.ws.core.utils.JavaUtils;
-import org.jboss.ws.metadata.FaultMetaData;
-import org.jboss.ws.metadata.OperationMetaData;
-import org.jboss.ws.metadata.ParameterMetaData;
+import org.jboss.ws.metadata.umdm.FaultMetaData;
+import org.jboss.ws.metadata.umdm.OperationMetaData;
+import org.jboss.ws.metadata.umdm.ParameterMetaData;
import org.jboss.ws.metadata.wsdl.WSDLUtils;
import org.jboss.ws.tools.ToolsUtils;
import org.jboss.ws.tools.Configuration.OperationConfig;
Modified:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/tools/metadata/ToolsAnnotationMetaDataBuilder.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/tools/metadata/ToolsAnnotationMetaDataBuilder.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/tools/metadata/ToolsAnnotationMetaDataBuilder.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -37,9 +37,9 @@
import org.jboss.ws.WSException;
import org.jboss.ws.core.jaxrpc.Style;
-import org.jboss.ws.metadata.FaultMetaData;
-import org.jboss.ws.metadata.OperationMetaData;
-import org.jboss.ws.metadata.ParameterMetaData;
+import org.jboss.ws.metadata.umdm.FaultMetaData;
+import org.jboss.ws.metadata.umdm.OperationMetaData;
+import org.jboss.ws.metadata.umdm.ParameterMetaData;
import org.jboss.ws.metadata.wsdl.WSDLUtils;
import org.jboss.ws.tools.ToolsUtils;
Modified:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/tools/metadata/ToolsEndpointMetaData.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/tools/metadata/ToolsEndpointMetaData.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/tools/metadata/ToolsEndpointMetaData.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -26,8 +26,8 @@
import javax.xml.namespace.QName;
import org.jboss.util.NotImplementedException;
-import org.jboss.ws.metadata.EndpointMetaData;
-import org.jboss.ws.metadata.ServiceMetaData;
+import org.jboss.ws.metadata.umdm.EndpointMetaData;
+import org.jboss.ws.metadata.umdm.ServiceMetaData;
/**
* Tools Endpoint Metadata
Modified:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/tools/metadata/ToolsUnifiedMetaDataBuilder.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/tools/metadata/ToolsUnifiedMetaDataBuilder.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/tools/metadata/ToolsUnifiedMetaDataBuilder.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -33,8 +33,8 @@
import org.jboss.logging.Logger;
import org.jboss.ws.WSException;
import org.jboss.ws.core.jaxrpc.Style;
-import org.jboss.ws.metadata.ServiceMetaData;
-import org.jboss.ws.metadata.UnifiedMetaData;
+import org.jboss.ws.metadata.umdm.ServiceMetaData;
+import org.jboss.ws.metadata.umdm.UnifiedMetaData;
import org.jboss.ws.metadata.wsdl.WSDLUtils;
import org.jboss.ws.tools.Configuration.OperationConfig;
Copied:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/tools/wsdl/WSDL11DefinitionFactory.java
(from rev 1603,
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/wsdl/WSDL11DefinitionFactory.java)
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/wsdl/WSDL11DefinitionFactory.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/tools/wsdl/WSDL11DefinitionFactory.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -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.tools.wsdl;
+
+// $Id: WSDL11DefinitionFactory.java 906 2006-09-06 18:57:40Z thomas.diesler(a)jboss.com $
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.core.utils.JBossWSEntityResolver;
+import org.xml.sax.EntityResolver;
+import org.xml.sax.InputSource;
+
+import com.ibm.wsdl.xml.WSDLReaderImpl;
+
+import javax.wsdl.Definition;
+import javax.wsdl.WSDLException;
+import javax.wsdl.factory.WSDLFactory;
+import javax.wsdl.xml.WSDLLocator;
+import javax.wsdl.xml.WSDLReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+/**
+ * A factory that creates a WSDL-1.1 <code>Definition</code> from an URL.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 15-April-2004
+ */
+public class WSDL11DefinitionFactory
+{
+ // provide logging
+ private static Logger log = Logger.getLogger(WSDL11DefinitionFactory.class);
+
+ // This feature is set by default in wsdl4j, it means the object structore contains
the imported arguments
+ public static final String FEATURE_IMPORT_DOCUMENTS =
"javax.wsdl.importDocuments";
+ // Set this feature for additional debugging output
+ public static final String FEATURE_VERBOSE = "javax.wsdl.verbose";
+
+ // The WSDLReader that is used by this factory
+ private WSDLReader wsdlReader;
+
+ // Hide constructor
+ private WSDL11DefinitionFactory() throws WSDLException
+ {
+ WSDLFactory wsdlFactory = WSDLFactory.newInstance();
+ wsdlReader = wsdlFactory.newWSDLReader();
+ wsdlReader.setFeature(WSDL11DefinitionFactory.FEATURE_VERBOSE, false);
+ }
+
+ /** Create a new instance of a wsdl factory */
+ public static WSDL11DefinitionFactory newInstance() throws WSDLException
+ {
+ return new WSDL11DefinitionFactory();
+ }
+
+ /** Set a feature on the underlying reader */
+ public void setFeature(String name, boolean value) throws IllegalArgumentException
+ {
+ wsdlReader.setFeature(name, value);
+ }
+
+ /**
+ * Read the wsdl document from the given URL
+ */
+ public Definition parse(URL wsdlLocation) throws WSDLException
+ {
+ if (wsdlLocation == null)
+ throw new IllegalArgumentException("URL cannot be null");
+
+ log.trace("parse: " + wsdlLocation.toExternalForm());
+
+ EntityResolver entityResolver = new JBossWSEntityResolver();
+
+ // Set EntityResolver in patched version of wsdl4j-1.5.2jboss
+ ((WSDLReaderImpl)wsdlReader).setEntityResolver(entityResolver);
+
+ Definition wsdlDefinition = wsdlReader.readWSDL(new WSDLLocatorImpl(entityResolver,
wsdlLocation));
+ return wsdlDefinition;
+ }
+}
Copied:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/tools/wsdl/WSDL11Reader.java
(from rev 1603,
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/wsdl/WSDL11Reader.java)
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/wsdl/WSDL11Reader.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/tools/wsdl/WSDL11Reader.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -0,0 +1,1170 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ws.tools.wsdl;
+
+// $Id$
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.wsdl.Binding;
+import javax.wsdl.BindingInput;
+import javax.wsdl.BindingOperation;
+import javax.wsdl.BindingOutput;
+import javax.wsdl.Definition;
+import javax.wsdl.Fault;
+import javax.wsdl.Import;
+import javax.wsdl.Input;
+import javax.wsdl.Message;
+import javax.wsdl.Operation;
+import javax.wsdl.Output;
+import javax.wsdl.Part;
+import javax.wsdl.Port;
+import javax.wsdl.PortType;
+import javax.wsdl.Service;
+import javax.wsdl.Types;
+import javax.wsdl.extensions.ExtensibilityElement;
+import javax.wsdl.extensions.UnknownExtensibilityElement;
+import javax.wsdl.extensions.mime.MIMEContent;
+import javax.wsdl.extensions.mime.MIMEMultipartRelated;
+import javax.wsdl.extensions.mime.MIMEPart;
+import javax.wsdl.extensions.schema.Schema;
+import javax.wsdl.extensions.soap.SOAPAddress;
+import javax.wsdl.extensions.soap.SOAPBinding;
+import javax.wsdl.extensions.soap.SOAPBody;
+import javax.wsdl.extensions.soap.SOAPHeader;
+import javax.wsdl.extensions.soap.SOAPOperation;
+import javax.xml.namespace.QName;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.Constants;
+import org.jboss.ws.WSException;
+import org.jboss.ws.core.jaxrpc.Style;
+import org.jboss.ws.core.utils.DOMUtils;
+import org.jboss.ws.core.utils.DOMWriter;
+import org.jboss.ws.metadata.wsdl.NCName;
+import org.jboss.ws.metadata.wsdl.WSDLBinding;
+import org.jboss.ws.metadata.wsdl.WSDLBindingOperation;
+import org.jboss.ws.metadata.wsdl.WSDLDefinitions;
+import org.jboss.ws.metadata.wsdl.WSDLEndpoint;
+import org.jboss.ws.metadata.wsdl.WSDLInterface;
+import org.jboss.ws.metadata.wsdl.WSDLInterfaceFault;
+import org.jboss.ws.metadata.wsdl.WSDLInterfaceOperation;
+import org.jboss.ws.metadata.wsdl.WSDLInterfaceOperationInput;
+import org.jboss.ws.metadata.wsdl.WSDLInterfaceOperationOutfault;
+import org.jboss.ws.metadata.wsdl.WSDLInterfaceOperationOutput;
+import org.jboss.ws.metadata.wsdl.WSDLProperty;
+import org.jboss.ws.metadata.wsdl.WSDLService;
+import org.jboss.ws.metadata.wsdl.WSDLTypes;
+import org.jboss.ws.metadata.wsdl.WSDLUtils;
+import org.jboss.ws.metadata.wsdl.XSModelTypes;
+import org.jboss.ws.metadata.wsdl.xmlschema.JBossXSModel;
+import org.jboss.ws.metadata.wsdl.xsd.SchemaUtils;
+import org.jboss.ws.tools.JavaToXSD;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+
+/**
+ * A helper that translates a WSDL-1.1 object graph into a WSDL-2.0 object graph.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @author Anil.Saldhana(a)jboss.org
+ * @since 10-Oct-2004
+ */
+public class WSDL11Reader
+{
+ // provide logging
+ private static final Logger log = Logger.getLogger(WSDL11Reader.class);
+
+ private static QName SOAP12_BINDING = new QName(Constants.NS_SOAP12,
"binding");
+ private static QName SOAP12_BODY = new QName(Constants.NS_SOAP12, "body");
+ private static QName SOAP12_OPERATION = new QName(Constants.NS_SOAP12,
"operation");
+ private static QName SOAP12_ADDRESS = new QName(Constants.NS_SOAP12,
"address");
+
+ private WSDLDefinitions destWsdl;
+
+ // Maps wsdl message parts to their corresponding element names
+ private Map<String, QName> messagePartToElementMap = new HashMap<String,
QName>();
+
+ // Map of <ns,URL> for schemalocation keyed by namespace
+ private Map<String, URL> schemaLocationsMap = new HashMap<String, URL>();
+
+ // Temporary files used by this reader.
+ private List<File> tempFiles = new ArrayList<File>();
+
+ /**
+ * Takes a WSDL11 Definition element and converts into
+ * our object graph that has been developed for WSDL20
+ *
+ * @param srcWsdl The src WSDL11 definition
+ * @param wsdlLoc The source location, if null we cannot process imports or includes
+ */
+ public WSDLDefinitions processDefinition(Definition srcWsdl, URL wsdlLoc) throws
IOException
+ {
+ log.trace("processDefinition: " + wsdlLoc);
+
+ destWsdl = new WSDLDefinitions();
+ destWsdl.setWsdlTypes(new XSModelTypes());
+ destWsdl.setWsdlOneOneDefinition(srcWsdl);
+ destWsdl.setWsdlNamespace(Constants.NS_WSDL11);
+
+ processNamespaces(srcWsdl);
+ processTypes(srcWsdl, wsdlLoc);
+ processServices(srcWsdl);
+
+ if (getAllDefinedBindings(srcWsdl).size() != destWsdl.getBindings().length)
+ processUnreachableBindings(srcWsdl);
+
+ cleanupTemporaryFiles();
+
+ return destWsdl;
+ }
+
+ private void cleanupTemporaryFiles()
+ {
+ for (File current : tempFiles)
+ {
+ current.delete();
+ }
+ }
+
+ // process all bindings not within service separetly
+ private void processUnreachableBindings(Definition srcWsdl)
+ {
+ log.trace("processUnreachableBindings");
+
+ Iterator it = getAllDefinedBindings(srcWsdl).values().iterator();
+ while (it.hasNext())
+ {
+ Binding srcBinding = (Binding)it.next();
+ QName srcQName = srcBinding.getQName();
+
+ WSDLBinding destBinding = destWsdl.getBinding(new NCName(srcQName));
+ if (destBinding == null)
+ {
+ processBinding(srcWsdl, srcBinding);
+ }
+ }
+ }
+
+ private void processNamespaces(Definition srcWsdl)
+ {
+ String targetNS = srcWsdl.getTargetNamespace();
+ destWsdl.setTargetNamespace(targetNS);
+
+ // Copy wsdl namespaces
+ Map nsMap = srcWsdl.getNamespaces();
+ Iterator iter = nsMap.entrySet().iterator();
+ while (iter.hasNext())
+ {
+ Map.Entry entry = (Map.Entry)iter.next();
+ String prefix = (String)entry.getKey();
+ String nsURI = (String)entry.getValue();
+ destWsdl.registerNamespaceURI(nsURI, prefix);
+ }
+ }
+
+ private void processTypes(Definition srcWsdl, URL wsdlLoc) throws IOException
+ {
+ log.trace("BEGIN processTypes: " + wsdlLoc);
+
+ WSDLTypes destTypes = destWsdl.getWsdlTypes();
+
+ Types srcTypes = srcWsdl.getTypes();
+ if (srcTypes != null && srcTypes.getExtensibilityElements().size() > 0)
+ {
+ List extElements = srcTypes.getExtensibilityElements();
+ int len = extElements.size();
+
+ for (int i = 0; i < len; i++)
+ {
+ ExtensibilityElement extElement = (ExtensibilityElement)extElements.get(i);
+
+ Element domElement;
+ if (extElement instanceof Schema)
+ {
+ domElement = ((Schema)extElement).getElement();
+ }
+ else if (extElement instanceof UnknownExtensibilityElement)
+ {
+ domElement = ((UnknownExtensibilityElement)extElement).getElement();
+ }
+ else
+ {
+ throw new WSException("Unsupported extensibility element: " +
extElement);
+ }
+
+ Element domElementClone = (Element)domElement.cloneNode(true);
+ copyParentNamespaceDeclarations(domElementClone, domElement);
+
+ String localname = domElementClone.getLocalName();
+ try
+ {
+ if ("import".equals(localname))
+ {
+ processSchemaImport(destTypes, wsdlLoc, domElementClone);
+ }
+ else if ("schema".equals(localname))
+ {
+ processSchemaInclude(destTypes, wsdlLoc, domElementClone);
+ }
+ else
+ {
+ throw new IllegalArgumentException("Unsuported schema element:
" + localname);
+ }
+ }
+ catch (IOException e)
+ {
+ throw new WSException("Cannot extract schema definition", e);
+ }
+ }
+
+ if (len > 0)
+ {
+ JavaToXSD jxsd = new JavaToXSD();
+ JBossXSModel xsmodel = jxsd.parseSchema(schemaLocationsMap);
+ WSDLUtils.addSchemaModel(destTypes, destWsdl.getTargetNamespace(), xsmodel);
+ }
+ }
+ else
+ {
+ log.trace("Empty wsdl types element, processing imports");
+ Iterator it = srcWsdl.getImports().values().iterator();
+ while (it.hasNext())
+ {
+ List<Import> srcImports = (List<Import>)it.next();
+ for (Import srcImport : srcImports)
+ {
+ Definition impDefinition = srcImport.getDefinition();
+ String impLoc = impDefinition.getDocumentBaseURI();
+ processTypes(impDefinition, new URL(impLoc));
+ }
+ }
+ }
+
+ log.trace("END processTypes: " + wsdlLoc + "\n" + destTypes);
+ }
+
+ private void copyParentNamespaceDeclarations(Element destElement, Element srcElement)
+ {
+ Node parent = srcElement.getParentNode();
+ while (parent != null)
+ {
+ if (parent.hasAttributes())
+ {
+ NamedNodeMap attributes = parent.getAttributes();
+ for (int i = 0; i < attributes.getLength(); i++)
+ {
+ Attr attr = (Attr)attributes.item(i);
+ String name = attr.getName();
+ String value = attr.getValue();
+ if (name.startsWith("xmlns:") &&
destElement.hasAttribute(name) == false)
+ destElement.setAttribute(name, value);
+ }
+ }
+ parent = parent.getParentNode();
+ }
+ }
+
+ private void processSchemaImport(WSDLTypes types, URL wsdlLoc, Element importEl)
throws IOException
+ {
+ if (wsdlLoc == null)
+ throw new IllegalArgumentException("Cannot process import, parent location
not set");
+
+ log.trace("processSchemaImport: " + wsdlLoc);
+
+ String location = getOptionalAttribute(importEl, "schemaLocation");
+ if (location == null)
+ throw new IllegalArgumentException("schemaLocation is null for
xsd:import");
+
+ URL locationURL = getLocationURL(wsdlLoc, location);
+ Element rootElement = DOMUtils.parse(locationURL.openStream());
+ URL newloc = processSchemaInclude(types, locationURL, rootElement);
+ if (newloc != null)
+ importEl.setAttribute("schemaLocation", newloc.toExternalForm());
+ }
+
+ private URL processSchemaInclude(WSDLTypes types, URL wsdlLoc, Element schemaEl)
throws IOException
+ {
+ if (wsdlLoc == null)
+ throw new IllegalArgumentException("Cannot process iclude, parent location
not set");
+
+ File tmpFile = null;
+ if (wsdlLoc == null)
+ throw new IllegalArgumentException("Cannot process include, parent location
not set");
+
+ log.trace("processSchemaInclude: " + wsdlLoc);
+
+ String schemaPrefix = schemaEl.getPrefix();
+
+ String importTag = (schemaPrefix == null) ? "import" : schemaPrefix +
":import";
+ Element importElement =
schemaEl.getOwnerDocument().createElementNS(Constants.NS_SCHEMA_XSD, importTag);
+ importElement.setAttribute("namespace", Constants.URI_SOAP11_ENC);
+ schemaEl.insertBefore(importElement, DOMUtils.getFirstChildElement(schemaEl));
+
+ // Handle schema includes
+ Iterator it = DOMUtils.getChildElements(schemaEl, new
QName(Constants.NS_SCHEMA_XSD, "include"));
+ while (it.hasNext())
+ {
+ Element includeEl = (Element)it.next();
+ String location = getOptionalAttribute(includeEl, "schemaLocation");
+ if (location == null)
+ throw new IllegalArgumentException("schemaLocation is null for
xsd:include");
+
+ URL locationURL = getLocationURL(wsdlLoc, location);
+ Element rootElement = DOMUtils.parse(locationURL.openStream());
+ URL newloc = processSchemaInclude(types, locationURL, rootElement);
+ if (newloc != null)
+ includeEl.setAttribute("schemaLocation", newloc.toExternalForm());
+ }
+
+ String targetNS = getOptionalAttribute(schemaEl, "targetNamespace");
+ if (targetNS != null)
+ {
+ log.trace("processSchemaInclude: [targetNS=" + targetNS +
",parentURL=" + wsdlLoc + "]");
+
+ tmpFile = SchemaUtils.getSchemaTempFile(targetNS);
+ tempFiles.add(tmpFile);
+
+ FileWriter fwrite = new FileWriter(tmpFile);
+ new DOMWriter(fwrite).setPrettyprint(true).print(schemaEl);
+ fwrite.close();
+
+ schemaLocationsMap.put(targetNS, tmpFile.toURL());
+ }
+
+ // schema elements that have no target namespace are skipped
+ //
+ // <xsd:schema>
+ // <xsd:import
namespace="http://org.jboss.webservice/example/types"
schemaLocation="Hello.xsd"/>
+ // <xsd:import
namespace="http://org.jboss.webservice/example/types/arrays/org/jboss/test/webservice/admindevel"
schemaLocation="subdir/HelloArr.xsd"/>
+ // </xsd:schema>
+ if (targetNS == null)
+ {
+ log.trace("Schema element without target namespace in: " + wsdlLoc);
+ }
+
+ handleSchemaImports(schemaEl, wsdlLoc);
+
+ return tmpFile != null ? tmpFile.toURL() : null;
+ }
+
+ private void handleSchemaImports(Element schemaEl, URL wsdlLoc) throws
MalformedURLException
+ {
+ if (wsdlLoc == null)
+ throw new IllegalArgumentException("Cannot process import, parent location
not set");
+
+ Iterator it = DOMUtils.getChildElements(schemaEl, new
QName(Constants.NS_SCHEMA_XSD, "import"));
+ while (it.hasNext())
+ {
+ Element includeEl = (Element)it.next();
+ String schemaLocation = getOptionalAttribute(includeEl,
"schemaLocation");
+ String namespace = getOptionalAttribute(includeEl, "namespace");
+
+ log.trace("handleSchemaImport: [namespace=" + namespace +
",schemaLocation=" + schemaLocation + "]");
+
+ // Skip, let the entity resolver resolve these
+ if (namespace != null && schemaLocation != null)
+ {
+ URL currLoc = getLocationURL(wsdlLoc, schemaLocation);
+ schemaLocationsMap.put(namespace, currLoc);
+ }
+ else
+ {
+ log.trace("Skip schema import: [namespace=" + namespace +
",schemaLocation=" + schemaLocation + "]");
+ }
+ }
+ }
+
+ private URL getLocationURL(URL parentURL, String location) throws
MalformedURLException
+ {
+ log.trace("getLocationURL: [location=" + location + ",parent="
+ parentURL + "]");
+
+ URL locationURL = null;
+ try
+ {
+ locationURL = new URL(location);
+ }
+ catch (MalformedURLException e)
+ {
+ // ignore malformed URL
+ }
+
+ if (locationURL == null)
+ {
+ String parentProtocol = parentURL.getProtocol();
+ if (parentProtocol.equals("file") &&
!location.startsWith("/"))
+ {
+ String path = parentURL.toExternalForm();
+ path = path.substring(0, path.lastIndexOf("/"));
+ locationURL = new URL(path + "/" + location);
+ }
+ else if (parentProtocol.startsWith("http") &&
location.startsWith("/"))
+ {
+ String path = parentProtocol + "://" + parentURL.getHost() +
":" + parentURL.getPort();
+ locationURL = new URL(path + location);
+ }
+ else if (parentProtocol.equals("jar") &&
!location.startsWith("/"))
+ {
+ String path = parentURL.toExternalForm();
+ path = path.substring(0, path.lastIndexOf("/"));
+ locationURL = new URL(path + "/" + location);
+ }
+ else
+ {
+ throw new WSException("Unsupported schemaLocation: " + location);
+ }
+ }
+
+ log.trace("Modified schemaLocation: " + locationURL);
+ return locationURL;
+ }
+
+ private void processPortType(Definition srcWsdl, PortType srcPortType)
+ {
+ log.trace("processPortType: " + srcPortType.getQName());
+
+ QName qname = srcPortType.getQName();
+ NCName ncName = new NCName(qname);
+ if (destWsdl.getInterface(ncName) == null)
+ {
+ WSDLInterface destInterface = new WSDLInterface(destWsdl);
+ destInterface.setName(ncName);
+ destInterface.setQName(qname);
+
+ // eventing extensions
+ QName eventSourceProp =
(QName)srcPortType.getExtensionAttribute(Constants.WSDL_ATTRIBUTE_WSE_EVENTSOURCE);
+ if (eventSourceProp != null &&
eventSourceProp.getLocalPart().equals(Boolean.TRUE.toString()))
+ {
+ destInterface.addProperty(new
WSDLProperty(Constants.WSDL_PROPERTY_EVENTSOURCE, eventSourceProp.getLocalPart()));
+ }
+
+ destWsdl.addInterface(destInterface);
+
+ processPortTypeOperations(srcWsdl, destInterface, srcPortType);
+ }
+ }
+
+ private void processPortTypeOperations(Definition srcWsdl, WSDLInterface
destInterface, PortType srcPortType)
+ {
+ Iterator itOperations = srcPortType.getOperations().iterator();
+ while (itOperations.hasNext())
+ {
+ Operation srcOperation = (Operation)itOperations.next();
+
+ WSDLInterfaceOperation destOperation = new
WSDLInterfaceOperation(destInterface);
+ destOperation.setName(new NCName(srcOperation.getName()));
+
+ processOperationInput(srcWsdl, srcOperation, destOperation, srcPortType);
+ processOperationOutput(srcWsdl, srcOperation, destOperation, srcPortType);
+ processOperationFaults(srcOperation, destOperation, destInterface);
+
+ destInterface.addOperation(destOperation);
+ }
+ }
+
+ private void processOperationInput(Definition srcWsdl, Operation srcOperation,
WSDLInterfaceOperation destOperation, PortType srcPortType)
+ {
+ Input srcInput = srcOperation.getInput();
+ if (srcInput != null)
+ {
+ Message srcMessage = srcInput.getMessage();
+ log.trace("processOperationInput: " + srcMessage.getQName());
+
+ QName wsaAction =
(QName)srcInput.getExtensionAttribute(Constants.WSDL_ATTRIBUTE_WSA_ACTION);
+ if (wsaAction != null)
+ destOperation.addProperty(new WSDLProperty(Constants.WSDL_PROPERTY_ACTION_IN,
wsaAction.getLocalPart()));
+
+ List paramOrder = srcOperation.getParameterOrdering();
+ Iterator itMessageParts = srcMessage.getOrderedParts(paramOrder).iterator();
+ while (itMessageParts.hasNext())
+ {
+ WSDLInterfaceOperationInput destInput = new
WSDLInterfaceOperationInput(destOperation);
+
+ Part srcPart = (Part)itMessageParts.next();
+ QName elementName = messagePartToElementName(srcWsdl, srcPortType,
srcOperation, srcMessage, srcPart);
+ destInput.setElement(elementName);
+
+ //Lets remember the Message name
+ destInput.addProperty(new WSDLProperty(Constants.WSDL_PROPERTY_MESSAGE_NAME,
srcMessage.getQName().getLocalPart()));
+ destOperation.addProperty(new
WSDLProperty(Constants.WSDL_PROPERTY_MESSAGE_NAME_IN,
srcMessage.getQName().getLocalPart()));
+
+ // Remember the original part name
+ WSDLProperty wsdlProperty = new
WSDLProperty(Constants.WSDL_PROPERTY_PART_NAME, srcPart.getName());
+ destInput.addProperty(wsdlProperty);
+
+ // If the Part references a type rather than an element
+ // we transport the xmlType as property
+ QName xmlType = srcPart.getTypeName();
+ if (xmlType != null)
+ {
+ xmlType = destWsdl.registerQName(xmlType);
+ String value = xmlType.getPrefix() + ":" +
xmlType.getLocalPart();
+ wsdlProperty = new WSDLProperty(Constants.WSDL_PROPERTY_RPC_XMLTYPE,
value);
+ destInput.addProperty(wsdlProperty);
+ }
+
+ destOperation.addInput(destInput);
+ }
+ }
+ }
+
+ private void processOperationOutput(Definition srcWsdl, Operation srcOperation,
WSDLInterfaceOperation destOperation, PortType srcPortType)
+ {
+ Output srcOutput = srcOperation.getOutput();
+ if (srcOutput != null)
+ {
+ Message srcMessage = srcOutput.getMessage();
+ log.trace("processOperationOutput: " + srcMessage.getQName());
+
+ destOperation.setPattern(Constants.WSDL20_PATTERN_IN_OUT);
+ QName wsaAction =
(QName)srcOutput.getExtensionAttribute(Constants.WSDL_ATTRIBUTE_WSA_ACTION);
+ if (wsaAction != null)
+ destOperation.addProperty(new
WSDLProperty(Constants.WSDL_PROPERTY_ACTION_OUT, wsaAction.getLocalPart()));
+
+ Iterator itMessageParts = srcMessage.getOrderedParts(null).iterator();
+ while (itMessageParts.hasNext())
+ {
+ WSDLInterfaceOperationOutput destOutput = new
WSDLInterfaceOperationOutput(destOperation);
+
+ Part srcPart = (Part)itMessageParts.next();
+ QName elementName = messagePartToElementName(srcWsdl, srcPortType,
srcOperation, srcMessage, srcPart);
+ destOutput.setElement(elementName);
+
+ //Lets remember the Message name
+ destOutput.addProperty(new WSDLProperty(Constants.WSDL_PROPERTY_MESSAGE_NAME,
srcMessage.getQName().getLocalPart()));
+ destOperation.addProperty(new
WSDLProperty(Constants.WSDL_PROPERTY_MESSAGE_NAME_OUT,
srcMessage.getQName().getLocalPart()));
+
+ // Remember the original part name
+ WSDLProperty wsdlProperty = new
WSDLProperty(Constants.WSDL_PROPERTY_PART_NAME, srcPart.getName());
+ destOutput.addProperty(wsdlProperty);
+
+ // If the Part references a type rather than an element
+ // we transport the xmlType as property
+ QName xmlType = srcPart.getTypeName();
+ if (xmlType != null)
+ {
+ xmlType = destWsdl.registerQName(xmlType);
+ String value = xmlType.getPrefix() + ":" +
xmlType.getLocalPart();
+ wsdlProperty = new WSDLProperty(Constants.WSDL_PROPERTY_RPC_XMLTYPE,
value);
+ destOutput.addProperty(wsdlProperty);
+ }
+
+ destOperation.addOutput(destOutput);
+ }
+ }
+ else
+ {
+ destOperation.setPattern(Constants.WSDL20_PATTERN_IN_ONLY);
+ }
+ }
+
+ private void processOperationFaults(Operation srcOperation, WSDLInterfaceOperation
destOperation, WSDLInterface destInterface)
+ {
+
+ Map faults = srcOperation.getFaults();
+ Iterator itFaults = faults.values().iterator();
+ while (itFaults.hasNext())
+ {
+ Fault srcFault = (Fault)itFaults.next();
+ processOperationFault(destOperation, destInterface, srcFault);
+ }
+ }
+
+ private void processOperationFault(WSDLInterfaceOperation destOperation, WSDLInterface
destInterface, Fault srcFault)
+ {
+ String faultName = srcFault.getName();
+ log.trace("processOperationFault: " + faultName);
+
+ WSDLInterfaceFault destFault = new WSDLInterfaceFault(destInterface);
+ NCName ncName = new NCName(faultName);
+ destFault.setName(ncName);
+
+ Message message = srcFault.getMessage();
+ QName messageName = message.getQName();
+
+ Map partsMap = message.getParts();
+ if (partsMap.size() != 1)
+ throw new WSException("Unsupported number of fault parts in message "
+ messageName);
+
+ Part part = (Part)partsMap.values().iterator().next();
+ QName xmlName = part.getElementName();
+ QName xmlType = part.getTypeName();
+
+ destFault.setXmlType(xmlType);
+ if (xmlName != null)
+ {
+ destFault.setXmlName(xmlName);
+ }
+ else
+ {
+ destFault.setXmlName(messageName);
+ log.warn("Unsupported fault message part in message: " +
messageName);
+ }
+
+ WSDLInterfaceFault prevFault = destInterface.getFault(ncName);
+ if (prevFault != null && prevFault.getName().equals(ncName) == false)
+ throw new WSException("Fault name must be unique: " + faultName);
+
+ // Add the fault to the interface
+ destInterface.addFault(destFault);
+
+ // Add the fault refererence to the operation
+ WSDLInterfaceOperationOutfault opOutFault = new
WSDLInterfaceOperationOutfault(destOperation);
+ opOutFault.setRef(new QName(destWsdl.getTargetNamespace(), faultName));
+ destOperation.addOutfault(opOutFault);
+ }
+
+ /** Translate the message part name into an XML element name.
+ */
+ private QName messagePartToElementName(Definition srcWsdl, PortType srcPortType,
Operation srcOperation, Message srcMessage, Part srcPart)
+ {
+ // <part name="param" element="tns:SomeType" />
+ QName xmlName = srcPart.getElementName();
+ if (xmlName != null)
+ xmlName = destWsdl.registerQName(xmlName);
+
+ // <part name="param" type="xsd:string" />
+ if (xmlName == null)
+ {
+ // Use the part name as fallback
+ xmlName = new QName(srcPart.getName());
+
+ // The binding may define a different xmlName for this message part (i.e. in
case of header parts)
+ // The rest of this implementation tries to discover that binding.
+
+ // Find the binding for this portType
+ Binding srcBinding = null;
+ Iterator itBindings = getAllDefinedBindings(srcWsdl).values().iterator();
+ while (srcBinding == null && itBindings.hasNext())
+ {
+ Binding binding = (Binding)itBindings.next();
+ if (binding.getPortType().equals(srcPortType))
+ srcBinding = binding;
+ }
+
+ if (srcBinding == null)
+ throw new WSException("Cannot find binding for: " +
srcPortType.getQName());
+
+ String srcOperationName = srcOperation.getName();
+ BindingOperation srcBindingOperation =
srcBinding.getBindingOperation(srcOperationName, null, null);
+ if (srcBindingOperation == null)
+ throw new WSException("Cannot find binding operation for: " +
srcOperationName);
+
+ // Scan the binding input for a <soap:header> for this message part
+ BindingInput srcBindingInput = srcBindingOperation.getBindingInput();
+ if (srcBindingInput != null)
+ {
+ Iterator itExt = srcBindingInput.getExtensibilityElements().iterator();
+ while (itExt.hasNext())
+ {
+ ExtensibilityElement extEl = (ExtensibilityElement)itExt.next();
+ if (extEl instanceof SOAPHeader)
+ {
+ SOAPHeader header = (SOAPHeader)extEl;
+ QName messageQName = header.getMessage();
+ String partName = header.getPart();
+ if (messageQName.equals(srcMessage.getQName()) &&
partName.equals(srcPart.getName()))
+ {
+ String namespaceURI = header.getNamespaceURI();
+ if (namespaceURI != null)
+ {
+ xmlName = new QName(namespaceURI, partName);
+ xmlName = destWsdl.registerQName(xmlName);
+ }
+ }
+ }
+ }
+ }
+
+ // Scan the binding output for a <soap:header> for this message part
+ BindingOutput srcBindingOutput = srcBindingOperation.getBindingOutput();
+ if (srcBindingOutput != null)
+ {
+ Iterator itExt = srcBindingOutput.getExtensibilityElements().iterator();
+ while (itExt.hasNext())
+ {
+ ExtensibilityElement extEl = (ExtensibilityElement)itExt.next();
+ if (extEl instanceof SOAPHeader)
+ {
+ SOAPHeader header = (SOAPHeader)extEl;
+ QName messageQName = header.getMessage();
+ String partName = header.getPart();
+ if (messageQName.equals(srcMessage.getQName()) &&
partName.equals(srcPart.getName()))
+ {
+ String namespaceURI = header.getNamespaceURI();
+ if (namespaceURI != null)
+ {
+ xmlName = new QName(namespaceURI, partName);
+ xmlName = destWsdl.registerQName(xmlName);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ // cache the element name for processing of the bindings
+ String key = srcMessage.getQName() + "->" + srcPart.getName();
+ messagePartToElementMap.put(key, xmlName);
+
+ return xmlName;
+ }
+
+ private void processBinding(Definition srcWsdl, Binding srcBinding)
+ {
+ QName srcBindingQName = srcBinding.getQName();
+ log.trace("processBinding: " + srcBindingQName);
+
+ NCName ncName = new NCName(srcBindingQName);
+ if (destWsdl.getBinding(ncName) == null)
+ {
+ PortType srcPortType = srcBinding.getPortType();
+ if (srcPortType == null)
+ throw new WSException("Cannot find port type for binding: " +
ncName);
+
+ processPortType(srcWsdl, srcPortType);
+
+ WSDLBinding destBinding = new WSDLBinding(destWsdl);
+ destBinding.setQName(srcBindingQName);
+ destBinding.setName(ncName);
+ destBinding.setInterfaceName(srcPortType.getQName());
+
+ String bindingStyle = Style.getDefaultStyle().toString();
+ List<ExtensibilityElement> extList =
srcBinding.getExtensibilityElements();
+ for (ExtensibilityElement extElement : extList)
+ {
+ QName elementType = extElement.getElementType();
+ if (extElement instanceof SOAPBinding)
+ {
+ destBinding.setType(Constants.NS_SOAP11);
+ SOAPBinding soapBinding = (SOAPBinding)extElement;
+ bindingStyle = soapBinding.getStyle();
+ }
+ else if (SOAP12_BINDING.equals(elementType))
+ {
+ destBinding.setType(Constants.NS_SOAP12);
+ Element domElement =
((UnknownExtensibilityElement)extElement).getElement();
+ bindingStyle = getOptionalAttribute(domElement, "style");
+ }
+ }
+ destWsdl.addBinding(destBinding);
+ processBindingOperations(destBinding, srcBinding, bindingStyle);
+ }
+ }
+
+ private Map getAllDefinedBindings(Definition srcWsdl)
+ {
+ Map<QName, Binding> retMap = new LinkedHashMap<QName, Binding>();
+ Map srcBindings = srcWsdl.getBindings();
+ Iterator itBinding = srcBindings.values().iterator();
+ while (itBinding.hasNext())
+ {
+ Binding srcBinding = (Binding)itBinding.next();
+ retMap.put(srcBinding.getQName(), srcBinding);
+ }
+
+ // Bindings not available when pulled in through <wsdl:import>
+ //
http://sourceforge.net/tracker/index.php?func=detail&aid=1240323&...
+ Iterator itService = srcWsdl.getServices().values().iterator();
+ while (itService.hasNext())
+ {
+ Service srcService = (Service)itService.next();
+ Iterator itPort = srcService.getPorts().values().iterator();
+ while (itPort.hasNext())
+ {
+ Port srcPort = (Port)itPort.next();
+ Binding srcBinding = srcPort.getBinding();
+ retMap.put(srcBinding.getQName(), srcBinding);
+ }
+ }
+ return retMap;
+ }
+
+ private void processBindingOperations(WSDLBinding destBinding, Binding srcBinding,
String bindingStyle)
+ {
+ Iterator it = srcBinding.getBindingOperations().iterator();
+ while (it.hasNext())
+ {
+ BindingOperation srcBindingOperation = (BindingOperation)it.next();
+ processBindingOperation(destBinding, bindingStyle, srcBindingOperation);
+ }
+ }
+
+ private void processBindingOperation(WSDLBinding destBinding, String bindingStyle,
BindingOperation srcBindingOperation)
+ {
+ String srcBindingName = srcBindingOperation.getName();
+ log.trace("processBindingOperation: " + srcBindingName);
+
+ WSDLInterface destInterface = destBinding.getInterface();
+ String namespaceURI = destInterface.getQName().getNamespaceURI();
+
+ WSDLBindingOperation destBindingOperation = new WSDLBindingOperation(destBinding);
+ QName refQName = new QName(namespaceURI, srcBindingName);
+ destBindingOperation.setRef(refQName);
+ destBinding.addOperation(destBindingOperation);
+
+ String opName = srcBindingName;
+ WSDLInterfaceOperation destIntfOperation = destInterface.getOperation(new
NCName(opName));
+
+ // Process soap:operation@soapAction, soap:operation@style
+ String operationStyle = null;
+ List<ExtensibilityElement> extList =
srcBindingOperation.getExtensibilityElements();
+ for (ExtensibilityElement extElement : extList)
+ {
+ QName elementType = extElement.getElementType();
+ if (extElement instanceof SOAPOperation)
+ {
+ SOAPOperation soapOp = (SOAPOperation)extElement;
+ destBindingOperation.setSOAPAction(soapOp.getSoapActionURI());
+ operationStyle = soapOp.getStyle();
+ }
+ else if (SOAP12_OPERATION.equals(elementType))
+ {
+ Element domElement = ((UnknownExtensibilityElement)extElement).getElement();
+ operationStyle = getOptionalAttribute(domElement, "style");
+ destBindingOperation.setSOAPAction(getOptionalAttribute(domElement,
"soapAction"));
+ }
+ }
+ destIntfOperation.setStyle(operationStyle != null ? operationStyle :
bindingStyle);
+
+ BindingInput srcBindingInput = srcBindingOperation.getBindingInput();
+ if (srcBindingInput != null)
+ {
+ processBindingInput(destBindingOperation, destIntfOperation, srcBindingInput);
+ }
+
+ BindingOutput srcBindingOutput = srcBindingOperation.getBindingOutput();
+ if (srcBindingOutput != null)
+ {
+ processBindingOutput(destBindingOperation, destIntfOperation,
srcBindingOutput);
+ }
+ }
+
+ private void processBindingInput(WSDLBindingOperation destBindingOperation,
WSDLInterfaceOperation destIntfOperation, BindingInput srcBindingInput)
+ {
+ log.trace("processBindingInput");
+
+ QName soap11Body = new QName(Constants.NS_SOAP11, "body");
+ List<ExtensibilityElement> extList =
srcBindingInput.getExtensibilityElements();
+ for (ExtensibilityElement extElement : extList)
+ {
+ QName elementType = extElement.getElementType();
+ if (soap11Body.equals(elementType) || SOAP12_BODY.equals(elementType))
+ {
+ processEncodingStyle(extElement, destBindingOperation);
+ }
+ else if (extElement instanceof SOAPHeader)
+ {
+ SOAPHeader header = (SOAPHeader)extElement;
+ QName messageQName = header.getMessage();
+ String partName = header.getPart();
+
+ // get cached element name for processing of the bindings
+ String key = messageQName + "->" + partName;
+ QName elementName = (QName)messagePartToElementMap.get(key);
+ if (elementName != null)
+ {
+ WSDLInterfaceOperationInput destIntfInput =
destIntfOperation.getInput(elementName);
+ if (destIntfInput == null)
+ throw new WSException("Cannot find interface input for element:
" + elementName);
+
+ WSDLProperty wsdlProperty = new
WSDLProperty(Constants.WSDL_PROPERTY_APPLICATION_DATA, false, null, null);
+ destIntfInput.addProperty(wsdlProperty);
+ }
+ }
+ else if (extElement instanceof MIMEMultipartRelated)
+ {
+ MIMEMultipartRelated related = (MIMEMultipartRelated)extElement;
+ Iterator i = related.getMIMEParts().iterator();
+ while (i.hasNext())
+ {
+ MIMEPart part = (MIMEPart)i.next();
+ Iterator j = part.getExtensibilityElements().iterator();
+ String name = null;
+ String types = null;
+
+ while (j.hasNext())
+ {
+ ExtensibilityElement inner = (ExtensibilityElement)j.next();
+ if (inner instanceof MIMEContent)
+ {
+ MIMEContent content = (MIMEContent)inner;
+ name = content.getPart();
+ if (types == null)
+ {
+ types = content.getType();
+ }
+ else
+ {
+ types += "," + content.getType();
+ }
+ }
+ }
+
+ // Found content types in this part
+ if (name != null)
+ {
+ // A mime part must be defined as <part type="">
+ QName elementName = new QName(name);
+ WSDLInterfaceOperationInput destIntfInput =
destIntfOperation.getInput(elementName);
+ if (destIntfInput == null)
+ throw new WSException("Cannot find interface input for element:
" + elementName);
+
+ WSDLProperty wsdlProperty = new
WSDLProperty(Constants.WSDL_PROPERTY_WSDL11_MIME_TYPE, false, types, null);
+ destIntfInput.addProperty(wsdlProperty);
+ }
+ }
+ }
+ }
+ }
+
+ private void processBindingOutput(WSDLBindingOperation destBindingOperation,
WSDLInterfaceOperation destIntfOperation, BindingOutput srcBindingOutput)
+ {
+ log.trace("processBindingOutput");
+
+ List<ExtensibilityElement> extList =
srcBindingOutput.getExtensibilityElements();
+ for (ExtensibilityElement extElement : extList)
+ {
+ QName elementType = extElement.getElementType();
+ if (extElement instanceof SOAPBody || SOAP12_BODY.equals(elementType))
+ {
+ processEncodingStyle(extElement, destBindingOperation);
+ }
+ else if (extElement instanceof SOAPHeader)
+ {
+ SOAPHeader header = (SOAPHeader)extElement;
+ QName messageQName = header.getMessage();
+ String partName = header.getPart();
+
+ // get cached element name for processing of the bindings
+ String key = messageQName + "->" + partName;
+ QName elementName = (QName)messagePartToElementMap.get(key);
+ if (elementName != null)
+ {
+ WSDLInterfaceOperationOutput destIntfOutput =
destIntfOperation.getOutput(elementName);
+ if (destIntfOutput == null)
+ throw new WSException("Cannot find interface output for element:
" + elementName);
+
+ WSDLProperty wsdlProperty = new
WSDLProperty(Constants.WSDL_PROPERTY_APPLICATION_DATA, false, null, null);
+ destIntfOutput.addProperty(wsdlProperty);
+ }
+ }
+ else if (extElement instanceof MIMEMultipartRelated)
+ {
+ MIMEMultipartRelated related = (MIMEMultipartRelated)extElement;
+ Iterator i = related.getMIMEParts().iterator();
+ while (i.hasNext())
+ {
+ MIMEPart part = (MIMEPart)i.next();
+ Iterator j = part.getExtensibilityElements().iterator();
+ String name = null;
+ String types = null;
+
+ while (j.hasNext())
+ {
+ ExtensibilityElement inner = (ExtensibilityElement)j.next();
+ if (inner instanceof MIMEContent)
+ {
+ MIMEContent content = (MIMEContent)inner;
+ name = content.getPart();
+ if (types == null)
+ {
+ types = content.getType();
+ }
+ else
+ {
+ types += "," + content.getType();
+ }
+ }
+ }
+
+ // Found content types in this part
+ if (name != null)
+ {
+ // A mime part must be defined as <part type="">
+ QName elementName = new QName(name);
+ WSDLInterfaceOperationOutput destIntfOutput =
destIntfOperation.getOutput(elementName);
+ if (destIntfOutput == null)
+ throw new WSException("Cannot find interface output for
element: " + elementName);
+
+ WSDLProperty wsdlProperty = new
WSDLProperty(Constants.WSDL_PROPERTY_WSDL11_MIME_TYPE, false, types, null);
+ destIntfOutput.addProperty(wsdlProperty);
+ }
+ }
+ }
+ }
+ }
+
+ private void processEncodingStyle(ExtensibilityElement extElement,
WSDLBindingOperation destBindingOperation)
+ {
+ log.trace("processEncodingStyle");
+
+ String encStyle = null;
+ QName elementType = extElement.getElementType();
+ if (extElement instanceof SOAPBody)
+ {
+ SOAPBody body = (SOAPBody)extElement;
+ List encStyleList = body.getEncodingStyles();
+ if (encStyleList != null)
+ {
+ if (encStyleList.size() > 1)
+ log.warn("Multiple encoding styles not supported: " +
encStyleList);
+
+ if (encStyleList.size() > 0)
+ {
+ encStyle = (String)encStyleList.get(0);
+ }
+ }
+ }
+ else if (SOAP12_BODY.equals(elementType))
+ {
+ Element domElement = ((UnknownExtensibilityElement)extElement).getElement();
+ encStyle = getOptionalAttribute(domElement, "encodingStyle");
+ }
+
+ if (encStyle != null)
+ {
+ String setStyle = destBindingOperation.getEncodingStyle();
+ if (encStyle.equals(setStyle) == false)
+ log.warn("Encoding style '" + encStyle + "' not
supported for: " + destBindingOperation.getRef());
+
+ destBindingOperation.setEncodingStyle(encStyle);
+ }
+ }
+
+ private void processServices(Definition srcWsdl)
+ {
+ log.trace("BEGIN processServices: " + srcWsdl.getDocumentBaseURI());
+
+ if (srcWsdl.getServices().size() > 0)
+ {
+ Iterator it = srcWsdl.getServices().values().iterator();
+ while (it.hasNext())
+ {
+ Service srcService = (Service)it.next();
+ QName qname = srcService.getQName();
+ WSDLService destService = new WSDLService(destWsdl);
+ destService.setName(new NCName(qname));
+ destService.setQName(qname);
+ destWsdl.addService(destService);
+ processPorts(srcWsdl, destService, srcService);
+ }
+ }
+ else
+ {
+ log.trace("Empty wsdl services, processing imports");
+ Iterator it = srcWsdl.getImports().values().iterator();
+ while (it.hasNext())
+ {
+ List<Import> srcImports = (List<Import>)it.next();
+ for (Import srcImport : srcImports)
+ {
+ Definition importDefinition = srcImport.getDefinition();
+ processServices(importDefinition);
+ }
+ }
+ }
+
+ log.trace("END processServices: " + srcWsdl.getDocumentBaseURI());
+ }
+
+ private void processPorts(Definition srcWsdl, WSDLService destService, Service
srcService)
+ {
+ Iterator it = srcService.getPorts().values().iterator();
+ while (it.hasNext())
+ {
+ Port srcPort = (Port)it.next();
+ processPort(srcWsdl, destService, srcPort);
+ }
+ }
+
+ private void processPort(Definition srcWsdl, WSDLService destService, Port srcPort)
+ {
+ log.trace("processPort: " + srcPort.getName());
+
+ Binding srcBinding = srcPort.getBinding();
+
+ WSDLEndpoint destEndpoint = new WSDLEndpoint(destService);
+ destEndpoint.setName(new NCName(srcPort.getName()));
+ destEndpoint.setBinding(srcBinding.getQName());
+ destEndpoint.setQName(new QName(srcWsdl.getTargetNamespace(), srcPort.getName()));
+ destEndpoint.setAddress(getSOAPAddress(srcPort));
+ destService.addEndpoint(destEndpoint);
+
+ processBinding(srcWsdl, srcBinding);
+ }
+
+ /** Get the endpoint address from the ports extensible element
+ */
+ private String getSOAPAddress(Port srcPort)
+ {
+ String soapAddress = "dummy";
+
+ Iterator it = srcPort.getExtensibilityElements().iterator();
+ while (it.hasNext())
+ {
+ ExtensibilityElement extElement = (ExtensibilityElement)it.next();
+ QName elementType = extElement.getElementType();
+
+ if (extElement instanceof SOAPAddress)
+ {
+ SOAPAddress addr = (SOAPAddress)extElement;
+ soapAddress = addr.getLocationURI();
+ break;
+ }
+ else if (SOAP12_ADDRESS.equals(elementType))
+ {
+ Element domElement = ((UnknownExtensibilityElement)extElement).getElement();
+ soapAddress = getOptionalAttribute(domElement, "location");
+ break;
+ }
+ else if ("address".equals(elementType.getLocalPart()))
+ {
+ log.warn("Unprocessed extension element: " + elementType);
+ }
+ }
+
+ if (soapAddress == null)
+ throw new WSException("Cannot obtain SOAP address");
+
+ return soapAddress;
+ }
+
+ private String getOptionalAttribute(Element domElement, String attrName)
+ {
+ String attrValue = domElement.getAttribute(attrName);
+ return (attrValue.length() > 0 ? attrValue : null);
+ }
+}
Copied:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/tools/wsdl/WSDL11Writer.java
(from rev 1603,
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/wsdl/WSDL11Writer.java)
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/wsdl/WSDL11Writer.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/tools/wsdl/WSDL11Writer.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -0,0 +1,571 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+package org.jboss.ws.tools.wsdl;
+
+import java.io.IOException;
+import java.io.Writer;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.wsdl.Definition;
+import javax.wsdl.WSDLException;
+import javax.wsdl.factory.WSDLFactory;
+import javax.xml.namespace.QName;
+
+import org.jboss.ws.core.utils.DOMUtils;
+import org.jboss.ws.core.utils.DOMWriter;
+import org.jboss.ws.metadata.wsdl.NCName;
+import org.jboss.ws.metadata.wsdl.WSDLBinding;
+import org.jboss.ws.metadata.wsdl.WSDLBindingOperation;
+import org.jboss.ws.metadata.wsdl.WSDLBindingOperationInput;
+import org.jboss.ws.metadata.wsdl.WSDLBindingOperationOutput;
+import org.jboss.ws.metadata.wsdl.WSDLDefinitions;
+import org.jboss.ws.metadata.wsdl.WSDLEndpoint;
+import org.jboss.ws.metadata.wsdl.WSDLInterface;
+import org.jboss.ws.metadata.wsdl.WSDLInterfaceOperation;
+import org.jboss.ws.metadata.wsdl.WSDLInterfaceOperationInput;
+import org.jboss.ws.metadata.wsdl.WSDLInterfaceOperationOutfault;
+import org.jboss.ws.metadata.wsdl.WSDLInterfaceOperationOutput;
+import org.jboss.ws.metadata.wsdl.WSDLService;
+import org.jboss.ws.Constants;
+import org.jboss.ws.WSException;
+import org.w3c.dom.Element;
+
+/**
+ * A WSDL Writer that writes a WSDL 1.1 file. It works off
+ * of the WSDL20 Object Graph.
+ * @author <mailto:Anil.Saldhana@jboss.org>Anil Saldhana
+ */
+public class WSDL11Writer extends WSDLWriter
+{
+ //Used Internally
+ private String wsdlStyle = Constants.RPC_LITERAL;
+
+ // Used to prevent duplicates
+ private HashSet<String> writtenFaultMessages = new HashSet<String>();
+
+ /** Use WSDLDefinitions.writeWSDL instead. */
+ public WSDL11Writer(WSDLDefinitions wsdl)
+ {
+ super(wsdl);
+ }
+
+ public void write(Writer writer) throws IOException
+ {
+ write(writer, null);
+ }
+
+ public void write(Writer writer, String charset) throws IOException
+ {
+ // Write out the wsdl-1.1 represention (only path to obtain is from WSDL11Reader)
+ if (wsdl.getWsdlOneOneDefinition() != null)
+ {
+ Definition wsdlDefinition = wsdl.getWsdlOneOneDefinition();
+ try
+ {
+ WSDLFactory wsdlFactory = WSDLFactory.newInstance();
+ javax.wsdl.xml.WSDLWriter wsdlWriter = wsdlFactory.newWSDLWriter();
+ wsdlWriter.writeWSDL(wsdlDefinition, writer);
+ }
+ catch (WSDLException e)
+ {
+ this.logException(e);
+ throw new IOException(e.toString());
+ }
+ }
+ else
+ {
+ StringBuilder buffer = new StringBuilder();
+
+ //Detect the WSDL Style early
+ wsdlStyle = utils.getWSDLStyle(wsdl);
+
+ writtenFaultMessages.clear();
+
+ appendDefinitions(buffer);
+ appendTypes(buffer);
+ appendMessages(buffer);
+ appendPortTypes(buffer);
+ appendBindings(buffer);
+ appendServices(buffer);
+
+ buffer.append("</definitions>");
+ Element element = DOMUtils.parse(buffer.toString());
+
+ if (charset != null)
+ writer.write("<?xml version=\"1.0\" encoding=\""
+ charset + "\"?>\n");
+ new DOMWriter(writer).setPrettyprint(true).print(element);
+ }
+ }
+
+ protected void appendMessages(StringBuilder buffer)
+ {
+ WSDLInterface[] interfaces = wsdl.getInterfaces();
+ int len = interfaces != null ? interfaces.length : 0;
+ for (int i = 0; i < len; i++)
+ {
+ WSDLInterface intf = interfaces[i];
+ WSDLInterfaceOperation[] operations = intf.getSortedOperations();
+ int lenOps = operations.length;
+ for (int j = 0; j < lenOps; j++)
+ {
+ appendMessage(buffer, operations[j]);
+ appendMessagesForExceptions(buffer, operations[j]);
+ }//end for
+ }//end for
+ }
+
+ private void appendMessage(StringBuilder buffer, WSDLInterfaceOperation operation)
+ {
+ String opname = operation.getName().toString();
+ //Determine the style of the wsdl
+ if (Constants.URI_STYLE_RPC.equals(operation.getStyle()) == false)
+ wsdlStyle = Constants.DOCUMENT_LITERAL; //Not RPC/Literal
+
+ String interfaceName = operation.getWsdlInterface().getName().toString();
+ buffer.append("<message name='" + interfaceName + "_" +
opname + "' >");
+ WSDLInterfaceOperationInput[] inputs = operation.getInputs();
+ int lenin = inputs.length;
+ for (int i = 0; i < lenin; i++)
+ {
+ WSDLInterfaceOperationInput input = inputs[i];
+ appendInputParts(buffer, input, i);
+ }
+
+ buffer.append("</message>");
+
+ //Now the return type
+ WSDLInterfaceOperationOutput[] outputs = operation.getOutputs();
+ int lenout = outputs != null ? outputs.length : 0;
+
+ if (Constants.WSDL20_PATTERN_IN_ONLY.equals(operation.getPattern()))
+ return;
+
+ buffer.append("<message name='" + interfaceName + "_" +
opname + "Response' >");
+ if (lenout > 0)
+ {
+ //Since the outputs have been obtained from a linkedhashmap
+ //they will be in the order of insertion i.e. in case of
+ //holders, the holder types will be inserted first. So let
+ //us iterate in the reverse order
+ String str = "";
+ for (int i = 0; i < lenout; i++)
+ {
+ WSDLInterfaceOperationOutput out = outputs[i];
+ str += appendOutputParts(out, i);
+ }
+ buffer.append(str);
+ }//end if
+ buffer.append("</message>");
+ }
+
+ private void appendMessagesForExceptions(StringBuilder buffer, WSDLInterfaceOperation
operation)
+ {
+ //Get the outfaults
+ WSDLInterfaceOperationOutfault[] faults = operation.getOutfaults();
+ int len = faults != null ? faults.length : 0;
+
+ for (int i = 0; i < len; i++)
+ {
+ WSDLInterfaceOperationOutfault fault = faults[i];
+ QName xmlName = fault.getRef();
+ String exceptionName = xmlName.getLocalPart();
+ if (writtenFaultMessages.contains(exceptionName))
+ continue;
+
+ buffer.append("<message name='" + exceptionName + "'
>");
+ String prefix = wsdl.getPrefix(xmlName.getNamespaceURI());
+ String xmlNameStr = prefix + ":" + xmlName.getLocalPart();
+ buffer.append("<part name='" + exceptionName + "'
element='" + xmlNameStr + "' />");
+ buffer.append("</message>");
+
+ writtenFaultMessages.add(exceptionName);
+ }
+ }
+
+ private void appendInputParts(StringBuilder buffer, WSDLInterfaceOperationInput input,
int index)
+ {
+ boolean header = input.getProperty(Constants.WSDL_PROPERTY_APPLICATION_DATA) !=
null;
+ if (wsdlStyle.equals(Constants.RPC_LITERAL) && !header)
+ {
+ QName el = input.getElement();
+ QName xmlType = input.getXMLType();
+ String prefix = wsdl.getPrefix(xmlType.getNamespaceURI() );
+ buffer.append("<part name='" + el.getLocalPart() +
"'");
+ buffer.append(" type='" + prefix + ":" +
xmlType.getLocalPart() + "'>");
+ buffer.append("</part>");
+ }
+ //Doc-literal case
+ else
+ {
+ //TODO:Handle this better later
+ //In the case of doc/lit, the input element will give the partname
+ QName elm = input.getElement();
+ buffer.append("<part name='").append(header ?
elm.getLocalPart() : "parameters").append("'");
+ String part = wsdl.getPrefix(elm.getNamespaceURI()) + ":" +
elm.getLocalPart();
+ buffer.append(" element='" + part + "'>");
+ buffer.append("</part>");
+ }
+ }
+
+ private String appendOutputParts(WSDLInterfaceOperationOutput out, int index)
+ {
+ boolean header = out.getProperty(Constants.WSDL_PROPERTY_APPLICATION_DATA) !=
null;
+ StringBuilder buf = new StringBuilder("");
+ if (wsdlStyle.equals(Constants.RPC_LITERAL) && !header)
+ {
+ //Get the XMLName
+ QName xmlName = out.getElement();
+ QName xmlType = out.getXMLType();
+ String prefix = wsdl.getPrefix(xmlType.getNamespaceURI() );
+
+ buf.append("<part name='" + xmlName.getLocalPart() +
"'");
+ buf.append(" type='" + prefix + ":" +
xmlType.getLocalPart() + "'>");
+ buf.append("</part>");
+ }
+ else
+ {
+ QName elm = out.getElement();
+ buf.append("<part name='").append(header ? elm.getLocalPart() :
Constants.DEFAULT_RPC_RETURN_NAME).append("'");
+ String value = wsdl.getPrefix(elm.getNamespaceURI()) + ":" +
elm.getLocalPart();
+ //String value = this.getXMLTypeFromWSDLProperty(out);
+ buf.append(" element='" + value + "'>");
+ buf.append("</part>");
+ }
+ return buf.toString();
+ }
+
+ protected void appendInterfaces(StringBuilder buffer)
+ {
+ }
+
+ protected void appendPortTypes(StringBuilder buffer)
+ {
+ WSDLInterface[] intfs = wsdl.getInterfaces();
+ for (int i = 0; i < intfs.length; i++)
+ {
+ WSDLInterface intf = intfs[i];
+ if (i == 0)
+ buffer.append("<portType name='" + intf.getName() +
"'>");
+ appendPortOperations(buffer, intf);
+ }
+ buffer.append("</portType>");
+ }
+
+ protected void appendPortOperations(StringBuilder buffer, WSDLInterface intf)
+ {
+ String targetPrefix = wsdl.getTargetPrefix();
+ WSDLInterfaceOperation[] operations = intf.getSortedOperations();
+ for (int i = 0; i < operations.length; i++)
+ {
+ WSDLInterfaceOperation operation = operations[i];
+ WSDLInterfaceOperationInput[] inputs = operation.getInputs();
+ WSDLInterfaceOperationOutput[] outputs = operation.getOutputs();
+ buffer.append("<operation name='" +
operation.getName().toString() + "'");
+
+ if (wsdlStyle.equals(Constants.RPC_LITERAL))
+ {
+ StringBuilder order = new StringBuilder();
+ Set<QName> inParameters = new HashSet<QName>();
+ for (int j = 0; j < inputs.length; j++)
+ {
+ WSDLInterfaceOperationInput input = inputs[j];
+ if (order.length() > 0)
+ order.append(" ");
+ QName el = input.getElement();
+ order.append(el.getLocalPart());
+ inParameters.add(el);
+ }
+
+ for (int j = 0; j < outputs.length; j++)
+ {
+ WSDLInterfaceOperationOutput output = outputs[j];
+ // The return value is ommitted as a hint to other parameter based binding
layers.
+ // Also, INOUT parameters need to only appear once
+ if (output.getProperty(Constants.WSDL_PROPERTY_RETURN_PART) == null)
+ {
+ QName el = output.getElement();
+ if (! inParameters.contains(el))
+ {
+ if (order.length() > 0)
+ order.append(" ");
+ order.append(el.getLocalPart());
+ }
+ }
+ }
+
+ if (order.length() > 0)
+ buffer.append("
parameterOrder='").append(order.toString()).append("'");
+ }
+
+ buffer.append(">"); //End operation element
+
+ String opname = operation.getName().toString();
+ String interfaceName = operation.getWsdlInterface().getName().toString();
+ String msgEl = targetPrefix + ":" + interfaceName + "_" +
opname;
+
+ buffer.append("<input message='" + msgEl +
"'>").append("</input>");
+
+ if (! Constants.WSDL20_PATTERN_IN_ONLY.equals(operation.getPattern()))
+ {
+ buffer.append("<output message='" + msgEl +
"Response'>");
+ buffer.append("</output>");
+ }
+
+ //Append the Faults
+ WSDLInterfaceOperationOutfault[] faults = operation.getOutfaults();
+ //WSDLInterfaceFault[] faults = intf.getFaults();
+ int lenf = faults != null ? faults.length : 0;
+ for (int k = 0; k < lenf; k++)
+ {
+ //WSDLInterfaceFault flt = faults[k];
+ WSDLInterfaceOperationOutfault flt = faults[k];
+ QName elt = flt.getRef();
+
+ String targetNS = wsdl.getTargetNamespace();
+ //Writing the fault, the prefix should always be the one for wsdl target
namespace
+ elt = new QName(targetNS, elt.getLocalPart(), wsdl.getPrefix(targetNS));
+ //Remove Fault or Error appended to the name
+ String cleanname = utils.chop(utils.chop(elt.getLocalPart(),
"Error"), "Fault");
+
+ String n = "name='" + cleanname + "'";
+
+ String cleanref = utils.chop(utils.getFormattedString(elt),
"Error");
+ buffer.append("<fault message='" + cleanref + "'
" + n + ">");
+ buffer.append("</fault>");
+ }
+
+ buffer.append("</operation>");
+ }
+ }
+
+ protected void appendBindings(StringBuilder buffer)
+ {
+ WSDLBinding[] bindings = wsdl.getBindings();
+ for (int i = 0; i < bindings.length; i++)
+ {
+ WSDLBinding binding = bindings[i];
+ buffer.append("<binding name='" + binding.getName() +
"' type='" + getQNameRef(binding.getInterfaceName()) +
"'>");
+ //TODO:Need to derive the WSDLStyle from the Style attribute of
InterfaceOperation
+ if (wsdlStyle == null)
+ throw new IllegalArgumentException("WSDL Style is null (should be rpc or
document");
+ String style = "rpc";
+ if (wsdlStyle.equals(Constants.DOCUMENT_LITERAL))
+ style = "document";
+ buffer.append("<" + soapPrefix + ":binding
transport='http://schemas.xmlsoap.org/soap/http' style='" + style +
"'/>");
+ appendBindingOperations(buffer, binding);
+ buffer.append("</binding>");
+ }
+ }
+
+ private boolean isHeaderInput(WSDLBindingOperationInput input)
+ {
+ WSDLBindingOperation operation = input.getWsdlBindingOperation();
+ WSDLBinding binding = operation.getWsdlBinding();
+ WSDLInterface wsdlInterface = binding.getInterface();
+ if (wsdlInterface == null)
+ return false;
+
+ WSDLInterfaceOperation interfaceOperation = wsdlInterface.getOperation(new
NCName(operation.getRef().getLocalPart()));
+ if (interfaceOperation == null)
+ return false;
+
+ WSDLInterfaceOperationInput interfaceInput =
interfaceOperation.getInputByPartName(input.getMessageLabel().toString());
+ if (interfaceInput == null)
+ return false;
+
+ if (interfaceInput.getProperty(Constants.WSDL_PROPERTY_APPLICATION_DATA) == null)
+ return false;
+ else
+ return true;
+ }
+
+ private boolean isHeaderOutput(WSDLBindingOperationOutput output)
+ {
+ WSDLBindingOperation operation = output.getWsdlBindingOperation();
+ WSDLBinding binding = operation.getWsdlBinding();
+ WSDLInterface wsdlInterface = binding.getInterface();
+ if (wsdlInterface == null)
+ return false;
+
+ WSDLInterfaceOperation interfaceOperation = wsdlInterface.getOperation(new
NCName(operation.getRef().getLocalPart()));
+ if (interfaceOperation == null)
+ return false;
+
+ WSDLInterfaceOperationOutput interfaceOutput =
interfaceOperation.getOutputByPartName(output.getMessageLabel().toString());
+ if (interfaceOutput == null)
+ return false;
+
+ if (interfaceOutput.getProperty(Constants.WSDL_PROPERTY_APPLICATION_DATA) == null)
+ return false;
+ else
+ return true;
+ }
+
+ protected void appendBindingOperations(StringBuilder buffer, WSDLBinding binding)
+ {
+ WSDLBindingOperation[] operations = binding.getOperations();
+ Arrays.sort(operations);
+
+ String tns = wsdl.getTargetNamespace();
+ for (int i = 0; i < operations.length; i++)
+ {
+ WSDLBindingOperation operation = operations[i];
+ String interfaceName =
operation.getWsdlBinding().getInterfaceName().getLocalPart();
+
+ buffer.append("<operation name='" +
operation.getRef().getLocalPart() + "'>");
+ String soapAction = (operation.getSOAPAction() != null ?
operation.getSOAPAction() : "");
+ buffer.append("<" + soapPrefix + ":operation
soapAction=\"" + soapAction + "\"/>");
+ buffer.append("<input>");
+
+ StringBuilder bodyParts = new StringBuilder();
+ boolean hasHeader = false;
+ WSDLBindingOperationInput[] inputs = operation.getInputs();
+ for (int j = 0; j < inputs.length; j++)
+ {
+ WSDLBindingOperationInput input = inputs[j];
+ if (isHeaderInput(input))
+ {
+ String messageName = interfaceName + "_" +
input.getWsdlBindingOperation().getRef().getLocalPart();
+ buffer.append("<" + soapPrefix + ":header
use='literal' message='tns:" + messageName + "' part='"
+ input.getMessageLabel() + "'/>");
+ hasHeader = true;
+ }
+ else
+ {
+ if (bodyParts.length() > 0)
+ bodyParts.append(" ");
+ bodyParts.append(input.getMessageLabel());
+ }
+ }
+
+ buffer.append("<" + soapPrefix + ":body
use='literal'");
+ if (hasHeader)
+ buffer.append("
parts='").append(bodyParts.toString()).append("'");
+ if (wsdlStyle != Constants.DOCUMENT_LITERAL)
+ buffer.append(" namespace='" + tns + "'");
+ buffer.append("/>");
+
+ buffer.append("</input>");
+
+ if (!
Constants.WSDL20_PATTERN_IN_ONLY.equals(getBindingOperationPattern(operation)))
+ {
+ buffer.append("<output>");
+ bodyParts = new StringBuilder();
+ hasHeader = false;
+ WSDLBindingOperationOutput[] outputs = operation.getOutputs();
+ for (int j = 0; j < outputs.length; j++)
+ {
+ WSDLBindingOperationOutput output = outputs[j];
+ if (isHeaderOutput(output))
+ {
+ String messageName = interfaceName + "_" +
output.getWsdlBindingOperation().getRef().getLocalPart() + "Response";
+
+ buffer.append("<" + soapPrefix + ":header
use='literal' message='tns:" + messageName + "' part='"
+ output.getMessageLabel() + "'/>");
+ hasHeader = true;
+ }
+ else
+ {
+ if (bodyParts.length() > 0)
+ bodyParts.append(" ");
+ bodyParts.append(output.getMessageLabel());
+ }
+ }
+
+ buffer.append("<" + soapPrefix + ":body
use='literal'");
+ if (hasHeader)
+ buffer.append("
parts='").append(bodyParts.toString()).append("'");
+ if (wsdlStyle != Constants.DOCUMENT_LITERAL)
+ buffer.append(" namespace='" + tns + "'");
+ buffer.append("/>");
+
+ buffer.append("</output>");
+ }
+
+ //Append faults
+ QName intfname = operation.getWsdlBinding().getInterfaceName();
+ WSDLInterface intf = wsdl.getInterface(new NCName(intfname.getLocalPart()));
+ if (intf == null)
+ throw new WSException("WSDL Interface should not be null");
+ WSDLInterfaceOperation interfaceOperation = intf.getOperation(new
NCName(operation.getRef().getLocalPart()));
+ WSDLInterfaceOperationOutfault[] faults = interfaceOperation.getOutfaults();
+ int lenf = faults != null ? faults.length : 0;
+ for (int k = 0; k < lenf; k++)
+ {
+ WSDLInterfaceOperationOutfault flt = faults[k];
+ //Remove Fault or Error appended to the name
+ String cleanname = utils.chop(utils.chop(flt.getRef().getLocalPart(),
"Error"), "Fault");
+ String n = "name='" + cleanname + "'";
+
+ //String cleanref = utils.chop(utils.getFormattedString(elt),
"Error");
+ buffer.append("<fault " + n + ">");
+ buffer.append("<" + soapPrefix + ":fault " + n +
" use='literal' />");
+ buffer.append("</fault>");
+ }
+
+ buffer.append("</operation>");
+ }
+ }
+
+ private String getBindingOperationPattern(WSDLBindingOperation operation)
+ {
+ WSDLBinding binding = operation.getWsdlBinding();
+ String pattern = binding.getInterface().getOperation(new
NCName(operation.getRef().getLocalPart())).getPattern();
+
+ return pattern;
+ }
+
+ protected void appendServices(StringBuilder buffer)
+ {
+ WSDLService[] services = wsdl.getServices();
+ int len = services.length;
+ for (int i = 0; i < len; i++)
+ {
+
+ WSDLService service = services[i];
+ buffer.append("<service name='" + service.getName() +
"'>");
+ WSDLEndpoint[] endpoints = service.getEndpoints();
+ int lenend = endpoints.length;
+ for (int j = 0; j < lenend; j++)
+ {
+ WSDLEndpoint endpoint = endpoints[j];
+ appendServicePort(buffer, endpoint);
+ }
+
+ buffer.append("</service>");
+ }
+ }
+
+ protected void appendServicePort(StringBuilder buffer, WSDLEndpoint endpoint)
+ {
+ String name = endpoint.getName().toString();
+ QName endpointBinding = endpoint.getBinding();
+ String prefix = endpointBinding.getPrefix();
+ if (prefix == null || prefix == "")
+ prefix = wsdl.getTargetPrefix();
+ String ebname = prefix + ":" + endpointBinding.getLocalPart();
+ buffer.append("<port name='" + name + "'
binding='" + ebname + "'>");
+ buffer.append("<" + soapPrefix + ":address location='" +
endpoint.getAddress() + "'/>");
+ buffer.append("</port>");
+ }
+
+}
Copied:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/tools/wsdl/WSDLDefinitionsFactory.java
(from rev 1603,
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/wsdl/WSDLDefinitionsFactory.java)
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/wsdl/WSDLDefinitionsFactory.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/tools/wsdl/WSDLDefinitionsFactory.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -0,0 +1,195 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+package org.jboss.ws.tools.wsdl;
+
+// $Id$
+
+import java.io.InputStream;
+import java.io.StringWriter;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import javax.wsdl.Definition;
+import javax.wsdl.factory.WSDLFactory;
+import javax.wsdl.xml.WSDLReader;
+import javax.xml.parsers.DocumentBuilder;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.core.utils.DOMUtils;
+import org.jboss.ws.core.utils.JBossWSEntityResolver;
+import org.jboss.ws.metadata.wsdl.WSDLDefinitions;
+import org.jboss.ws.metadata.wsdl.WSDLException;
+import org.jboss.ws.Constants;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.xml.sax.EntityResolver;
+
+import com.ibm.wsdl.xml.WSDLReaderImpl;
+
+/**
+ * A factory that creates a <code>WSDLDefinitions</code> object from an URL.
+ *
+ * This implementations deals with different WSDL versions so that clients of this
+ * factory do need to know about WSDL version specifics. The Java object view of the
+ * WSDL document (WSDLDefinitions) is modeled on WSDL-2.0
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 10-Oct-2004
+ */
+public class WSDLDefinitionsFactory
+{
+ // provide logging
+ private static final Logger log = Logger.getLogger(WSDLDefinitionsFactory.class);
+
+ // This feature is set by default in wsdl4j, it means the object structure contains
the imported arguments
+ public static final String FEATURE_IMPORT_DOCUMENTS =
"javax.wsdl.importDocuments";
+ // Set this feature for additional debugging output
+ public static final String FEATURE_VERBOSE = "javax.wsdl.verbose";
+
+ // The WSDL reader features
+ private Map features = new HashMap();
+
+ // Hide constructor
+ private WSDLDefinitionsFactory()
+ {
+ }
+
+ /**
+ * Create a new instance of a wsdl factory
+ */
+ public static WSDLDefinitionsFactory newInstance()
+ {
+ return new WSDLDefinitionsFactory();
+ }
+
+ /**
+ * Set a feature on the underlying reader
+ */
+ public void setFeature(String name, boolean value) throws IllegalArgumentException
+ {
+ features.put(name, new Boolean(value));
+ }
+
+ /**
+ * Read the wsdl document from the given URL
+ */
+ public WSDLDefinitions parse(URL wsdlLocation) throws WSDLException
+ {
+ if (wsdlLocation == null)
+ throw new IllegalArgumentException("URL cannot be null");
+
+ log.trace("parse: " + wsdlLocation.toExternalForm());
+
+ EntityResolver entityResolver = new JBossWSEntityResolver();
+ WSDLDefinitions wsdlDefinitions = null;
+ try
+ {
+ Document wsdlDoc = getDocument(wsdlLocation);
+ String defaultNamespace = getDefaultNamespace(wsdlDoc);
+ if (Constants.NS_WSDL11.equals(defaultNamespace))
+ {
+ WSDLFactory wsdlFactory = WSDLFactory.newInstance();
+ WSDLReader wsdlReader = wsdlFactory.newWSDLReader();
+ wsdlReader.setFeature("javax.wsdl.verbose", false);
+
+ // Setup reader features
+ Iterator it = features.entrySet().iterator();
+ while (it.hasNext())
+ {
+ Map.Entry entry = (Map.Entry)it.next();
+ String key = (String)entry.getKey();
+ Boolean flag = (Boolean)entry.getValue();
+ wsdlReader.setFeature(key, flag.booleanValue());
+ }
+
+ // Set EntityResolver in patched version of wsdl4j-1.5.2jboss
+ ((WSDLReaderImpl)wsdlReader).setEntityResolver(entityResolver);
+
+ Definition definition = wsdlReader.readWSDL(new
WSDLLocatorImpl(entityResolver, wsdlLocation));
+ wsdlDefinitions = new WSDL11Reader().processDefinition(definition,
wsdlLocation);
+ wsdlDefinitions.setWsdlDocument(wsdlDoc);
+ }
+ else
+ throw new WSDLException("Invalid default namespace: " +
defaultNamespace);
+
+ if (log.isTraceEnabled())
+ {
+ StringWriter stwr = new StringWriter();
+ WSDLWriter wsdlWriter = new WSDLWriter(wsdlDefinitions);
+ wsdlWriter.write(stwr);
+ log.trace("\n" + stwr.toString());
+ }
+ }
+ catch (WSDLException e)
+ {
+ throw e;
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (Exception e)
+ {
+ throw new WSDLException(e);
+ }
+
+ return wsdlDefinitions;
+ }
+
+ /** Get the WSDL document.
+ */
+ private Document getDocument(URL wsdlLocation) throws WSDLException
+ {
+ try
+ {
+ InputStream wsdlInputStream = wsdlLocation.openStream();
+ try
+ {
+ DocumentBuilder builder = DOMUtils.getDocumentBuilder();
+ return builder.parse(wsdlInputStream);
+ }
+ finally
+ {
+ wsdlInputStream.close();
+ }
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (Exception e)
+ {
+ throw new WSDLException(e);
+ }
+ }
+
+ /** Get the default namespace for the given WSDL
+ */
+ private String getDefaultNamespace(Document wsdlDoc) throws WSDLException
+ {
+ Element root = wsdlDoc.getDocumentElement();
+ String defaultNamespace = root.getNamespaceURI();
+ return defaultNamespace;
+ }
+}
Copied:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/tools/wsdl/WSDLLocatorImpl.java
(from rev 1603,
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/wsdl/WSDLLocatorImpl.java)
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/wsdl/WSDLLocatorImpl.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/tools/wsdl/WSDLLocatorImpl.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -0,0 +1,159 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ws.tools.wsdl;
+
+// $Id$
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import javax.wsdl.xml.WSDLLocator;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.WSException;
+import org.xml.sax.EntityResolver;
+import org.xml.sax.InputSource;
+
+/* A WSDLLocator that can handle wsdl imports
+ */
+class WSDLLocatorImpl implements WSDLLocator
+{
+ // provide logging
+ private static final Logger log = Logger.getLogger(WSDLDefinitionsFactory.class);
+
+ private EntityResolver entityResolver;
+ private URL wsdlURL;
+ private String latestImportURI;
+
+ public WSDLLocatorImpl(EntityResolver entityResolver, URL wsdlFile)
+ {
+ if (wsdlFile == null)
+ throw new IllegalArgumentException("WSDL file argument cannot be
null");
+
+ this.entityResolver = entityResolver;
+ this.wsdlURL = wsdlFile;
+ }
+
+ public InputSource getBaseInputSource()
+ {
+ log.trace("getBaseInputSource [wsdlUrl=" + wsdlURL + "]");
+ try
+ {
+ InputStream is = wsdlURL.openStream();
+ if (is == null)
+ throw new IllegalArgumentException("Cannot obtain wsdl from [" +
wsdlURL + "]");
+
+ return new InputSource(is);
+ }
+ catch (IOException e)
+ {
+ throw new RuntimeException("Cannot access wsdl from [" + wsdlURL +
"], " + e.getMessage());
+ }
+ }
+
+ public String getBaseURI()
+ {
+ return wsdlURL.toExternalForm();
+ }
+
+ public InputSource getImportInputSource(String parent, String resource)
+ {
+ log.trace("getImportInputSource [parent=" + parent +
",resource=" + resource + "]");
+
+ URL parentURL = null;
+ try
+ {
+ parentURL = new URL(parent);
+ }
+ catch (MalformedURLException e)
+ {
+ log.error("Not a valid URL: " + parent);
+ return null;
+ }
+
+ String wsdlImport = null;
+ String external = parentURL.toExternalForm();
+
+ // An external URL
+ if (resource.startsWith("http://") ||
resource.startsWith("https://"))
+ {
+ wsdlImport = resource;
+ }
+
+ // Absolute path
+ else if (resource.startsWith("/"))
+ {
+ String beforePath = external.substring(0,
external.indexOf(parentURL.getPath()));
+ wsdlImport = beforePath + resource;
+ }
+
+ // A relative path
+ else
+ {
+ String parentDir = external.substring(0, external.lastIndexOf("/"));
+
+ // remove references to current dir
+ while (resource.startsWith("./"))
+ resource = resource.substring(2);
+
+ // remove references to parentdir
+ while (resource.startsWith("../"))
+ {
+ parentDir = parentDir.substring(0, parentDir.lastIndexOf("/"));
+ resource = resource.substring(3);
+ }
+
+ wsdlImport = parentDir + "/" + resource;
+ }
+
+ try
+ {
+ log.trace("Trying to resolve: " + wsdlImport);
+ InputSource inputSource = entityResolver.resolveEntity(wsdlImport, wsdlImport);
+ if (inputSource != null)
+ {
+ latestImportURI = wsdlImport;
+ }
+ else
+ {
+ throw new IllegalArgumentException("Cannot resolve imported resource:
" + wsdlImport);
+ }
+
+ return inputSource;
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (Exception e)
+ {
+ throw new WSException("Cannot access imported wsdl [" + wsdlImport +
"], " + e.getMessage());
+ }
+ }
+
+ public String getLatestImportURI()
+ {
+ return latestImportURI;
+ }
+}
Copied:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/tools/wsdl/WSDLWriter.java (from
rev 1603,
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/wsdl/WSDLWriter.java)
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/wsdl/WSDLWriter.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/tools/wsdl/WSDLWriter.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -0,0 +1,209 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+package org.jboss.ws.tools.wsdl;
+
+// $Id$
+
+import java.io.IOException;
+import java.io.Writer;
+import java.util.Iterator;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.Constants;
+import org.jboss.ws.WSException;
+import org.jboss.ws.core.utils.DOMUtils;
+import org.jboss.ws.core.utils.DOMWriter;
+import org.jboss.ws.metadata.wsdl.WSDLDefinitions;
+import org.jboss.ws.metadata.wsdl.WSDLService;
+import org.jboss.ws.metadata.wsdl.WSDLUtils;
+import org.jboss.ws.metadata.wsdl.xmlschema.JBossXSModel;
+import org.w3c.dom.Element;
+
+/**
+ * A helper that writes out a WSDL definition
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @author Anil.Saldhana(a)jboss.org
+ * @since 10-Oct-2004
+ */
+public class WSDLWriter
+{
+ // provide logging
+ protected static final Logger log = Logger.getLogger(WSDLWriter.class);
+
+ protected WSDLDefinitions wsdl;
+ protected WSDLUtils utils = WSDLUtils.getInstance();
+
+ // The soap prefix
+ protected String soapPrefix = "soap";
+
+ /**
+ * Include or import WSDL Types
+ */
+ protected boolean includeSchemaInWSDL = true;
+
+ /** Use WSDLDefinitions.writeWSDL instead. */
+ public WSDLWriter(WSDLDefinitions wsdl)
+ {
+ if (wsdl == null)
+ throw new IllegalArgumentException("WSDL definitions is NULL");
+
+ this.wsdl = wsdl;
+ }
+
+ /** Write the wsdl definition to the given writer, clients should not care about the
wsdl version. */
+ public void write(Writer writer, String charset) throws IOException
+ {
+ write(writer, charset, null);
+ }
+
+ public void write(Writer writer, String charset, WSDLWriterResolver resolver) throws
IOException
+ {
+ String wsdlNamespace = wsdl.getWsdlNamespace();
+ if (Constants.NS_WSDL11.equals(wsdlNamespace))
+ {
+ WSDL11Writer wsdl11Writer = new WSDL11Writer(wsdl);
+ wsdl11Writer.write(writer, charset, resolver);
+ }
+ else
+ {
+ throw new WSException("Unsupported wsdl version: " + wsdlNamespace);
+ }
+ }
+
+ public void write(Writer writer) throws IOException
+ {
+ StringBuilder buffer = new StringBuilder();
+ buffer.append(Constants.XML_HEADER);
+
+ appendDefinitions(buffer);
+ appendTypes(buffer);
+ appendInterfaces(buffer);
+ appendBindings(buffer);
+ appendServices(buffer);
+
+ buffer.append("</definitions>");
+
+ Element element = DOMUtils.parse(buffer.toString());
+ new DOMWriter(writer).setPrettyprint(true).print(element);
+ }
+
+ protected void appendDefinitions(StringBuilder buffer)
+ {
+ buffer.append("<definitions");
+ //Append service name as done by wscompile, if there is just one
+ WSDLService[] services = wsdl.getServices();
+ if (services != null && services.length == 1)
+ {
+ WSDLService ser = services[0];
+ buffer.append(" name='" + ser.getName() + "'");
+ }
+ buffer.append(" targetNamespace='" + wsdl.getTargetNamespace() +
"'");
+ buffer.append(" xmlns='" + wsdl.getWsdlNamespace() +
"'");
+ Iterator it = wsdl.getRegisteredNamespaceURIs();
+ while (it.hasNext())
+ {
+ String namespaceURI = (String)it.next();
+ String prefix = wsdl.getPrefix(namespaceURI);
+ if (prefix.length() > 0)
+ {
+ buffer.append(" xmlns:" + prefix + "='" +
namespaceURI + "'");
+ if (Constants.PREFIX_SOAP11.equals(prefix) ||
Constants.PREFIX_SOAP12.equals(prefix))
+ soapPrefix = prefix;
+ }
+ }
+ buffer.append(">");
+ }
+
+ protected void appendTypes(StringBuilder buffer)
+ {
+ buffer.append("<types>");
+ JBossXSModel xsM = WSDLUtils.getSchemaModel(wsdl.getWsdlTypes());
+ String schema = xsM.serialize();
+ buffer.append(schema);
+ buffer.append("</types>");
+ }
+
+ protected void appendInterfaces(StringBuilder buffer)
+ {
+ }
+
+ protected void appendBindings(StringBuilder buffer)
+ {
+ }
+
+ protected void appendServices(StringBuilder buffer)
+ {
+ }
+
+ /** Get a prefixed name of form prefix:localPart */
+ protected String getQNameRef(QName qname)
+ {
+ String retStr = qname.getLocalPart();
+
+ String prefix = qname.getPrefix();
+ String nsURI = qname.getNamespaceURI();
+ if (prefix.length() == 0 && nsURI.length() > 0)
+ {
+ qname = wsdl.registerQName(qname);
+ prefix = qname.getPrefix();
+ }
+
+ if (prefix.length() > 0)
+ retStr = prefix + ":" + retStr;
+
+ return retStr;
+ }
+
+ public WSDLDefinitions getWsdl()
+ {
+ return wsdl;
+ }
+
+ public void setWsdl(WSDLDefinitions wsdl)
+ {
+ this.wsdl = wsdl;
+ }
+
+ public boolean isIncludeTypesInWSDL()
+ {
+ return includeSchemaInWSDL;
+ }
+
+ public void logException(Exception e)
+ {
+ if (log.isTraceEnabled())
+ {
+ log.trace(e);
+ }
+ }
+
+ public void logMessage(String msg)
+ {
+ if (log.isTraceEnabled())
+ {
+ log.trace(msg);
+ }
+ }
+}
Added:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/tools/wsdl/WSDLWriterResolver.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/tools/wsdl/WSDLWriterResolver.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/tools/wsdl/WSDLWriterResolver.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -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.tools.wsdl;
+
+// $Id$
+
+import java.io.IOException;
+import java.io.Writer;
+
+/**
+ * A helper that writes out a WSDL definition
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @author Anil.Saldhana(a)jboss.org
+ * @since 10-Oct-2004
+ */
+public abstract class WSDLWriterResolver
+{
+ public String actualFile;
+ public String charset;
+ public Writer writer;
+
+ public abstract WSDLWriterResolver resolve(String suggestedFile) throws IOException;
+}
Property changes on:
branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/tools/wsdl/WSDLWriterResolver.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified:
branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/common/binding/SOAPBindingTestCase.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/common/binding/SOAPBindingTestCase.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/common/binding/SOAPBindingTestCase.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -47,8 +47,8 @@
import org.jboss.ws.core.soap.MessageFactoryImpl;
import org.jboss.ws.core.soap.UnboundHeader;
import org.jboss.ws.core.utils.DOMUtils;
-import org.jboss.ws.metadata.OperationMetaData;
-import org.jboss.ws.metadata.ParameterMetaData;
+import org.jboss.ws.metadata.umdm.OperationMetaData;
+import org.jboss.ws.metadata.umdm.ParameterMetaData;
/**
* Test the SOAPBindingProvider
Modified:
branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/common/soap/attachment/GenericAttachmentTestCase.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/common/soap/attachment/GenericAttachmentTestCase.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/common/soap/attachment/GenericAttachmentTestCase.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -50,7 +50,7 @@
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.metadata.OperationMetaData;
+import org.jboss.ws.metadata.umdm.OperationMetaData;
/**
* TODO
Modified:
branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/samples/dynamichandler/DynamicHandlerTestCase.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/samples/dynamichandler/DynamicHandlerTestCase.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/samples/dynamichandler/DynamicHandlerTestCase.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -37,7 +37,7 @@
import org.jboss.test.ws.JBossWSTestSetup;
import org.jboss.ws.core.jaxrpc.ServiceExt;
import org.jboss.ws.core.utils.ObjectNameFactory;
-import org.jboss.ws.metadata.HandlerMetaData;
+import org.jboss.ws.metadata.umdm.HandlerMetaData;
/**
* Test dynamic handlers
Modified:
branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/xop/XOPTypeDefTestCase.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/xop/XOPTypeDefTestCase.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/xop/XOPTypeDefTestCase.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -7,7 +7,7 @@
import org.apache.xerces.xs.XSComplexTypeDefinition;
import org.apache.xerces.xs.XSModel;
import org.apache.xerces.xs.XSTypeDefinition;
-import org.jboss.ws.extensions.xop.XOPScanner;
+import org.jboss.ws.extensions.xop.jaxrpc.XOPScanner;
import org.jboss.ws.metadata.wsdl.xmlschema.JBossXSModel;
import org.jboss.ws.metadata.wsdl.xmlschema.WSSchemaUtils;
import org.jboss.ws.metadata.wsdl.xsd.SchemaUtils;
Modified:
branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxws/jsr181/oneway/JSR181OneWayTestCase.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxws/jsr181/oneway/JSR181OneWayTestCase.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxws/jsr181/oneway/JSR181OneWayTestCase.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -32,7 +32,7 @@
import org.jboss.test.ws.JBossWSTestSetup;
import org.jboss.ws.core.jaxrpc.CallImpl;
import org.jboss.ws.core.jaxrpc.ServiceFactoryImpl;
-import org.jboss.ws.metadata.OperationMetaData;
+import org.jboss.ws.metadata.umdm.OperationMetaData;
/**
* Test the JSR-181 annotation: javax.jws.Oneway
Modified:
branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxws/jsr181/soapbinding/JSR181SOAPBindingTestCase.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxws/jsr181/soapbinding/JSR181SOAPBindingTestCase.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxws/jsr181/soapbinding/JSR181SOAPBindingTestCase.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -43,7 +43,7 @@
import org.jboss.ws.core.jaxrpc.Style;
import org.jboss.ws.core.jaxrpc.Use;
import org.jboss.ws.core.soap.NameImpl;
-import org.jboss.ws.metadata.OperationMetaData;
+import org.jboss.ws.metadata.umdm.OperationMetaData;
/**
* Test the JSR-181 annotation: javax.jws.SOAPBinding
Modified:
branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxws/jsr181/webparam/JSR181WebParamTestCase.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxws/jsr181/webparam/JSR181WebParamTestCase.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxws/jsr181/webparam/JSR181WebParamTestCase.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -34,8 +34,8 @@
import org.jboss.test.ws.JBossWSTestSetup;
import org.jboss.ws.core.jaxrpc.CallImpl;
import org.jboss.ws.core.jaxrpc.ServiceFactoryImpl;
-import org.jboss.ws.metadata.OperationMetaData;
-import org.jboss.ws.metadata.ParameterMetaData;
+import org.jboss.ws.metadata.umdm.OperationMetaData;
+import org.jboss.ws.metadata.umdm.ParameterMetaData;
/**
* Test the JSR-181 annotation: javax.jws.WebParam
Modified:
branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/tools/metadata/WebServicesMetaDataTestCase.java
===================================================================
---
branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/tools/metadata/WebServicesMetaDataTestCase.java 2006-12-07
12:05:41 UTC (rev 1603)
+++
branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/tools/metadata/WebServicesMetaDataTestCase.java 2006-12-07
12:36:23 UTC (rev 1604)
@@ -29,10 +29,10 @@
import org.jboss.test.ws.JBossWSTest;
import org.jboss.ws.core.utils.DOMUtils;
-import org.jboss.ws.metadata.jsr109.PortComponentMetaData;
-import org.jboss.ws.metadata.jsr109.WebserviceDescriptionMetaData;
-import org.jboss.ws.metadata.jsr109.WebservicesFactory;
-import org.jboss.ws.metadata.jsr109.WebservicesMetaData;
+import org.jboss.ws.metadata.webservices.PortComponentMetaData;
+import org.jboss.ws.metadata.webservices.WebserviceDescriptionMetaData;
+import org.jboss.ws.metadata.webservices.WebservicesFactory;
+import org.jboss.ws.metadata.webservices.WebservicesMetaData;
import org.jboss.xb.binding.ObjectModelFactory;
import org.jboss.xb.binding.Unmarshaller;
import org.jboss.xb.binding.UnmarshallerFactory;