Author: thomas.diesler(a)jboss.com
Date: 2006-12-07 07:05:41 -0500 (Thu, 07 Dec 2006)
New Revision: 1603
Added:
trunk/src/main/java/org/jboss/ws/Constants.java
trunk/src/main/java/org/jboss/ws/core/CommonBinding.java
trunk/src/main/java/org/jboss/ws/core/CommonBindingProvider.java
trunk/src/main/java/org/jboss/ws/core/CommonSOAP11Binding.java
trunk/src/main/java/org/jboss/ws/core/CommonSOAP12Binding.java
trunk/src/main/java/org/jboss/ws/core/CommonSOAPBinding.java
trunk/src/main/java/org/jboss/ws/metadata/
trunk/src/main/java/org/jboss/ws/metadata/acessor/
trunk/src/main/java/org/jboss/ws/metadata/acessor/JAXBAccessor.java
trunk/src/main/java/org/jboss/ws/metadata/acessor/ReflectiveMethodAccessor.java
trunk/src/main/java/org/jboss/ws/metadata/builder/
trunk/src/main/java/org/jboss/ws/metadata/builder/MetaDataBuilder.java
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxrpc/
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCClientDeployment.java
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCClientMetaDataBuilder.java
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCDeployment.java
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCMetaDataBuilder.java
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCServerMetaDataBuilder.java
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSClientEndpointMetaDataBuilder.java
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSClientMetaDataBuilder.java
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSEndpointMetaDataBuilder.java
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilder.java
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilderEJB21.java
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilderEJB3.java
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilderJSE.java
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSProviderMetaDataBuilder.java
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSServerMetaDataBuilder.java
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSWebServiceMetaDataBuilder.java
trunk/src/main/java/org/jboss/ws/metadata/config/
trunk/src/main/java/org/jboss/ws/metadata/config/WSCommonConfig.java
trunk/src/main/java/org/jboss/ws/metadata/config/WSConfigFactory.java
trunk/src/main/java/org/jboss/ws/metadata/config/jaxrpc/
trunk/src/main/java/org/jboss/ws/metadata/config/jaxrpc/WSClientConfigJAXRPC.java
trunk/src/main/java/org/jboss/ws/metadata/config/jaxrpc/WSCommonConfigJAXRPC.java
trunk/src/main/java/org/jboss/ws/metadata/config/jaxrpc/WSConfigFactoryJAXRPC.java
trunk/src/main/java/org/jboss/ws/metadata/config/jaxrpc/WSConfigRootJAXRPC.java
trunk/src/main/java/org/jboss/ws/metadata/config/jaxrpc/WSEndpointConfigJAXRPC.java
trunk/src/main/java/org/jboss/ws/metadata/config/jaxws/
trunk/src/main/java/org/jboss/ws/metadata/config/jaxws/WSClientConfigJAXWS.java
trunk/src/main/java/org/jboss/ws/metadata/config/jaxws/WSCommonConfigJAXWS.java
trunk/src/main/java/org/jboss/ws/metadata/config/jaxws/WSConfigFactoryJAXWS.java
trunk/src/main/java/org/jboss/ws/metadata/config/jaxws/WSConfigRootJAXWS.java
trunk/src/main/java/org/jboss/ws/metadata/config/jaxws/WSEndpointConfigJAXWS.java
trunk/src/main/java/org/jboss/ws/metadata/config/jaxws/WSHandlerChainsConfigJAXWS.java
trunk/src/main/java/org/jboss/ws/metadata/j2ee/
trunk/src/main/java/org/jboss/ws/metadata/j2ee/UnifiedApplicationMetaData.java
trunk/src/main/java/org/jboss/ws/metadata/j2ee/UnifiedBeanMetaData.java
trunk/src/main/java/org/jboss/ws/metadata/j2ee/UnifiedEjbPortComponentMetaData.java
trunk/src/main/java/org/jboss/ws/metadata/j2ee/UnifiedHandlerMetaData.java
trunk/src/main/java/org/jboss/ws/metadata/j2ee/UnifiedMessageDrivenMetaData.java
trunk/src/main/java/org/jboss/ws/metadata/j2ee/UnifiedPortComponentRefMetaData.java
trunk/src/main/java/org/jboss/ws/metadata/j2ee/UnifiedServiceRefMetaData.java
trunk/src/main/java/org/jboss/ws/metadata/j2ee/UnifiedSessionMetaData.java
trunk/src/main/java/org/jboss/ws/metadata/j2ee/UnifiedWebMetaData.java
trunk/src/main/java/org/jboss/ws/metadata/j2ee/UnifiedWebSecurityMetaData.java
trunk/src/main/java/org/jboss/ws/metadata/jaxrpcmapping/
trunk/src/main/java/org/jboss/ws/metadata/jaxrpcmapping/ExceptionMapping.java
trunk/src/main/java/org/jboss/ws/metadata/jaxrpcmapping/JavaWsdlMapping.java
trunk/src/main/java/org/jboss/ws/metadata/jaxrpcmapping/JavaWsdlMappingFactory.java
trunk/src/main/java/org/jboss/ws/metadata/jaxrpcmapping/JavaXmlTypeMapping.java
trunk/src/main/java/org/jboss/ws/metadata/jaxrpcmapping/MethodParamPartsMapping.java
trunk/src/main/java/org/jboss/ws/metadata/jaxrpcmapping/PackageMapping.java
trunk/src/main/java/org/jboss/ws/metadata/jaxrpcmapping/PortMapping.java
trunk/src/main/java/org/jboss/ws/metadata/jaxrpcmapping/ServiceEndpointInterfaceMapping.java
trunk/src/main/java/org/jboss/ws/metadata/jaxrpcmapping/ServiceEndpointMethodMapping.java
trunk/src/main/java/org/jboss/ws/metadata/jaxrpcmapping/ServiceInterfaceMapping.java
trunk/src/main/java/org/jboss/ws/metadata/jaxrpcmapping/VariableMapping.java
trunk/src/main/java/org/jboss/ws/metadata/jaxrpcmapping/WsdlMessageMapping.java
trunk/src/main/java/org/jboss/ws/metadata/jaxrpcmapping/WsdlReturnValueMapping.java
trunk/src/main/java/org/jboss/ws/metadata/jsr181/
trunk/src/main/java/org/jboss/ws/metadata/jsr181/HandlerChainFactory.java
trunk/src/main/java/org/jboss/ws/metadata/jsr181/HandlerChainMetaData.java
trunk/src/main/java/org/jboss/ws/metadata/jsr181/HandlerChainsMetaData.java
trunk/src/main/java/org/jboss/ws/metadata/umdm/
trunk/src/main/java/org/jboss/ws/metadata/umdm/ClientEndpointMetaData.java
trunk/src/main/java/org/jboss/ws/metadata/umdm/EndpointMetaData.java
trunk/src/main/java/org/jboss/ws/metadata/umdm/ExtensibleMetaData.java
trunk/src/main/java/org/jboss/ws/metadata/umdm/FaultMetaData.java
trunk/src/main/java/org/jboss/ws/metadata/umdm/HandlerMetaData.java
trunk/src/main/java/org/jboss/ws/metadata/umdm/HandlerMetaDataJAXRPC.java
trunk/src/main/java/org/jboss/ws/metadata/umdm/HandlerMetaDataJAXWS.java
trunk/src/main/java/org/jboss/ws/metadata/umdm/MetaDataExtension.java
trunk/src/main/java/org/jboss/ws/metadata/umdm/OperationMetaData.java
trunk/src/main/java/org/jboss/ws/metadata/umdm/ParameterMetaData.java
trunk/src/main/java/org/jboss/ws/metadata/umdm/ServerEndpointMetaData.java
trunk/src/main/java/org/jboss/ws/metadata/umdm/ServiceMetaData.java
trunk/src/main/java/org/jboss/ws/metadata/umdm/TypeMappingMetaData.java
trunk/src/main/java/org/jboss/ws/metadata/umdm/TypesMetaData.java
trunk/src/main/java/org/jboss/ws/metadata/umdm/UnifiedMetaData.java
trunk/src/main/java/org/jboss/ws/metadata/umdm/WrappedParameter.java
trunk/src/main/java/org/jboss/ws/metadata/webservices/
trunk/src/main/java/org/jboss/ws/metadata/webservices/PortComponentMetaData.java
trunk/src/main/java/org/jboss/ws/metadata/webservices/WebserviceDescriptionMetaData.java
trunk/src/main/java/org/jboss/ws/metadata/webservices/WebservicesFactory.java
trunk/src/main/java/org/jboss/ws/metadata/webservices/WebservicesMetaData.java
trunk/src/main/java/org/jboss/ws/metadata/wsdl/
trunk/src/main/java/org/jboss/ws/metadata/wsdl/DOMTypes.java
trunk/src/main/java/org/jboss/ws/metadata/wsdl/Extendable.java
trunk/src/main/java/org/jboss/ws/metadata/wsdl/NCName.java
trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLBinding.java
trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLBindingFault.java
trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLBindingMessageReference.java
trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLBindingOperation.java
trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLBindingOperationInput.java
trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLBindingOperationOutput.java
trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLDefinitions.java
trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLDocumentation.java
trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLEndpoint.java
trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLException.java
trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLFeature.java
trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLImport.java
trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLInclude.java
trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLInterface.java
trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLInterfaceFault.java
trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLInterfaceMessageReference.java
trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLInterfaceOperation.java
trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLInterfaceOperationInfault.java
trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLInterfaceOperationInput.java
trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLInterfaceOperationOutfault.java
trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLInterfaceOperationOutput.java
trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLMIMEPart.java
trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLProperty.java
trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLRPCPart.java
trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLRPCSignatureItem.java
trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLSOAPHeader.java
trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLService.java
trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLTypes.java
trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLUtils.java
trunk/src/main/java/org/jboss/ws/metadata/wsdl/XSModelTypes.java
trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/
trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSComplexTypeDefinition.java
trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSElementDeclaration.java
trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSEntityResolver.java
trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSErrorHandler.java
trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSModel.java
trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSModelGroup.java
trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSNamedMap.java
trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSNamespaceItem.java
trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSNamespaceItemList.java
trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSObject.java
trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSObjectList.java
trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSParticle.java
trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSSimpleTypeDefinition.java
trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSStringList.java
trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSTypeDefinition.java
trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/WSSchemaUtils.java
trunk/src/main/java/org/jboss/ws/metadata/wsdl/xsd/
trunk/src/main/java/org/jboss/ws/metadata/wsdl/xsd/SchemaUtils.java
trunk/src/main/java/org/jboss/ws/metadata/wsdl/xsd/XSDWriter.java
trunk/src/main/java/org/jboss/ws/metadata/wsse/
trunk/src/main/java/org/jboss/ws/metadata/wsse/Config.java
trunk/src/main/java/org/jboss/ws/metadata/wsse/Encrypt.java
trunk/src/main/java/org/jboss/ws/metadata/wsse/Operation.java
trunk/src/main/java/org/jboss/ws/metadata/wsse/Port.java
trunk/src/main/java/org/jboss/ws/metadata/wsse/RequireEncryption.java
trunk/src/main/java/org/jboss/ws/metadata/wsse/RequireSignature.java
trunk/src/main/java/org/jboss/ws/metadata/wsse/RequireTimestamp.java
trunk/src/main/java/org/jboss/ws/metadata/wsse/Requires.java
trunk/src/main/java/org/jboss/ws/metadata/wsse/Sign.java
trunk/src/main/java/org/jboss/ws/metadata/wsse/Target.java
trunk/src/main/java/org/jboss/ws/metadata/wsse/Targetable.java
trunk/src/main/java/org/jboss/ws/metadata/wsse/Timestamp.java
trunk/src/main/java/org/jboss/ws/metadata/wsse/Username.java
trunk/src/main/java/org/jboss/ws/metadata/wsse/WSSecurityConfiguration.java
trunk/src/main/java/org/jboss/ws/metadata/wsse/WSSecurityConfigurationFactory.java
Removed:
trunk/src/main/java/org/jboss/ws/Constants.java
trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/CommonBinding.java
trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/CommonBindingProvider.java
trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/CommonSOAP11Binding.java
trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/CommonSOAP12Binding.java
trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/CommonSOAPBinding.java
trunk/src/main/java/org/jboss/ws/extensions/SomeClass.java
trunk/src/main/java/org/jboss/ws/metadata/
trunk/src/main/java/org/jboss/ws/metadata/acessor/
trunk/src/main/java/org/jboss/ws/metadata/acessor/JAXBAccessor.java
trunk/src/main/java/org/jboss/ws/metadata/acessor/ReflectiveMethodAccessor.java
trunk/src/main/java/org/jboss/ws/metadata/builder/
trunk/src/main/java/org/jboss/ws/metadata/builder/MetaDataBuilder.java
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxrpc/
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCClientDeployment.java
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCClientMetaDataBuilder.java
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCDeployment.java
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCMetaDataBuilder.java
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCServerMetaDataBuilder.java
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSClientEndpointMetaDataBuilder.java
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSClientMetaDataBuilder.java
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSEndpointMetaDataBuilder.java
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilder.java
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilderEJB21.java
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilderEJB3.java
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilderJSE.java
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSProviderMetaDataBuilder.java
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSServerMetaDataBuilder.java
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSWebServiceMetaDataBuilder.java
trunk/src/main/java/org/jboss/ws/metadata/config/
trunk/src/main/java/org/jboss/ws/metadata/config/WSCommonConfig.java
trunk/src/main/java/org/jboss/ws/metadata/config/WSConfigFactory.java
trunk/src/main/java/org/jboss/ws/metadata/config/jaxrpc/
trunk/src/main/java/org/jboss/ws/metadata/config/jaxrpc/WSClientConfigJAXRPC.java
trunk/src/main/java/org/jboss/ws/metadata/config/jaxrpc/WSCommonConfigJAXRPC.java
trunk/src/main/java/org/jboss/ws/metadata/config/jaxrpc/WSConfigFactoryJAXRPC.java
trunk/src/main/java/org/jboss/ws/metadata/config/jaxrpc/WSConfigRootJAXRPC.java
trunk/src/main/java/org/jboss/ws/metadata/config/jaxrpc/WSEndpointConfigJAXRPC.java
trunk/src/main/java/org/jboss/ws/metadata/config/jaxws/
trunk/src/main/java/org/jboss/ws/metadata/config/jaxws/WSClientConfigJAXWS.java
trunk/src/main/java/org/jboss/ws/metadata/config/jaxws/WSCommonConfigJAXWS.java
trunk/src/main/java/org/jboss/ws/metadata/config/jaxws/WSConfigFactoryJAXWS.java
trunk/src/main/java/org/jboss/ws/metadata/config/jaxws/WSConfigRootJAXWS.java
trunk/src/main/java/org/jboss/ws/metadata/config/jaxws/WSEndpointConfigJAXWS.java
trunk/src/main/java/org/jboss/ws/metadata/config/jaxws/WSHandlerChainsConfigJAXWS.java
trunk/src/main/java/org/jboss/ws/metadata/j2ee/
trunk/src/main/java/org/jboss/ws/metadata/j2ee/UnifiedApplicationMetaData.java
trunk/src/main/java/org/jboss/ws/metadata/j2ee/UnifiedBeanMetaData.java
trunk/src/main/java/org/jboss/ws/metadata/j2ee/UnifiedEjbPortComponentMetaData.java
trunk/src/main/java/org/jboss/ws/metadata/j2ee/UnifiedHandlerMetaData.java
trunk/src/main/java/org/jboss/ws/metadata/j2ee/UnifiedMessageDrivenMetaData.java
trunk/src/main/java/org/jboss/ws/metadata/j2ee/UnifiedPortComponentRefMetaData.java
trunk/src/main/java/org/jboss/ws/metadata/j2ee/UnifiedServiceRefMetaData.java
trunk/src/main/java/org/jboss/ws/metadata/j2ee/UnifiedSessionMetaData.java
trunk/src/main/java/org/jboss/ws/metadata/j2ee/UnifiedWebMetaData.java
trunk/src/main/java/org/jboss/ws/metadata/j2ee/UnifiedWebSecurityMetaData.java
trunk/src/main/java/org/jboss/ws/metadata/jaxrpcmapping/
trunk/src/main/java/org/jboss/ws/metadata/jaxrpcmapping/ExceptionMapping.java
trunk/src/main/java/org/jboss/ws/metadata/jaxrpcmapping/JavaWsdlMapping.java
trunk/src/main/java/org/jboss/ws/metadata/jaxrpcmapping/JavaWsdlMappingFactory.java
trunk/src/main/java/org/jboss/ws/metadata/jaxrpcmapping/JavaXmlTypeMapping.java
trunk/src/main/java/org/jboss/ws/metadata/jaxrpcmapping/MethodParamPartsMapping.java
trunk/src/main/java/org/jboss/ws/metadata/jaxrpcmapping/PackageMapping.java
trunk/src/main/java/org/jboss/ws/metadata/jaxrpcmapping/PortMapping.java
trunk/src/main/java/org/jboss/ws/metadata/jaxrpcmapping/ServiceEndpointInterfaceMapping.java
trunk/src/main/java/org/jboss/ws/metadata/jaxrpcmapping/ServiceEndpointMethodMapping.java
trunk/src/main/java/org/jboss/ws/metadata/jaxrpcmapping/ServiceInterfaceMapping.java
trunk/src/main/java/org/jboss/ws/metadata/jaxrpcmapping/VariableMapping.java
trunk/src/main/java/org/jboss/ws/metadata/jaxrpcmapping/WsdlMessageMapping.java
trunk/src/main/java/org/jboss/ws/metadata/jaxrpcmapping/WsdlReturnValueMapping.java
trunk/src/main/java/org/jboss/ws/metadata/jsr181/
trunk/src/main/java/org/jboss/ws/metadata/jsr181/HandlerChainFactory.java
trunk/src/main/java/org/jboss/ws/metadata/jsr181/HandlerChainMetaData.java
trunk/src/main/java/org/jboss/ws/metadata/jsr181/HandlerChainsMetaData.java
trunk/src/main/java/org/jboss/ws/metadata/umdm/
trunk/src/main/java/org/jboss/ws/metadata/umdm/ClientEndpointMetaData.java
trunk/src/main/java/org/jboss/ws/metadata/umdm/EndpointMetaData.java
trunk/src/main/java/org/jboss/ws/metadata/umdm/ExtensibleMetaData.java
trunk/src/main/java/org/jboss/ws/metadata/umdm/FaultMetaData.java
trunk/src/main/java/org/jboss/ws/metadata/umdm/HandlerMetaData.java
trunk/src/main/java/org/jboss/ws/metadata/umdm/HandlerMetaDataJAXRPC.java
trunk/src/main/java/org/jboss/ws/metadata/umdm/HandlerMetaDataJAXWS.java
trunk/src/main/java/org/jboss/ws/metadata/umdm/MetaDataExtension.java
trunk/src/main/java/org/jboss/ws/metadata/umdm/OperationMetaData.java
trunk/src/main/java/org/jboss/ws/metadata/umdm/ParameterMetaData.java
trunk/src/main/java/org/jboss/ws/metadata/umdm/ServerEndpointMetaData.java
trunk/src/main/java/org/jboss/ws/metadata/umdm/ServiceMetaData.java
trunk/src/main/java/org/jboss/ws/metadata/umdm/TypeMappingMetaData.java
trunk/src/main/java/org/jboss/ws/metadata/umdm/TypesMetaData.java
trunk/src/main/java/org/jboss/ws/metadata/umdm/UnifiedMetaData.java
trunk/src/main/java/org/jboss/ws/metadata/umdm/WrappedParameter.java
trunk/src/main/java/org/jboss/ws/metadata/webservices/
trunk/src/main/java/org/jboss/ws/metadata/webservices/PortComponentMetaData.java
trunk/src/main/java/org/jboss/ws/metadata/webservices/WebserviceDescriptionMetaData.java
trunk/src/main/java/org/jboss/ws/metadata/webservices/WebservicesFactory.java
trunk/src/main/java/org/jboss/ws/metadata/webservices/WebservicesMetaData.java
trunk/src/main/java/org/jboss/ws/metadata/wsdl/
trunk/src/main/java/org/jboss/ws/metadata/wsdl/DOMTypes.java
trunk/src/main/java/org/jboss/ws/metadata/wsdl/Extendable.java
trunk/src/main/java/org/jboss/ws/metadata/wsdl/NCName.java
trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLBinding.java
trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLBindingFault.java
trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLBindingMessageReference.java
trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLBindingOperation.java
trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLBindingOperationInput.java
trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLBindingOperationOutput.java
trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLDefinitions.java
trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLDocumentation.java
trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLEndpoint.java
trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLException.java
trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLFeature.java
trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLImport.java
trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLInclude.java
trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLInterface.java
trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLInterfaceFault.java
trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLInterfaceMessageReference.java
trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLInterfaceOperation.java
trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLInterfaceOperationInfault.java
trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLInterfaceOperationInput.java
trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLInterfaceOperationOutfault.java
trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLInterfaceOperationOutput.java
trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLMIMEPart.java
trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLProperty.java
trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLRPCPart.java
trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLRPCSignatureItem.java
trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLSOAPHeader.java
trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLService.java
trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLTypes.java
trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLUtils.java
trunk/src/main/java/org/jboss/ws/metadata/wsdl/XSModelTypes.java
trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/
trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSComplexTypeDefinition.java
trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSElementDeclaration.java
trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSEntityResolver.java
trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSErrorHandler.java
trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSModel.java
trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSModelGroup.java
trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSNamedMap.java
trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSNamespaceItem.java
trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSNamespaceItemList.java
trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSObject.java
trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSObjectList.java
trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSParticle.java
trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSSimpleTypeDefinition.java
trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSStringList.java
trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSTypeDefinition.java
trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/WSSchemaUtils.java
trunk/src/main/java/org/jboss/ws/metadata/wsdl/xsd/
trunk/src/main/java/org/jboss/ws/metadata/wsdl/xsd/SchemaUtils.java
trunk/src/main/java/org/jboss/ws/metadata/wsdl/xsd/XSDWriter.java
trunk/src/main/java/org/jboss/ws/metadata/wsse/
trunk/src/main/java/org/jboss/ws/metadata/wsse/Config.java
trunk/src/main/java/org/jboss/ws/metadata/wsse/Encrypt.java
trunk/src/main/java/org/jboss/ws/metadata/wsse/Operation.java
trunk/src/main/java/org/jboss/ws/metadata/wsse/Port.java
trunk/src/main/java/org/jboss/ws/metadata/wsse/RequireEncryption.java
trunk/src/main/java/org/jboss/ws/metadata/wsse/RequireSignature.java
trunk/src/main/java/org/jboss/ws/metadata/wsse/RequireTimestamp.java
trunk/src/main/java/org/jboss/ws/metadata/wsse/Requires.java
trunk/src/main/java/org/jboss/ws/metadata/wsse/Sign.java
trunk/src/main/java/org/jboss/ws/metadata/wsse/Target.java
trunk/src/main/java/org/jboss/ws/metadata/wsse/Targetable.java
trunk/src/main/java/org/jboss/ws/metadata/wsse/Timestamp.java
trunk/src/main/java/org/jboss/ws/metadata/wsse/Username.java
trunk/src/main/java/org/jboss/ws/metadata/wsse/WSSecurityConfiguration.java
trunk/src/main/java/org/jboss/ws/metadata/wsse/WSSecurityConfigurationFactory.java
Modified:
trunk/src/main/java/org/jboss/ws/core/CommonClient.java
trunk/src/main/java/org/jboss/ws/core/jaxrpc/SOAP11BindingJAXRPC.java
trunk/src/main/java/org/jboss/ws/core/jaxrpc/SOAP12BindingJAXRPC.java
trunk/src/main/java/org/jboss/ws/core/jaxws/binding/BindingProviderImpl.java
trunk/src/main/java/org/jboss/ws/core/jaxws/binding/HTTPBindingJAXWS.java
trunk/src/main/java/org/jboss/ws/core/jaxws/binding/MessageBinding.java
trunk/src/main/java/org/jboss/ws/core/jaxws/binding/PayloadBinding.java
trunk/src/main/java/org/jboss/ws/core/jaxws/binding/SOAP11BindingJAXWS.java
trunk/src/main/java/org/jboss/ws/core/jaxws/binding/SOAP12BindingJAXWS.java
trunk/src/main/java/org/jboss/ws/core/jaxws/client/ClientImpl.java
trunk/src/main/java/org/jboss/ws/core/server/AbstractServiceEndpointInvoker.java
trunk/src/main/java/org/jboss/ws/core/server/ServiceEndpoint.java
trunk/src/test/java/org/jboss/test/ws/common/binding/SOAPBindingTestCase.java
trunk/src/test/java/org/jboss/test/ws/common/soap/attachment/GenericAttachmentTestCase.java
trunk/src/test/java/org/jboss/test/ws/jaxws/xop/doclit/MTOMEndpointBean.java
Log:
reorganize package structure
Deleted: trunk/src/main/java/org/jboss/ws/Constants.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/Constants.java 2006-12-07 11:54:16 UTC (rev 1602)
+++ trunk/src/main/java/org/jboss/ws/Constants.java 2006-12-07 12:05:41 UTC (rev 1603)
@@ -1,278 +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;
-
-
-import javax.xml.namespace.QName;
-import javax.xml.soap.Name;
-
-import org.jboss.ws.core.soap.NameImpl;
-
-
-/**
- * A collection of constants relevant to JBossWS
- *
- * @author Thomas.Diesler(a)jboss.org
- * @author Anil.Saldhana(a)jboss.org
- * @since 10-Oct-2004
- */
-public interface Constants
-{
- /** Header for XML Documents */
- static final String XML_HEADER = "<?xml version='1.0'
encoding='UTF-8'?>";
-
- /** Default charset for XML Documents */
- static final String DEFAULT_XML_CHARSET = "UTF-8";
-
- /** JBossWS namespace URI */
- static final String NS_JBOSSWS_URI = "http://www.jboss.org/jbossws";
- /** XML Namespace */
- static final String NS_XML = "http://www.w3.org/XML/1998/namespace";
- /** XMLSchema namespace
http://www.w3.org/2001/XMLSchema */
- static final String NS_SCHEMA_XSD = "http://www.w3.org/2001/XMLSchema";
- /** XMLSchema instance namespace
http://www.w3.org/2001/XMLSchema-instance */
- static final String NS_SCHEMA_XSI =
"http://www.w3.org/2001/XMLSchema-instance";
- /** SOAP-1.1 namespace
http://schemas.xmlsoap.org/wsdl/soap/ */
- static final String NS_SOAP11 = "http://schemas.xmlsoap.org/wsdl/soap/";
- /** SOAP-1.1 envelope namespace
http://schemas.xmlsoap.org/soap/envelope/ */
- static final String NS_SOAP11_ENV =
"http://schemas.xmlsoap.org/soap/envelope/";
- /** SOAP-1.2 namespace
http://schemas.xmlsoap.org/wsdl/soap12/ */
- static final String NS_SOAP12 = "http://schemas.xmlsoap.org/wsdl/soap12/";
- /** SOAP-1.2 envelope namespace
http://www.w3.org/2003/05/soap-envelope */
- static final String NS_SOAP12_ENV =
"http://www.w3.org/2003/05/soap-envelope";
- /** The namespace for the SwA mime type */
- static final String NS_SWA_MIME = "http://schemas.xmlsoap.org/wsdl/mime/";
- /** Default namespace for WSDL-1.1
http://schemas.xmlsoap.org/wsdl/ */
- static final String NS_WSDL11 = "http://schemas.xmlsoap.org/wsdl/";
- /** Default namespace for WSDL-2.0
http://www.w3.org/TR/wsdl20 */
- static final String NS_WSDL20 = "http://www.w3.org/2003/11/wsdl";
- /** The namespace for the MTOM content type attribute. */
- static final String NS_XML_MIME = "http://www.w3.org/2005/05/xmlmime";
- /** The namespace for XOP. */
- static final String NS_XOP = "http://www.w3.org/2004/08/xop/include";
-
- /** A constant representing the identity of the SOAP 1.2 over HTTP binding. */
- static final String SOAP12HTTP_BINDING =
"http://www.w3.org/2003/05/soap/bindings/HTTP/";
- /** A constant representing the identity of the SOAP 1.1 over HTTP binding. */
- static final String SOAP11HTTP_BINDING =
"http://schemas.xmlsoap.org/wsdl/soap/http";
-
- /** SOAP-1.1 encoding URI */
- static final String URI_SOAP11_ENC =
"http://schemas.xmlsoap.org/soap/encoding/";
- /** SOAP-1.2 encoding URI */
- static final String URI_SOAP12_ENC =
"http://www.w3.org/2003/05/soap-encoding";
- /** Literal encoding URI */
- static final String URI_LITERAL_ENC = "";
- /** WSDL 2.0 Encoding Rules */
- static final String URI_STYLE_RPC =
"http://www.w3.org/2004/03/wsdl/style/rpc";
- static final String URI_STYLE_IRI =
"http://www.w3.org/2004/03/wsdl/style/iri"; //represents doc
- /**Style of WSDL */
- static final String RPC_LITERAL = "RPC/Literal";
- static final String DOCUMENT_LITERAL = "Document/Literal";
-
- // Some prefixes
- static final String PREFIX_ENV = "env";
- static final String PREFIX_XMIME = "xmime";
- static final String PREFIX_SOAP11 = "soap";
- static final String PREFIX_SOAP12 = "soap12";
- static final String PREFIX_SOAP11_ENC = "soap11-enc";
- static final String PREFIX_TNS = "tns";
- static final String PREFIX_WSDL = "wsdl";
- static final String PREFIX_XOP = "xop";
- static final String PREFIX_XSD = "xsd";
- static final String PREFIX_XSI = "xsi";
- static final String PREFIX_XML = "xml";
-
- /** XOP Include */
- static final Name NAME_XOP_INCLUDE = new NameImpl("Include", PREFIX_XOP,
NS_XOP);
-
- /** SOAP-1.1 roles */
- static final String URI_SOAP11_NEXT_ACTOR =
"http://schemas.xmlsoap.org/soap/actor/next";
-
- /** SOAP-1.1 attributes */
- static final String SOAP11_ATTR_ACTOR = "actor";
- static final String SOAP11_ATTR_ROLE = "role";
- static final String SOAP11_ATTR_MUST_UNDERSTAND = "mustUnderstand";
-
- /** SOAP-1.1 fault codes */
- static final QName SOAP11_FAULT_CODE_CLIENT = new QName(NS_SOAP11_ENV,
"Client", PREFIX_ENV);
- static final QName SOAP11_FAULT_CODE_SERVER = new QName(NS_SOAP11_ENV,
"Server", PREFIX_ENV);
- static final QName SOAP11_FAULT_CODE_VERSION_MISMATCH = new QName(NS_SOAP11_ENV,
"VersionMismatch", PREFIX_ENV);
- static final QName SOAP11_FAULT_CODE_MUST_UNDERSTAND = new QName(NS_SOAP11_ENV,
"MustUnderstand", PREFIX_ENV);
-
- /** SOAP-1.1 elements */
- static final Name SOAP11_ENVELOPE = new NameImpl("Envelope", PREFIX_ENV,
NS_SOAP11_ENV);
- static final Name SOAP11_HEADER = new NameImpl("Header", PREFIX_ENV,
NS_SOAP11_ENV);
- static final Name SOAP11_BODY = new NameImpl("Body", PREFIX_ENV,
NS_SOAP11_ENV);
- static final Name SOAP11_FAULT = new NameImpl("Fault", PREFIX_ENV,
NS_SOAP11_ENV);
-
- /** SOAP-1.2 roles */
- static final String URI_SOAP12_ROLE_NONE =
"http://www.w3.org/2003/05/soap-envelope/role/none";
- static final String URI_SOAP12_ROLE_NEXT =
"http://www.w3.org/2003/05/soap-envelope/role/next";
- static final String URI_SOAP12_ROLE_ULTIMATE_RECEIVER =
"http://www.w3.org/2003/05/soap-envelope/role/ultimateReceiver";
-
- /** The default RPC return parameter name */
- static final String DEFAULT_RPC_RETURN_NAME = "result"; // FIXME: According
to JSR-181 this should be 'return'
-
- /** Standard Literal XML types */
- static final QName TYPE_LITERAL_ANYSIMPLETYPE = new QName(NS_SCHEMA_XSD,
"anySimpleType", PREFIX_XSD);
- static final QName TYPE_LITERAL_ANYTYPE = new QName(NS_SCHEMA_XSD,
"anyType", PREFIX_XSD);
- static final QName TYPE_LITERAL_ANYURI = new QName(NS_SCHEMA_XSD, "anyURI",
PREFIX_XSD);
- static final QName TYPE_LITERAL_BASE64BINARY = new QName(NS_SCHEMA_XSD,
"base64Binary", PREFIX_XSD);
- static final QName TYPE_LITERAL_BOOLEAN = new QName(NS_SCHEMA_XSD,
"boolean", PREFIX_XSD);
- static final QName TYPE_LITERAL_BYTE = new QName(NS_SCHEMA_XSD, "byte",
PREFIX_XSD);
- static final QName TYPE_LITERAL_DATE = new QName(NS_SCHEMA_XSD, "date",
PREFIX_XSD);
- static final QName TYPE_LITERAL_DATETIME = new QName(NS_SCHEMA_XSD,
"dateTime", PREFIX_XSD);
- static final QName TYPE_LITERAL_DECIMAL = new QName(NS_SCHEMA_XSD,
"decimal", PREFIX_XSD);
- static final QName TYPE_LITERAL_DOUBLE = new QName(NS_SCHEMA_XSD, "double",
PREFIX_XSD);
- static final QName TYPE_LITERAL_DURATION = new QName(NS_SCHEMA_XSD,
"duration", PREFIX_XSD);
- static final QName TYPE_LITERAL_FLOAT = new QName(NS_SCHEMA_XSD, "float",
PREFIX_XSD);
- static final QName TYPE_LITERAL_GDAY = new QName(NS_SCHEMA_XSD, "gDay",
PREFIX_XSD);
- static final QName TYPE_LITERAL_GMONTH = new QName(NS_SCHEMA_XSD, "gMonth",
PREFIX_XSD);
- static final QName TYPE_LITERAL_GMONTHDAY = new QName(NS_SCHEMA_XSD,
"gMonthDay", PREFIX_XSD);
- static final QName TYPE_LITERAL_GYEAR = new QName(NS_SCHEMA_XSD, "gYear",
PREFIX_XSD);
- static final QName TYPE_LITERAL_GYEARMONTH = new QName(NS_SCHEMA_XSD,
"gYearMonth", PREFIX_XSD);
- static final QName TYPE_LITERAL_HEXBINARY = new QName(NS_SCHEMA_XSD,
"hexBinary", PREFIX_XSD);
- static final QName TYPE_LITERAL_ID = new QName(NS_SCHEMA_XSD, "ID",
PREFIX_XSD);
- static final QName TYPE_LITERAL_INT = new QName(NS_SCHEMA_XSD, "int",
PREFIX_XSD);
- static final QName TYPE_LITERAL_INTEGER = new QName(NS_SCHEMA_XSD,
"integer", PREFIX_XSD);
- static final QName TYPE_LITERAL_LANGUAGE = new QName(NS_SCHEMA_XSD,
"language", PREFIX_XSD);
- static final QName TYPE_LITERAL_LONG = new QName(NS_SCHEMA_XSD, "long",
PREFIX_XSD);
- static final QName TYPE_LITERAL_NAME = new QName(NS_SCHEMA_XSD, "Name",
PREFIX_XSD);
- static final QName TYPE_LITERAL_NCNAME = new QName(NS_SCHEMA_XSD, "NCName",
PREFIX_XSD);
- static final QName TYPE_LITERAL_NEGATIVEINTEGER = new QName(NS_SCHEMA_XSD,
"negativeInteger", PREFIX_XSD);
- static final QName TYPE_LITERAL_NMTOKEN = new QName(NS_SCHEMA_XSD,
"NMTOKEN", PREFIX_XSD);
- static final QName TYPE_LITERAL_NMTOKENS = new QName(NS_SCHEMA_XSD,
"NMTOKENS", PREFIX_XSD);
- static final QName TYPE_LITERAL_NONNEGATIVEINTEGER = new QName(NS_SCHEMA_XSD,
"nonNegativeInteger", PREFIX_XSD);
- static final QName TYPE_LITERAL_NONPOSITIVEINTEGER = new QName(NS_SCHEMA_XSD,
"nonPositiveInteger", PREFIX_XSD);
- static final QName TYPE_LITERAL_NORMALIZEDSTRING = new QName(NS_SCHEMA_XSD,
"normalizedString", PREFIX_XSD);
- static final QName TYPE_LITERAL_POSITIVEINTEGER = new QName(NS_SCHEMA_XSD,
"positiveInteger", PREFIX_XSD);
- static final QName TYPE_LITERAL_QNAME = new QName(NS_SCHEMA_XSD, "QName",
PREFIX_XSD);
- static final QName TYPE_LITERAL_SHORT = new QName(NS_SCHEMA_XSD, "short",
PREFIX_XSD);
- static final QName TYPE_LITERAL_STRING = new QName(NS_SCHEMA_XSD, "string",
PREFIX_XSD);
- static final QName TYPE_LITERAL_TIME = new QName(NS_SCHEMA_XSD, "time",
PREFIX_XSD);
- static final QName TYPE_LITERAL_TOKEN = new QName(NS_SCHEMA_XSD, "token",
PREFIX_XSD);
- static final QName TYPE_LITERAL_UNSIGNEDBYTE = new QName(NS_SCHEMA_XSD,
"unsignedByte", PREFIX_XSD);
- static final QName TYPE_LITERAL_UNSIGNEDINT = new QName(NS_SCHEMA_XSD,
"unsignedInt", PREFIX_XSD);
- static final QName TYPE_LITERAL_UNSIGNEDLONG = new QName(NS_SCHEMA_XSD,
"unsignedLong", PREFIX_XSD);
- static final QName TYPE_LITERAL_UNSIGNEDSHORT = new QName(NS_SCHEMA_XSD,
"unsignedShort", PREFIX_XSD);
-
- /** Standard SOAP-1.1 encoded XML types */
- static final QName TYPE_SOAP11_ANYSIMPLETYPE = new QName(URI_SOAP11_ENC,
"anySimpleType", PREFIX_SOAP11_ENC);
- static final QName TYPE_SOAP11_ANYTYPE = new QName(URI_SOAP11_ENC,
"anyType", PREFIX_SOAP11_ENC);
- static final QName TYPE_SOAP11_ANYURI = new QName(URI_SOAP11_ENC, "anyURI",
PREFIX_SOAP11_ENC);
- static final QName TYPE_SOAP11_BASE64 = new QName(URI_SOAP11_ENC, "base64",
PREFIX_SOAP11_ENC);
- static final QName TYPE_SOAP11_BASE64BINARY = new QName(URI_SOAP11_ENC,
"base64Binary", PREFIX_SOAP11_ENC);
- static final QName TYPE_SOAP11_BOOLEAN = new QName(URI_SOAP11_ENC,
"boolean", PREFIX_SOAP11_ENC);
- static final QName TYPE_SOAP11_BYTE = new QName(URI_SOAP11_ENC, "byte",
PREFIX_SOAP11_ENC);
- static final QName TYPE_SOAP11_DATE = new QName(URI_SOAP11_ENC, "date",
PREFIX_SOAP11_ENC);
- static final QName TYPE_SOAP11_DATETIME = new QName(URI_SOAP11_ENC,
"dateTime", PREFIX_SOAP11_ENC);
- static final QName TYPE_SOAP11_DECIMAL = new QName(URI_SOAP11_ENC,
"decimal", PREFIX_SOAP11_ENC);
- static final QName TYPE_SOAP11_DOUBLE = new QName(URI_SOAP11_ENC, "double",
PREFIX_SOAP11_ENC);
- static final QName TYPE_SOAP11_DURATION = new QName(URI_SOAP11_ENC,
"duration", PREFIX_SOAP11_ENC);
- static final QName TYPE_SOAP11_FLOAT = new QName(URI_SOAP11_ENC, "float",
PREFIX_SOAP11_ENC);
- static final QName TYPE_SOAP11_GDAY = new QName(URI_SOAP11_ENC, "gDay",
PREFIX_SOAP11_ENC);
- static final QName TYPE_SOAP11_GMONTH = new QName(URI_SOAP11_ENC, "gMonth",
PREFIX_SOAP11_ENC);
- static final QName TYPE_SOAP11_GMONTHDAY = new QName(URI_SOAP11_ENC,
"gMonthDay", PREFIX_SOAP11_ENC);
- static final QName TYPE_SOAP11_GYEAR = new QName(URI_SOAP11_ENC, "gYear",
PREFIX_SOAP11_ENC);
- static final QName TYPE_SOAP11_GYEARMONTH = new QName(URI_SOAP11_ENC,
"gYearMonth", PREFIX_SOAP11_ENC);
- static final QName TYPE_SOAP11_HEXBINARY = new QName(URI_SOAP11_ENC,
"hexBinary", PREFIX_SOAP11_ENC);
- static final QName TYPE_SOAP11_ID = new QName(URI_SOAP11_ENC, "ID",
PREFIX_SOAP11_ENC);
- static final QName TYPE_SOAP11_INT = new QName(URI_SOAP11_ENC, "int",
PREFIX_SOAP11_ENC);
- static final QName TYPE_SOAP11_INTEGER = new QName(URI_SOAP11_ENC,
"integer", PREFIX_SOAP11_ENC);
- static final QName TYPE_SOAP11_LANGUAGE = new QName(URI_SOAP11_ENC,
"language", PREFIX_SOAP11_ENC);
- static final QName TYPE_SOAP11_LONG = new QName(URI_SOAP11_ENC, "long",
PREFIX_SOAP11_ENC);
- static final QName TYPE_SOAP11_NAME = new QName(URI_SOAP11_ENC, "Name",
PREFIX_SOAP11_ENC);
- static final QName TYPE_SOAP11_NCNAME = new QName(URI_SOAP11_ENC, "NCName",
PREFIX_SOAP11_ENC);
- static final QName TYPE_SOAP11_NEGATIVEINTEGER = new QName(URI_SOAP11_ENC,
"negativeInteger", PREFIX_SOAP11_ENC);
- static final QName TYPE_SOAP11_NMTOKEN = new QName(URI_SOAP11_ENC,
"NMTOKEN", PREFIX_SOAP11_ENC);
- static final QName TYPE_SOAP11_NMTOKENS = new QName(URI_SOAP11_ENC,
"NMTOKENS", PREFIX_SOAP11_ENC);
- static final QName TYPE_SOAP11_NONNEGATIVEINTEGER = new QName(URI_SOAP11_ENC,
"nonNegativeInteger", PREFIX_SOAP11_ENC);
- static final QName TYPE_SOAP11_NONPOSITIVEINTEGER = new QName(URI_SOAP11_ENC,
"nonPositiveInteger", PREFIX_SOAP11_ENC);
- static final QName TYPE_SOAP11_NORMALIZEDSTRING = new QName(URI_SOAP11_ENC,
"normalizedString", PREFIX_SOAP11_ENC);
- static final QName TYPE_SOAP11_POSITIVEINTEGER = new QName(URI_SOAP11_ENC,
"positiveInteger", PREFIX_SOAP11_ENC);
- static final QName TYPE_SOAP11_QNAME = new QName(URI_SOAP11_ENC, "QName",
PREFIX_SOAP11_ENC);
- static final QName TYPE_SOAP11_SHORT = new QName(URI_SOAP11_ENC, "short",
PREFIX_SOAP11_ENC);
- static final QName TYPE_SOAP11_STRING = new QName(URI_SOAP11_ENC, "string",
PREFIX_SOAP11_ENC);
- static final QName TYPE_SOAP11_TIME = new QName(URI_SOAP11_ENC, "time",
PREFIX_SOAP11_ENC);
- static final QName TYPE_SOAP11_TOKEN = new QName(URI_SOAP11_ENC, "token",
PREFIX_SOAP11_ENC);
- static final QName TYPE_SOAP11_UNSIGNEDBYTE = new QName(URI_SOAP11_ENC,
"unsignedByte", PREFIX_SOAP11_ENC);
- static final QName TYPE_SOAP11_UNSIGNEDINT = new QName(URI_SOAP11_ENC,
"unsignedInt", PREFIX_SOAP11_ENC);
- static final QName TYPE_SOAP11_UNSIGNEDLONG = new QName(URI_SOAP11_ENC,
"unsignedLong", PREFIX_SOAP11_ENC);
- static final QName TYPE_SOAP11_UNSIGNEDSHORT = new QName(URI_SOAP11_ENC,
"unsignedShort", PREFIX_SOAP11_ENC);
-
- /** Encoded mime type namespace for internall and DII use */
- static final String NS_ATTACHMENT_MIME_TYPE =
"http://www.jboss.org/jbossws/attachment/mimetype";
-
- /** Attachment Types */
- static final QName TYPE_MIME_APPLICATION_XML = new QName(NS_ATTACHMENT_MIME_TYPE,
"application_xml");
- static final QName TYPE_MIME_IMAGE_JPEG = new QName(NS_ATTACHMENT_MIME_TYPE,
"image_jpeg");
- static final QName TYPE_MIME_IMAGE_GIF = new QName(NS_ATTACHMENT_MIME_TYPE,
"image_gif");
- static final QName TYPE_MIME_MULTIPART_MIXED = new QName(NS_ATTACHMENT_MIME_TYPE,
"multipart_mixed");
- static final QName TYPE_MIME_TEXT_PLAIN = new QName(NS_ATTACHMENT_MIME_TYPE,
"text_plain");
- static final QName TYPE_MIME_TEXT_XML = new QName(NS_ATTACHMENT_MIME_TYPE,
"text_xml");
-
- static final QName TYPE_XMIME_DEFAULT = new QName(NS_XML_MIME,
"base64Binary");
-
- /** For out of bound transport (i.e. in headers);
http://www.w3.org/2004/08/wsdl/feature/AD/data */
- static final String WSDL_PROPERTY_APPLICATION_DATA =
"http://www.w3.org/2004/08/wsdl/feature/AD/data";
- /** The key to the original message part name */
- static final String WSDL_PROPERTY_MESSAGE_NAME =
"http://www.jboss.org/jbossws/messagename";
- /** Key to the inbound message name */
- static final String WSDL_PROPERTY_MESSAGE_NAME_IN =
"http://www.jboss.org/jbossws/messagename/in";
- /** Key to the outbound message name */
- static final String WSDL_PROPERTY_MESSAGE_NAME_OUT =
"http://www.jboss.org/jbossws/messagename/out";
- /** Key to the inboudn wsa action */
- static final String WSDL_PROPERTY_ACTION_IN =
"http://www.jboss.org/jbossws/wsa/actionIn";
- /** Key to the outbound wsa action */
- static final String WSDL_PROPERTY_ACTION_OUT =
"http://www.jboss.org/jbossws/wsa/actionOut";
-
- static final String WSDL_PROPERTY_EVENTSOURCE =
"http://www.jboss.org/jbossws/wse/isEventSource";
-
- /** The key to the original message part name */
- static final String WSDL_PROPERTY_PART_NAME =
"http://www.jboss.org/jbossws/partname";
- /** The key to the message part type in case a part does not reference an element;
http://www.jboss.org/jbossws/rpc/xmltype */
- static final String WSDL_PROPERTY_RPC_XMLTYPE =
"http://www.jboss.org/jbossws/rpc/xmltype";
- /** Used as WSDL 2.0 property string to provide support for WSDL 1.1 mime types */
- static final String WSDL_PROPERTY_WSDL11_MIME_TYPE = NS_ATTACHMENT_MIME_TYPE;
- /** Indicate that the operation has zero arguments */
- static final String WSDL_PROPERTY_ZERO_ARGS =
"http://www.jboss.org/jbossws/zero-args";
- /** Indicate that the operation has a void return*/
- static final String WSDL_PROPERTY_VOID_RETURN =
"http://www.jboss.org/jbossws/void-return";
- /** Indicates that an output is a return parameter */
- static final String WSDL_PROPERTY_RETURN_PART =
"http://www.jboss.org/jbossws/return-part";
-
- static final QName WSDL_ATTRIBUTE_WSA_ACTION = new
QName("http://www.w3.org/2005/08/addressing", "Action");
-
- static final QName WSDL_ATTRIBUTE_WSE_EVENTSOURCE = new
QName("http://schemas.xmlsoap.org/ws/2004/08/eventing",
"EventSource");
-
- /** WSDL-2.0 exchange patterns */
- static final String WSDL20_PATTERN_IN_ONLY =
"http://www.w3.org/2004/08/wsdl/in-only";
- static final String WSDL20_PATTERN_ROUST_IN_ONLY =
"http://www.w3.org/2004/08/wsdl/robust-in-only";
- static final String WSDL20_PATTERN_IN_OUT =
"http://www.w3.org/2004/08/wsdl/in-out";
- static final String WSDL20_PATTERN_IN_OPTIONAL_OUT =
"http://www.w3.org/2004/08/wsdl/in-opt-out";
- static final String WSDL20_PATTERN_OUT_ONLY =
"http://www.w3.org/2004/08/wsdl/out-only";
- static final String WSDL20_PATTERN_ROBUST_OUT_ONLY =
"http://www.w3.org/2004/08/wsdl/robust-out-only";
- static final String WSDL20_PATTERN_OUT_IN =
"http://www.w3.org/2004/08/wsdl/out-in";
- static final String WSDL20_PATTERN_OUT_OPT_IN =
"http://www.w3.org/2004/08/wsdl/out-opt-in";
-
- static final String ASYNC_METHOD_SUFFIX = "Async";
-}
Copied: trunk/src/main/java/org/jboss/ws/Constants.java (from rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/Constants.java)
Copied: trunk/src/main/java/org/jboss/ws/core/CommonBinding.java (from rev 1600,
trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/CommonBinding.java)
===================================================================
--- trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/CommonBinding.java 2006-12-07
10:43:36 UTC (rev 1600)
+++ trunk/src/main/java/org/jboss/ws/core/CommonBinding.java 2006-12-07 12:05:41 UTC (rev
1603)
@@ -0,0 +1,53 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ws.core;
+
+// $Id$
+
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.ws.core.jaxrpc.binding.BindingException;
+import org.jboss.ws.core.soap.UnboundHeader;
+import org.jboss.ws.metadata.umdm.OperationMetaData;
+
+/**
+ * The base interface for protocol bindings.
+ *
+ * @author Thomas.Diesler(a)jboss.com
+ * @since 04-Jul-2006
+ */
+public interface CommonBinding
+{
+ /** On the client side, generate the Object from IN parameters. */
+ Object bindRequestMessage(OperationMetaData opMetaData, EndpointInvocation epInv,
Map<QName, UnboundHeader> unboundHeaders) throws BindingException;
+
+ /** On the server side, extract the IN parameters from the Object and populate an
Invocation object */
+ EndpointInvocation unbindRequestMessage(OperationMetaData opMetaData, Object
reqMessage) throws BindingException;
+
+ /** On the server side, generate the Object from OUT parameters in the Invocation
object. */
+ Object bindResponseMessage(OperationMetaData opMetaData, EndpointInvocation epInv)
throws BindingException;
+
+ /** On the client side, extract the OUT parameters from the Object and return them to
the client. */
+ void unbindResponseMessage(OperationMetaData opMetaData, Object resMessage,
EndpointInvocation epInv, Map<QName, UnboundHeader> unboundHeaders) throws
BindingException;
+}
Copied: trunk/src/main/java/org/jboss/ws/core/CommonBindingProvider.java (from rev 1600,
trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/CommonBindingProvider.java)
===================================================================
---
trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/CommonBindingProvider.java 2006-12-07
10:43:36 UTC (rev 1600)
+++ trunk/src/main/java/org/jboss/ws/core/CommonBindingProvider.java 2006-12-07 12:05:41
UTC (rev 1603)
@@ -0,0 +1,76 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ws.core;
+
+// $Id$
+
+import org.jboss.ws.WSException;
+import org.jboss.ws.core.jaxrpc.SOAP11BindingJAXRPC;
+import org.jboss.ws.core.jaxrpc.SOAP12BindingJAXRPC;
+import org.jboss.ws.core.jaxws.binding.SOAP11BindingJAXWS;
+import org.jboss.ws.core.jaxws.binding.SOAP12BindingJAXWS;
+import org.jboss.ws.metadata.umdm.EndpointMetaData;
+import org.jboss.ws.metadata.umdm.EndpointMetaData.Type;
+
+/**
+ * Provides access to the protocol binding.
+ *
+ * @author Thomas.Diesler(a)jboss.com
+ * @since 04-Jul-2006
+ */
+public class CommonBindingProvider
+{
+ protected EndpointMetaData epMetaData;
+ protected CommonBinding binding;
+
+ public CommonBindingProvider(EndpointMetaData epMetaData)
+ {
+ this.epMetaData = epMetaData;
+ initBinding(epMetaData.getBindingId(), epMetaData.getType());
+ }
+
+ public CommonBindingProvider(String bindingId, Type type)
+ {
+ initBinding(bindingId, type);
+ }
+
+ protected void initBinding(String bindingId, Type type)
+ {
+ if (CommonSOAPBinding.SOAP11HTTP_BINDING.equals(bindingId))
+ {
+ binding = (type == Type.JAXWS ? new SOAP11BindingJAXWS() : new
SOAP11BindingJAXRPC());
+ }
+ else if (CommonSOAPBinding.SOAP12HTTP_BINDING.equals(bindingId))
+ {
+ binding = (type == Type.JAXWS ? new SOAP12BindingJAXWS() : new
SOAP12BindingJAXRPC());
+ }
+ else
+ {
+ throw new WSException("Unsupported binding: " + bindingId);
+ }
+ }
+
+ public CommonBinding getCommonBinding()
+ {
+ return binding;
+ }
+}
Modified: trunk/src/main/java/org/jboss/ws/core/CommonClient.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/core/CommonClient.java 2006-12-07 11:54:16 UTC (rev
1602)
+++ trunk/src/main/java/org/jboss/ws/core/CommonClient.java 2006-12-07 12:05:41 UTC (rev
1603)
@@ -39,8 +39,6 @@
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.binding.CommonBinding;
-import org.jboss.ws.core.jaxrpc.binding.CommonBindingProvider;
import org.jboss.ws.core.jaxrpc.handler.HandlerChainBaseImpl;
import org.jboss.ws.core.soap.EndpointInfo;
import org.jboss.ws.core.soap.MessageContextAssociation;
Copied: trunk/src/main/java/org/jboss/ws/core/CommonSOAP11Binding.java (from rev 1600,
trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/CommonSOAP11Binding.java)
===================================================================
---
trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/CommonSOAP11Binding.java 2006-12-07
10:43:36 UTC (rev 1600)
+++ trunk/src/main/java/org/jboss/ws/core/CommonSOAP11Binding.java 2006-12-07 12:05:41 UTC
(rev 1603)
@@ -0,0 +1,63 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ws.core;
+
+// $Id$
+
+import javax.xml.soap.SOAPEnvelope;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPMessage;
+
+import org.jboss.ws.Constants;
+import org.jboss.ws.core.jaxrpc.Use;
+import org.jboss.ws.core.soap.MessageFactoryImpl;
+import org.jboss.ws.metadata.umdm.OperationMetaData;
+
+/**
+ * The SOAP11Binding
+ *
+ * @author Thomas.Diesler(a)jboss.com
+ * @since 04-Jul-2006
+ */
+public abstract class CommonSOAP11Binding extends CommonSOAPBinding
+{
+ public CommonSOAP11Binding()
+ {
+ }
+
+ /** Create the SOAP-1.1 message */
+ protected SOAPMessage createMessage(OperationMetaData opMetaData) throws
SOAPException
+ {
+ MessageFactoryImpl factory = new MessageFactoryImpl();
+ factory.setEnvelopeURI(Constants.NS_SOAP11_ENV);
+ SOAPMessage soapMessage = factory.createMessage();
+
+ Use encStyle = opMetaData.getEndpointMetaData().getEncodingStyle();
+ if (Use.ENCODED.equals(encStyle))
+ {
+ SOAPEnvelope soapEnvelope = soapMessage.getSOAPPart().getEnvelope();
+ soapEnvelope.addNamespaceDeclaration(Constants.PREFIX_SOAP11_ENC,
Constants.URI_SOAP11_ENC);
+ }
+
+ return soapMessage;
+ }
+}
Copied: trunk/src/main/java/org/jboss/ws/core/CommonSOAP12Binding.java (from rev 1600,
trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/CommonSOAP12Binding.java)
===================================================================
---
trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/CommonSOAP12Binding.java 2006-12-07
10:43:36 UTC (rev 1600)
+++ trunk/src/main/java/org/jboss/ws/core/CommonSOAP12Binding.java 2006-12-07 12:05:41 UTC
(rev 1603)
@@ -0,0 +1,53 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ws.core;
+
+// $Id$
+
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPMessage;
+
+import org.jboss.ws.Constants;
+import org.jboss.ws.core.soap.MessageFactoryImpl;
+import org.jboss.ws.metadata.umdm.OperationMetaData;
+
+/**
+ * The SOAP11Binding
+ *
+ * @author Thomas.Diesler(a)jboss.com
+ * @since 04-Jul-2006
+ */
+public abstract class CommonSOAP12Binding extends CommonSOAPBinding
+{
+
+ public CommonSOAP12Binding()
+ {
+ }
+
+ /** Create the SOAP-1.1 message */
+ protected SOAPMessage createMessage(OperationMetaData opMetaData) throws
SOAPException
+ {
+ MessageFactoryImpl factory = new MessageFactoryImpl();
+ factory.setEnvelopeURI(Constants.NS_SOAP12_ENV);
+ return factory.createMessage();
+ }
+}
Copied: trunk/src/main/java/org/jboss/ws/core/CommonSOAPBinding.java (from rev 1600,
trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/CommonSOAPBinding.java)
===================================================================
--- trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/CommonSOAPBinding.java 2006-12-07
10:43:36 UTC (rev 1600)
+++ trunk/src/main/java/org/jboss/ws/core/CommonSOAPBinding.java 2006-12-07 12:05:41 UTC
(rev 1603)
@@ -0,0 +1,906 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, 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;
+
+// $Id$
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
+import javax.activation.DataHandler;
+import javax.xml.namespace.QName;
+import javax.xml.rpc.ParameterMode;
+import javax.xml.soap.AttachmentPart;
+import javax.xml.soap.MessageFactory;
+import javax.xml.soap.Name;
+import javax.xml.soap.SOAPBody;
+import javax.xml.soap.SOAPBodyElement;
+import javax.xml.soap.SOAPElement;
+import javax.xml.soap.SOAPEnvelope;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPFactory;
+import javax.xml.soap.SOAPHeader;
+import javax.xml.soap.SOAPMessage;
+
+import org.apache.xerces.xs.XSElementDeclaration;
+import org.apache.xerces.xs.XSTypeDefinition;
+import org.jboss.logging.Logger;
+import org.jboss.ws.Constants;
+import org.jboss.ws.WSException;
+import org.jboss.ws.core.jaxrpc.ParameterWrapping;
+import org.jboss.ws.core.jaxrpc.StubExt;
+import org.jboss.ws.core.jaxrpc.Style;
+import org.jboss.ws.core.jaxrpc.binding.BindingException;
+import org.jboss.ws.core.soap.MessageContextAssociation;
+import org.jboss.ws.core.soap.MessageFactoryImpl;
+import org.jboss.ws.core.soap.NameImpl;
+import org.jboss.ws.core.soap.SOAPBodyElementDoc;
+import org.jboss.ws.core.soap.SOAPBodyElementRpc;
+import org.jboss.ws.core.soap.SOAPContentElement;
+import org.jboss.ws.core.soap.SOAPElementImpl;
+import org.jboss.ws.core.soap.SOAPFactoryImpl;
+import org.jboss.ws.core.soap.SOAPFaultImpl;
+import org.jboss.ws.core.soap.SOAPHeaderElementImpl;
+import org.jboss.ws.core.soap.SOAPMessageImpl;
+import org.jboss.ws.core.soap.UnboundHeader;
+import org.jboss.ws.core.soap.attachment.AttachmentPartImpl;
+import org.jboss.ws.core.soap.attachment.CIDGenerator;
+import org.jboss.ws.core.utils.DOMUtils;
+import org.jboss.ws.core.utils.JavaUtils;
+import org.jboss.ws.core.utils.MimeUtils;
+import org.jboss.ws.extensions.xop.XOPContext;
+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;
+
+/**
+ * The SOAPBinding interface is an abstraction for the SOAP binding.
+ *
+ * @author Thomas.Diesler(a)jboss.com
+ * @since 04-Jul-2006
+ */
+public abstract class CommonSOAPBinding implements CommonBinding
+{
+ // provide logging
+ private static Logger log = Logger.getLogger(CommonSOAPBinding.class);
+
+ private boolean mtomEnabled;
+
+ /** A constant representing the identity of the SOAP 1.2 over HTTP binding. */
+ public static final String SOAP12HTTP_BINDING =
"http://www.w3.org/2003/05/soap/bindings/HTTP/";
+
+ /** A constant representing the identity of the SOAP 1.1 over HTTP binding. */
+ public static final String SOAP11HTTP_BINDING =
"http://schemas.xmlsoap.org/wsdl/soap/http";
+ private static final Name SOAP_ARRAY_NAME = new NameImpl("Array",
Constants.PREFIX_SOAP11_ENC, Constants.URI_SOAP11_ENC);
+
+ public CommonSOAPBinding()
+ {
+ }
+
+ public MessageFactory getMessageFactory()
+ {
+ return new MessageFactoryImpl();
+ }
+
+ public SOAPFactory getSOAPFactory()
+ {
+ return new SOAPFactoryImpl();
+ }
+
+ public boolean isMTOMEnabled()
+ {
+ return mtomEnabled;
+ }
+
+ public void setMTOMEnabled(boolean flag)
+ {
+ this.mtomEnabled = flag;
+ }
+
+ /** Create the SOAP-1.1 message */
+ protected abstract SOAPMessage createMessage(OperationMetaData opMetaData) throws
SOAPException;
+
+ /** On the client side, generate the payload from IN parameters. */
+ public Object bindRequestMessage(OperationMetaData opMetaData, EndpointInvocation
epInv, Map<QName, UnboundHeader> unboundHeaders) throws BindingException
+ {
+ log.debug("bindRequestMessage: " + opMetaData.getQName());
+
+ try
+ {
+ CommonMessageContext msgContext =
MessageContextAssociation.peekMessageContext();
+ if (msgContext == null)
+ throw new WSException("MessageContext not available");
+
+ // Disable MTOM for rpc/encoded
+ if (opMetaData.isRPCEncoded())
+ msgContext.setProperty(StubExt.PROPERTY_MTOM_ENABLED, Boolean.FALSE);
+
+ // Associate current message with message context
+ SOAPMessageImpl reqMessage = (SOAPMessageImpl)createMessage(opMetaData);
+ msgContext.setSOAPMessage(reqMessage);
+
+ SOAPEnvelope soapEnvelope = reqMessage.getSOAPPart().getEnvelope();
+ SOAPBody soapBody = soapEnvelope.getBody();
+ SOAPHeader soapHeader = soapEnvelope.getHeader();
+
+ // Get the namespace registry
+ NamespaceRegistry namespaceRegistry = msgContext.getNamespaceRegistry();
+
+ Style style = opMetaData.getStyle();
+ if (style == Style.RPC)
+ {
+ QName opQName = opMetaData.getQName();
+ Name opName = new NameImpl(namespaceRegistry.registerQName(opQName));
+
+ log.debug("Create RPC body element: " + opName);
+ SOAPBodyElement soapBodyElement = new SOAPBodyElementRpc(opName);
+
+
+ soapBodyElement =
(SOAPBodyElement)soapBody.addChildElement(soapBodyElement);
+
+ for (ParameterMetaData paramMetaData : opMetaData.getInputParameters())
+ {
+ QName xmlName = paramMetaData.getXmlName();
+ Object value = epInv.getRequestParamValue(xmlName);
+
+ if (paramMetaData.isSwA())
+ {
+ CIDGenerator cidGenerator = reqMessage.getCidGenerator();
+ AttachmentPart part = createAttachmentPart(paramMetaData, value,
cidGenerator);
+ reqMessage.addAttachmentPart(part);
+ }
+ else
+ {
+ SOAPElement soapElement = paramMetaData.isInHeader() ?
(SOAPElement)soapHeader : soapBodyElement;
+ addParameterToMessage(paramMetaData, value, soapElement);
+ }
+ }
+ }
+ else if (style == Style.DOCUMENT)
+ {
+ for (ParameterMetaData paramMetaData : opMetaData.getInputParameters())
+ {
+ QName xmlName = paramMetaData.getXmlName();
+ Object value = epInv.getRequestParamValue(xmlName);
+
+ if (paramMetaData.isSwA())
+ {
+ CIDGenerator cidGenerator = reqMessage.getCidGenerator();
+ AttachmentPart part = createAttachmentPart(paramMetaData, value,
cidGenerator);
+ reqMessage.addAttachmentPart(part);
+ }
+ else
+ {
+ SOAPElement soapElement = paramMetaData.isInHeader() ?
(SOAPElement)soapHeader : soapBody;
+ addParameterToMessage(paramMetaData, value, soapElement);
+ }
+ }
+ }
+ else
+ {
+ throw new WSException("Unsupported message style: " + style);
+ }
+
+ // Add unbound headers
+ if (unboundHeaders != null)
+ {
+ Iterator it = unboundHeaders.values().iterator();
+ while (it.hasNext())
+ {
+ UnboundHeader unboundHeader = (UnboundHeader)it.next();
+ if (unboundHeader.getMode() != ParameterMode.OUT)
+ {
+ QName xmlName = unboundHeader.getXmlName();
+ Object value = unboundHeader.getHeaderValue();
+
+ xmlName = namespaceRegistry.registerQName(xmlName);
+ Name soapName = new NameImpl(xmlName.getLocalPart(),
xmlName.getPrefix(), xmlName.getNamespaceURI());
+
+ log.debug("Add unboundHeader element: " + soapName);
+ SOAPContentElement contentElement = new
SOAPHeaderElementImpl(soapName);
+
contentElement.setParamMetaData(unboundHeader.toParameterMetaData(opMetaData));
+ soapHeader.addChildElement(contentElement);
+ contentElement.setObjectValue(value);
+ }
+ }
+ }
+
+ // Set the SOAPAction
+ setSOAPActionHeader(opMetaData, reqMessage);
+
+ return reqMessage;
+ }
+ catch (Exception e)
+ {
+ handleException(e);
+ return null;
+ }
+ }
+
+ /** Override to set the SOAPAction header */
+ public abstract void setSOAPActionHeader(OperationMetaData opMetaData, SOAPMessage
reqMessage);
+
+ /** On the server side, extract the IN parameters from the payload and populate an
Invocation object */
+ public EndpointInvocation unbindRequestMessage(OperationMetaData opMetaData, Object
payload) throws BindingException
+ {
+ log.debug("unbindRequestMessage: " + opMetaData.getQName());
+
+ try
+ {
+ // Read the SOAPEnvelope from the reqMessage
+ SOAPMessage reqMessage = (SOAPMessage)payload;
+ SOAPEnvelope soapEnvelope = reqMessage.getSOAPPart().getEnvelope();
+ SOAPHeader soapHeader = soapEnvelope.getHeader();
+ SOAPBody soapBody = soapEnvelope.getBody();
+
+ // Verify the SOAP version
+ verifySOAPVersion(opMetaData, soapEnvelope);
+
+ // Construct the endpoint invocation object
+ EndpointInvocation epInv = new EndpointInvocation(opMetaData);
+
+ CommonMessageContext msgContext =
MessageContextAssociation.peekMessageContext();
+ if (msgContext == null)
+ throw new WSException("MessageContext not available");
+
+ // Disable MTOM for rpc/encoded
+ if (opMetaData.isRPCEncoded())
+ msgContext.setProperty(StubExt.PROPERTY_MTOM_ENABLED, Boolean.FALSE);
+
+ // Get the namespace registry
+ NamespaceRegistry namespaceRegistry = msgContext.getNamespaceRegistry();
+
+ if (opMetaData.isMessageEndpoint() == false)
+ {
+ Style style = opMetaData.getStyle();
+ if (style == Style.RPC)
+ {
+ SOAPBodyElement soapBodyElement =
(SOAPBodyElement)soapBody.getChildElements().next();
+ Name elName = soapBodyElement.getElementName();
+
+ QName elQName = new QName(elName.getURI(), elName.getLocalName(),
elName.getPrefix());
+ elQName = namespaceRegistry.registerQName(elQName);
+
+ for (ParameterMetaData paramMetaData : opMetaData.getParameters())
+ {
+ QName xmlName = paramMetaData.getXmlName();
+ if (paramMetaData.getMode() == ParameterMode.OUT)
+ {
+ epInv.setRequestParamValue(xmlName, null);
+ }
+ else
+ {
+ if (paramMetaData.isSwA())
+ {
+ Object value = getAttachmentFromMessage(paramMetaData,
reqMessage);
+ epInv.setRequestParamValue(xmlName, value);
+ }
+ else
+ {
+ if (paramMetaData.isInHeader() == false)
+ {
+ Object value = getParameterFromMessage(paramMetaData,
soapBodyElement, false);
+ epInv.setRequestParamValue(xmlName, value);
+ }
+ else
+ {
+ Object value = getParameterFromMessage(paramMetaData,
soapHeader, false);
+ epInv.setRequestParamValue(xmlName, value);
+ }
+ }
+ }
+ }
+ }
+
+ // Document style
+ else
+ {
+ for (ParameterMetaData paramMetaData : opMetaData.getParameters())
+ {
+ QName xmlName = paramMetaData.getXmlName();
+ if (paramMetaData.isSwA())
+ {
+ Object value = getAttachmentFromMessage(paramMetaData, reqMessage);
+ epInv.setRequestParamValue(xmlName, value);
+ }
+ else
+ {
+ if (paramMetaData.isInHeader())
+ {
+ if (paramMetaData.getMode() == ParameterMode.IN)
+ {
+ Object value = getParameterFromMessage(paramMetaData,
soapHeader, false);
+ epInv.setRequestParamValue(xmlName, value);
+ }
+ else
+ {
+ Object value = getParameterFromMessage(paramMetaData,
soapHeader, true);
+ epInv.setRequestParamValue(xmlName, value);
+ }
+ }
+ else
+ {
+ Object value = getParameterFromMessage(paramMetaData, soapBody,
false);
+ epInv.setRequestParamValue(xmlName, value);
+ }
+ }
+ }
+ }
+ }
+
+ // Generic message endpoint
+ else
+ {
+ for (ParameterMetaData paramMetaData : opMetaData.getParameters())
+ {
+ QName xmlName = paramMetaData.getXmlName();
+ Object value = soapBody.getChildElements().next();
+ epInv.setRequestParamValue(xmlName, value);
+ }
+ }
+
+ return epInv;
+ }
+ catch (Exception e)
+ {
+ handleException(e);
+ return null;
+ }
+ }
+
+ /** On the server side, generate the payload from OUT parameters. */
+ public Object bindResponseMessage(OperationMetaData opMetaData, EndpointInvocation
epInv) throws BindingException
+ {
+ log.debug("bindResponseMessage: " + opMetaData.getQName());
+
+ try
+ {
+ CommonMessageContext msgContext =
MessageContextAssociation.peekMessageContext();
+ if (msgContext == null)
+ throw new WSException("MessageContext not available");
+
+ // Disable MTOM for rpc/encoded
+ if (opMetaData.isRPCEncoded())
+ msgContext.setProperty(StubExt.PROPERTY_MTOM_ENABLED, Boolean.FALSE);
+
+ // Associate current message with message context
+ SOAPMessageImpl resMessage = (SOAPMessageImpl)createMessage(opMetaData);
+ msgContext.setSOAPMessage(resMessage);
+
+ // R2714 For one-way operations, an INSTANCE MUST NOT return a HTTP response
that contains a SOAP envelope.
+ // Specifically, the HTTP response entity-body must be empty.
+ if (opMetaData.isOneWay())
+ {
+ resMessage.getSOAPPart().setContent(null);
+ return resMessage;
+ }
+
+ SOAPEnvelope soapEnvelope = resMessage.getSOAPPart().getEnvelope();
+ SOAPHeader soapHeader = soapEnvelope.getHeader();
+ SOAPBody soapBody = soapEnvelope.getBody();
+
+ // Get the namespace registry
+ NamespaceRegistry namespaceRegistry = msgContext.getNamespaceRegistry();
+
+ Style style = opMetaData.getStyle();
+ if (style == Style.RPC)
+ {
+ QName opQName = opMetaData.getResponseName();
+
+ Name opName = new NameImpl(namespaceRegistry.registerQName(opQName));
+ SOAPBodyElement soapBodyElement = new SOAPBodyElementRpc(opName);
+
+ soapBodyElement =
(SOAPBodyElement)soapBody.addChildElement(soapBodyElement);
+
+ // Add the return to the message
+ ParameterMetaData retMetaData = opMetaData.getReturnParameter();
+ if (retMetaData != null)
+ {
+ Object value = epInv.getReturnValue();
+ if (retMetaData.isSwA())
+ {
+ CIDGenerator cidGenerator = resMessage.getCidGenerator();
+ AttachmentPart part = createAttachmentPart(retMetaData, value,
cidGenerator);
+ resMessage.addAttachmentPart(part);
+ epInv.setReturnValue(part);
+ }
+ else
+ {
+ SOAPContentElement soapElement = addParameterToMessage(retMetaData,
value, soapBodyElement);
+ epInv.setReturnValue(soapElement);
+ soapElement.setObjectValue(value);
+ }
+ }
+
+ // Add the out parameters to the message
+ for (ParameterMetaData paramMetaData : opMetaData.getOutputParameters())
+ {
+ QName xmlName = paramMetaData.getXmlName();
+ Object value = epInv.getResponseParamValue(xmlName);
+ if (paramMetaData.isSwA())
+ {
+ CIDGenerator cidGenerator = resMessage.getCidGenerator();
+ AttachmentPart part = createAttachmentPart(retMetaData, value,
cidGenerator);
+ resMessage.addAttachmentPart(part);
+ }
+ else
+ {
+ if (paramMetaData.isInHeader())
+ {
+ addParameterToMessage(paramMetaData, value, soapHeader);
+ }
+ else
+ {
+ addParameterToMessage(paramMetaData, value, soapBodyElement);
+ }
+ }
+ }
+ }
+ else if (style == Style.DOCUMENT)
+ {
+ ParameterMetaData retMetaData = opMetaData.getReturnParameter();
+ if (retMetaData != null)
+ {
+ Object value = epInv.getReturnValue();
+ if (opMetaData.isDocumentWrapped())
+ value = ParameterWrapping.wrapResponseParameters(retMetaData, value,
epInv.getOutParameters());
+
+ if (retMetaData.isSwA())
+ {
+ CIDGenerator cidGenerator = resMessage.getCidGenerator();
+ AttachmentPart part = createAttachmentPart(retMetaData, value,
cidGenerator);
+ resMessage.addAttachmentPart(part);
+ epInv.setReturnValue(part);
+ }
+ else
+ {
+ SOAPContentElement soapElement = addParameterToMessage(retMetaData,
value, soapBody);
+ epInv.setReturnValue(soapElement);
+ }
+ }
+
+ // Add the out header parameters to the message
+ for (ParameterMetaData paramMetaData : opMetaData.getOutputParameters())
+ {
+ QName xmlName = paramMetaData.getXmlName();
+ if (paramMetaData.isInHeader())
+ {
+ Object value = epInv.getResponseParamValue(xmlName);
+ addParameterToMessage(paramMetaData, value, soapHeader);
+ }
+ }
+ }
+ else
+ {
+ throw new WSException("Unsupported message style: " + style);
+ }
+
+ return resMessage;
+ }
+ catch (Exception e)
+ {
+ handleException(e);
+ return null;
+ }
+ }
+
+ /** On the client side, extract the OUT parameters from the payload and return them to
the client. */
+ public void unbindResponseMessage(OperationMetaData opMetaData, Object payload,
EndpointInvocation epInv, Map<QName, UnboundHeader> unboundHeaders)
+ throws BindingException
+ {
+ log.debug("unbindResponseMessage: " + opMetaData.getQName());
+
+ try
+ {
+ // R2714 For one-way operations, an INSTANCE MUST NOT return a HTTP response
that contains a SOAP envelope.
+ // Specifically, the HTTP response entity-body must be empty.
+ if (opMetaData.isOneWay() == true)
+ {
+ return;
+ }
+
+ // WS-Addressing might redirect the response, which results in an empty
envelope
+ SOAPMessage resMessage = (SOAPMessage)payload;
+ SOAPEnvelope soapEnvelope = resMessage.getSOAPPart().getEnvelope();
+ if (soapEnvelope == null)
+ {
+ return;
+ }
+
+ // Verify the SOAP version
+ verifySOAPVersion(opMetaData, soapEnvelope);
+
+ // Get the SOAP message context that is associated with the current thread
+ CommonMessageContext msgContext =
MessageContextAssociation.peekMessageContext();
+ if (msgContext == null)
+ throw new WSException("MessageContext not available");
+
+ // Disable MTOM for rpc/encoded
+ if (opMetaData.isRPCEncoded())
+ msgContext.setProperty(StubExt.PROPERTY_MTOM_ENABLED, Boolean.FALSE);
+
+ SOAPHeader soapHeader = soapEnvelope.getHeader();
+ SOAPBody soapBody = soapEnvelope.getBody();
+ Iterator bodyChildren = soapBody.getChildElements();
+
+ SOAPBodyElement soapBodyElement = null;
+ if (bodyChildren.hasNext() != false)
+ soapBodyElement = (SOAPBodyElement)bodyChildren.next();
+
+ // Translate the SOAPFault to an exception and throw it
+ if (soapBodyElement instanceof SOAPFaultImpl)
+ throwFaultException((SOAPFaultImpl)soapBodyElement);
+
+ // Extract unbound OUT headers
+ if (unboundHeaders != null)
+ {
+ Map<QName, UnboundHeader> outHeaders = new HashMap<QName,
UnboundHeader>();
+ Iterator itHeaderElements = soapHeader.getChildElements();
+ while (itHeaderElements.hasNext())
+ {
+ SOAPContentElement soapHeaderElement =
(SOAPHeaderElementImpl)itHeaderElements.next();
+ Name elName = soapHeaderElement.getElementName();
+ QName xmlName = new QName(elName.getURI(), elName.getLocalName());
+
+ UnboundHeader unboundHeader = (UnboundHeader)unboundHeaders.get(xmlName);
+ if (unboundHeader != null)
+ {
+
soapHeaderElement.setParamMetaData(unboundHeader.toParameterMetaData(opMetaData));
+
+ // Do the unmarshalling
+ Object value = soapHeaderElement.getObjectValue();
+ unboundHeader.setHeaderValue(value);
+ outHeaders.put(xmlName, unboundHeader);
+ }
+ }
+ unboundHeaders.clear();
+ unboundHeaders.putAll(outHeaders);
+ }
+
+ Style style = opMetaData.getStyle();
+ if (style == Style.RPC)
+ {
+ if (soapBodyElement == null)
+ throw new WSException("Cannot unbind response message with empty soap
body");
+
+ ParameterMetaData retMetaData = opMetaData.getReturnParameter();
+ if (retMetaData != null)
+ {
+ if (retMetaData.isSwA())
+ {
+ Object value = getAttachmentFromMessage(retMetaData, resMessage);
+ epInv.setReturnValue(value);
+ }
+ else
+ {
+ Object value = getParameterFromMessage(retMetaData, soapBodyElement,
false);
+ epInv.setReturnValue(value);
+ }
+ }
+
+ for (ParameterMetaData paramMetaData : opMetaData.getOutputParameters())
+ {
+ QName xmlName = paramMetaData.getXmlName();
+ if (paramMetaData.isSwA())
+ {
+ Object value = getAttachmentFromMessage(paramMetaData, resMessage);
+ epInv.setResponseParamValue(xmlName, value);
+ }
+ else
+ {
+ SOAPElement soapElement = paramMetaData.isInHeader() ? soapHeader :
(SOAPElement)soapBodyElement;
+ Object value = getParameterFromMessage(paramMetaData, soapElement,
false);
+ epInv.setResponseParamValue(xmlName, value);
+ }
+ }
+ }
+ else if (style == Style.DOCUMENT)
+ {
+ ParameterMetaData retMetaData = opMetaData.getReturnParameter();
+
+ // WS-Eventing has no message part for UnsubscribeResponseMsg
+ if (retMetaData != null)
+ {
+ if (retMetaData.isSwA())
+ {
+ Object value = getAttachmentFromMessage(retMetaData, resMessage);
+ epInv.setReturnValue(value);
+ }
+ else
+ {
+ Object value = getParameterFromMessage(retMetaData, soapBody, false);
+ epInv.setReturnValue(value);
+ }
+
+ for (ParameterMetaData paramMetaData : opMetaData.getOutputParameters())
+ {
+ QName xmlName = paramMetaData.getXmlName();
+ if (paramMetaData.isInHeader())
+ {
+ Object value = getParameterFromMessage(paramMetaData, soapHeader,
false);
+ epInv.setResponseParamValue(xmlName, value);
+ }
+ }
+ }
+ }
+ else
+ {
+ throw new WSException("Unsupported message style: " + style);
+ }
+ }
+ catch (Exception e)
+ {
+ handleException(e);
+ }
+ }
+
+ public abstract SOAPMessage exceptionToFaultMessage(Exception ex);
+
+ private void verifySOAPVersion(OperationMetaData opMetaData, SOAPEnvelope
soapEnvelope)
+ {
+ String envNS = soapEnvelope.getNamespaceURI();
+ String bindingId = opMetaData.getEndpointMetaData().getBindingId();
+ if (CommonSOAPBinding.SOAP11HTTP_BINDING.equals(bindingId) &&
Constants.NS_SOAP11_ENV.equals(envNS) == false)
+ log.warn("Expected SOAP-1.1 envelope, but got: " + envNS);
+
+ if (CommonSOAPBinding.SOAP12HTTP_BINDING.equals(bindingId) &&
Constants.NS_SOAP12_ENV.equals(envNS) == false)
+ log.warn("Expected SOAP-1.2 envelope, but got: " + envNS);
+ }
+
+ private AttachmentPart createAttachmentPart(ParameterMetaData paramMetaData, Object
value, CIDGenerator cidGenerator) throws SOAPException, BindingException
+ {
+ String partName = paramMetaData.getXmlName().getLocalPart();
+ Set mimeTypes = paramMetaData.getMimeTypes();
+
+ AttachmentPart part = new AttachmentPartImpl();
+ if (value instanceof DataHandler)
+ {
+ DataHandler handler = (DataHandler)value;
+ String mimeType = MimeUtils.getBaseMimeType(handler.getContentType());
+
+ if (mimeTypes != null && !MimeUtils.isMemberOf(mimeType, mimeTypes))
+ throw new BindingException("Mime type " + mimeType + " not
allowed for parameter " + partName + " allowed types are " + mimeTypes);
+
+ part.setDataHandler((DataHandler)value);
+ }
+ else
+ {
+ String mimeType = null;
+ if (mimeTypes != null && mimeTypes.size() > 0)
+ {
+ mimeType = (String)mimeTypes.iterator().next();
+ }
+ else
+ {
+ mimeType = MimeUtils.resolveMimeType(value);
+ }
+
+ if (mimeType == null)
+ throw new BindingException("Could not determine mime type for attachment
parameter: " + partName);
+
+ part.setContent(value, mimeType);
+ }
+
+ if (paramMetaData.isSwA())
+ {
+ String swaCID = '<' + partName + "=" +
cidGenerator.generateFromCount() + '>';
+ part.setContentId(swaCID);
+ }
+ if (paramMetaData.isXOP())
+ {
+ String xopCID = '<' + cidGenerator.generateFromName(partName) +
'>';
+ part.setContentId(xopCID);
+ }
+
+ return part;
+ }
+
+ private Object getAttachmentFromMessage(ParameterMetaData paramMetaData, SOAPMessage
message) throws SOAPException, BindingException
+ {
+ QName xmlName = paramMetaData.getXmlName();
+
+ AttachmentPart part =
((SOAPMessageImpl)message).getAttachmentByPartName(xmlName.getLocalPart());
+ if (part == null)
+ throw new BindingException("Could not locate attachment for parameter:
" + paramMetaData.getXmlName());
+
+ return part;
+ }
+
+ /** Marshall the given parameter and add it to the SOAPMessage */
+ private SOAPContentElement addParameterToMessage(ParameterMetaData paramMetaData,
Object value, SOAPElement soapElement) throws SOAPException, BindingException
+ {
+ QName xmlName = paramMetaData.getXmlName();
+ Class javaType = paramMetaData.getJavaType();
+
+ if (value != null && paramMetaData.isXOP() == false)
+ {
+ Class valueType = value.getClass();
+ if (JavaUtils.isAssignableFrom(javaType, valueType) == false)
+ throw new BindingException("javaType " + javaType.getName() +
" is not assignable from: " + valueType.getName());
+ }
+
+ // Make sure we have a prefix on qualified names
+ if (xmlName.getNamespaceURI().length() > 0)
+ {
+ CommonMessageContext msgContext =
MessageContextAssociation.peekMessageContext();
+ NamespaceRegistry namespaceRegistry = msgContext.getNamespaceRegistry();
+ xmlName = namespaceRegistry.registerQName(xmlName);
+ }
+
+ Name soapName = new NameImpl(xmlName.getLocalPart(), xmlName.getPrefix(),
xmlName.getNamespaceURI());
+ if (paramMetaData.isSOAPArrayParam())
+ soapName = new NameImpl("Array", Constants.PREFIX_SOAP11_ENC,
Constants.URI_SOAP11_ENC);
+
+ SOAPContentElement contentElement;
+ if (soapElement instanceof SOAPHeader)
+ {
+ contentElement = new SOAPHeaderElementImpl(soapName);
+ soapElement.addChildElement(contentElement);
+ }
+ else
+ {
+ Style style = paramMetaData.getOperationMetaData().getStyle();
+ if (style == Style.DOCUMENT)
+ {
+ contentElement = new SOAPBodyElementDoc(soapName);
+ soapElement.addChildElement(contentElement);
+ }
+ else
+ {
+ contentElement = new SOAPContentElement(soapName);
+ soapElement.addChildElement(contentElement);
+ }
+ }
+
+ contentElement.setParamMetaData(paramMetaData);
+
+ if (paramMetaData.isSOAPArrayParam())
+ {
+ log.trace("Add parameter as SOAP encoded Array");
+ contentElement.addNamespaceDeclaration(Constants.PREFIX_SOAP11_ENC,
Constants.URI_SOAP11_ENC);
+ }
+
+ // When a potential xop parameter is detected and MTOM is enabled
+ // we flag the SOAP message as a XOP package
+ if (paramMetaData.isXOP() && XOPContext.isMTOMEnabled())
+ {
+ log.trace("Add parameter as XOP");
+ CommonMessageContext msgContext =
MessageContextAssociation.peekMessageContext();
+ SOAPMessageImpl soapMessage = (SOAPMessageImpl)msgContext.getSOAPMessage();
+ soapMessage.setXOPMessage(true);
+ }
+
+ contentElement.setObjectValue(value);
+
+ return contentElement;
+ }
+
+ /** Unmarshall a message element and add it to the parameter list */
+ private Object getParameterFromMessage(ParameterMetaData paramMetaData, SOAPElement
soapElement, boolean optional) throws BindingException
+ {
+ Name xmlName = new NameImpl(paramMetaData.getXmlName());
+
+ SOAPContentElement soapContentElement = null;
+ Iterator childElements = soapElement.getChildElements();
+ while (childElements.hasNext())
+ {
+ SOAPElementImpl childElement = (SOAPElementImpl)childElements.next();
+
+ // If this message was manipulated by a handler the child may not be a content
element
+ if (!(childElement instanceof SOAPContentElement))
+ childElement = (SOAPContentElement)soapElement.replaceChild(new
SOAPContentElement(childElement), childElement);
+
+ // The parameters are expected to be lazy
+ SOAPContentElement aux = (SOAPContentElement)childElement;
+ Name elName = aux.getElementName();
+
+ if (xmlName.equals(elName))
+ {
+ soapContentElement = aux;
+ soapContentElement.setParamMetaData(paramMetaData);
+ break;
+ }
+
+ if (SOAP_ARRAY_NAME.equals(elName))
+ {
+ CommonMessageContext msgContext =
MessageContextAssociation.peekMessageContext();
+ msgContext.setProperty(CommonMessageContext.ALLOW_EXPAND_TO_DOM,
Boolean.TRUE);
+ try
+ {
+ QName compXMLName = paramMetaData.getXmlName();
+ Element compElement = DOMUtils.getFirstChildElement(aux);
+ if (compElement.getNodeName().equals(compXMLName.getLocalPart()))
+ {
+ soapContentElement = aux;
+ soapContentElement.setParamMetaData(paramMetaData);
+ break;
+ }
+ }
+ finally
+ {
+ msgContext.removeProperty(CommonMessageContext.ALLOW_EXPAND_TO_DOM);
+ }
+ }
+ }
+
+ // If matching by name fails, try to match by xmlType
+ // This maybe necessary when wsa:Action dispatches to the operation
+ if (soapContentElement == null)
+ {
+ childElements = soapElement.getChildElements();
+ OperationMetaData opMetaData = paramMetaData.getOperationMetaData();
+ TypesMetaData typesMetaData =
opMetaData.getEndpointMetaData().getServiceMetaData().getTypesMetaData();
+ if (childElements.hasNext() && opMetaData.getStyle() == Style.DOCUMENT)
+ {
+ SOAPElementImpl childElement = (SOAPElementImpl)childElements.next();
+
+ // The parameters are expected to be lazy
+ SOAPContentElement aux = (SOAPContentElement)childElement;
+ Name elName = aux.getElementName();
+ QName elType = null;
+
+ XSElementDeclaration xsdElement =
typesMetaData.getSchemaModel().getElementDeclaration(elName.getLocalName(),
elName.getURI());
+ if (xsdElement != null && xsdElement.getTypeDefinition() != null)
+ {
+ XSTypeDefinition xsdType = xsdElement.getTypeDefinition();
+ elType = new QName(xsdType.getNamespace(), xsdType.getName());
+ }
+
+ if (paramMetaData.getXmlType().equals(elType))
+ {
+ soapContentElement = aux;
+ soapContentElement.setParamMetaData(paramMetaData);
+ }
+ }
+ }
+
+ if (soapContentElement == null && optional == false)
+ throw new WSException("Cannot find child element: " + xmlName);
+
+ // When a potential XOP parameter is detected and
+ // the incomming request is actuall XOP encoded we flag
+ // the SOAP message a XOP packaged.
+ if (paramMetaData.isXOP() && XOPContext.isXOPEncodedRequest())
+ {
+ SOAPMessageImpl soapMessage =
(SOAPMessageImpl)MessageContextAssociation.peekMessageContext().getSOAPMessage();
+ soapMessage.setXOPMessage(true);
+ }
+ return soapContentElement;
+ }
+
+ abstract protected void throwFaultException(SOAPFaultImpl fault) throws Exception;
+
+ private void handleException(Exception ex) throws BindingException
+ {
+ if (ex instanceof RuntimeException)
+ throw (RuntimeException)ex;
+
+ if (ex instanceof BindingException)
+ throw (BindingException)ex;
+
+ throw new BindingException(ex);
+ }
+}
Modified: trunk/src/main/java/org/jboss/ws/core/jaxrpc/SOAP11BindingJAXRPC.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/core/jaxrpc/SOAP11BindingJAXRPC.java 2006-12-07
11:54:16 UTC (rev 1602)
+++ trunk/src/main/java/org/jboss/ws/core/jaxrpc/SOAP11BindingJAXRPC.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -25,7 +25,7 @@
import javax.xml.soap.SOAPMessage;
-import org.jboss.ws.core.jaxrpc.binding.CommonSOAP11Binding;
+import org.jboss.ws.core.CommonSOAP11Binding;
import org.jboss.ws.core.soap.SOAPFaultImpl;
import org.jboss.ws.metadata.umdm.OperationMetaData;
Modified: trunk/src/main/java/org/jboss/ws/core/jaxrpc/SOAP12BindingJAXRPC.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/core/jaxrpc/SOAP12BindingJAXRPC.java 2006-12-07
11:54:16 UTC (rev 1602)
+++ trunk/src/main/java/org/jboss/ws/core/jaxrpc/SOAP12BindingJAXRPC.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -25,7 +25,7 @@
import javax.xml.soap.SOAPMessage;
-import org.jboss.ws.core.jaxrpc.binding.CommonSOAP12Binding;
+import org.jboss.ws.core.CommonSOAP12Binding;
import org.jboss.ws.core.soap.SOAPFaultImpl;
import org.jboss.ws.metadata.umdm.OperationMetaData;
Deleted: trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/CommonBinding.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/CommonBinding.java 2006-12-07
11:54:16 UTC (rev 1602)
+++ trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/CommonBinding.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -1,53 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.ws.core.jaxrpc.binding;
-
-// $Id$
-
-import java.util.Map;
-
-import javax.xml.namespace.QName;
-
-import org.jboss.ws.core.EndpointInvocation;
-import org.jboss.ws.core.soap.UnboundHeader;
-import org.jboss.ws.metadata.umdm.OperationMetaData;
-
-/**
- * The base interface for protocol bindings.
- *
- * @author Thomas.Diesler(a)jboss.com
- * @since 04-Jul-2006
- */
-public interface CommonBinding
-{
- /** On the client side, generate the Object from IN parameters. */
- Object bindRequestMessage(OperationMetaData opMetaData, EndpointInvocation epInv,
Map<QName, UnboundHeader> unboundHeaders) throws BindingException;
-
- /** On the server side, extract the IN parameters from the Object and populate an
Invocation object */
- EndpointInvocation unbindRequestMessage(OperationMetaData opMetaData, Object
reqMessage) throws BindingException;
-
- /** On the server side, generate the Object from OUT parameters in the Invocation
object. */
- Object bindResponseMessage(OperationMetaData opMetaData, EndpointInvocation epInv)
throws BindingException;
-
- /** On the client side, extract the OUT parameters from the Object and return them to
the client. */
- void unbindResponseMessage(OperationMetaData opMetaData, Object resMessage,
EndpointInvocation epInv, Map<QName, UnboundHeader> unboundHeaders) throws
BindingException;
-}
Deleted: trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/CommonBindingProvider.java
===================================================================
---
trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/CommonBindingProvider.java 2006-12-07
11:54:16 UTC (rev 1602)
+++
trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/CommonBindingProvider.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -1,76 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.ws.core.jaxrpc.binding;
-
-// $Id$
-
-import org.jboss.ws.WSException;
-import org.jboss.ws.core.jaxrpc.SOAP11BindingJAXRPC;
-import org.jboss.ws.core.jaxrpc.SOAP12BindingJAXRPC;
-import org.jboss.ws.core.jaxws.binding.SOAP11BindingJAXWS;
-import org.jboss.ws.core.jaxws.binding.SOAP12BindingJAXWS;
-import org.jboss.ws.metadata.umdm.EndpointMetaData;
-import org.jboss.ws.metadata.umdm.EndpointMetaData.Type;
-
-/**
- * Provides access to the protocol binding.
- *
- * @author Thomas.Diesler(a)jboss.com
- * @since 04-Jul-2006
- */
-public class CommonBindingProvider
-{
- protected EndpointMetaData epMetaData;
- protected CommonBinding binding;
-
- public CommonBindingProvider(EndpointMetaData epMetaData)
- {
- this.epMetaData = epMetaData;
- initBinding(epMetaData.getBindingId(), epMetaData.getType());
- }
-
- public CommonBindingProvider(String bindingId, Type type)
- {
- initBinding(bindingId, type);
- }
-
- protected void initBinding(String bindingId, Type type)
- {
- if (CommonSOAPBinding.SOAP11HTTP_BINDING.equals(bindingId))
- {
- binding = (type == Type.JAXWS ? new SOAP11BindingJAXWS() : new
SOAP11BindingJAXRPC());
- }
- else if (CommonSOAPBinding.SOAP12HTTP_BINDING.equals(bindingId))
- {
- binding = (type == Type.JAXWS ? new SOAP12BindingJAXWS() : new
SOAP12BindingJAXRPC());
- }
- else
- {
- throw new WSException("Unsupported binding: " + bindingId);
- }
- }
-
- public CommonBinding getCommonBinding()
- {
- return binding;
- }
-}
Deleted: trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/CommonSOAP11Binding.java
===================================================================
---
trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/CommonSOAP11Binding.java 2006-12-07
11:54:16 UTC (rev 1602)
+++
trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/CommonSOAP11Binding.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -1,63 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.ws.core.jaxrpc.binding;
-
-// $Id$
-
-import javax.xml.soap.SOAPEnvelope;
-import javax.xml.soap.SOAPException;
-import javax.xml.soap.SOAPMessage;
-
-import org.jboss.ws.Constants;
-import org.jboss.ws.core.jaxrpc.Use;
-import org.jboss.ws.core.soap.MessageFactoryImpl;
-import org.jboss.ws.metadata.umdm.OperationMetaData;
-
-/**
- * The SOAP11Binding
- *
- * @author Thomas.Diesler(a)jboss.com
- * @since 04-Jul-2006
- */
-public abstract class CommonSOAP11Binding extends CommonSOAPBinding
-{
- public CommonSOAP11Binding()
- {
- }
-
- /** Create the SOAP-1.1 message */
- protected SOAPMessage createMessage(OperationMetaData opMetaData) throws
SOAPException
- {
- MessageFactoryImpl factory = new MessageFactoryImpl();
- factory.setEnvelopeURI(Constants.NS_SOAP11_ENV);
- SOAPMessage soapMessage = factory.createMessage();
-
- Use encStyle = opMetaData.getEndpointMetaData().getEncodingStyle();
- if (Use.ENCODED.equals(encStyle))
- {
- SOAPEnvelope soapEnvelope = soapMessage.getSOAPPart().getEnvelope();
- soapEnvelope.addNamespaceDeclaration(Constants.PREFIX_SOAP11_ENC,
Constants.URI_SOAP11_ENC);
- }
-
- return soapMessage;
- }
-}
Deleted: trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/CommonSOAP12Binding.java
===================================================================
---
trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/CommonSOAP12Binding.java 2006-12-07
11:54:16 UTC (rev 1602)
+++
trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/CommonSOAP12Binding.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -1,53 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.ws.core.jaxrpc.binding;
-
-// $Id$
-
-import javax.xml.soap.SOAPException;
-import javax.xml.soap.SOAPMessage;
-
-import org.jboss.ws.Constants;
-import org.jboss.ws.core.soap.MessageFactoryImpl;
-import org.jboss.ws.metadata.umdm.OperationMetaData;
-
-/**
- * The SOAP11Binding
- *
- * @author Thomas.Diesler(a)jboss.com
- * @since 04-Jul-2006
- */
-public abstract class CommonSOAP12Binding extends CommonSOAPBinding
-{
-
- public CommonSOAP12Binding()
- {
- }
-
- /** Create the SOAP-1.1 message */
- protected SOAPMessage createMessage(OperationMetaData opMetaData) throws
SOAPException
- {
- MessageFactoryImpl factory = new MessageFactoryImpl();
- factory.setEnvelopeURI(Constants.NS_SOAP12_ENV);
- return factory.createMessage();
- }
-}
Deleted: trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/CommonSOAPBinding.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/CommonSOAPBinding.java 2006-12-07
11:54:16 UTC (rev 1602)
+++ trunk/src/main/java/org/jboss/ws/core/jaxrpc/binding/CommonSOAPBinding.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -1,907 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.ws.core.jaxrpc.binding;
-
-// $Id$
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-
-import javax.activation.DataHandler;
-import javax.xml.namespace.QName;
-import javax.xml.rpc.ParameterMode;
-import javax.xml.soap.AttachmentPart;
-import javax.xml.soap.MessageFactory;
-import javax.xml.soap.Name;
-import javax.xml.soap.SOAPBody;
-import javax.xml.soap.SOAPBodyElement;
-import javax.xml.soap.SOAPElement;
-import javax.xml.soap.SOAPEnvelope;
-import javax.xml.soap.SOAPException;
-import javax.xml.soap.SOAPFactory;
-import javax.xml.soap.SOAPHeader;
-import javax.xml.soap.SOAPMessage;
-
-import org.apache.xerces.xs.XSElementDeclaration;
-import org.apache.xerces.xs.XSTypeDefinition;
-import org.jboss.logging.Logger;
-import org.jboss.ws.Constants;
-import org.jboss.ws.WSException;
-import org.jboss.ws.core.CommonMessageContext;
-import org.jboss.ws.core.EndpointInvocation;
-import org.jboss.ws.core.jaxrpc.ParameterWrapping;
-import org.jboss.ws.core.jaxrpc.StubExt;
-import org.jboss.ws.core.jaxrpc.Style;
-import org.jboss.ws.core.soap.MessageContextAssociation;
-import org.jboss.ws.core.soap.MessageFactoryImpl;
-import org.jboss.ws.core.soap.NameImpl;
-import org.jboss.ws.core.soap.SOAPBodyElementDoc;
-import org.jboss.ws.core.soap.SOAPBodyElementRpc;
-import org.jboss.ws.core.soap.SOAPContentElement;
-import org.jboss.ws.core.soap.SOAPElementImpl;
-import org.jboss.ws.core.soap.SOAPFactoryImpl;
-import org.jboss.ws.core.soap.SOAPFaultImpl;
-import org.jboss.ws.core.soap.SOAPHeaderElementImpl;
-import org.jboss.ws.core.soap.SOAPMessageImpl;
-import org.jboss.ws.core.soap.UnboundHeader;
-import org.jboss.ws.core.soap.attachment.AttachmentPartImpl;
-import org.jboss.ws.core.soap.attachment.CIDGenerator;
-import org.jboss.ws.core.utils.DOMUtils;
-import org.jboss.ws.core.utils.JavaUtils;
-import org.jboss.ws.core.utils.MimeUtils;
-import org.jboss.ws.extensions.xop.XOPContext;
-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;
-
-/**
- * The SOAPBinding interface is an abstraction for the SOAP binding.
- *
- * @author Thomas.Diesler(a)jboss.com
- * @since 04-Jul-2006
- */
-public abstract class CommonSOAPBinding implements CommonBinding
-{
- // provide logging
- private static Logger log = Logger.getLogger(CommonSOAPBinding.class);
-
- private boolean mtomEnabled;
-
- /** A constant representing the identity of the SOAP 1.2 over HTTP binding. */
- public static final String SOAP12HTTP_BINDING =
"http://www.w3.org/2003/05/soap/bindings/HTTP/";
-
- /** A constant representing the identity of the SOAP 1.1 over HTTP binding. */
- public static final String SOAP11HTTP_BINDING =
"http://schemas.xmlsoap.org/wsdl/soap/http";
- private static final Name SOAP_ARRAY_NAME = new NameImpl("Array",
Constants.PREFIX_SOAP11_ENC, Constants.URI_SOAP11_ENC);
-
- public CommonSOAPBinding()
- {
- }
-
- public MessageFactory getMessageFactory()
- {
- return new MessageFactoryImpl();
- }
-
- public SOAPFactory getSOAPFactory()
- {
- return new SOAPFactoryImpl();
- }
-
- public boolean isMTOMEnabled()
- {
- return mtomEnabled;
- }
-
- public void setMTOMEnabled(boolean flag)
- {
- this.mtomEnabled = flag;
- }
-
- /** Create the SOAP-1.1 message */
- protected abstract SOAPMessage createMessage(OperationMetaData opMetaData) throws
SOAPException;
-
- /** On the client side, generate the payload from IN parameters. */
- public Object bindRequestMessage(OperationMetaData opMetaData, EndpointInvocation
epInv, Map<QName, UnboundHeader> unboundHeaders) throws BindingException
- {
- log.debug("bindRequestMessage: " + opMetaData.getQName());
-
- try
- {
- CommonMessageContext msgContext =
MessageContextAssociation.peekMessageContext();
- if (msgContext == null)
- throw new WSException("MessageContext not available");
-
- // Disable MTOM for rpc/encoded
- if (opMetaData.isRPCEncoded())
- msgContext.setProperty(StubExt.PROPERTY_MTOM_ENABLED, Boolean.FALSE);
-
- // Associate current message with message context
- SOAPMessageImpl reqMessage = (SOAPMessageImpl)createMessage(opMetaData);
- msgContext.setSOAPMessage(reqMessage);
-
- SOAPEnvelope soapEnvelope = reqMessage.getSOAPPart().getEnvelope();
- SOAPBody soapBody = soapEnvelope.getBody();
- SOAPHeader soapHeader = soapEnvelope.getHeader();
-
- // Get the namespace registry
- NamespaceRegistry namespaceRegistry = msgContext.getNamespaceRegistry();
-
- Style style = opMetaData.getStyle();
- if (style == Style.RPC)
- {
- QName opQName = opMetaData.getQName();
- Name opName = new NameImpl(namespaceRegistry.registerQName(opQName));
-
- log.debug("Create RPC body element: " + opName);
- SOAPBodyElement soapBodyElement = new SOAPBodyElementRpc(opName);
-
-
- soapBodyElement =
(SOAPBodyElement)soapBody.addChildElement(soapBodyElement);
-
- for (ParameterMetaData paramMetaData : opMetaData.getInputParameters())
- {
- QName xmlName = paramMetaData.getXmlName();
- Object value = epInv.getRequestParamValue(xmlName);
-
- if (paramMetaData.isSwA())
- {
- CIDGenerator cidGenerator = reqMessage.getCidGenerator();
- AttachmentPart part = createAttachmentPart(paramMetaData, value,
cidGenerator);
- reqMessage.addAttachmentPart(part);
- }
- else
- {
- SOAPElement soapElement = paramMetaData.isInHeader() ?
(SOAPElement)soapHeader : soapBodyElement;
- addParameterToMessage(paramMetaData, value, soapElement);
- }
- }
- }
- else if (style == Style.DOCUMENT)
- {
- for (ParameterMetaData paramMetaData : opMetaData.getInputParameters())
- {
- QName xmlName = paramMetaData.getXmlName();
- Object value = epInv.getRequestParamValue(xmlName);
-
- if (paramMetaData.isSwA())
- {
- CIDGenerator cidGenerator = reqMessage.getCidGenerator();
- AttachmentPart part = createAttachmentPart(paramMetaData, value,
cidGenerator);
- reqMessage.addAttachmentPart(part);
- }
- else
- {
- SOAPElement soapElement = paramMetaData.isInHeader() ?
(SOAPElement)soapHeader : soapBody;
- addParameterToMessage(paramMetaData, value, soapElement);
- }
- }
- }
- else
- {
- throw new WSException("Unsupported message style: " + style);
- }
-
- // Add unbound headers
- if (unboundHeaders != null)
- {
- Iterator it = unboundHeaders.values().iterator();
- while (it.hasNext())
- {
- UnboundHeader unboundHeader = (UnboundHeader)it.next();
- if (unboundHeader.getMode() != ParameterMode.OUT)
- {
- QName xmlName = unboundHeader.getXmlName();
- Object value = unboundHeader.getHeaderValue();
-
- xmlName = namespaceRegistry.registerQName(xmlName);
- Name soapName = new NameImpl(xmlName.getLocalPart(),
xmlName.getPrefix(), xmlName.getNamespaceURI());
-
- log.debug("Add unboundHeader element: " + soapName);
- SOAPContentElement contentElement = new
SOAPHeaderElementImpl(soapName);
-
contentElement.setParamMetaData(unboundHeader.toParameterMetaData(opMetaData));
- soapHeader.addChildElement(contentElement);
- contentElement.setObjectValue(value);
- }
- }
- }
-
- // Set the SOAPAction
- setSOAPActionHeader(opMetaData, reqMessage);
-
- return reqMessage;
- }
- catch (Exception e)
- {
- handleException(e);
- return null;
- }
- }
-
- /** Override to set the SOAPAction header */
- public abstract void setSOAPActionHeader(OperationMetaData opMetaData, SOAPMessage
reqMessage);
-
- /** On the server side, extract the IN parameters from the payload and populate an
Invocation object */
- public EndpointInvocation unbindRequestMessage(OperationMetaData opMetaData, Object
payload) throws BindingException
- {
- log.debug("unbindRequestMessage: " + opMetaData.getQName());
-
- try
- {
- // Read the SOAPEnvelope from the reqMessage
- SOAPMessage reqMessage = (SOAPMessage)payload;
- SOAPEnvelope soapEnvelope = reqMessage.getSOAPPart().getEnvelope();
- SOAPHeader soapHeader = soapEnvelope.getHeader();
- SOAPBody soapBody = soapEnvelope.getBody();
-
- // Verify the SOAP version
- verifySOAPVersion(opMetaData, soapEnvelope);
-
- // Construct the endpoint invocation object
- EndpointInvocation epInv = new EndpointInvocation(opMetaData);
-
- CommonMessageContext msgContext =
MessageContextAssociation.peekMessageContext();
- if (msgContext == null)
- throw new WSException("MessageContext not available");
-
- // Disable MTOM for rpc/encoded
- if (opMetaData.isRPCEncoded())
- msgContext.setProperty(StubExt.PROPERTY_MTOM_ENABLED, Boolean.FALSE);
-
- // Get the namespace registry
- NamespaceRegistry namespaceRegistry = msgContext.getNamespaceRegistry();
-
- if (opMetaData.isMessageEndpoint() == false)
- {
- Style style = opMetaData.getStyle();
- if (style == Style.RPC)
- {
- SOAPBodyElement soapBodyElement =
(SOAPBodyElement)soapBody.getChildElements().next();
- Name elName = soapBodyElement.getElementName();
-
- QName elQName = new QName(elName.getURI(), elName.getLocalName(),
elName.getPrefix());
- elQName = namespaceRegistry.registerQName(elQName);
-
- for (ParameterMetaData paramMetaData : opMetaData.getParameters())
- {
- QName xmlName = paramMetaData.getXmlName();
- if (paramMetaData.getMode() == ParameterMode.OUT)
- {
- epInv.setRequestParamValue(xmlName, null);
- }
- else
- {
- if (paramMetaData.isSwA())
- {
- Object value = getAttachmentFromMessage(paramMetaData,
reqMessage);
- epInv.setRequestParamValue(xmlName, value);
- }
- else
- {
- if (paramMetaData.isInHeader() == false)
- {
- Object value = getParameterFromMessage(paramMetaData,
soapBodyElement, false);
- epInv.setRequestParamValue(xmlName, value);
- }
- else
- {
- Object value = getParameterFromMessage(paramMetaData,
soapHeader, false);
- epInv.setRequestParamValue(xmlName, value);
- }
- }
- }
- }
- }
-
- // Document style
- else
- {
- for (ParameterMetaData paramMetaData : opMetaData.getParameters())
- {
- QName xmlName = paramMetaData.getXmlName();
- if (paramMetaData.isSwA())
- {
- Object value = getAttachmentFromMessage(paramMetaData, reqMessage);
- epInv.setRequestParamValue(xmlName, value);
- }
- else
- {
- if (paramMetaData.isInHeader())
- {
- if (paramMetaData.getMode() == ParameterMode.IN)
- {
- Object value = getParameterFromMessage(paramMetaData,
soapHeader, false);
- epInv.setRequestParamValue(xmlName, value);
- }
- else
- {
- Object value = getParameterFromMessage(paramMetaData,
soapHeader, true);
- epInv.setRequestParamValue(xmlName, value);
- }
- }
- else
- {
- Object value = getParameterFromMessage(paramMetaData, soapBody,
false);
- epInv.setRequestParamValue(xmlName, value);
- }
- }
- }
- }
- }
-
- // Generic message endpoint
- else
- {
- for (ParameterMetaData paramMetaData : opMetaData.getParameters())
- {
- QName xmlName = paramMetaData.getXmlName();
- Object value = soapBody.getChildElements().next();
- epInv.setRequestParamValue(xmlName, value);
- }
- }
-
- return epInv;
- }
- catch (Exception e)
- {
- handleException(e);
- return null;
- }
- }
-
- /** On the server side, generate the payload from OUT parameters. */
- public Object bindResponseMessage(OperationMetaData opMetaData, EndpointInvocation
epInv) throws BindingException
- {
- log.debug("bindResponseMessage: " + opMetaData.getQName());
-
- try
- {
- CommonMessageContext msgContext =
MessageContextAssociation.peekMessageContext();
- if (msgContext == null)
- throw new WSException("MessageContext not available");
-
- // Disable MTOM for rpc/encoded
- if (opMetaData.isRPCEncoded())
- msgContext.setProperty(StubExt.PROPERTY_MTOM_ENABLED, Boolean.FALSE);
-
- // Associate current message with message context
- SOAPMessageImpl resMessage = (SOAPMessageImpl)createMessage(opMetaData);
- msgContext.setSOAPMessage(resMessage);
-
- // R2714 For one-way operations, an INSTANCE MUST NOT return a HTTP response
that contains a SOAP envelope.
- // Specifically, the HTTP response entity-body must be empty.
- if (opMetaData.isOneWay())
- {
- resMessage.getSOAPPart().setContent(null);
- return resMessage;
- }
-
- SOAPEnvelope soapEnvelope = resMessage.getSOAPPart().getEnvelope();
- SOAPHeader soapHeader = soapEnvelope.getHeader();
- SOAPBody soapBody = soapEnvelope.getBody();
-
- // Get the namespace registry
- NamespaceRegistry namespaceRegistry = msgContext.getNamespaceRegistry();
-
- Style style = opMetaData.getStyle();
- if (style == Style.RPC)
- {
- QName opQName = opMetaData.getResponseName();
-
- Name opName = new NameImpl(namespaceRegistry.registerQName(opQName));
- SOAPBodyElement soapBodyElement = new SOAPBodyElementRpc(opName);
-
- soapBodyElement =
(SOAPBodyElement)soapBody.addChildElement(soapBodyElement);
-
- // Add the return to the message
- ParameterMetaData retMetaData = opMetaData.getReturnParameter();
- if (retMetaData != null)
- {
- Object value = epInv.getReturnValue();
- if (retMetaData.isSwA())
- {
- CIDGenerator cidGenerator = resMessage.getCidGenerator();
- AttachmentPart part = createAttachmentPart(retMetaData, value,
cidGenerator);
- resMessage.addAttachmentPart(part);
- epInv.setReturnValue(part);
- }
- else
- {
- SOAPContentElement soapElement = addParameterToMessage(retMetaData,
value, soapBodyElement);
- epInv.setReturnValue(soapElement);
- soapElement.setObjectValue(value);
- }
- }
-
- // Add the out parameters to the message
- for (ParameterMetaData paramMetaData : opMetaData.getOutputParameters())
- {
- QName xmlName = paramMetaData.getXmlName();
- Object value = epInv.getResponseParamValue(xmlName);
- if (paramMetaData.isSwA())
- {
- CIDGenerator cidGenerator = resMessage.getCidGenerator();
- AttachmentPart part = createAttachmentPart(retMetaData, value,
cidGenerator);
- resMessage.addAttachmentPart(part);
- }
- else
- {
- if (paramMetaData.isInHeader())
- {
- addParameterToMessage(paramMetaData, value, soapHeader);
- }
- else
- {
- addParameterToMessage(paramMetaData, value, soapBodyElement);
- }
- }
- }
- }
- else if (style == Style.DOCUMENT)
- {
- ParameterMetaData retMetaData = opMetaData.getReturnParameter();
- if (retMetaData != null)
- {
- Object value = epInv.getReturnValue();
- if (opMetaData.isDocumentWrapped())
- value = ParameterWrapping.wrapResponseParameters(retMetaData, value,
epInv.getOutParameters());
-
- if (retMetaData.isSwA())
- {
- CIDGenerator cidGenerator = resMessage.getCidGenerator();
- AttachmentPart part = createAttachmentPart(retMetaData, value,
cidGenerator);
- resMessage.addAttachmentPart(part);
- epInv.setReturnValue(part);
- }
- else
- {
- SOAPContentElement soapElement = addParameterToMessage(retMetaData,
value, soapBody);
- epInv.setReturnValue(soapElement);
- }
- }
-
- // Add the out header parameters to the message
- for (ParameterMetaData paramMetaData : opMetaData.getOutputParameters())
- {
- QName xmlName = paramMetaData.getXmlName();
- if (paramMetaData.isInHeader())
- {
- Object value = epInv.getResponseParamValue(xmlName);
- addParameterToMessage(paramMetaData, value, soapHeader);
- }
- }
- }
- else
- {
- throw new WSException("Unsupported message style: " + style);
- }
-
- return resMessage;
- }
- catch (Exception e)
- {
- handleException(e);
- return null;
- }
- }
-
- /** On the client side, extract the OUT parameters from the payload and return them to
the client. */
- public void unbindResponseMessage(OperationMetaData opMetaData, Object payload,
EndpointInvocation epInv, Map<QName, UnboundHeader> unboundHeaders)
- throws BindingException
- {
- log.debug("unbindResponseMessage: " + opMetaData.getQName());
-
- try
- {
- // R2714 For one-way operations, an INSTANCE MUST NOT return a HTTP response
that contains a SOAP envelope.
- // Specifically, the HTTP response entity-body must be empty.
- if (opMetaData.isOneWay() == true)
- {
- return;
- }
-
- // WS-Addressing might redirect the response, which results in an empty
envelope
- SOAPMessage resMessage = (SOAPMessage)payload;
- SOAPEnvelope soapEnvelope = resMessage.getSOAPPart().getEnvelope();
- if (soapEnvelope == null)
- {
- return;
- }
-
- // Verify the SOAP version
- verifySOAPVersion(opMetaData, soapEnvelope);
-
- // Get the SOAP message context that is associated with the current thread
- CommonMessageContext msgContext =
MessageContextAssociation.peekMessageContext();
- if (msgContext == null)
- throw new WSException("MessageContext not available");
-
- // Disable MTOM for rpc/encoded
- if (opMetaData.isRPCEncoded())
- msgContext.setProperty(StubExt.PROPERTY_MTOM_ENABLED, Boolean.FALSE);
-
- SOAPHeader soapHeader = soapEnvelope.getHeader();
- SOAPBody soapBody = soapEnvelope.getBody();
- Iterator bodyChildren = soapBody.getChildElements();
-
- SOAPBodyElement soapBodyElement = null;
- if (bodyChildren.hasNext() != false)
- soapBodyElement = (SOAPBodyElement)bodyChildren.next();
-
- // Translate the SOAPFault to an exception and throw it
- if (soapBodyElement instanceof SOAPFaultImpl)
- throwFaultException((SOAPFaultImpl)soapBodyElement);
-
- // Extract unbound OUT headers
- if (unboundHeaders != null)
- {
- Map<QName, UnboundHeader> outHeaders = new HashMap<QName,
UnboundHeader>();
- Iterator itHeaderElements = soapHeader.getChildElements();
- while (itHeaderElements.hasNext())
- {
- SOAPContentElement soapHeaderElement =
(SOAPHeaderElementImpl)itHeaderElements.next();
- Name elName = soapHeaderElement.getElementName();
- QName xmlName = new QName(elName.getURI(), elName.getLocalName());
-
- UnboundHeader unboundHeader = (UnboundHeader)unboundHeaders.get(xmlName);
- if (unboundHeader != null)
- {
-
soapHeaderElement.setParamMetaData(unboundHeader.toParameterMetaData(opMetaData));
-
- // Do the unmarshalling
- Object value = soapHeaderElement.getObjectValue();
- unboundHeader.setHeaderValue(value);
- outHeaders.put(xmlName, unboundHeader);
- }
- }
- unboundHeaders.clear();
- unboundHeaders.putAll(outHeaders);
- }
-
- Style style = opMetaData.getStyle();
- if (style == Style.RPC)
- {
- if (soapBodyElement == null)
- throw new WSException("Cannot unbind response message with empty soap
body");
-
- ParameterMetaData retMetaData = opMetaData.getReturnParameter();
- if (retMetaData != null)
- {
- if (retMetaData.isSwA())
- {
- Object value = getAttachmentFromMessage(retMetaData, resMessage);
- epInv.setReturnValue(value);
- }
- else
- {
- Object value = getParameterFromMessage(retMetaData, soapBodyElement,
false);
- epInv.setReturnValue(value);
- }
- }
-
- for (ParameterMetaData paramMetaData : opMetaData.getOutputParameters())
- {
- QName xmlName = paramMetaData.getXmlName();
- if (paramMetaData.isSwA())
- {
- Object value = getAttachmentFromMessage(paramMetaData, resMessage);
- epInv.setResponseParamValue(xmlName, value);
- }
- else
- {
- SOAPElement soapElement = paramMetaData.isInHeader() ? soapHeader :
(SOAPElement)soapBodyElement;
- Object value = getParameterFromMessage(paramMetaData, soapElement,
false);
- epInv.setResponseParamValue(xmlName, value);
- }
- }
- }
- else if (style == Style.DOCUMENT)
- {
- ParameterMetaData retMetaData = opMetaData.getReturnParameter();
-
- // WS-Eventing has no message part for UnsubscribeResponseMsg
- if (retMetaData != null)
- {
- if (retMetaData.isSwA())
- {
- Object value = getAttachmentFromMessage(retMetaData, resMessage);
- epInv.setReturnValue(value);
- }
- else
- {
- Object value = getParameterFromMessage(retMetaData, soapBody, false);
- epInv.setReturnValue(value);
- }
-
- for (ParameterMetaData paramMetaData : opMetaData.getOutputParameters())
- {
- QName xmlName = paramMetaData.getXmlName();
- if (paramMetaData.isInHeader())
- {
- Object value = getParameterFromMessage(paramMetaData, soapHeader,
false);
- epInv.setResponseParamValue(xmlName, value);
- }
- }
- }
- }
- else
- {
- throw new WSException("Unsupported message style: " + style);
- }
- }
- catch (Exception e)
- {
- handleException(e);
- }
- }
-
- public abstract SOAPMessage exceptionToFaultMessage(Exception ex);
-
- private void verifySOAPVersion(OperationMetaData opMetaData, SOAPEnvelope
soapEnvelope)
- {
- String envNS = soapEnvelope.getNamespaceURI();
- String bindingId = opMetaData.getEndpointMetaData().getBindingId();
- if (CommonSOAPBinding.SOAP11HTTP_BINDING.equals(bindingId) &&
Constants.NS_SOAP11_ENV.equals(envNS) == false)
- log.warn("Expected SOAP-1.1 envelope, but got: " + envNS);
-
- if (CommonSOAPBinding.SOAP12HTTP_BINDING.equals(bindingId) &&
Constants.NS_SOAP12_ENV.equals(envNS) == false)
- log.warn("Expected SOAP-1.2 envelope, but got: " + envNS);
- }
-
- private AttachmentPart createAttachmentPart(ParameterMetaData paramMetaData, Object
value, CIDGenerator cidGenerator) throws SOAPException, BindingException
- {
- String partName = paramMetaData.getXmlName().getLocalPart();
- Set mimeTypes = paramMetaData.getMimeTypes();
-
- AttachmentPart part = new AttachmentPartImpl();
- if (value instanceof DataHandler)
- {
- DataHandler handler = (DataHandler)value;
- String mimeType = MimeUtils.getBaseMimeType(handler.getContentType());
-
- if (mimeTypes != null && !MimeUtils.isMemberOf(mimeType, mimeTypes))
- throw new BindingException("Mime type " + mimeType + " not
allowed for parameter " + partName + " allowed types are " + mimeTypes);
-
- part.setDataHandler((DataHandler)value);
- }
- else
- {
- String mimeType = null;
- if (mimeTypes != null && mimeTypes.size() > 0)
- {
- mimeType = (String)mimeTypes.iterator().next();
- }
- else
- {
- mimeType = MimeUtils.resolveMimeType(value);
- }
-
- if (mimeType == null)
- throw new BindingException("Could not determine mime type for attachment
parameter: " + partName);
-
- part.setContent(value, mimeType);
- }
-
- if (paramMetaData.isSwA())
- {
- String swaCID = '<' + partName + "=" +
cidGenerator.generateFromCount() + '>';
- part.setContentId(swaCID);
- }
- if (paramMetaData.isXOP())
- {
- String xopCID = '<' + cidGenerator.generateFromName(partName) +
'>';
- part.setContentId(xopCID);
- }
-
- return part;
- }
-
- private Object getAttachmentFromMessage(ParameterMetaData paramMetaData, SOAPMessage
message) throws SOAPException, BindingException
- {
- QName xmlName = paramMetaData.getXmlName();
-
- AttachmentPart part =
((SOAPMessageImpl)message).getAttachmentByPartName(xmlName.getLocalPart());
- if (part == null)
- throw new BindingException("Could not locate attachment for parameter:
" + paramMetaData.getXmlName());
-
- return part;
- }
-
- /** Marshall the given parameter and add it to the SOAPMessage */
- private SOAPContentElement addParameterToMessage(ParameterMetaData paramMetaData,
Object value, SOAPElement soapElement) throws SOAPException, BindingException
- {
- QName xmlName = paramMetaData.getXmlName();
- Class javaType = paramMetaData.getJavaType();
-
- if (value != null && paramMetaData.isXOP() == false)
- {
- Class valueType = value.getClass();
- if (JavaUtils.isAssignableFrom(javaType, valueType) == false)
- throw new BindingException("javaType " + javaType.getName() +
" is not assignable from: " + valueType.getName());
- }
-
- // Make sure we have a prefix on qualified names
- if (xmlName.getNamespaceURI().length() > 0)
- {
- CommonMessageContext msgContext =
MessageContextAssociation.peekMessageContext();
- NamespaceRegistry namespaceRegistry = msgContext.getNamespaceRegistry();
- xmlName = namespaceRegistry.registerQName(xmlName);
- }
-
- Name soapName = new NameImpl(xmlName.getLocalPart(), xmlName.getPrefix(),
xmlName.getNamespaceURI());
- if (paramMetaData.isSOAPArrayParam())
- soapName = new NameImpl("Array", Constants.PREFIX_SOAP11_ENC,
Constants.URI_SOAP11_ENC);
-
- SOAPContentElement contentElement;
- if (soapElement instanceof SOAPHeader)
- {
- contentElement = new SOAPHeaderElementImpl(soapName);
- soapElement.addChildElement(contentElement);
- }
- else
- {
- Style style = paramMetaData.getOperationMetaData().getStyle();
- if (style == Style.DOCUMENT)
- {
- contentElement = new SOAPBodyElementDoc(soapName);
- soapElement.addChildElement(contentElement);
- }
- else
- {
- contentElement = new SOAPContentElement(soapName);
- soapElement.addChildElement(contentElement);
- }
- }
-
- contentElement.setParamMetaData(paramMetaData);
-
- if (paramMetaData.isSOAPArrayParam())
- {
- log.trace("Add parameter as SOAP encoded Array");
- contentElement.addNamespaceDeclaration(Constants.PREFIX_SOAP11_ENC,
Constants.URI_SOAP11_ENC);
- }
-
- // When a potential xop parameter is detected and MTOM is enabled
- // we flag the SOAP message as a XOP package
- if (paramMetaData.isXOP() && XOPContext.isMTOMEnabled())
- {
- log.trace("Add parameter as XOP");
- CommonMessageContext msgContext =
MessageContextAssociation.peekMessageContext();
- SOAPMessageImpl soapMessage = (SOAPMessageImpl)msgContext.getSOAPMessage();
- soapMessage.setXOPMessage(true);
- }
-
- contentElement.setObjectValue(value);
-
- return contentElement;
- }
-
- /** Unmarshall a message element and add it to the parameter list */
- private Object getParameterFromMessage(ParameterMetaData paramMetaData, SOAPElement
soapElement, boolean optional) throws BindingException
- {
- Name xmlName = new NameImpl(paramMetaData.getXmlName());
-
- SOAPContentElement soapContentElement = null;
- Iterator childElements = soapElement.getChildElements();
- while (childElements.hasNext())
- {
- SOAPElementImpl childElement = (SOAPElementImpl)childElements.next();
-
- // If this message was manipulated by a handler the child may not be a content
element
- if (!(childElement instanceof SOAPContentElement))
- childElement = (SOAPContentElement)soapElement.replaceChild(new
SOAPContentElement(childElement), childElement);
-
- // The parameters are expected to be lazy
- SOAPContentElement aux = (SOAPContentElement)childElement;
- Name elName = aux.getElementName();
-
- if (xmlName.equals(elName))
- {
- soapContentElement = aux;
- soapContentElement.setParamMetaData(paramMetaData);
- break;
- }
-
- if (SOAP_ARRAY_NAME.equals(elName))
- {
- CommonMessageContext msgContext =
MessageContextAssociation.peekMessageContext();
- msgContext.setProperty(CommonMessageContext.ALLOW_EXPAND_TO_DOM,
Boolean.TRUE);
- try
- {
- QName compXMLName = paramMetaData.getXmlName();
- Element compElement = DOMUtils.getFirstChildElement(aux);
- if (compElement.getNodeName().equals(compXMLName.getLocalPart()))
- {
- soapContentElement = aux;
- soapContentElement.setParamMetaData(paramMetaData);
- break;
- }
- }
- finally
- {
- msgContext.removeProperty(CommonMessageContext.ALLOW_EXPAND_TO_DOM);
- }
- }
- }
-
- // If matching by name fails, try to match by xmlType
- // This maybe necessary when wsa:Action dispatches to the operation
- if (soapContentElement == null)
- {
- childElements = soapElement.getChildElements();
- OperationMetaData opMetaData = paramMetaData.getOperationMetaData();
- TypesMetaData typesMetaData =
opMetaData.getEndpointMetaData().getServiceMetaData().getTypesMetaData();
- if (childElements.hasNext() && opMetaData.getStyle() == Style.DOCUMENT)
- {
- SOAPElementImpl childElement = (SOAPElementImpl)childElements.next();
-
- // The parameters are expected to be lazy
- SOAPContentElement aux = (SOAPContentElement)childElement;
- Name elName = aux.getElementName();
- QName elType = null;
-
- XSElementDeclaration xsdElement =
typesMetaData.getSchemaModel().getElementDeclaration(elName.getLocalName(),
elName.getURI());
- if (xsdElement != null && xsdElement.getTypeDefinition() != null)
- {
- XSTypeDefinition xsdType = xsdElement.getTypeDefinition();
- elType = new QName(xsdType.getNamespace(), xsdType.getName());
- }
-
- if (paramMetaData.getXmlType().equals(elType))
- {
- soapContentElement = aux;
- soapContentElement.setParamMetaData(paramMetaData);
- }
- }
- }
-
- if (soapContentElement == null && optional == false)
- throw new WSException("Cannot find child element: " + xmlName);
-
- // When a potential XOP parameter is detected and
- // the incomming request is actuall XOP encoded we flag
- // the SOAP message a XOP packaged.
- if (paramMetaData.isXOP() && XOPContext.isXOPEncodedRequest())
- {
- SOAPMessageImpl soapMessage =
(SOAPMessageImpl)MessageContextAssociation.peekMessageContext().getSOAPMessage();
- soapMessage.setXOPMessage(true);
- }
- return soapContentElement;
- }
-
- abstract protected void throwFaultException(SOAPFaultImpl fault) throws Exception;
-
- private void handleException(Exception ex) throws BindingException
- {
- if (ex instanceof RuntimeException)
- throw (RuntimeException)ex;
-
- if (ex instanceof BindingException)
- throw (BindingException)ex;
-
- throw new BindingException(ex);
- }
-}
Modified: trunk/src/main/java/org/jboss/ws/core/jaxws/binding/BindingProviderImpl.java
===================================================================
---
trunk/src/main/java/org/jboss/ws/core/jaxws/binding/BindingProviderImpl.java 2006-12-07
11:54:16 UTC (rev 1602)
+++
trunk/src/main/java/org/jboss/ws/core/jaxws/binding/BindingProviderImpl.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -33,7 +33,7 @@
import javax.xml.ws.http.HTTPBinding;
import javax.xml.ws.soap.SOAPBinding;
-import org.jboss.ws.core.jaxrpc.binding.CommonBindingProvider;
+import org.jboss.ws.core.CommonBindingProvider;
import org.jboss.ws.metadata.umdm.EndpointMetaData;
import org.jboss.ws.metadata.umdm.EndpointMetaData.Type;
Modified: trunk/src/main/java/org/jboss/ws/core/jaxws/binding/HTTPBindingJAXWS.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/core/jaxws/binding/HTTPBindingJAXWS.java 2006-12-07
11:54:16 UTC (rev 1602)
+++ trunk/src/main/java/org/jboss/ws/core/jaxws/binding/HTTPBindingJAXWS.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -31,9 +31,9 @@
import javax.xml.ws.http.HTTPBinding;
import org.jboss.util.NotImplementedException;
+import org.jboss.ws.core.CommonBinding;
import org.jboss.ws.core.EndpointInvocation;
import org.jboss.ws.core.jaxrpc.binding.BindingException;
-import org.jboss.ws.core.jaxrpc.binding.CommonBinding;
import org.jboss.ws.core.soap.UnboundHeader;
import org.jboss.ws.metadata.umdm.OperationMetaData;
import org.jboss.ws.metadata.umdm.HandlerMetaData.HandlerType;
Modified: trunk/src/main/java/org/jboss/ws/core/jaxws/binding/MessageBinding.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/core/jaxws/binding/MessageBinding.java 2006-12-07
11:54:16 UTC (rev 1602)
+++ trunk/src/main/java/org/jboss/ws/core/jaxws/binding/MessageBinding.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -33,9 +33,9 @@
import org.jboss.logging.Logger;
import org.jboss.util.NotImplementedException;
import org.jboss.ws.WSException;
+import org.jboss.ws.core.CommonBinding;
import org.jboss.ws.core.EndpointInvocation;
import org.jboss.ws.core.jaxrpc.binding.BindingException;
-import org.jboss.ws.core.jaxrpc.binding.CommonBinding;
import org.jboss.ws.core.jaxws.handler.SOAPMessageContextJAXWS;
import org.jboss.ws.core.soap.MessageContextAssociation;
import org.jboss.ws.core.soap.UnboundHeader;
Modified: trunk/src/main/java/org/jboss/ws/core/jaxws/binding/PayloadBinding.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/core/jaxws/binding/PayloadBinding.java 2006-12-07
11:54:16 UTC (rev 1602)
+++ trunk/src/main/java/org/jboss/ws/core/jaxws/binding/PayloadBinding.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -35,9 +35,9 @@
import org.jboss.util.NotImplementedException;
import org.jboss.ws.Constants;
import org.jboss.ws.WSException;
+import org.jboss.ws.core.CommonBinding;
import org.jboss.ws.core.EndpointInvocation;
import org.jboss.ws.core.jaxrpc.binding.BindingException;
-import org.jboss.ws.core.jaxrpc.binding.CommonBinding;
import org.jboss.ws.core.jaxws.handler.SOAPMessageContextJAXWS;
import org.jboss.ws.core.soap.MessageContextAssociation;
import org.jboss.ws.core.soap.MessageFactoryImpl;
Modified: trunk/src/main/java/org/jboss/ws/core/jaxws/binding/SOAP11BindingJAXWS.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/core/jaxws/binding/SOAP11BindingJAXWS.java 2006-12-07
11:54:16 UTC (rev 1602)
+++ trunk/src/main/java/org/jboss/ws/core/jaxws/binding/SOAP11BindingJAXWS.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -33,7 +33,7 @@
import javax.xml.ws.soap.SOAPBinding;
import org.jboss.ws.Constants;
-import org.jboss.ws.core.jaxrpc.binding.CommonSOAP11Binding;
+import org.jboss.ws.core.CommonSOAP11Binding;
import org.jboss.ws.core.jaxws.SOAPFaultHelperJAXWS;
import org.jboss.ws.core.soap.SOAPFaultImpl;
import org.jboss.ws.metadata.umdm.OperationMetaData;
Modified: trunk/src/main/java/org/jboss/ws/core/jaxws/binding/SOAP12BindingJAXWS.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/core/jaxws/binding/SOAP12BindingJAXWS.java 2006-12-07
11:54:16 UTC (rev 1602)
+++ trunk/src/main/java/org/jboss/ws/core/jaxws/binding/SOAP12BindingJAXWS.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -34,7 +34,7 @@
import javax.xml.ws.soap.SOAPBinding;
import org.jboss.ws.Constants;
-import org.jboss.ws.core.jaxrpc.binding.CommonSOAP12Binding;
+import org.jboss.ws.core.CommonSOAP12Binding;
import org.jboss.ws.core.jaxws.SOAPFaultHelperJAXWS;
import org.jboss.ws.core.soap.SOAPFaultImpl;
import org.jboss.ws.metadata.umdm.OperationMetaData;
Modified: trunk/src/main/java/org/jboss/ws/core/jaxws/client/ClientImpl.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/core/jaxws/client/ClientImpl.java 2006-12-07 11:54:16
UTC (rev 1602)
+++ trunk/src/main/java/org/jboss/ws/core/jaxws/client/ClientImpl.java 2006-12-07 12:05:41
UTC (rev 1603)
@@ -40,9 +40,9 @@
import javax.xml.ws.soap.SOAPFaultException;
import org.jboss.logging.Logger;
+import org.jboss.ws.core.CommonBindingProvider;
import org.jboss.ws.core.CommonClient;
import org.jboss.ws.core.CommonMessageContext;
-import org.jboss.ws.core.jaxrpc.binding.CommonBindingProvider;
import org.jboss.ws.core.jaxws.binding.BindingExt;
import org.jboss.ws.core.jaxws.binding.BindingProviderImpl;
import org.jboss.ws.core.jaxws.handler.HandlerChainExecutor;
Modified:
trunk/src/main/java/org/jboss/ws/core/server/AbstractServiceEndpointInvoker.java
===================================================================
---
trunk/src/main/java/org/jboss/ws/core/server/AbstractServiceEndpointInvoker.java 2006-12-07
11:54:16 UTC (rev 1602)
+++
trunk/src/main/java/org/jboss/ws/core/server/AbstractServiceEndpointInvoker.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -42,11 +42,11 @@
import org.jboss.logging.Logger;
import org.jboss.ws.Constants;
+import org.jboss.ws.core.CommonBinding;
+import org.jboss.ws.core.CommonBindingProvider;
import org.jboss.ws.core.CommonMessageContext;
+import org.jboss.ws.core.CommonSOAPBinding;
import org.jboss.ws.core.EndpointInvocation;
-import org.jboss.ws.core.jaxrpc.binding.CommonBinding;
-import org.jboss.ws.core.jaxrpc.binding.CommonBindingProvider;
-import org.jboss.ws.core.jaxrpc.binding.CommonSOAPBinding;
import org.jboss.ws.core.jaxrpc.handler.HandlerDelegateJAXRPC;
import org.jboss.ws.core.jaxws.binding.BindingProviderImpl;
import org.jboss.ws.core.jaxws.handler.HandlerDelegateJAXWS;
Modified: trunk/src/main/java/org/jboss/ws/core/server/ServiceEndpoint.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/core/server/ServiceEndpoint.java 2006-12-07 11:54:16
UTC (rev 1602)
+++ trunk/src/main/java/org/jboss/ws/core/server/ServiceEndpoint.java 2006-12-07 12:05:41
UTC (rev 1603)
@@ -38,10 +38,10 @@
import org.jboss.logging.Logger;
import org.jboss.ws.Constants;
+import org.jboss.ws.core.CommonBindingProvider;
import org.jboss.ws.core.CommonMessageContext;
+import org.jboss.ws.core.CommonSOAPBinding;
import org.jboss.ws.core.jaxrpc.binding.BindingException;
-import org.jboss.ws.core.jaxrpc.binding.CommonBindingProvider;
-import org.jboss.ws.core.jaxrpc.binding.CommonSOAPBinding;
import org.jboss.ws.core.soap.MessageContextAssociation;
import org.jboss.ws.core.soap.MessageFactoryImpl;
import org.jboss.ws.core.soap.SOAPElementImpl;
Deleted: trunk/src/main/java/org/jboss/ws/extensions/SomeClass.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/extensions/SomeClass.java 2006-12-07 11:54:16 UTC
(rev 1602)
+++ trunk/src/main/java/org/jboss/ws/extensions/SomeClass.java 2006-12-07 12:05:41 UTC
(rev 1603)
@@ -1,6 +0,0 @@
-package org.jboss.ws.extensions;
-
-public class SomeClass
-{
-
-}
Copied: trunk/src/main/java/org/jboss/ws/metadata (from rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata)
Copied: trunk/src/main/java/org/jboss/ws/metadata/acessor (from rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/acessor)
Deleted: trunk/src/main/java/org/jboss/ws/metadata/acessor/JAXBAccessor.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/acessor/JAXBAccessor.java 2006-12-07
10:43:36 UTC (rev 1600)
+++ trunk/src/main/java/org/jboss/ws/metadata/acessor/JAXBAccessor.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -1,125 +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.acessor;
-
-import javax.xml.bind.JAXBException;
-import javax.xml.namespace.QName;
-
-import org.jboss.ws.WSException;
-import org.jboss.ws.metadata.umdm.ParameterMetaData;
-import org.jboss.ws.metadata.umdm.WrappedParameter;
-import org.jboss.ws.metadata.umdm.ParameterMetaData.AccessorFactoryCreator;
-import org.jboss.ws.metadata.umdm.WrappedParameter.Accessor;
-import org.jboss.ws.metadata.umdm.WrappedParameter.AccessorFactory;
-
-import com.sun.xml.bind.api.AccessorException;
-import com.sun.xml.bind.api.JAXBRIContext;
-import com.sun.xml.bind.api.RawAccessor;
-
-/**
- * A JAXB object accessor.
- *
- * @author <a href="jason.greene(a)jboss.com">Jason T. Greene</a>
- * @version $Revision$
- */
-@SuppressWarnings("unchecked")
-public class JAXBAccessor implements Accessor
-{
- private RawAccessor accessor;
-
- public static AccessorFactoryCreator FACTORY_CREATOR = new AccessorFactoryCreator()
- {
- public AccessorFactory create(ParameterMetaData parameter)
- {
- final Class clazz = parameter.getJavaType();
- final JAXBRIContext ctx;
-
- try
- {
- ctx = (JAXBRIContext) JAXBRIContext.newInstance(new Class[]{clazz});
- }
- catch (JAXBException e)
- {
- WSException ex = new WSException(e.getMessage());
- ex.setStackTrace(e.getStackTrace());
- throw ex;
- }
-
- return new AccessorFactory()
- {
- public Accessor create(WrappedParameter parameter)
- {
- RawAccessor<Object,Object> accessor;
- try
- {
- QName name = parameter.getName();
- accessor = ctx.getElementPropertyAccessor(clazz,
name.getNamespaceURI(), name.getLocalPart());
- }
- catch (Throwable t)
- {
- WSException ex = new WSException(t.getMessage());
- ex.setStackTrace(t.getStackTrace());
- throw ex;
- }
-
- if (accessor == null)
- throw new IllegalStateException("Could not obtain accessor for
parameter: " + parameter);
-
- return new JAXBAccessor(accessor);
- }
- };
- }
- };
-
- private JAXBAccessor(RawAccessor accessor)
- {
- this.accessor = accessor;
- }
-
- public Object get(Object bean)
- {
- try
- {
- return accessor.get(bean);
- }
- catch (AccessorException a)
- {
- WSException ex = new WSException(a.getMessage());
- ex.setStackTrace(a.getStackTrace());
- throw ex;
- }
- }
-
- public void set(Object bean, Object value)
- {
- try
- {
- accessor.set(bean, value);
- }
- catch (AccessorException a)
- {
- WSException ex = new WSException(a.getMessage());
- ex.setStackTrace(a.getStackTrace());
- throw ex;
- }
- }
-}
\ No newline at end of file
Copied: trunk/src/main/java/org/jboss/ws/metadata/acessor/JAXBAccessor.java (from rev
1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/acessor/JAXBAccessor.java)
Deleted: trunk/src/main/java/org/jboss/ws/metadata/acessor/ReflectiveMethodAccessor.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/acessor/ReflectiveMethodAccessor.java 2006-12-07
10:43:36 UTC (rev 1600)
+++
trunk/src/main/java/org/jboss/ws/metadata/acessor/ReflectiveMethodAccessor.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -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.metadata.acessor;
-
-import java.beans.PropertyDescriptor;
-import java.lang.reflect.Method;
-
-import org.jboss.ws.WSException;
-import org.jboss.ws.metadata.umdm.ParameterMetaData;
-import org.jboss.ws.metadata.umdm.WrappedParameter;
-import org.jboss.ws.metadata.umdm.ParameterMetaData.AccessorFactoryCreator;
-import org.jboss.ws.metadata.umdm.WrappedParameter.Accessor;
-import org.jboss.ws.metadata.umdm.WrappedParameter.AccessorFactory;
-
-/**
- * A simple JavaBean accessor that uses ordinary reflection.
- *
- * @author <a href="jason.greene(a)jboss.com">Jason T. Greene</a>
- * @version $Revision$
- */
-@SuppressWarnings("unchecked")
-public class ReflectiveMethodAccessor implements Accessor
-{
- private Method getter;
- private Method setter;
-
- public static AccessorFactoryCreator FACTORY_CREATOR = new AccessorFactoryCreator()
- {
- public AccessorFactory create(ParameterMetaData parameter)
- {
- final Class clazz = parameter.getJavaType();
-
- return new AccessorFactory()
- {
- public Accessor create(WrappedParameter parameter)
- {
- try
- {
- PropertyDescriptor pd = new PropertyDescriptor(parameter.getVariable(),
clazz);
- return new ReflectiveMethodAccessor(pd.getReadMethod(),
pd.getWriteMethod());
- }
- catch (Throwable t)
- {
- WSException ex = new WSException(t.getMessage());
- ex.setStackTrace(t.getStackTrace());
- throw ex;
- }
- }
- };
- }
- };
-
- private ReflectiveMethodAccessor(Method getter, Method setter)
- {
- this.getter = getter;
- this.setter = setter;
- }
-
- public Object get(Object bean)
- {
- try
- {
- return getter.invoke(bean);
- }
- catch (Throwable e)
- {
- WSException ex = new WSException(e.getMessage());
- ex.setStackTrace(ex.getStackTrace());
- throw ex;
- }
- }
-
- public void set(Object bean, Object value)
- {
- try
- {
- setter.invoke(bean, value);
- }
- catch (Throwable e)
- {
- WSException ex = new WSException(e.getMessage());
- ex.setStackTrace(ex.getStackTrace());
- throw ex;
- }
- }
-}
\ No newline at end of file
Copied: trunk/src/main/java/org/jboss/ws/metadata/acessor/ReflectiveMethodAccessor.java
(from rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/acessor/ReflectiveMethodAccessor.java)
Copied: trunk/src/main/java/org/jboss/ws/metadata/builder (from rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/builder)
Deleted: trunk/src/main/java/org/jboss/ws/metadata/builder/MetaDataBuilder.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/builder/MetaDataBuilder.java 2006-12-07
10:43:36 UTC (rev 1600)
+++ trunk/src/main/java/org/jboss/ws/metadata/builder/MetaDataBuilder.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -1,476 +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.builder;
-
-// $Id$
-
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import javax.management.ObjectName;
-import javax.wsdl.Definition;
-import javax.wsdl.Import;
-import javax.wsdl.Port;
-import javax.wsdl.Service;
-import javax.wsdl.extensions.ExtensibilityElement;
-import javax.wsdl.extensions.UnknownExtensibilityElement;
-import javax.wsdl.extensions.soap.SOAPAddress;
-import javax.xml.namespace.QName;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.Constants;
-import org.jboss.ws.WSException;
-import org.jboss.ws.core.jaxrpc.Use;
-import org.jboss.ws.core.jaxrpc.binding.CommonSOAPBinding;
-import org.jboss.ws.core.server.ServiceEndpointManager;
-import org.jboss.ws.core.server.ServiceEndpointManagerFactory;
-import org.jboss.ws.core.server.UnifiedDeploymentInfo;
-import org.jboss.ws.core.utils.ObjectNameFactory;
-import org.jboss.ws.metadata.j2ee.UnifiedApplicationMetaData;
-import org.jboss.ws.metadata.j2ee.UnifiedBeanMetaData;
-import org.jboss.ws.metadata.j2ee.UnifiedEjbPortComponentMetaData;
-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.ServerEndpointMetaData;
-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.WSDLService;
-import org.jboss.ws.metadata.wsse.WSSecurityConfiguration;
-import org.jboss.ws.metadata.wsse.WSSecurityConfigurationFactory;
-import org.w3c.dom.Element;
-
-/** An abstract meta data builder.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 19-May-2005
- */
-public abstract class MetaDataBuilder
-{
- // provide logging
- private final static Logger log = Logger.getLogger(MetaDataBuilder.class);
-
- public static WSSecurityConfiguration getWsSecurityConfiguration(UnifiedDeploymentInfo
udi) throws IOException
- {
- WSSecurityConfiguration config = null;
-
- String resource = WSSecurityConfigurationFactory.SERVER_RESOURCE_NAME;
- if (udi.metaData instanceof UnifiedWebMetaData)
- {
- resource = "WEB-INF/" + resource;
- }
- else
- {
- resource = "META-INF/" + resource;
- }
-
- URL location = udi.classLoader.getResource(resource);
- if (location != null)
- {
- config = WSSecurityConfigurationFactory.newInstance().parse(location);
-
- // Get and set deployment path to the keystore file
- if (config.getKeyStoreFile() != null)
- {
- location = udi.classLoader.getResource(config.getKeyStoreFile());
- if (location != null)
- config.setKeyStoreURL(location);
- }
-
- if (config.getTrustStoreFile() != null)
- {
- location = udi.classLoader.getResource(config.getTrustStoreFile());
- if (location != null)
- config.setTrustStoreURL(location);
- }
- }
-
- return config;
- }
-
- /** Inititialize the endpoint binding */
- protected void initEndpointBinding(WSDLEndpoint wsdlEndpoint, ClientEndpointMetaData
epMetaData)
- {
- WSDLDefinitions wsdlDefinitions =
wsdlEndpoint.getWsdlService().getWsdlDefinitions();
- WSDLInterface wsdlInterface = wsdlEndpoint.getInterface();
- WSDLBinding wsdlBinding =
wsdlDefinitions.getBindingByInterfaceName(wsdlInterface.getQName());
- String bindingType = wsdlBinding.getType();
- if (Constants.NS_SOAP11.equals(bindingType))
- epMetaData.setBindingId(CommonSOAPBinding.SOAP11HTTP_BINDING);
- else if (Constants.NS_SOAP12.equals(bindingType))
- epMetaData.setBindingId(CommonSOAPBinding.SOAP12HTTP_BINDING);
- }
-
- /** Initialize the endpoint encoding style from the binding operations
- */
- protected void initEndpointEncodingStyle(EndpointMetaData epMetaData)
- {
- WSDLDefinitions wsdlDefinitions =
epMetaData.getServiceMetaData().getWsdlDefinitions();
- for (WSDLService wsdlService : wsdlDefinitions.getServices())
- {
- for (WSDLEndpoint wsdlEndpoint : wsdlService.getEndpoints())
- {
- if (epMetaData.getQName().equals(wsdlEndpoint.getQName()))
- {
- QName bindQName = wsdlEndpoint.getBinding();
- NCName ncName = new NCName(bindQName.getLocalPart());
- WSDLBinding wsdlBinding = wsdlDefinitions.getBinding(ncName);
- if (wsdlBinding == null)
- throw new WSException("Cannot obtain binding: " + ncName);
-
- for (WSDLBindingOperation wsdlBindingOperation :
wsdlBinding.getOperations())
- {
- String encStyle = wsdlBindingOperation.getEncodingStyle();
- epMetaData.setEncodingStyle(Use.valueOf(encStyle));
- }
- }
- }
- }
- }
-
-
- public static void initEndpointAddress(UnifiedDeploymentInfo udi,
ServerEndpointMetaData sepMetaData, String linkName)
- {
- String contextRoot = sepMetaData.getContextRoot();
- String urlPattern = sepMetaData.getURLPattern();
-
- if (udi.metaData instanceof UnifiedWebMetaData)
- {
- UnifiedWebMetaData webMetaData = (UnifiedWebMetaData)udi.metaData;
- String jbwebContextRoot = webMetaData.getContextRoot();
- if (jbwebContextRoot != null)
- contextRoot = jbwebContextRoot;
-
- Map<String, String> servletMappings = webMetaData.getServletMappings();
- urlPattern = (String)servletMappings.get(linkName);
- if (urlPattern == null)
- throw new WSException("Cannot obtain url pattern for servlet name:
" + linkName);
- }
-
- if (udi.metaData instanceof UnifiedApplicationMetaData)
- {
- UnifiedApplicationMetaData applMetaData =
(UnifiedApplicationMetaData)udi.metaData;
- UnifiedBeanMetaData beanMetaData =
(UnifiedBeanMetaData)applMetaData.getBeanByEjbName(linkName);
- if (beanMetaData == null)
- throw new WSException("Cannot obtain meta data for ejb link: " +
linkName);
-
- String wsContextRoot = applMetaData.getWebServiceContextRoot();
- if (wsContextRoot != null)
- contextRoot = wsContextRoot;
-
- UnifiedEjbPortComponentMetaData ejbpcMetaData =
beanMetaData.getPortComponent();
- if (ejbpcMetaData != null && ejbpcMetaData.getPortComponentURI() !=
null)
- {
- String pcUrlPattern = ejbpcMetaData.getPortComponentURI();
- if (pcUrlPattern != null)
- urlPattern = pcUrlPattern;
- }
- }
-
- // If not, derive the context root from the deployment
- if (contextRoot == null)
- {
- contextRoot = "/";
- if (udi.parent != null)
- {
- String shortName = udi.parent.shortName;
- shortName = shortName.substring(0, shortName.indexOf('.'));
- contextRoot += shortName + "-";
- }
- String shortName = udi.shortName;
- shortName = shortName.substring(0, shortName.indexOf('.'));
- contextRoot += shortName;
- }
-
- if (contextRoot.startsWith("/") == false)
- contextRoot = "/" + contextRoot;
- if (urlPattern == null)
- urlPattern = "/" + linkName;
- if (urlPattern.startsWith("/") == false)
- urlPattern = "/" + urlPattern;
-
- sepMetaData.setContextRoot(contextRoot);
- sepMetaData.setURLPattern(urlPattern);
-
- String servicePath = contextRoot + urlPattern;
- sepMetaData.setEndpointAddress(getServiceEndpointAddress(null, servicePath));
- }
-
- public static ObjectName getServiceEndpointID(UnifiedDeploymentInfo udi,
ServerEndpointMetaData sepMetaData)
- {
- String linkName = sepMetaData.getLinkName();
- String context = sepMetaData.getContextRoot();
- if (context.startsWith("/"))
- context = context.substring(1);
-
- StringBuilder idstr = new StringBuilder(ServerEndpointMetaData.SEPID_DOMAIN +
":");
- idstr.append(ServerEndpointMetaData.SEPID_PROPERTY_CONTEXT + "=" +
context);
- idstr.append("," + ServerEndpointMetaData.SEPID_PROPERTY_ENDPOINT +
"=" + linkName);
-
- // Add JMS destination JNDI name for MDB endpoints
- if (udi.metaData instanceof UnifiedApplicationMetaData)
- {
- String ejbName = sepMetaData.getLinkName();
- if (ejbName == null)
- throw new WSException("Cannot obtain ejb-link from port
component");
-
- UnifiedApplicationMetaData applMetaData =
(UnifiedApplicationMetaData)udi.metaData;
- UnifiedBeanMetaData beanMetaData =
(UnifiedBeanMetaData)applMetaData.getBeanByEjbName(ejbName);
- if (beanMetaData == null)
- throw new WSException("Cannot obtain ejb meta data for: " +
ejbName);
-
- if (beanMetaData instanceof UnifiedMessageDrivenMetaData)
- {
- UnifiedMessageDrivenMetaData mdMetaData =
(UnifiedMessageDrivenMetaData)beanMetaData;
- String jndiName = mdMetaData.getDestinationJndiName();
- idstr.append(",jms=" + jndiName);
- }
- }
-
- return ObjectNameFactory.create(idstr.toString());
- }
-
-
- /** Get the web service address for a given path
- */
- public static String getServiceEndpointAddress(String uriScheme, String servicePath)
- {
- if (servicePath == null || servicePath.length() == 0)
- throw new WSException("Service path cannot be null");
-
- if (servicePath.endsWith("/*"))
- servicePath = servicePath.substring(0, servicePath.length() - 2);
-
- if (uriScheme == null)
- uriScheme = "http";
-
- ServiceEndpointManagerFactory factory =
ServiceEndpointManagerFactory.getInstance();
- ServiceEndpointManager epManager = factory.getServiceEndpointManager();
- String host = epManager.getWebServiceHost();
- int port = epManager.getWebServicePort();
- if ("https".equals(uriScheme))
- port = epManager.getWebServiceSecurePort();
-
- String urlStr = uriScheme + "://" + host + ":" + port +
servicePath;
- try
- {
- return new URL(urlStr).toExternalForm();
- }
- catch (MalformedURLException e)
- {
- throw new WSException("Malformed URL: " + urlStr);
- }
- }
-
- /**
- * Read the transport guarantee from web.xml
- */
- protected void initTransportGuaranteeJSE(UnifiedDeploymentInfo udi,
ServerEndpointMetaData sepMetaData, String servletLink) throws IOException
- {
- String transportGuarantee = null;
- if (udi.metaData instanceof UnifiedWebMetaData)
- {
- UnifiedWebMetaData webMetaData = (UnifiedWebMetaData)udi.metaData;
- Map<String, String> servletMappings = webMetaData.getServletMappings();
- String urlPattern = servletMappings.get(servletLink);
-
- if (urlPattern == null)
- throw new WSException("Cannot find <url-pattern> for servlet-name:
" + servletLink);
-
- List<UnifiedWebSecurityMetaData> securityList =
webMetaData.getSecurityMetaData();
- for (UnifiedWebSecurityMetaData currentSecurity : securityList)
- {
- if (currentSecurity.getTransportGuarantee() != null &&
currentSecurity.getTransportGuarantee().length() > 0)
- {
- for (UnifiedWebResourceCollection currentCollection :
currentSecurity.getWebResources())
- {
- for (String currentUrlPattern : currentCollection.getUrlPatterns())
- {
- if (urlPattern.equals(currentUrlPattern))
- {
- transportGuarantee = currentSecurity.getTransportGuarantee();
- }
- }
- }
- }
- }
- }
- sepMetaData.setTransportGuarantee(transportGuarantee);
- }
-
- /** Replace the address locations for a given port component.
- */
- public static void replaceAddressLocation(ServerEndpointMetaData sepMetaData)
- {
- WSDLDefinitions wsdlDefinitions =
sepMetaData.getServiceMetaData().getWsdlDefinitions();
- QName portName = sepMetaData.getQName();
-
- boolean endpointFound = false;
- for (WSDLService wsdlService : wsdlDefinitions.getServices())
- {
- for (WSDLEndpoint wsdlEndpoint : wsdlService.getEndpoints())
- {
- QName wsdlPortName = wsdlEndpoint.getQName();
- if (wsdlPortName.equals(portName))
- {
- endpointFound = true;
-
- String orgAddress = wsdlEndpoint.getAddress();
- String uriScheme = getUriScheme(orgAddress);
-
- String transportGuarantee = sepMetaData.getTransportGuarantee();
- if ("CONFIDENTIAL".equals(transportGuarantee))
- uriScheme = "https";
-
- String servicePath = sepMetaData.getContextRoot() +
sepMetaData.getURLPattern();
- String serviceEndpointURL = getServiceEndpointAddress(uriScheme,
servicePath);
-
- ServiceEndpointManagerFactory factory =
ServiceEndpointManagerFactory.getInstance();
- ServiceEndpointManager epManager = factory.getServiceEndpointManager();
- boolean alwaysModify = epManager.isAlwaysModifySOAPAddress();
-
- if (alwaysModify || uriScheme == null ||
orgAddress.indexOf("REPLACE_WITH_ACTUAL_URL") >= 0)
- {
- log.debug("Replace service endpoint address '" +
orgAddress + "' with '" + serviceEndpointURL + "'");
- wsdlEndpoint.setAddress(serviceEndpointURL);
- sepMetaData.setEndpointAddress(serviceEndpointURL);
-
- // modify the wsdl-1.1 definition
- if (wsdlDefinitions.getWsdlOneOneDefinition() != null)
- replaceWSDL11SOAPAddress(wsdlDefinitions, portName,
serviceEndpointURL);
- }
- else
- {
- log.debug("Don't replace service endpoint address '"
+ orgAddress + "'");
- try
- {
- sepMetaData.setEndpointAddress(new
URL(orgAddress).toExternalForm());
- }
- catch (MalformedURLException e)
- {
- throw new WSException("Malformed URL: " + orgAddress);
- }
- }
- }
- }
- }
-
- if (endpointFound == false)
- throw new WSException("Cannot find port in wsdl: " + portName);
- }
-
- private static void replaceWSDL11SOAPAddress(WSDLDefinitions wsdlDefinitions, QName
portQName, String serviceEndpointURL)
- {
- Definition wsdlOneOneDefinition = wsdlDefinitions.getWsdlOneOneDefinition();
- String tnsURI = wsdlOneOneDefinition.getTargetNamespace();
-
- // search for matching portElement and replace the address URI
- Port wsdlOneOnePort = modifySOAPAddress(tnsURI, portQName, serviceEndpointURL,
wsdlOneOneDefinition.getServices());
-
- // recursivly process imports if none can be found
- if (wsdlOneOnePort == null &&
!wsdlOneOneDefinition.getImports().isEmpty())
- {
-
- Iterator imports = wsdlOneOneDefinition.getImports().values().iterator();
- while (imports.hasNext())
- {
- List l = (List)imports.next();
- Iterator importsByNS = l.iterator();
- while (importsByNS.hasNext())
- {
- Import anImport = (Import)importsByNS.next();
- wsdlOneOnePort = modifySOAPAddress(anImport.getNamespaceURI(), portQName,
serviceEndpointURL, anImport.getDefinition().getServices());
- }
- }
- }
-
- // if it still doesn't exist something is wrong
- if (wsdlOneOnePort == null)
- throw new IllegalArgumentException("Cannot find port with name '"
+ portQName + "' in wsdl document");
- }
-
- private static Port modifySOAPAddress(String tnsURI, QName portQName, String
serviceEndpointURL, Map services)
- {
- QName SOAP12_ADDRESS = new QName(Constants.NS_SOAP12, "address");
-
- Port wsdlOneOnePort = null;
- Iterator itServices = services.values().iterator();
- while (itServices.hasNext())
- {
- Service wsdlOneOneService = (Service)itServices.next();
- Map wsdlOneOnePorts = wsdlOneOneService.getPorts();
- Iterator itPorts = wsdlOneOnePorts.keySet().iterator();
- while (itPorts.hasNext())
- {
- String portLocalName = (String)itPorts.next();
- if (portQName.equals(new QName(tnsURI, portLocalName)))
- {
- wsdlOneOnePort = (Port)wsdlOneOnePorts.get(portLocalName);
- List extElements = wsdlOneOnePort.getExtensibilityElements();
- for (Object extElement : extElements)
- {
- QName elementType =
((ExtensibilityElement)extElement).getElementType();
- if (extElement instanceof SOAPAddress)
- {
- SOAPAddress address = (SOAPAddress)extElement;
- address.setLocationURI(serviceEndpointURL);
- }
- else if (SOAP12_ADDRESS.equals(elementType))
- {
- Element domElement =
((UnknownExtensibilityElement)extElement).getElement();
- domElement.setAttribute("location", serviceEndpointURL);
- }
- }
- }
- }
- }
-
- return wsdlOneOnePort;
- }
-
- private static String getUriScheme(String addrStr)
- {
- try
- {
- URI addrURI = new URI(addrStr);
- String scheme = addrURI.getScheme();
- return scheme;
- }
- catch (URISyntaxException e)
- {
- return null;
- }
- }
-}
Copied: trunk/src/main/java/org/jboss/ws/metadata/builder/MetaDataBuilder.java (from rev
1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/builder/MetaDataBuilder.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/builder/MetaDataBuilder.java 2006-12-07
10:43:36 UTC (rev 1600)
+++ trunk/src/main/java/org/jboss/ws/metadata/builder/MetaDataBuilder.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -0,0 +1,476 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, 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.builder;
+
+// $Id$
+
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.management.ObjectName;
+import javax.wsdl.Definition;
+import javax.wsdl.Import;
+import javax.wsdl.Port;
+import javax.wsdl.Service;
+import javax.wsdl.extensions.ExtensibilityElement;
+import javax.wsdl.extensions.UnknownExtensibilityElement;
+import javax.wsdl.extensions.soap.SOAPAddress;
+import javax.xml.namespace.QName;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.Constants;
+import org.jboss.ws.WSException;
+import org.jboss.ws.core.CommonSOAPBinding;
+import org.jboss.ws.core.jaxrpc.Use;
+import org.jboss.ws.core.server.ServiceEndpointManager;
+import org.jboss.ws.core.server.ServiceEndpointManagerFactory;
+import org.jboss.ws.core.server.UnifiedDeploymentInfo;
+import org.jboss.ws.core.utils.ObjectNameFactory;
+import org.jboss.ws.metadata.j2ee.UnifiedApplicationMetaData;
+import org.jboss.ws.metadata.j2ee.UnifiedBeanMetaData;
+import org.jboss.ws.metadata.j2ee.UnifiedEjbPortComponentMetaData;
+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.ServerEndpointMetaData;
+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.WSDLService;
+import org.jboss.ws.metadata.wsse.WSSecurityConfiguration;
+import org.jboss.ws.metadata.wsse.WSSecurityConfigurationFactory;
+import org.w3c.dom.Element;
+
+/** An abstract meta data builder.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 19-May-2005
+ */
+public abstract class MetaDataBuilder
+{
+ // provide logging
+ private final static Logger log = Logger.getLogger(MetaDataBuilder.class);
+
+ public static WSSecurityConfiguration getWsSecurityConfiguration(UnifiedDeploymentInfo
udi) throws IOException
+ {
+ WSSecurityConfiguration config = null;
+
+ String resource = WSSecurityConfigurationFactory.SERVER_RESOURCE_NAME;
+ if (udi.metaData instanceof UnifiedWebMetaData)
+ {
+ resource = "WEB-INF/" + resource;
+ }
+ else
+ {
+ resource = "META-INF/" + resource;
+ }
+
+ URL location = udi.classLoader.getResource(resource);
+ if (location != null)
+ {
+ config = WSSecurityConfigurationFactory.newInstance().parse(location);
+
+ // Get and set deployment path to the keystore file
+ if (config.getKeyStoreFile() != null)
+ {
+ location = udi.classLoader.getResource(config.getKeyStoreFile());
+ if (location != null)
+ config.setKeyStoreURL(location);
+ }
+
+ if (config.getTrustStoreFile() != null)
+ {
+ location = udi.classLoader.getResource(config.getTrustStoreFile());
+ if (location != null)
+ config.setTrustStoreURL(location);
+ }
+ }
+
+ return config;
+ }
+
+ /** Inititialize the endpoint binding */
+ protected void initEndpointBinding(WSDLEndpoint wsdlEndpoint, ClientEndpointMetaData
epMetaData)
+ {
+ WSDLDefinitions wsdlDefinitions =
wsdlEndpoint.getWsdlService().getWsdlDefinitions();
+ WSDLInterface wsdlInterface = wsdlEndpoint.getInterface();
+ WSDLBinding wsdlBinding =
wsdlDefinitions.getBindingByInterfaceName(wsdlInterface.getQName());
+ String bindingType = wsdlBinding.getType();
+ if (Constants.NS_SOAP11.equals(bindingType))
+ epMetaData.setBindingId(CommonSOAPBinding.SOAP11HTTP_BINDING);
+ else if (Constants.NS_SOAP12.equals(bindingType))
+ epMetaData.setBindingId(CommonSOAPBinding.SOAP12HTTP_BINDING);
+ }
+
+ /** Initialize the endpoint encoding style from the binding operations
+ */
+ protected void initEndpointEncodingStyle(EndpointMetaData epMetaData)
+ {
+ WSDLDefinitions wsdlDefinitions =
epMetaData.getServiceMetaData().getWsdlDefinitions();
+ for (WSDLService wsdlService : wsdlDefinitions.getServices())
+ {
+ for (WSDLEndpoint wsdlEndpoint : wsdlService.getEndpoints())
+ {
+ if (epMetaData.getQName().equals(wsdlEndpoint.getQName()))
+ {
+ QName bindQName = wsdlEndpoint.getBinding();
+ NCName ncName = new NCName(bindQName.getLocalPart());
+ WSDLBinding wsdlBinding = wsdlDefinitions.getBinding(ncName);
+ if (wsdlBinding == null)
+ throw new WSException("Cannot obtain binding: " + ncName);
+
+ for (WSDLBindingOperation wsdlBindingOperation :
wsdlBinding.getOperations())
+ {
+ String encStyle = wsdlBindingOperation.getEncodingStyle();
+ epMetaData.setEncodingStyle(Use.valueOf(encStyle));
+ }
+ }
+ }
+ }
+ }
+
+
+ public static void initEndpointAddress(UnifiedDeploymentInfo udi,
ServerEndpointMetaData sepMetaData, String linkName)
+ {
+ String contextRoot = sepMetaData.getContextRoot();
+ String urlPattern = sepMetaData.getURLPattern();
+
+ if (udi.metaData instanceof UnifiedWebMetaData)
+ {
+ UnifiedWebMetaData webMetaData = (UnifiedWebMetaData)udi.metaData;
+ String jbwebContextRoot = webMetaData.getContextRoot();
+ if (jbwebContextRoot != null)
+ contextRoot = jbwebContextRoot;
+
+ Map<String, String> servletMappings = webMetaData.getServletMappings();
+ urlPattern = (String)servletMappings.get(linkName);
+ if (urlPattern == null)
+ throw new WSException("Cannot obtain url pattern for servlet name:
" + linkName);
+ }
+
+ if (udi.metaData instanceof UnifiedApplicationMetaData)
+ {
+ UnifiedApplicationMetaData applMetaData =
(UnifiedApplicationMetaData)udi.metaData;
+ UnifiedBeanMetaData beanMetaData =
(UnifiedBeanMetaData)applMetaData.getBeanByEjbName(linkName);
+ if (beanMetaData == null)
+ throw new WSException("Cannot obtain meta data for ejb link: " +
linkName);
+
+ String wsContextRoot = applMetaData.getWebServiceContextRoot();
+ if (wsContextRoot != null)
+ contextRoot = wsContextRoot;
+
+ UnifiedEjbPortComponentMetaData ejbpcMetaData =
beanMetaData.getPortComponent();
+ if (ejbpcMetaData != null && ejbpcMetaData.getPortComponentURI() !=
null)
+ {
+ String pcUrlPattern = ejbpcMetaData.getPortComponentURI();
+ if (pcUrlPattern != null)
+ urlPattern = pcUrlPattern;
+ }
+ }
+
+ // If not, derive the context root from the deployment
+ if (contextRoot == null)
+ {
+ contextRoot = "/";
+ if (udi.parent != null)
+ {
+ String shortName = udi.parent.shortName;
+ shortName = shortName.substring(0, shortName.indexOf('.'));
+ contextRoot += shortName + "-";
+ }
+ String shortName = udi.shortName;
+ shortName = shortName.substring(0, shortName.indexOf('.'));
+ contextRoot += shortName;
+ }
+
+ if (contextRoot.startsWith("/") == false)
+ contextRoot = "/" + contextRoot;
+ if (urlPattern == null)
+ urlPattern = "/" + linkName;
+ if (urlPattern.startsWith("/") == false)
+ urlPattern = "/" + urlPattern;
+
+ sepMetaData.setContextRoot(contextRoot);
+ sepMetaData.setURLPattern(urlPattern);
+
+ String servicePath = contextRoot + urlPattern;
+ sepMetaData.setEndpointAddress(getServiceEndpointAddress(null, servicePath));
+ }
+
+ public static ObjectName getServiceEndpointID(UnifiedDeploymentInfo udi,
ServerEndpointMetaData sepMetaData)
+ {
+ String linkName = sepMetaData.getLinkName();
+ String context = sepMetaData.getContextRoot();
+ if (context.startsWith("/"))
+ context = context.substring(1);
+
+ StringBuilder idstr = new StringBuilder(ServerEndpointMetaData.SEPID_DOMAIN +
":");
+ idstr.append(ServerEndpointMetaData.SEPID_PROPERTY_CONTEXT + "=" +
context);
+ idstr.append("," + ServerEndpointMetaData.SEPID_PROPERTY_ENDPOINT +
"=" + linkName);
+
+ // Add JMS destination JNDI name for MDB endpoints
+ if (udi.metaData instanceof UnifiedApplicationMetaData)
+ {
+ String ejbName = sepMetaData.getLinkName();
+ if (ejbName == null)
+ throw new WSException("Cannot obtain ejb-link from port
component");
+
+ UnifiedApplicationMetaData applMetaData =
(UnifiedApplicationMetaData)udi.metaData;
+ UnifiedBeanMetaData beanMetaData =
(UnifiedBeanMetaData)applMetaData.getBeanByEjbName(ejbName);
+ if (beanMetaData == null)
+ throw new WSException("Cannot obtain ejb meta data for: " +
ejbName);
+
+ if (beanMetaData instanceof UnifiedMessageDrivenMetaData)
+ {
+ UnifiedMessageDrivenMetaData mdMetaData =
(UnifiedMessageDrivenMetaData)beanMetaData;
+ String jndiName = mdMetaData.getDestinationJndiName();
+ idstr.append(",jms=" + jndiName);
+ }
+ }
+
+ return ObjectNameFactory.create(idstr.toString());
+ }
+
+
+ /** Get the web service address for a given path
+ */
+ public static String getServiceEndpointAddress(String uriScheme, String servicePath)
+ {
+ if (servicePath == null || servicePath.length() == 0)
+ throw new WSException("Service path cannot be null");
+
+ if (servicePath.endsWith("/*"))
+ servicePath = servicePath.substring(0, servicePath.length() - 2);
+
+ if (uriScheme == null)
+ uriScheme = "http";
+
+ ServiceEndpointManagerFactory factory =
ServiceEndpointManagerFactory.getInstance();
+ ServiceEndpointManager epManager = factory.getServiceEndpointManager();
+ String host = epManager.getWebServiceHost();
+ int port = epManager.getWebServicePort();
+ if ("https".equals(uriScheme))
+ port = epManager.getWebServiceSecurePort();
+
+ String urlStr = uriScheme + "://" + host + ":" + port +
servicePath;
+ try
+ {
+ return new URL(urlStr).toExternalForm();
+ }
+ catch (MalformedURLException e)
+ {
+ throw new WSException("Malformed URL: " + urlStr);
+ }
+ }
+
+ /**
+ * Read the transport guarantee from web.xml
+ */
+ protected void initTransportGuaranteeJSE(UnifiedDeploymentInfo udi,
ServerEndpointMetaData sepMetaData, String servletLink) throws IOException
+ {
+ String transportGuarantee = null;
+ if (udi.metaData instanceof UnifiedWebMetaData)
+ {
+ UnifiedWebMetaData webMetaData = (UnifiedWebMetaData)udi.metaData;
+ Map<String, String> servletMappings = webMetaData.getServletMappings();
+ String urlPattern = servletMappings.get(servletLink);
+
+ if (urlPattern == null)
+ throw new WSException("Cannot find <url-pattern> for servlet-name:
" + servletLink);
+
+ List<UnifiedWebSecurityMetaData> securityList =
webMetaData.getSecurityMetaData();
+ for (UnifiedWebSecurityMetaData currentSecurity : securityList)
+ {
+ if (currentSecurity.getTransportGuarantee() != null &&
currentSecurity.getTransportGuarantee().length() > 0)
+ {
+ for (UnifiedWebResourceCollection currentCollection :
currentSecurity.getWebResources())
+ {
+ for (String currentUrlPattern : currentCollection.getUrlPatterns())
+ {
+ if (urlPattern.equals(currentUrlPattern))
+ {
+ transportGuarantee = currentSecurity.getTransportGuarantee();
+ }
+ }
+ }
+ }
+ }
+ }
+ sepMetaData.setTransportGuarantee(transportGuarantee);
+ }
+
+ /** Replace the address locations for a given port component.
+ */
+ public static void replaceAddressLocation(ServerEndpointMetaData sepMetaData)
+ {
+ WSDLDefinitions wsdlDefinitions =
sepMetaData.getServiceMetaData().getWsdlDefinitions();
+ QName portName = sepMetaData.getQName();
+
+ boolean endpointFound = false;
+ for (WSDLService wsdlService : wsdlDefinitions.getServices())
+ {
+ for (WSDLEndpoint wsdlEndpoint : wsdlService.getEndpoints())
+ {
+ QName wsdlPortName = wsdlEndpoint.getQName();
+ if (wsdlPortName.equals(portName))
+ {
+ endpointFound = true;
+
+ String orgAddress = wsdlEndpoint.getAddress();
+ String uriScheme = getUriScheme(orgAddress);
+
+ String transportGuarantee = sepMetaData.getTransportGuarantee();
+ if ("CONFIDENTIAL".equals(transportGuarantee))
+ uriScheme = "https";
+
+ String servicePath = sepMetaData.getContextRoot() +
sepMetaData.getURLPattern();
+ String serviceEndpointURL = getServiceEndpointAddress(uriScheme,
servicePath);
+
+ ServiceEndpointManagerFactory factory =
ServiceEndpointManagerFactory.getInstance();
+ ServiceEndpointManager epManager = factory.getServiceEndpointManager();
+ boolean alwaysModify = epManager.isAlwaysModifySOAPAddress();
+
+ if (alwaysModify || uriScheme == null ||
orgAddress.indexOf("REPLACE_WITH_ACTUAL_URL") >= 0)
+ {
+ log.debug("Replace service endpoint address '" +
orgAddress + "' with '" + serviceEndpointURL + "'");
+ wsdlEndpoint.setAddress(serviceEndpointURL);
+ sepMetaData.setEndpointAddress(serviceEndpointURL);
+
+ // modify the wsdl-1.1 definition
+ if (wsdlDefinitions.getWsdlOneOneDefinition() != null)
+ replaceWSDL11SOAPAddress(wsdlDefinitions, portName,
serviceEndpointURL);
+ }
+ else
+ {
+ log.debug("Don't replace service endpoint address '"
+ orgAddress + "'");
+ try
+ {
+ sepMetaData.setEndpointAddress(new
URL(orgAddress).toExternalForm());
+ }
+ catch (MalformedURLException e)
+ {
+ throw new WSException("Malformed URL: " + orgAddress);
+ }
+ }
+ }
+ }
+ }
+
+ if (endpointFound == false)
+ throw new WSException("Cannot find port in wsdl: " + portName);
+ }
+
+ private static void replaceWSDL11SOAPAddress(WSDLDefinitions wsdlDefinitions, QName
portQName, String serviceEndpointURL)
+ {
+ Definition wsdlOneOneDefinition = wsdlDefinitions.getWsdlOneOneDefinition();
+ String tnsURI = wsdlOneOneDefinition.getTargetNamespace();
+
+ // search for matching portElement and replace the address URI
+ Port wsdlOneOnePort = modifySOAPAddress(tnsURI, portQName, serviceEndpointURL,
wsdlOneOneDefinition.getServices());
+
+ // recursivly process imports if none can be found
+ if (wsdlOneOnePort == null &&
!wsdlOneOneDefinition.getImports().isEmpty())
+ {
+
+ Iterator imports = wsdlOneOneDefinition.getImports().values().iterator();
+ while (imports.hasNext())
+ {
+ List l = (List)imports.next();
+ Iterator importsByNS = l.iterator();
+ while (importsByNS.hasNext())
+ {
+ Import anImport = (Import)importsByNS.next();
+ wsdlOneOnePort = modifySOAPAddress(anImport.getNamespaceURI(), portQName,
serviceEndpointURL, anImport.getDefinition().getServices());
+ }
+ }
+ }
+
+ // if it still doesn't exist something is wrong
+ if (wsdlOneOnePort == null)
+ throw new IllegalArgumentException("Cannot find port with name '"
+ portQName + "' in wsdl document");
+ }
+
+ private static Port modifySOAPAddress(String tnsURI, QName portQName, String
serviceEndpointURL, Map services)
+ {
+ QName SOAP12_ADDRESS = new QName(Constants.NS_SOAP12, "address");
+
+ Port wsdlOneOnePort = null;
+ Iterator itServices = services.values().iterator();
+ while (itServices.hasNext())
+ {
+ Service wsdlOneOneService = (Service)itServices.next();
+ Map wsdlOneOnePorts = wsdlOneOneService.getPorts();
+ Iterator itPorts = wsdlOneOnePorts.keySet().iterator();
+ while (itPorts.hasNext())
+ {
+ String portLocalName = (String)itPorts.next();
+ if (portQName.equals(new QName(tnsURI, portLocalName)))
+ {
+ wsdlOneOnePort = (Port)wsdlOneOnePorts.get(portLocalName);
+ List extElements = wsdlOneOnePort.getExtensibilityElements();
+ for (Object extElement : extElements)
+ {
+ QName elementType =
((ExtensibilityElement)extElement).getElementType();
+ if (extElement instanceof SOAPAddress)
+ {
+ SOAPAddress address = (SOAPAddress)extElement;
+ address.setLocationURI(serviceEndpointURL);
+ }
+ else if (SOAP12_ADDRESS.equals(elementType))
+ {
+ Element domElement =
((UnknownExtensibilityElement)extElement).getElement();
+ domElement.setAttribute("location", serviceEndpointURL);
+ }
+ }
+ }
+ }
+ }
+
+ return wsdlOneOnePort;
+ }
+
+ private static String getUriScheme(String addrStr)
+ {
+ try
+ {
+ URI addrURI = new URI(addrStr);
+ String scheme = addrURI.getScheme();
+ return scheme;
+ }
+ catch (URISyntaxException e)
+ {
+ return null;
+ }
+ }
+}
Copied: trunk/src/main/java/org/jboss/ws/metadata/builder/jaxrpc (from rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/builder/jaxrpc)
Deleted:
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCClientDeployment.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCClientDeployment.java 2006-12-07
10:43:36 UTC (rev 1600)
+++
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCClientDeployment.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -1,42 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.ws.metadata.builder.jaxrpc;
-
-import org.jboss.ws.core.server.UnifiedDeploymentInfo;
-
-
-// $Id$
-
-/**
- * The container independent deployment info.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 05-May-2006
- */
-public class JAXRPCClientDeployment extends UnifiedDeploymentInfo
-{
-
- public JAXRPCClientDeployment(DeploymentType type)
- {
- super(type);
- }
-}
Copied:
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCClientDeployment.java (from
rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCClientDeployment.java)
Deleted:
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCClientMetaDataBuilder.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCClientMetaDataBuilder.java 2006-12-07
10:43:36 UTC (rev 1600)
+++
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCClientMetaDataBuilder.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -1,258 +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.builder.jaxrpc;
-
-//$Id$
-
-import java.io.IOException;
-import java.net.URL;
-import java.util.Set;
-
-import javax.xml.namespace.QName;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.Constants;
-import org.jboss.ws.WSException;
-import org.jboss.ws.metadata.config.jaxrpc.WSClientConfigJAXRPC;
-import org.jboss.ws.metadata.j2ee.UnifiedHandlerMetaData;
-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.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;
-import org.jboss.ws.metadata.wsdl.WSDLService;
-import org.jboss.ws.metadata.wsse.WSSecurityConfiguration;
-import org.jboss.ws.metadata.wsse.WSSecurityConfigurationFactory;
-
-/**
- * A client side meta data builder.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 19-May-2005
- */
-public class JAXRPCClientMetaDataBuilder extends JAXRPCMetaDataBuilder
-{
- // provide logging
- private final Logger log = Logger.getLogger(JAXRPCClientMetaDataBuilder.class);
-
- /** Build from WSDL and jaxrpc-mapping.xml
- */
- public ServiceMetaData buildMetaData(QName serviceQName, URL wsdlURL, URL mappingURL,
URL securityURL,
- UnifiedServiceRefMetaData serviceRefMetaData, ClassLoader loader)
- {
- try
- {
- JavaWsdlMapping javaWsdlMapping = null;
- if (mappingURL != null)
- {
- JavaWsdlMappingFactory mappingFactory =
JavaWsdlMappingFactory.newInstance();
- javaWsdlMapping = mappingFactory.parse(mappingURL);
- }
-
- WSSecurityConfiguration securityConfig = null;
- if (securityURL != null)
- {
- securityConfig =
WSSecurityConfigurationFactory.newInstance().parse(securityURL);
- }
-
- return buildMetaData(serviceQName, wsdlURL, javaWsdlMapping, securityConfig,
serviceRefMetaData, loader);
- }
- catch (RuntimeException rte)
- {
- throw rte;
- }
- catch (Exception ex)
- {
- throw new WSException("Cannot build meta data: " + ex.getMessage(),
ex);
- }
- }
-
- /** Build from WSDL and jaxrpc-mapping.xml
- */
- public ServiceMetaData buildMetaData(QName serviceQName, URL wsdlURL, JavaWsdlMapping
javaWsdlMapping, WSSecurityConfiguration securityConfig,
- UnifiedServiceRefMetaData serviceRefMetaData, ClassLoader loader)
- {
- log.debug("START buildMetaData: [service=" + serviceQName +
"]");
- try
- {
- UnifiedMetaData wsMetaData = new UnifiedMetaData();
- wsMetaData.setClassLoader(loader);
-
- ServiceMetaData serviceMetaData = new ServiceMetaData(wsMetaData,
serviceQName);
- wsMetaData.addService(serviceMetaData);
-
- serviceMetaData.setWsdlFile(wsdlURL.toExternalForm());
- WSDLDefinitions wsdlDefinitions = serviceMetaData.getWsdlDefinitions();
-
- URL mappingURL = null;
- if (javaWsdlMapping != null)
- {
- mappingURL = new URL(Constants.NS_JBOSSWS_URI +
"/dummy-mapping-url");
- wsMetaData.addMappingDefinition(mappingURL.toExternalForm(),
javaWsdlMapping);
- serviceMetaData.setJaxrpcMappingFile(mappingURL.toExternalForm());
- }
-
- if (securityConfig != null)
- {
- serviceMetaData.setSecurityConfiguration(securityConfig);
- setupSecurity(securityConfig, loader);
- }
-
- buildMetaDataInternal(serviceMetaData, wsdlDefinitions, javaWsdlMapping,
serviceRefMetaData);
-
- // eagerly initialize
- wsMetaData.eagerInitialize();
-
- log.debug("END buildMetaData: " + wsMetaData);
- return serviceMetaData;
- }
- catch (RuntimeException rte)
- {
- throw rte;
- }
- catch (Exception ex)
- {
- throw new WSException("Cannot build meta data: " + ex.getMessage(),
ex);
- }
- }
-
- private void buildMetaDataInternal(ServiceMetaData serviceMetaData, WSDLDefinitions
wsdlDefinitions, JavaWsdlMapping javaWsdlMapping,
- UnifiedServiceRefMetaData serviceRefMetaData) throws IOException
- {
- QName serviceQName = serviceMetaData.getServiceName();
-
- // Get the WSDL service
- WSDLService wsdlService = null;
- if (serviceQName == null)
- {
- if (wsdlDefinitions.getServices().length != 1)
- throw new IllegalArgumentException("Expected a single service
element");
-
- wsdlService = wsdlDefinitions.getServices()[0];
- serviceMetaData.setServiceName(wsdlService.getQName());
- }
- else
- {
- wsdlService = wsdlDefinitions.getService(new
NCName(serviceQName.getLocalPart()));
- }
- if (wsdlService == null)
- throw new IllegalArgumentException("Cannot obtain wsdl service: " +
serviceQName);
-
- // Build type mapping meta data
- setupTypesMetaData(serviceMetaData);
-
- // Build endpoint meta data
- for (WSDLEndpoint wsdlEndpoint : wsdlService.getEndpoints())
- {
- QName portName = wsdlEndpoint.getQName();
- QName interfaceQName = wsdlEndpoint.getInterface().getQName();
- ClientEndpointMetaData epMetaData = new ClientEndpointMetaData(serviceMetaData,
portName, interfaceQName, Type.JAXRPC);
- epMetaData.setEndpointAddress(wsdlEndpoint.getAddress());
- serviceMetaData.addEndpoint(epMetaData);
-
- // config-name, config-file
- if (serviceRefMetaData != null)
- {
- String configName = serviceRefMetaData.getConfigName();
- if (configName != null)
- epMetaData.setConfigName(configName);
-
- String configFile = serviceRefMetaData.getConfigFile();
- if (configFile != null)
- epMetaData.setConfigFile(configFile);
- }
-
- // Init the endpoint binding
- initEndpointBinding(wsdlEndpoint, epMetaData);
-
- // Init the service encoding style
- initEndpointEncodingStyle(epMetaData);
-
- ServiceEndpointInterfaceMapping seiMapping = null;
- if (javaWsdlMapping != null)
- {
- QName portType = wsdlEndpoint.getInterface().getQName();
- seiMapping =
javaWsdlMapping.getServiceEndpointInterfaceMappingByPortType(portType);
- if (seiMapping != null)
- {
-
epMetaData.setServiceEndpointInterfaceName(seiMapping.getServiceEndpointInterface());
- }
- else
- {
- log.warn("Cannot obtain the SEI mapping for: " + portType);
- }
- }
-
- processEndpointMetaDataExtensions(epMetaData, wsdlDefinitions);
- setupOperationsFromWSDL(epMetaData, wsdlEndpoint, seiMapping);
- setupHandlers(serviceRefMetaData, portName, epMetaData);
- }
- }
-
- private void setupHandlers(UnifiedServiceRefMetaData serviceRefMetaData, QName
portName, EndpointMetaData epMetaData)
- {
- // Add pre handlers
- WSClientConfigJAXRPC jaxrpcConfig =
(WSClientConfigJAXRPC)epMetaData.getEndpointConfig();
- epMetaData.addHandlers(jaxrpcConfig.getHandlers(epMetaData, HandlerType.PRE));
-
- // Setup the endpoint handlers
- if (serviceRefMetaData != null)
- {
- for (UnifiedHandlerMetaData uhmd : serviceRefMetaData.getHandlers())
- {
- Set<String> portNames = uhmd.getPortNames();
- if (portNames.size() == 0 || portNames.contains(portName.getLocalPart()))
- {
- epMetaData.addHandler(uhmd.getHandlerMetaDataJAXRPC(epMetaData,
HandlerType.ENDPOINT));
- }
- }
- }
-
- // Add post handlers
- epMetaData.addHandlers(jaxrpcConfig.getHandlers(epMetaData, HandlerType.POST));
- }
-
- private void setupSecurity(WSSecurityConfiguration securityConfig, ClassLoader
loader)
- {
- if (securityConfig.getKeyStoreFile() != null)
- {
- URL location = loader.getResource(securityConfig.getKeyStoreFile());
- if (location != null)
- securityConfig.setKeyStoreURL(location);
- }
-
- if (securityConfig.getTrustStoreFile() != null)
- {
- URL location = loader.getResource(securityConfig.getTrustStoreFile());
- if (location != null)
- securityConfig.setTrustStoreURL(location);
- }
- }
-}
Copied:
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCClientMetaDataBuilder.java
(from rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCClientMetaDataBuilder.java)
Deleted: trunk/src/main/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCDeployment.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCDeployment.java 2006-12-07
10:43:36 UTC (rev 1600)
+++
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCDeployment.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -1,75 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.ws.metadata.builder.jaxrpc;
-
-import java.io.InputStream;
-import java.net.URL;
-
-import org.jboss.ws.core.server.UnifiedDeploymentInfo;
-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;
-
-// $Id$
-
-/**
- * The container independent deployment info.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 05-May-2006
- */
-public class JAXRPCDeployment extends UnifiedDeploymentInfo
-{
- private WebservicesMetaData jsr109MetaData;
-
- public JAXRPCDeployment(DeploymentType type, URL webservicesURL)
- {
- super(type);
-
- try
- {
- // Unmarshall webservices.xml
- InputStream is = webservicesURL.openStream();
- try
- {
- Unmarshaller unmarshaller =
UnmarshallerFactory.newInstance().newUnmarshaller();
- ObjectModelFactory factory = new WebservicesFactory(webservicesURL);
- jsr109MetaData = (WebservicesMetaData)unmarshaller.unmarshal(is, factory,
null);
- }
- finally
- {
- is.close();
- }
- }
- catch (Exception ex)
- {
- throw new RuntimeException(ex);
- }
- }
-
- public WebservicesMetaData getWebservicesMetaData()
- {
- return jsr109MetaData;
- }
-}
Copied: trunk/src/main/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCDeployment.java
(from rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCDeployment.java)
Deleted:
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCMetaDataBuilder.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCMetaDataBuilder.java 2006-12-07
10:43:36 UTC (rev 1600)
+++
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCMetaDataBuilder.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -1,968 +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.builder.jaxrpc;
-
-//$Id$
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.jws.soap.SOAPBinding.ParameterStyle;
-import javax.xml.namespace.QName;
-import javax.xml.rpc.ParameterMode;
-import javax.xml.rpc.encoding.TypeMappingRegistry;
-import javax.xml.ws.addressing.AddressingProperties;
-
-import org.apache.xerces.xs.XSTypeDefinition;
-import org.jboss.logging.Logger;
-import org.jboss.ws.Constants;
-import org.jboss.ws.WSException;
-import org.jboss.ws.core.jaxrpc.LiteralTypeMapping;
-import org.jboss.ws.core.jaxrpc.Style;
-import org.jboss.ws.core.jaxrpc.TypeMappingImpl;
-import org.jboss.ws.core.jaxrpc.TypeMappingRegistryImpl;
-import org.jboss.ws.core.jaxrpc.UnqualifiedFaultException;
-import org.jboss.ws.core.jaxrpc.Use;
-import org.jboss.ws.core.utils.JavaUtils;
-import org.jboss.ws.extensions.addressing.AddressingPropertiesImpl;
-import org.jboss.ws.extensions.addressing.metadata.AddressingOpMetaExt;
-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.extensions.xop.jaxrpc.XOPScanner;
-import org.jboss.ws.metadata.builder.MetaDataBuilder;
-import org.jboss.ws.metadata.jaxrpcmapping.ExceptionMapping;
-import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping;
-import org.jboss.ws.metadata.jaxrpcmapping.JavaXmlTypeMapping;
-import org.jboss.ws.metadata.jaxrpcmapping.MethodParamPartsMapping;
-import org.jboss.ws.metadata.jaxrpcmapping.ServiceEndpointInterfaceMapping;
-import org.jboss.ws.metadata.jaxrpcmapping.ServiceEndpointMethodMapping;
-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.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.WrappedParameter;
-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.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.WSDLMIMEPart;
-import org.jboss.ws.metadata.wsdl.WSDLProperty;
-import org.jboss.ws.metadata.wsdl.WSDLRPCPart;
-import org.jboss.ws.metadata.wsdl.WSDLRPCSignatureItem;
-import org.jboss.ws.metadata.wsdl.WSDLSOAPHeader;
-import org.jboss.ws.metadata.wsdl.WSDLTypes;
-import org.jboss.ws.metadata.wsdl.WSDLUtils;
-import org.jboss.ws.metadata.wsdl.WSDLRPCSignatureItem.Direction;
-import org.jboss.ws.metadata.wsdl.xmlschema.JBossXSModel;
-
-/**
- * A meta data builder that is based on webservices.xml.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @authoer <a href="mailto:jason.greene@jboss.org">Jason T.
Greene</a>
- * @since 19-Oct-2005
- */
-public abstract class JAXRPCMetaDataBuilder extends MetaDataBuilder
-{
- // provide logging
- final Logger log = Logger.getLogger(JAXRPCMetaDataBuilder.class);
-
- protected QName lookupSchemaType(WSDLInterfaceOperation operation, QName element)
- {
- WSDLDefinitions wsdlDefinitions =
operation.getWsdlInterface().getWsdlDefinitions();
- WSDLTypes wsdlTypes = wsdlDefinitions.getWsdlTypes();
- return wsdlTypes.getXMLType(element);
- }
-
- protected void setupTypesMetaData(ServiceMetaData serviceMetaData)
- {
- WSDLDefinitions wsdlDefinitions = serviceMetaData.getWsdlDefinitions();
- JavaWsdlMapping javaWsdlMapping = serviceMetaData.getJavaWsdlMapping();
- TypesMetaData typesMetaData = serviceMetaData.getTypesMetaData();
-
- // Copy the schema locations to the types meta data
- if (wsdlDefinitions != null)
- {
- WSDLTypes wsdlTypes = wsdlDefinitions.getWsdlTypes();
- typesMetaData.setSchemaModel(WSDLUtils.getSchemaModel(wsdlTypes));
- }
-
- // Copy the type mappings to the types meta data
- if (javaWsdlMapping != null)
- {
- for (JavaXmlTypeMapping xmlTypeMapping :
javaWsdlMapping.getJavaXmlTypeMappings())
- {
- String javaTypeName = xmlTypeMapping.getJavaType();
- String qnameScope = xmlTypeMapping.getQnameScope();
-
- QName xmlType = xmlTypeMapping.getRootTypeQName();
- QName anonymousXMLType = xmlTypeMapping.getAnonymousTypeQName();
- if (xmlType == null && anonymousXMLType != null)
- xmlType = anonymousXMLType;
-
- String nsURI = xmlType.getNamespaceURI();
- if (Constants.NS_SCHEMA_XSD.equals(nsURI) == false &&
Constants.URI_SOAP11_ENC.equals(nsURI) == false)
- {
- TypeMappingMetaData tmMetaData = new TypeMappingMetaData(typesMetaData,
xmlType, javaTypeName);
- tmMetaData.setQNameScope(qnameScope);
- typesMetaData.addTypeMapping(tmMetaData);
- }
- }
-
- for (ExceptionMapping exceptionMapping :
javaWsdlMapping.getExceptionMappings())
- {
- QName xmlType = exceptionMapping.getWsdlMessage();
- String javaTypeName = exceptionMapping.getExceptionType();
- TypeMappingMetaData tmMetaData = new TypeMappingMetaData(typesMetaData,
xmlType, javaTypeName);
- typesMetaData.addTypeMapping(tmMetaData);
- }
- }
- }
-
- protected void setupOperationsFromWSDL(EndpointMetaData epMetaData, WSDLEndpoint
wsdlEndpoint, ServiceEndpointInterfaceMapping seiMapping)
- {
- WSDLDefinitions wsdlDefinitions =
wsdlEndpoint.getInterface().getWsdlDefinitions();
-
- // For every WSDL interface operation build the OperationMetaData
- WSDLInterface wsdlInterface = wsdlEndpoint.getInterface();
- for (WSDLInterfaceOperation wsdlOperation : wsdlInterface.getOperations())
- {
- String opName = wsdlOperation.getName().toString();
- QName opQName = wsdlOperation.getQName();
-
- // Set java method name
- String javaName = opName.substring(0, 1).toLowerCase() + opName.substring(1);
- ServiceEndpointMethodMapping seiMethodMapping = null;
- if (seiMapping != null)
- {
-
epMetaData.setServiceEndpointInterfaceName(seiMapping.getServiceEndpointInterface());
-
- seiMethodMapping =
seiMapping.getServiceEndpointMethodMappingByWsdlOperation(opName);
- if (seiMethodMapping == null)
- throw new WSException("Cannot obtain method mapping for: " +
opName);
-
- javaName = seiMethodMapping.getJavaMethodName();
- }
-
- OperationMetaData opMetaData = new OperationMetaData(epMetaData, opQName,
javaName);
- epMetaData.addOperation(opMetaData);
-
- // Set the operation style
- String style = wsdlOperation.getStyle();
- epMetaData.setStyle((Constants.URI_STYLE_IRI.equals(style) ? Style.DOCUMENT :
Style.RPC));
-
- // Set the operation MEP
- if (Constants.WSDL20_PATTERN_IN_ONLY.equals(wsdlOperation.getPattern()))
- opMetaData.setOneWay(true);
-
- // Set the operation SOAPAction
- WSDLBinding wsdlBinding =
wsdlDefinitions.getBindingByInterfaceName(wsdlInterface.getQName());
- WSDLBindingOperation wsdlBindingOperation =
wsdlBinding.getOperationByRef(opQName);
- if (wsdlBindingOperation != null)
- opMetaData.setSOAPAction(wsdlBindingOperation.getSOAPAction());
-
- // Get the type mapping for the encoding style
- String encStyle = epMetaData.getEncodingStyle().toURI();
- TypeMappingRegistry tmRegistry = new TypeMappingRegistryImpl();
- TypeMappingImpl typeMapping =
(TypeMappingImpl)tmRegistry.getTypeMapping(encStyle);
-
- // Build the parameter meta data
- if (opMetaData.getStyle() == Style.RPC)
- {
- buildParameterMetaDataRpc(opMetaData, wsdlOperation, seiMethodMapping,
typeMapping);
- }
- else
- {
- buildParameterMetaDataDoc(opMetaData, wsdlOperation, seiMethodMapping,
typeMapping);
- }
-
- // Build operation faults
- buildFaultMetaData(opMetaData, wsdlOperation);
-
- // process further operation extensions
- processOpMetaExtensions(opMetaData, wsdlOperation);
- }
- }
-
- private ParameterMetaData buildInputParameter(OperationMetaData opMetaData,
WSDLInterfaceOperation wsdlOperation, ServiceEndpointMethodMapping seiMethodMapping,
TypeMappingImpl typeMapping, String partName, QName xmlName, QName xmlType, int pos)
- {
- WSDLRPCSignatureItem item = wsdlOperation.getRpcSignatureitem(partName);
- if (item != null)
- pos = item.getPosition();
-
- String javaTypeName = typeMapping.getJavaTypeName(xmlType);
- if (seiMethodMapping != null)
- {
- MethodParamPartsMapping paramMapping =
seiMethodMapping.getMethodParamPartsMappingByPartName(partName);
- if (paramMapping == null)
- throw new WSException("Cannot obtain method parameter mapping for
message part '" + partName + "' in wsdl operation: "
- + seiMethodMapping.getWsdlOperation());
-
- javaTypeName = paramMapping.getParamType();
- pos = paramMapping.getParamPosition();
- }
-
- JavaWsdlMapping javaWsdlMapping =
opMetaData.getEndpointMetaData().getServiceMetaData().getJavaWsdlMapping();
- if (javaTypeName == null && javaWsdlMapping != null)
- {
- String packageName =
javaWsdlMapping.getPackageNameForNamespaceURI(xmlType.getNamespaceURI());
- if (packageName != null)
- {
- javaTypeName = packageName + "." + xmlType.getLocalPart();
- log.warn("Guess java type from package mapping: [xmlType=" +
xmlType + ",javaType=" + javaTypeName + "]");
- }
- }
-
- if (javaTypeName == null)
- throw new WSException("Cannot obtain java type mapping for: " +
xmlType);
-
- ParameterMetaData inMetaData = new ParameterMetaData(opMetaData, xmlName, xmlType,
javaTypeName);
- inMetaData.setPartName(partName);
- inMetaData.setIndex(pos);
- opMetaData.addParameter(inMetaData);
-
- TypesMetaData typesMetaData =
opMetaData.getEndpointMetaData().getServiceMetaData().getTypesMetaData();
- // In arrays of user types, wscompile does not generate a mapping in
jaxrpc-mapping.xml
- if (typesMetaData.getTypeMappingByXMLType(xmlType) == null)
- {
- String nsURI = xmlType.getNamespaceURI();
- if (Constants.NS_SCHEMA_XSD.equals(nsURI) == false &&
Constants.URI_SOAP11_ENC.equals(nsURI) == false)
- {
- TypeMappingMetaData tmMetaData = new TypeMappingMetaData(typesMetaData,
xmlType, javaTypeName);
- typesMetaData.addTypeMapping(tmMetaData);
- }
- }
-
- return inMetaData;
- }
-
- private ParameterMetaData buildOutputParameter(OperationMetaData opMetaData,
WSDLInterfaceOperation wsdlOperation, ServiceEndpointMethodMapping seiMethodMapping, int
pos, String partName, QName xmlName, QName xmlType, TypeMappingImpl typeMapping)
- {
- // Default is first listed output
- boolean hasReturnMapping = opMetaData.getReturnParameter() == null;
-
- WSDLRPCSignatureItem item = wsdlOperation.getRpcSignatureitem(partName);
- if (item != null)
- {
- hasReturnMapping = item.getDirection() == Direction.RETURN;
- pos = item.getPosition();
- }
-
- String javaTypeName = typeMapping.getJavaTypeName(xmlType);
- if (seiMethodMapping != null)
- {
- MethodParamPartsMapping paramMapping =
seiMethodMapping.getMethodParamPartsMappingByPartName(partName);
- if (paramMapping != null)
- {
- javaTypeName = paramMapping.getParamType();
- pos = paramMapping.getParamPosition();
- hasReturnMapping = false;
- }
- else
- {
- WsdlReturnValueMapping returnMapping =
seiMethodMapping.getWsdlReturnValueMapping();
- String mappingPart = returnMapping.getWsdlMessagePartName();
- if (returnMapping != null && mappingPart != null &&
partName.equals(mappingPart));
- {
- javaTypeName = returnMapping.getMethodReturnValue();
- hasReturnMapping = true;
- }
- }
- }
-
- JavaWsdlMapping javaWsdlMapping =
opMetaData.getEndpointMetaData().getServiceMetaData().getJavaWsdlMapping();
- if (javaTypeName == null && javaWsdlMapping != null)
- {
- String packageName =
javaWsdlMapping.getPackageNameForNamespaceURI(xmlType.getNamespaceURI());
- if (packageName != null)
- {
- javaTypeName = packageName + "." + xmlType.getLocalPart();
- log.warn("Guess java type from package mapping: [xmlType=" +
xmlType + ",javaType=" + javaTypeName + "]");
- }
- }
-
- if (javaTypeName == null)
- throw new WSException("Cannot obtain java type mapping for: " +
xmlType);
-
- ParameterMetaData outMetaData = new ParameterMetaData(opMetaData, xmlName, xmlType,
javaTypeName);
- outMetaData.setPartName(partName);
-
- if (hasReturnMapping)
- {
- opMetaData.setReturnParameter(outMetaData);
- }
- else
- {
- outMetaData.setIndex(pos);
- outMetaData.setMode(ParameterMode.OUT);
- opMetaData.addParameter(outMetaData);
- }
-
- TypesMetaData typesMetaData =
opMetaData.getEndpointMetaData().getServiceMetaData().getTypesMetaData();
- // In arrays of user types, wscompile does not generate a mapping in
jaxrpc-mapping.xml
- if (typesMetaData.getTypeMappingByXMLType(xmlType) == null)
- {
- String nsURI = xmlType.getNamespaceURI();
- if (Constants.NS_SCHEMA_XSD.equals(nsURI) == false &&
Constants.URI_SOAP11_ENC.equals(nsURI) == false)
- {
- TypeMappingMetaData tmMetaData = new TypeMappingMetaData(typesMetaData,
xmlType, javaTypeName);
- typesMetaData.addTypeMapping(tmMetaData);
- }
- }
-
- return outMetaData;
- }
-
- private int processBindingParameters(OperationMetaData opMetaData,
WSDLInterfaceOperation wsdlOperation, ServiceEndpointMethodMapping seiMethodMapping,
TypeMappingImpl typeMapping, WSDLBindingOperation bindingOperation, int wsdlPosition)
- {
- WSDLBindingOperationInput bindingInput = bindingOperation.getInputs()[0];
- for (WSDLSOAPHeader header : bindingInput.getSoapHeaders())
- {
- QName xmlName = header.getElement();
- QName xmlType = lookupSchemaType(wsdlOperation, xmlName);
- String partName = header.getPartName();
-
- ParameterMetaData pmd = buildInputParameter(opMetaData, wsdlOperation,
seiMethodMapping, typeMapping, partName, xmlName, xmlType, wsdlPosition++);
- pmd.setInHeader(true);
- }
-
- for (WSDLMIMEPart mimePart : bindingInput.getMimeParts())
- {
- String partName = mimePart.getPartName();
- QName xmlName = new QName(partName);
- QName xmlType = mimePart.getXmlType();
-
- ParameterMetaData pmd = buildInputParameter(opMetaData, wsdlOperation,
seiMethodMapping, typeMapping, partName, xmlName, xmlType, wsdlPosition++);
- pmd.setSwA(true);
- pmd.setMimeTypes(mimePart.getMimeTypes());
- }
-
- return wsdlPosition;
- }
-
- private int processBindingOutputParameters(OperationMetaData opMetaData,
WSDLInterfaceOperation wsdlOperation, ServiceEndpointMethodMapping seiMethodMapping,
TypeMappingImpl typeMapping, WSDLBindingOperation bindingOperation, int wsdlPosition)
- {
- WSDLBindingOperationOutput bindingOutput = bindingOperation.getOutputs()[0];
- for (WSDLSOAPHeader header : bindingOutput.getSoapHeaders())
- {
- String partName = header.getPartName();
- QName xmlName = header.getElement();
-
- ParameterMetaData outMetaData = opMetaData.getParameter(xmlName);
- if (outMetaData != null)
- {
- outMetaData.setMode(ParameterMode.INOUT);
- }
- else
- {
- QName xmlType = lookupSchemaType(wsdlOperation, xmlName);
-
- ParameterMetaData pmd = buildOutputParameter(opMetaData, wsdlOperation,
seiMethodMapping, wsdlPosition, partName, xmlName, xmlType, typeMapping);
- pmd.setInHeader(true);
-
- if (opMetaData.getReturnParameter() != pmd)
- wsdlPosition++;
- }
- }
-
- for (WSDLMIMEPart mimePart : bindingOutput.getMimeParts())
- {
- String partName = mimePart.getPartName();
- QName xmlName = new QName(partName);
-
- ParameterMetaData outMetaData = opMetaData.getParameter(xmlName);
- if (outMetaData != null)
- {
- outMetaData.setMode(ParameterMode.INOUT);
- }
- else
- {
- QName xmlType = mimePart.getXmlType();
-
- ParameterMetaData pmd = buildOutputParameter(opMetaData, wsdlOperation,
seiMethodMapping, wsdlPosition, partName, xmlName, xmlType, typeMapping);
- pmd.setSwA(true);
- pmd.setMimeTypes(mimePart.getMimeTypes());
-
- if (opMetaData.getReturnParameter() != pmd)
- wsdlPosition++;
- }
- }
-
- return wsdlPosition;
- }
-
- /* SOAP-ENC:Array
- *
- * FIXME: This hack should be removed as soon as we can reliably get the
- * soapenc:arrayType from wsdl + schema.
- */
- private void setupSOAPArrayParameter(ParameterMetaData paramMetaData)
- {
- Use use = paramMetaData.getOperationMetaData().getUse();
- String xmlTypeLocalPart = paramMetaData.getXmlType().getLocalPart();
- if (use == Use.ENCODED && xmlTypeLocalPart.indexOf("ArrayOf")
>= 0)
- {
- paramMetaData.setSOAPArrayParam(true);
- try
- {
- String javaTypeName = paramMetaData.getJavaTypeName();
- // This approach determins the array component type from the javaTypeName.
- // It will not work for user defined types, nor will the array dimension be
- // initialized properly. Ideally the array parameter meta data should be
initialized
- // from the XSModel or wherever it is defined in WSDL.
- Class javaType = JavaUtils.loadJavaType(javaTypeName);
- Class compJavaType = javaType.getComponentType();
-
- if (xmlTypeLocalPart.indexOf("ArrayOfArrayOf") >= 0)
- compJavaType = compJavaType.getComponentType();
-
- QName compXMLType = new LiteralTypeMapping().getXMLType(compJavaType);
- paramMetaData.setSOAPArrayCompType(compXMLType);
- }
- catch (ClassNotFoundException e)
- {
- // ignore that user defined types cannot be loaded yet
- }
- }
- }
-
- private void setupXOPAttachmentParameter(WSDLInterfaceOperation operation,
ParameterMetaData paramMetaData)
- {
- QName xmlType = paramMetaData.getXmlType();
-
- // An XOP parameter is detected if it is a complex type that derives from
xsd:base64Binary
- WSDLTypes wsdlTypes =
operation.getWsdlInterface().getWsdlDefinitions().getWsdlTypes();
- JBossXSModel schemaModel = WSDLUtils.getSchemaModel(wsdlTypes);
- String localPart = xmlType.getLocalPart() != null ? xmlType.getLocalPart() :
"";
- String ns = xmlType.getNamespaceURI() != null ? xmlType.getNamespaceURI() :
"";
- XSTypeDefinition xsType = schemaModel.getTypeDefinition(localPart, ns);
- XOPScanner scanner = new XOPScanner();
- if(scanner.findXOPTypeDef(xsType)!=null |
(localPart.equals("base64Binary")&&ns.equals(Constants.NS_SCHEMA_XSD)))
- {
- // FIXME: read the xmime:contentType from the element declaration
- // See SchemaUtils#findXOPTypeDef(XSTypeDefinition typeDef) for details
-
- /*
- FIXME: the classloader is not set yet
- paramMetaData.setXopContentType(
- MimeUtils.resolveMimeType(paramMetaData.getJavaType())
- );
- */
-
- paramMetaData.setXOP(true);
-
- }
- }
-
- /*
- * Perhaps the JAX-RPC mapping model should be hash based. For now we optimize just
this case.
- */
- private Map<String, String> createVariableMappingMap(VariableMapping[]
mappings)
- {
- HashMap<String, String> map = new HashMap<String, String>();
- if (mappings != null)
- for (VariableMapping mapping : mappings)
- map.put(mapping.getXmlElementName(), mapping.getJavaVariableName());
-
- return map;
- }
-
- private void buildParameterMetaDataRpc(OperationMetaData opMetaData,
WSDLInterfaceOperation wsdlOperation, ServiceEndpointMethodMapping seiMethodMapping,
- TypeMappingImpl typeMapping)
- {
- log.trace("buildParameterMetaDataRpc: " + opMetaData.getQName());
-
- WSDLBindingOperation bindingOperation = wsdlOperation.getBindingOperation();
- if (bindingOperation == null)
- throw new WSException("Could not locate binding operation for:" +
opMetaData.getQName());
-
- // RPC has one input
- WSDLInterfaceOperationInput input = wsdlOperation.getInputs()[0];
- int wsdlPosition = 0;
- for (WSDLRPCPart part : input.getChildParts())
- {
- QName xmlType = part.getType();
- String partName = part.getName();
- QName xmlName = new QName(partName);
-
- ParameterMetaData pmd = buildInputParameter(opMetaData, wsdlOperation,
seiMethodMapping, typeMapping, partName, xmlName, xmlType, wsdlPosition++);
-
- setupXOPAttachmentParameter(wsdlOperation, pmd);
- setupSOAPArrayParameter(pmd);
- }
-
- wsdlPosition = processBindingParameters(opMetaData, wsdlOperation,
seiMethodMapping, typeMapping, bindingOperation, wsdlPosition);
-
- WSDLInterfaceOperationOutput[] outputs = wsdlOperation.getOutputs();
- if (outputs.length > 0)
- {
- WSDLInterfaceOperationOutput output = outputs[0];
- for (WSDLRPCPart part : output.getChildParts())
- {
- String partName = part.getName();
-
- ParameterMetaData outMetaData = opMetaData.getParameter(new
QName(partName));
- if (outMetaData != null)
- {
- outMetaData.setMode(ParameterMode.INOUT);
- }
- else
- {
- QName xmlName = new QName(partName);
- QName xmlType = part.getType();
-
- ParameterMetaData pmd = buildOutputParameter(opMetaData, wsdlOperation,
seiMethodMapping, wsdlPosition, partName, xmlName, xmlType, typeMapping);
- if (opMetaData.getReturnParameter() != pmd)
- wsdlPosition++;
-
- setupXOPAttachmentParameter(wsdlOperation, pmd);
- setupSOAPArrayParameter(pmd);
- }
- }
-
- processBindingOutputParameters(opMetaData, wsdlOperation, seiMethodMapping,
typeMapping, bindingOperation, wsdlPosition);
- }
- else if (wsdlOperation.getPattern() != Constants.WSDL20_PATTERN_IN_ONLY)
- {
- throw new WSException("RPC style was missing an output, and was not an
IN-ONLY MEP.");
- }
- }
-
- private int processDocElement(OperationMetaData operation, WSDLInterfaceOperation
wsdlOperation, ServiceEndpointMethodMapping seiMethodMapping, TypeMappingImpl typeMapping,
List<WrappedParameter> wrappedParameters, List<WrappedParameter>
wrappedResponseParameters)
- {
- WSDLInterfaceOperationInput input = wsdlOperation.getInputs()[0];
- int wsdlPosition;
-
- QName xmlName = input.getElement();
- QName xmlType = input.getXMLType();
- String javaTypeName = typeMapping.getJavaTypeName(xmlType);
-
- TypesMetaData typesMetaData =
operation.getEndpointMetaData().getServiceMetaData().getTypesMetaData();
- TypeMappingMetaData typeMetaData = typesMetaData.getTypeMappingByXMLType(xmlType);
- if (typeMetaData != null)
- javaTypeName = typeMetaData.getJavaTypeName();
-
- if (javaTypeName == null)
- throw new WSException("Cannot obtain java type mapping for: " +
xmlType);
-
- // Check if we need to wrap the parameters
- boolean isWrapped = isWrapped(seiMethodMapping, javaTypeName);
- operation.getEndpointMetaData().setParameterStyle(isWrapped ?
ParameterStyle.WRAPPED : ParameterStyle.BARE);
-
- ParameterMetaData inMetaData = new ParameterMetaData(operation, xmlName, xmlType,
javaTypeName);
- operation.addParameter(inMetaData);
-
-
- // Set the variable names
- if (inMetaData.getOperationMetaData().isDocumentWrapped())
- {
- if (seiMethodMapping == null)
- throw new IllegalArgumentException("Cannot wrap parameters without SEI
method mapping");
-
- ServiceEndpointInterfaceMapping seiMapping =
seiMethodMapping.getServiceEndpointInterfaceMapping();
- JavaXmlTypeMapping javaXmlTypeMapping =
seiMapping.getJavaWsdlMapping().getTypeMappingForQName(xmlType);
- if (javaXmlTypeMapping == null)
- throw new WSException("Cannot obtain java/xml type mapping for: " +
xmlType);
-
-
- Map<String, String> variableMap =
createVariableMappingMap(javaXmlTypeMapping.getVariableMappings());
- for (MethodParamPartsMapping partMapping :
seiMethodMapping.getMethodParamPartsMappings())
- {
- WsdlMessageMapping wsdlMessageMapping = partMapping.getWsdlMessageMapping();
- if (wsdlMessageMapping == null)
- throw new IllegalArgumentException("wsdl-message-message mapping
required for document/literal wrapped");
-
- String elementName = wsdlMessageMapping.getWsdlMessagePartName();
- String variable =
variableMap.get(wsdlMessageMapping.getWsdlMessagePartName());
- if (variable == null)
- throw new IllegalArgumentException("Could not determine variable name
for element: " + elementName);
-
- WrappedParameter wrapped = new WrappedParameter(new QName(elementName),
partMapping.getParamType(), variable,
- partMapping.getParamPosition());
-
-
- String parameterMode = wsdlMessageMapping.getParameterMode();
- if (parameterMode == null || parameterMode.length() < 2)
- throw new IllegalArgumentException("Invalid parameter mode for
element: " + elementName);
-
- if (! "OUT".equals(parameterMode))
- wrappedParameters.add(wrapped);
- if (! "IN".equals(parameterMode))
- wrappedResponseParameters.add(wrapped);
- }
- inMetaData.setWrappedParameters(wrappedParameters);
- wsdlPosition = wrappedParameters.size();
- }
- else
- {
- if (seiMethodMapping != null)
- {
- MethodParamPartsMapping part =
seiMethodMapping.getMethodParamPartsMappingByPartName(input.getPartName());
- if (part != null)
- {
- inMetaData.setJavaTypeName(part.getParamType());
- inMetaData.setIndex(part.getParamPosition());
- }
- }
-
- setupXOPAttachmentParameter(wsdlOperation, inMetaData);
- wsdlPosition = 1;
- }
-
- return wsdlPosition;
- }
-
- private boolean isWrapped(ServiceEndpointMethodMapping seiMethodMapping, String
javaTypeName)
- {
- boolean isWrapParameters = (seiMethodMapping != null ?
seiMethodMapping.isWrappedElement() : false);
- log.trace("isWrapParameters based on wrapped-element: " +
isWrapParameters);
- if (isWrapParameters == false && seiMethodMapping != null)
- {
-
- MethodParamPartsMapping[] partsMappings =
seiMethodMapping.getMethodParamPartsMappings();
- if (partsMappings.length > 0)
- {
- boolean matchingPartFound = false;
- for (MethodParamPartsMapping partsMapping : partsMappings)
- {
- String paramTypeName = partsMapping.getParamType();
- if (paramTypeName.equals(javaTypeName))
- {
- matchingPartFound = true;
- break;
- }
- else
- {
- // Check assignability,
- // JavaUtils.isAssignableFrom("org.w3c.dom.Element",
- // "javax.xml.soap.SOAPElement")
- try
- {
- Class paramType = JavaUtils.loadJavaType(paramTypeName);
- Class javaType = JavaUtils.loadJavaType(javaTypeName);
-
- // If it is assignable the explict mapping takes presedence
- // and we don't wrap
- if (JavaUtils.isAssignableFrom(javaType, paramType))
- {
- // javaTypeName = paramTypeName;
- matchingPartFound = true;
- break;
- }
- }
- catch (ClassNotFoundException e)
- {
- // Ignore. For simple types this should work, others should
- // be lexically equal
- // if it is not wrapped.
- }
- }
- }
- // Do we really want to continue to handle invalid mappings?
- isWrapParameters = (matchingPartFound == false);
- log.trace("isWrapParameters based on matching parts: " +
isWrapParameters);
- }
- }
- return isWrapParameters;
- }
-
- private int processOutputDocElement(OperationMetaData opMetaData,
WSDLInterfaceOperation wsdlOperation,
- ServiceEndpointMethodMapping seiMethodMapping, TypeMappingImpl typeMapping,
List<WrappedParameter> wrappedResponseParameters,
- int wsdlPosition)
- {
- WSDLInterfaceOperationOutput opOutput = wsdlOperation.getOutputs()[0];
- QName xmlName = opOutput.getElement();
- QName xmlType = opOutput.getXMLType();
-
- String javaTypeName = typeMapping.getJavaTypeName(xmlType);
-
- TypesMetaData typesMetaData =
opMetaData.getEndpointMetaData().getServiceMetaData().getTypesMetaData();
- if (typesMetaData.getTypeMappingByXMLType(xmlType) != null)
- javaTypeName =
typesMetaData.getTypeMappingByXMLType(xmlType).getJavaTypeName();
-
- if (javaTypeName == null)
- throw new WSException("Cannot obtain java/xml type mapping for: " +
xmlType);
-
- ParameterMetaData outMetaData = new ParameterMetaData(opMetaData, xmlName, xmlType,
javaTypeName);
-
- boolean hasReturnMapping = true;
- if (opMetaData.isDocumentWrapped())
- {
- if (seiMethodMapping == null)
- throw new IllegalArgumentException("Cannot wrap parameters without SEI
method mapping");
-
- WsdlReturnValueMapping returnValueMapping =
seiMethodMapping.getWsdlReturnValueMapping();
- if (returnValueMapping != null)
- {
- ServiceEndpointInterfaceMapping seiMapping =
seiMethodMapping.getServiceEndpointInterfaceMapping();
- JavaWsdlMapping javaWsdlMapping = seiMapping.getJavaWsdlMapping();
- JavaXmlTypeMapping javaXmlTypeMapping =
javaWsdlMapping.getTypeMappingForQName(xmlType);
- if (javaXmlTypeMapping == null)
- throw new WSException("Cannot obtain java/xml type mapping for:
" + xmlType);
-
- Map<String, String> map =
createVariableMappingMap(javaXmlTypeMapping.getVariableMappings());
- String elementName = returnValueMapping.getWsdlMessagePartName();
- String variable = map.get(elementName);
- if (variable == null)
- throw new IllegalArgumentException("Could not determine variable name
for element: " + elementName);
-
- String wrappedType = returnValueMapping.getMethodReturnValue();
- QName element = new QName(elementName);
- WrappedParameter wrappedParameter = new WrappedParameter(element,
wrappedType, variable, WrappedParameter.RETURN);
- wrappedResponseParameters.add(0, wrappedParameter);
- }
-
- outMetaData.setWrappedParameters(wrappedResponseParameters);
- }
- else
- {
- if (seiMethodMapping != null)
- {
- MethodParamPartsMapping part =
seiMethodMapping.getMethodParamPartsMappingByPartName(opOutput.getPartName());
- String mode = null;
- if (part != null)
- {
- WsdlMessageMapping wsdlMessageMapping = part.getWsdlMessageMapping();
- mode = wsdlMessageMapping.getParameterMode();
- }
- if ("INOUT".equals(mode))
- {
- ParameterMetaData inMetaData = opMetaData.getParameter(xmlName);
- if (inMetaData != null)
- {
- inMetaData.setMode(ParameterMode.INOUT);
- return wsdlPosition;
- }
-
- throw new WSException("Could not update IN parameter to be INOUT, as
indicated in the mapping: " + opOutput.getPartName());
- }
- // It's potentialy possible that an input parameter could exist with the
same part name
- else if ("OUT".equals(mode))
- {
- hasReturnMapping = false;
- javaTypeName = part.getParamType();
- outMetaData.setIndex(part.getParamPosition());
- outMetaData.setJavaTypeName(javaTypeName);
- }
- else
- {
- WsdlReturnValueMapping returnValueMapping =
seiMethodMapping.getWsdlReturnValueMapping();
- if (returnValueMapping != null)
- {
- javaTypeName = returnValueMapping.getMethodReturnValue();
- outMetaData.setJavaTypeName(javaTypeName);
- }
- }
- }
-
- setupXOPAttachmentParameter(wsdlOperation, outMetaData);
- }
-
- if (hasReturnMapping)
- {
- opMetaData.setReturnParameter(outMetaData);
- }
- else
- {
- opMetaData.addParameter(outMetaData);
- outMetaData.setMode(ParameterMode.OUT);
- wsdlPosition++;
- }
-
- return wsdlPosition;
- }
-
- private void buildParameterMetaDataDoc(OperationMetaData opMetaData,
WSDLInterfaceOperation wsdlOperation, ServiceEndpointMethodMapping seiMethodMapping,
- TypeMappingImpl typeMapping)
- {
- log.trace("buildParameterMetaDataDoc: " + opMetaData.getQName());
-
- WSDLBindingOperation bindingOperation = wsdlOperation.getBindingOperation();
- if (bindingOperation == null)
- throw new WSException("Could not locate binding operation for:" +
bindingOperation);
-
- List<WrappedParameter> wrappedParameters = new
ArrayList<WrappedParameter>();
- List<WrappedParameter> wrappedResponseParameters = new
ArrayList<WrappedParameter>();
-
- int wsdlPosition = 0;
- // WS-I BP 1.0 allows document/literal bare to have zero message parts
- if (wsdlOperation.getInputs().length > 0)
- {
- wsdlPosition = processDocElement(opMetaData, wsdlOperation, seiMethodMapping,
typeMapping, wrappedParameters, wrappedResponseParameters);
- wsdlPosition = processBindingParameters(opMetaData, wsdlOperation,
seiMethodMapping, typeMapping, bindingOperation, wsdlPosition);
- }
- else
- {
- // Set the default to bare in case there isn't an input object, revisit
this
- opMetaData.getEndpointMetaData().setParameterStyle(ParameterStyle.BARE);
- }
-
- if (wsdlOperation.getOutputs().length > 0)
- {
- wsdlPosition = processOutputDocElement(opMetaData, wsdlOperation,
seiMethodMapping, typeMapping, wrappedResponseParameters, wsdlPosition);
- wsdlPosition = processBindingOutputParameters(opMetaData, wsdlOperation,
seiMethodMapping, typeMapping, bindingOperation, wsdlPosition);
- }
- }
-
- /**
- * Build default action according to the pattern described in
- *
http://www.w3.org/Submission/2004/SUBM-ws-addressing-20040810/
- * Section 3.3.2 'Default Action Pattern'<br>
- * [target namespace]/[port type name]/[input|output name]
- *
- * @param wsdlOperation
- * @return action value
- */
- private String buildWsaActionValue(WSDLInterfaceOperation wsdlOperation)
- {
- WSDLProperty wsaAction =
wsdlOperation.getProperty(Constants.WSDL_ATTRIBUTE_WSA_ACTION.toString());
- String actionValue = null;
-
- if (null == wsaAction)
- {
-
- String tns = wsdlOperation.getQName().getNamespaceURI();
- String portTypeName = wsdlOperation.getQName().getLocalPart();
- WSDLProperty messageName =
wsdlOperation.getProperty("http://www.jboss.org/jbossws/messagename/...;
-
- actionValue = new String(tns + "/" + portTypeName + "/" +
messageName.getValue());
- }
- else
- {
- actionValue = wsaAction.getValue();
- }
-
- return actionValue;
- }
-
- protected void buildFaultMetaData(OperationMetaData opMetaData, WSDLInterfaceOperation
wsdlOperation)
- {
- TypesMetaData typesMetaData =
opMetaData.getEndpointMetaData().getServiceMetaData().getTypesMetaData();
-
- WSDLInterface wsdlInterface = wsdlOperation.getWsdlInterface();
- for (WSDLInterfaceOperationOutfault outFault : wsdlOperation.getOutfaults())
- {
- QName ref = outFault.getRef();
-
- WSDLInterfaceFault wsdlFault = wsdlInterface.getFault(new
NCName(ref.getLocalPart()));
- QName xmlName = wsdlFault.getElement();
- QName xmlType = wsdlFault.getXmlType();
- String javaTypeName = null;
-
- if (xmlType == null)
- {
- log.warn("Cannot obtain fault type for element: " + xmlName);
- xmlType = xmlName;
- }
-
- TypeMappingMetaData tmMetaData =
typesMetaData.getTypeMappingByXMLType(xmlType);
- if (tmMetaData != null)
- javaTypeName = tmMetaData.getJavaTypeName();
-
- if (javaTypeName == null)
- {
- log.warn("Cannot obtain java type mapping for: " + xmlType);
- javaTypeName = new UnqualifiedFaultException(xmlType).getClass().getName();
- }
-
- FaultMetaData faultMetaData = new FaultMetaData(opMetaData, xmlName, xmlType,
javaTypeName);
- opMetaData.addFault(faultMetaData);
- }
- }
-
- protected void processEndpointMetaDataExtensions(EndpointMetaData epMetaData,
WSDLDefinitions wsdlDefinitions)
- {
- for (WSDLInterface wsdlInterface : wsdlDefinitions.getInterfaces())
- {
- WSDLProperty eventSourceProp =
wsdlInterface.getProperty(Constants.WSDL_PROPERTY_EVENTSOURCE);
- if (eventSourceProp != null && epMetaData instanceof
ServerEndpointMetaData)
- {
- ServerEndpointMetaData sepMetaData = (ServerEndpointMetaData)epMetaData;
- String eventSourceNS = wsdlInterface.getQName().getNamespaceURI() +
"/" + wsdlInterface.getQName().getLocalPart();
- Object notificationSchema = null; // todo: resolve schema from operation
message
-
- EventingEpMetaExt ext = new
EventingEpMetaExt(EventingConstants.NS_EVENTING);
- ext.setEventSourceNS(eventSourceNS);
- ext.setNotificationSchema(notificationSchema);
-
- sepMetaData.addExtension(ext);
- sepMetaData.setManagedEndpointBean(EventingEndpoint.class.getName());
- }
- }
- }
-
- /** Process operation meta data extensions. */
- protected void processOpMetaExtensions(OperationMetaData opMetaData,
WSDLInterfaceOperation wsdlOperation)
- {
-
- String tns = wsdlOperation.getQName().getNamespaceURI();
- String portTypeName = wsdlOperation.getQName().getLocalPart();
-
- AddressingProperties ADDR = new AddressingPropertiesImpl();
- AddressingOpMetaExt addrExt = new AddressingOpMetaExt(ADDR.getNamespaceURI());
-
- // inbound action
- WSDLProperty wsaInAction =
wsdlOperation.getProperty(Constants.WSDL_PROPERTY_ACTION_IN);
- if (wsaInAction != null)
- {
- addrExt.setInboundAction(wsaInAction.getValue());
- }
- else
- {
- WSDLProperty messageName =
wsdlOperation.getProperty(Constants.WSDL_PROPERTY_MESSAGE_NAME_IN);
- addrExt.setInboundAction(tns + "/" + portTypeName + "/" +
messageName);
- }
-
- // outbound action
- WSDLProperty wsaOutAction =
wsdlOperation.getProperty(Constants.WSDL_PROPERTY_ACTION_OUT);
- if (wsaOutAction != null)
- {
- addrExt.setOutboundAction(wsaOutAction.getValue());
- }
- else
- {
- WSDLProperty messageName =
wsdlOperation.getProperty(Constants.WSDL_PROPERTY_MESSAGE_NAME_OUT);
- addrExt.setOutboundAction(tns + "/" + portTypeName + "/" +
messageName);
- }
-
- opMetaData.addExtension(addrExt);
- }
-}
Copied:
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCMetaDataBuilder.java (from
rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCMetaDataBuilder.java)
Deleted:
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCServerMetaDataBuilder.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCServerMetaDataBuilder.java 2006-12-07
10:43:36 UTC (rev 1600)
+++
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCServerMetaDataBuilder.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -1,263 +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.builder.jaxrpc;
-
-import java.util.Set;
-
-import javax.management.ObjectName;
-import javax.xml.namespace.QName;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.WSException;
-import org.jboss.ws.metadata.config.jaxrpc.WSEndpointConfigJAXRPC;
-import org.jboss.ws.metadata.j2ee.UnifiedApplicationMetaData;
-import org.jboss.ws.metadata.j2ee.UnifiedBeanMetaData;
-import org.jboss.ws.metadata.j2ee.UnifiedEjbPortComponentMetaData;
-import org.jboss.ws.metadata.j2ee.UnifiedHandlerMetaData;
-import org.jboss.ws.metadata.j2ee.UnifiedWebMetaData;
-import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping;
-import org.jboss.ws.metadata.jaxrpcmapping.ServiceEndpointInterfaceMapping;
-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;
-import org.jboss.ws.metadata.wsse.WSSecurityConfiguration;
-
-/**
- * A server side meta data builder that is based on webservices.xml.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 19-May-2005
- */
-public class JAXRPCServerMetaDataBuilder extends JAXRPCMetaDataBuilder
-{
- // provide logging
- final Logger log = Logger.getLogger(JAXRPCServerMetaDataBuilder.class);
-
- /**
- * Build from webservices.xml
- */
- public UnifiedMetaData buildMetaData(JAXRPCDeployment udi)
- {
- log.debug("START buildMetaData: [name=" + udi.getCanonicalName() +
"]");
- try
- {
- // For every webservice-description build the ServiceMetaData
- UnifiedMetaData wsMetaData = new UnifiedMetaData();
- wsMetaData.setDeploymentName(udi.getCanonicalName());
- wsMetaData.setClassLoader(udi.classLoader);
-
- WebserviceDescriptionMetaData[] wsDescriptionArr =
udi.getWebservicesMetaData().getWebserviceDescriptions();
- for (WebserviceDescriptionMetaData wsdMetaData : wsDescriptionArr)
- {
- ServiceMetaData serviceMetaData = new ServiceMetaData(wsMetaData, null);
-
serviceMetaData.setWebserviceDescriptionName(wsdMetaData.getWebserviceDescriptionName());
- wsMetaData.addService(serviceMetaData);
-
- // Unmarshall the WSDL
- serviceMetaData.setWsdlFile(wsdMetaData.getWsdlFile());
- WSDLDefinitions wsdlDefinitions = serviceMetaData.getWsdlDefinitions();
-
- // Unmarshall the jaxrpc-mapping.xml
- serviceMetaData.setJaxrpcMappingFile(wsdMetaData.getJaxrpcMappingFile());
- JavaWsdlMapping javaWsdlMapping = serviceMetaData.getJavaWsdlMapping();
- if (javaWsdlMapping == null)
- throw new WSException("jaxrpc-mapping-file not configured from
webservices.xml");
-
- // Build type mapping meta data
- setupTypesMetaData(serviceMetaData);
-
- // Assign the WS-Security configuration,
- WSSecurityConfiguration securityConfiguration =
getWsSecurityConfiguration(udi);
- serviceMetaData.setSecurityConfiguration(securityConfiguration);
-
- // For every port-component build the EndpointMetaData
- PortComponentMetaData[] pcMetaDataArr = wsdMetaData.getPortComponents();
- for (PortComponentMetaData pcMetaData : pcMetaDataArr)
- {
- QName portName = pcMetaData.getWsdlPort();
-
- // JBWS-722
- // <wsdl-port> in webservices.xml should be qualified
- if (portName.getNamespaceURI().length() == 0)
- {
- String nsURI = wsdlDefinitions.getTargetNamespace();
- portName = new QName(nsURI, portName.getLocalPart());
- log.warn("Adding wsdl targetNamespace to: " + portName);
- pcMetaData.setWsdlPort(portName);
- }
-
- WSDLEndpoint wsdlEndpoint = getWsdlEndpoint(wsdlDefinitions, portName);
- if (wsdlEndpoint == null)
- throw new WSException("Cannot find port in wsdl: " +
portName);
-
- // set service name
- serviceMetaData.setServiceName(wsdlEndpoint.getWsdlService().getQName());
- QName interfaceQName = wsdlEndpoint.getInterface().getQName();
-
- ServerEndpointMetaData sepMetaData = new
ServerEndpointMetaData(serviceMetaData, portName, interfaceQName, Type.JAXRPC);
- sepMetaData.setPortComponentName(pcMetaData.getPortComponentName());
- String linkName = pcMetaData.getEjbLink() != null ?
pcMetaData.getEjbLink() : pcMetaData.getServletLink();
- sepMetaData.setLinkName(linkName);
- serviceMetaData.addEndpoint(sepMetaData);
-
- initEndpointEncodingStyle(sepMetaData);
-
- initEndpointAddress(udi, sepMetaData, linkName);
-
- if (udi.metaData instanceof UnifiedApplicationMetaData)
- {
- UnifiedApplicationMetaData apMetaData =
(UnifiedApplicationMetaData)udi.metaData;
- wsMetaData.setSecurityDomain(apMetaData.getSecurityDomain());
-
- // Copy the wsdl publish location from jboss.xml
- String wsdName = serviceMetaData.getWebserviceDescriptionName();
- String wsdlPublishLocation =
apMetaData.getWsdlPublishLocationByName(wsdName);
- serviceMetaData.setWsdlPublishLocation(wsdlPublishLocation);
-
- // Copy <port-component> meta data
- UnifiedBeanMetaData beanMetaData =
(UnifiedBeanMetaData)apMetaData.getBeanByEjbName(linkName);
- if (beanMetaData == null)
- throw new WSException("Cannot obtain UnifiedBeanMetaData for:
" + linkName);
-
- String configName = apMetaData.getConfigName();
- if (configName != null)
- sepMetaData.setConfigName(configName);
-
- String configFile = apMetaData.getConfigFile();
- if (configFile != null)
- sepMetaData.setConfigFile(configFile);
-
- UnifiedEjbPortComponentMetaData bpcMetaData =
beanMetaData.getPortComponent();
- if (bpcMetaData != null)
- {
- if (bpcMetaData.getAuthMethod() != null)
- {
- String authMethod = bpcMetaData.getAuthMethod();
- sepMetaData.setAuthMethod(authMethod);
- }
- if (bpcMetaData.getTransportGuarantee() != null)
- {
- String transportGuarantee = bpcMetaData.getTransportGuarantee();
- sepMetaData.setTransportGuarantee(transportGuarantee);
- }
-
- sepMetaData.setURLPattern(bpcMetaData.getURLPattern());
- }
- }
- else if (udi.metaData instanceof UnifiedWebMetaData)
- {
- UnifiedWebMetaData webMetaData = (UnifiedWebMetaData)udi.metaData;
- wsMetaData.setSecurityDomain(webMetaData.getSecurityDomain());
-
- String targetBean = webMetaData.getServletClassNames().get(linkName);
- sepMetaData.setServiceEndpointImplName(targetBean);
-
- // Copy the wsdl publish location from jboss-web.xml
- String wsdName = serviceMetaData.getWebserviceDescriptionName();
- String wsdlPublishLocation =
webMetaData.getWsdlPublishLocationByName(wsdName);
- serviceMetaData.setWsdlPublishLocation(wsdlPublishLocation);
-
- String configName = webMetaData.getConfigName();
- if (configName != null)
- sepMetaData.setConfigName(configName);
-
- String configFile = webMetaData.getConfigFile();
- if (configFile != null)
- sepMetaData.setConfigFile(configFile);
-
- initTransportGuaranteeJSE(udi, sepMetaData, linkName);
- }
-
- // init service endpoint id
- ObjectName sepID = getServiceEndpointID(udi, sepMetaData);
- sepMetaData.setServiceEndpointID(sepID);
-
- replaceAddressLocation(sepMetaData);
-
- String seiName = pcMetaData.getServiceEndpointInterface();
- sepMetaData.setServiceEndpointInterfaceName(seiName);
-
- ServiceEndpointInterfaceMapping seiMapping =
javaWsdlMapping.getServiceEndpointInterfaceMapping(seiName);
- if (seiMapping == null)
- log.warn("Cannot obtain SEI mapping for: " + seiName);
-
- // process endpoint meta extension
- processEndpointMetaDataExtensions(sepMetaData, wsdlDefinitions);
-
- // Setup the endpoint operations
- setupOperationsFromWSDL(sepMetaData, wsdlEndpoint, seiMapping);
-
- // Add pre handlers
- WSEndpointConfigJAXRPC jaxrpcConfig =
(WSEndpointConfigJAXRPC)sepMetaData.getEndpointConfig();
- sepMetaData.addHandlers(jaxrpcConfig.getHandlers(sepMetaData,
HandlerType.PRE));
-
- // Setup the endpoint handlers
- for (UnifiedHandlerMetaData uhmd : pcMetaData.getHandlers())
- {
- Set<String> portNames = uhmd.getPortNames();
- if (portNames.size() == 0 ||
portNames.contains(portName.getLocalPart()))
- {
- sepMetaData.addHandler(uhmd.getHandlerMetaDataJAXRPC(sepMetaData,
HandlerType.ENDPOINT));
- }
- }
-
- // Add post handlers
- sepMetaData.addHandlers(jaxrpcConfig.getHandlers(sepMetaData,
HandlerType.POST));
- }
- }
-
- log.debug("END buildMetaData: " + wsMetaData);
- return wsMetaData;
- }
- catch (RuntimeException rte)
- {
- throw rte;
- }
- catch (Exception ex)
- {
- throw new WSException("Cannot build meta data: " + ex.getMessage(),
ex);
- }
- }
-
- private WSDLEndpoint getWsdlEndpoint(WSDLDefinitions wsdlDefinitions, QName portName)
- {
- WSDLEndpoint wsdlEndpoint = null;
- for (WSDLService wsdlService : wsdlDefinitions.getServices())
- {
- WSDLEndpoint auxEndpoint = wsdlService.getEndpoint(portName);
- if (auxEndpoint != null)
- {
- wsdlEndpoint = auxEndpoint;
- break;
- }
- }
- return wsdlEndpoint;
- }
-}
Copied:
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCServerMetaDataBuilder.java
(from rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCServerMetaDataBuilder.java)
Copied: trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws (from rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws)
Deleted:
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSClientEndpointMetaDataBuilder.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSClientEndpointMetaDataBuilder.java 2006-12-07
10:43:36 UTC (rev 1600)
+++
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSClientEndpointMetaDataBuilder.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -1,89 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
-*/
-// $Id$
-package org.jboss.ws.metadata.builder.jaxws;
-
-import javax.jws.HandlerChain;
-import javax.jws.soap.SOAPBinding;
-import javax.xml.ws.BindingType;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.metadata.config.jaxws.WSClientConfigJAXWS;
-import org.jboss.ws.metadata.umdm.EndpointMetaData;
-import org.jboss.ws.metadata.umdm.HandlerMetaData.HandlerType;
-
-/**
- * A client side meta data builder that is based on JSR-181 annotations
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 9-Aug-2006
- */
-public class JAXWSClientEndpointMetaDataBuilder extends JAXWSWebServiceMetaDataBuilder
-{
- // provide logging
- private final Logger log =
Logger.getLogger(JAXWSClientEndpointMetaDataBuilder.class);
-
- public void rebuildEndpointMetaData(EndpointMetaData epMetaData, Class<?>
wsClass)
- {
- log.debug("START: rebuildMetaData");
-
- // Clear the java types, etc.
- resetMetaDataBuilder(epMetaData.getClassLoader());
-
- // Nuke parameterStyle
- epMetaData.setParameterStyle(null);
-
- // Process an optional @BindingType annotation
- if (wsClass.isAnnotationPresent(BindingType.class))
- processBindingType(epMetaData, wsClass);
-
- // Process @SOAPBinding
- if (wsClass.isAnnotationPresent(SOAPBinding.class))
- processSOAPBinding(epMetaData, wsClass);
-
- // Clear handlers
- epMetaData.clearHandlers();
-
- // Add pre handlers
- WSClientConfigJAXWS jaxwsConfig =
(WSClientConfigJAXWS)epMetaData.getEndpointConfig();
- epMetaData.addHandlers(jaxwsConfig.getHandlers(epMetaData, HandlerType.PRE));
-
- // Process an optional @HandlerChain annotation
- if (wsClass.isAnnotationPresent(HandlerChain.class))
- processHandlerChain(epMetaData, wsClass);
-
- // Add post handlers
- epMetaData.addHandlers(jaxwsConfig.getHandlers(epMetaData, HandlerType.POST));
-
- // Process @WebMethod
- processWebMethods(epMetaData, wsClass);
-
- // Initialize types
- createJAXBContext(epMetaData);
- populateXmlTypes(epMetaData);
-
- // Eager initialization
- epMetaData.eagerInitialize();
-
- log.debug("END: rebuildMetaData\n" + epMetaData.getServiceMetaData());
- }
-}
Copied:
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSClientEndpointMetaDataBuilder.java
(from rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSClientEndpointMetaDataBuilder.java)
Deleted:
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSClientMetaDataBuilder.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSClientMetaDataBuilder.java 2006-12-07
10:43:36 UTC (rev 1600)
+++
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSClientMetaDataBuilder.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -1,173 +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.builder.jaxws;
-
-//$Id$
-
-import java.io.IOException;
-import java.net.URL;
-
-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.metadata.umdm.ClientEndpointMetaData;
-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.umdm.EndpointMetaData.Type;
-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.WSDLInterfaceOperation;
-import org.jboss.ws.metadata.wsdl.WSDLService;
-import org.jboss.ws.metadata.wsdl.WSDLUtils;
-import org.jboss.ws.metadata.wsdl.xmlschema.JBossXSModel;
-
-/**
- * A client side meta data builder.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 19-May-2005
- */
-public class JAXWSClientMetaDataBuilder extends JAXWSMetaDataBuilder
-{
- // provide logging
- private final Logger log = Logger.getLogger(JAXWSClientMetaDataBuilder.class);
-
- /** Build from WSDL and jaxrpc-mapping.xml
- */
- public ServiceMetaData buildMetaData(QName serviceName, URL wsdlURL, ClassLoader
loader)
- {
- if (wsdlURL == null)
- throw new IllegalArgumentException("Invalid wsdlURL: " + wsdlURL);
-
- log.debug("START buildMetaData: [service=" + serviceName +
"]");
- try
- {
- UnifiedMetaData wsMetaData = new UnifiedMetaData();
-
- ServiceMetaData serviceMetaData = new ServiceMetaData(wsMetaData, serviceName);
- wsMetaData.addService(serviceMetaData);
-
- serviceMetaData.setWsdlFile(wsdlURL.toExternalForm());
- WSDLDefinitions wsdlDefinitions = serviceMetaData.getWsdlDefinitions();
-
- buildMetaDataInternal(serviceMetaData, wsdlDefinitions);
-
- // Read the WSDL and initialize the schema model
- // This should only be needed for debuging purposes of the UMDM
- JBossXSModel schemaModel =
WSDLUtils.getSchemaModel(wsdlDefinitions.getWsdlTypes());
- serviceMetaData.getTypesMetaData().setSchemaModel(schemaModel);
-
- log.debug("END buildMetaData: " + wsMetaData);
- return serviceMetaData;
- }
- catch (RuntimeException rte)
- {
- throw rte;
- }
- catch (Exception ex)
- {
- throw new WSException("Cannot build meta data: " + ex.getMessage(),
ex);
- }
- }
-
- private void buildMetaDataInternal(ServiceMetaData serviceMetaData, WSDLDefinitions
wsdlDefinitions) throws IOException
- {
- QName serviceName = serviceMetaData.getServiceName();
-
- // Get the WSDL service
- WSDLService wsdlService = null;
- if (serviceName == null)
- {
- if (wsdlDefinitions.getServices().length != 1)
- throw new IllegalArgumentException("Expected a single service
element");
-
- wsdlService = wsdlDefinitions.getServices()[0];
- serviceMetaData.setServiceName(wsdlService.getQName());
- }
- else
- {
- wsdlService = wsdlDefinitions.getService(new
NCName(serviceName.getLocalPart()));
- }
- if (wsdlService == null)
- throw new IllegalArgumentException("Cannot obtain wsdl service: " +
serviceName);
-
- // Build endpoint meta data
- for (WSDLEndpoint wsdlEndpoint : wsdlService.getEndpoints())
- {
- QName portName = wsdlEndpoint.getQName();
- QName interfaceQName = wsdlEndpoint.getInterface().getQName();
- ClientEndpointMetaData epMetaData = new ClientEndpointMetaData(serviceMetaData,
portName, interfaceQName, Type.JAXWS);
- epMetaData.setEndpointAddress(wsdlEndpoint.getAddress());
- serviceMetaData.addEndpoint(epMetaData);
-
- // Init the endpoint binding
- initEndpointBinding(wsdlEndpoint, epMetaData);
-
- // Init the service encoding style
- initEndpointEncodingStyle(epMetaData);
-
- setupOperationsFromWSDL(epMetaData, wsdlEndpoint);
- }
- }
-
- protected void setupOperationsFromWSDL(EndpointMetaData epMetaData, WSDLEndpoint
wsdlEndpoint)
- {
- WSDLDefinitions wsdlDefinitions =
wsdlEndpoint.getInterface().getWsdlDefinitions();
-
- // For every WSDL interface operation build the OperationMetaData
- WSDLInterface wsdlInterface = wsdlEndpoint.getInterface();
- for (WSDLInterfaceOperation wsdlOperation : wsdlInterface.getOperations())
- {
- String opName = wsdlOperation.getName().toString();
- QName opQName = wsdlOperation.getQName();
-
- // Set java method name
- String javaName = opName.substring(0, 1).toLowerCase() + opName.substring(1);
-
- OperationMetaData opMetaData = new OperationMetaData(epMetaData, opQName,
javaName);
- epMetaData.addOperation(opMetaData);
-
- // Set the operation style
- String style = wsdlOperation.getStyle();
- epMetaData.setStyle((Constants.URI_STYLE_IRI.equals(style) ? Style.DOCUMENT :
Style.RPC));
-
- // Set the operation MEP
- if (Constants.WSDL20_PATTERN_IN_ONLY.equals(wsdlOperation.getPattern()))
- opMetaData.setOneWay(true);
-
- // Set the operation SOAPAction
- WSDLBinding wsdlBinding =
wsdlDefinitions.getBindingByInterfaceName(wsdlInterface.getQName());
- WSDLBindingOperation wsdlBindingOperation =
wsdlBinding.getOperationByRef(opQName);
- if (wsdlBindingOperation != null)
- opMetaData.setSOAPAction(wsdlBindingOperation.getSOAPAction());
- }
- }
-}
Copied:
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSClientMetaDataBuilder.java
(from rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSClientMetaDataBuilder.java)
Deleted:
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSEndpointMetaDataBuilder.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSEndpointMetaDataBuilder.java 2006-12-07
10:43:36 UTC (rev 1600)
+++
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSEndpointMetaDataBuilder.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -1,152 +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.builder.jaxws;
-
-import javax.xml.ws.BindingType;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.annotation.PortComponent;
-import org.jboss.ws.core.server.UnifiedDeploymentInfo;
-import org.jboss.ws.core.server.UnifiedDeploymentInfo.DeploymentType;
-import org.jboss.ws.metadata.umdm.EndpointMetaData;
-import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
-import org.jboss.ws.metadata.umdm.UnifiedMetaData;
-
-/**
- * Builds ServiceEndpointMetaData for a JAX-WS endpoint.
- *
- * @author <a href="mailto:jason.greene@jboss.com">Jason T.
Greene</a>
- * @version $Revision$
- */
-public abstract class JAXWSEndpointMetaDataBuilder extends JAXWSMetaDataBuilder
-{
- // provide logging
- private final Logger log = Logger.getLogger(JAXWSEndpointMetaDataBuilder.class);
-
- public abstract ServerEndpointMetaData buildEndpoint(UnifiedMetaData wsMetaData,
UnifiedDeploymentInfo udi, Class<?> sepClass, String linkName);
-
- protected void processBindingType(EndpointMetaData epMetaData, Class<?>
wsClass)
- {
- BindingType anBindingType = (BindingType)wsClass.getAnnotation(BindingType.class);
- String uri = anBindingType.value();
- if (uri.length() > 0)
- {
- // TODO: switch to JAX-WS 2.1
- // This allows us to use constants here and reuse the orig. URI straigt away
-
if(uri.equals("http://schemas.xmlsoap.org/wsdl/soap/http?mtom=true&q...
- {
- log.debug("MTOM enabled endpoint found");
- epMetaData.setMtomEnabled(true);
- epMetaData.setBindingId(uri.substring(0, uri.indexOf("?")));
- }
- else
- {
- epMetaData.setBindingId(uri);
- }
- }
- }
-
- protected void processPortComponent(UnifiedDeploymentInfo udi, Class<?> wsClass,
String linkName, ServerEndpointMetaData sepMetaData)
- {
- PortComponent anPortComponent =
(PortComponent)wsClass.getAnnotation(PortComponent.class);
- if (anPortComponent != null)
- {
- // setup config name
- if (anPortComponent.configName().length() > 0)
- {
- String configName = anPortComponent.configName();
- sepMetaData.setConfigName(configName);
- }
-
- // setup config file
- if (anPortComponent.configFile().length() > 0)
- {
- String configFile = anPortComponent.configFile();
- sepMetaData.setConfigFile(configFile);
- }
-
- boolean isJSEEndpoint = udi.type == DeploymentType.JAXWS_JSE;
-
- // context-root
- if (anPortComponent.contextRoot().length() > 0)
- {
- if (isJSEEndpoint)
- log.warn("(a)PortComponent.contextRoot is only valid on EJB
endpoints");
-
- if (isJSEEndpoint == false)
- {
- String contextRoot = anPortComponent.contextRoot();
- if (contextRoot.startsWith("/") == false)
- contextRoot = "/" + contextRoot;
-
- sepMetaData.setContextRoot(contextRoot);
- }
- }
-
- // url-pattern
- if (anPortComponent.urlPattern().length() > 0)
- {
- if (isJSEEndpoint)
- log.warn("(a)PortComponent.urlPattern is only valid on EJB
endpoints");
-
- if (isJSEEndpoint == false)
- {
- String urlPattern = anPortComponent.urlPattern();
- sepMetaData.setURLPattern(urlPattern);
- }
- }
-
- // auth-method
- if (anPortComponent.authMethod().length() > 0)
- {
- if (isJSEEndpoint)
- log.warn("(a)PortComponent.authMethod is only valid on EJB
endpoints");
-
- if (isJSEEndpoint == false)
- {
- String authMethod = anPortComponent.authMethod();
- sepMetaData.setAuthMethod(authMethod);
- }
- }
-
- // transport-guarantee
- if (anPortComponent.transportGuarantee().length() > 0)
- {
- if (isJSEEndpoint)
- log.warn("(a)PortComponent.transportGuarantee is only valid on EJB
endpoints");
-
- if (isJSEEndpoint == false)
- {
- String transportGuarantee = anPortComponent.transportGuarantee();
- sepMetaData.setTransportGuarantee(transportGuarantee);
- }
- }
-
- // virtual hosts
- String[] virtualHosts = anPortComponent.virtualHosts();
- if (virtualHosts != null & virtualHosts.length > 0)
- {
- sepMetaData.setVirtualHosts(virtualHosts);
- }
- }
- }
-}
Copied:
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSEndpointMetaDataBuilder.java
(from rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSEndpointMetaDataBuilder.java)
Deleted:
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilder.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilder.java 2006-12-07
10:43:36 UTC (rev 1600)
+++
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilder.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -1,34 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
-*/
-package org.jboss.ws.metadata.builder.jaxws;
-
-import org.jboss.ws.metadata.builder.MetaDataBuilder;
-
-/**
- * Abstract class that represents a JAX-WS metadata builder.
- *
- * @author <a href="mailto:jason.greene@jboss.com">Jason T.
Greene</a>
- * @version $Revision$
- */
-public class JAXWSMetaDataBuilder extends MetaDataBuilder
-{
-}
Copied: trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilder.java
(from rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilder.java)
Deleted:
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilderEJB21.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilderEJB21.java 2006-12-07
10:43:36 UTC (rev 1600)
+++
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilderEJB21.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -1,85 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
-*/
-// $Id$
-package org.jboss.ws.metadata.builder.jaxws;
-
-import java.util.Iterator;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.WSException;
-import org.jboss.ws.core.server.UnifiedDeploymentInfo;
-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
- *
- * @author Thomas.Diesler(a)jboss.org
- * @author <a href="mailto:jason.greene@jboss.com">Jason T.
Greene</a>
- * @since 19-May-2005
- */
-public class JAXWSMetaDataBuilderEJB21 extends JAXWSServerMetaDataBuilder
-{
- // provide logging
- private final Logger log = Logger.getLogger(JAXWSMetaDataBuilderEJB21.class);
-
- /** Build from annotations
- */
- public UnifiedMetaData buildMetaData(UnifiedDeploymentInfo udi)
- {
- log.debug("START buildMetaData: [name=" + udi.getCanonicalName() +
"]");
- try
- {
- UnifiedMetaData wsMetaData = new UnifiedMetaData();
- wsMetaData.setDeploymentName(udi.getCanonicalName());
- wsMetaData.setClassLoader(udi.classLoader);
-
- if (udi.classLoader == null)
- throw new WSException("Deployment class loader not initialized");
-
- // For every bean
- UnifiedApplicationMetaData appMetaData =
(UnifiedApplicationMetaData)udi.metaData;
- Iterator it = appMetaData.getEnterpriseBeans();
- while (it.hasNext())
- {
- UnifiedBeanMetaData beanMetaData = (UnifiedBeanMetaData)it.next();
-
- String ejbName = beanMetaData.getEjbName();
- String ejbClassName = beanMetaData.getEjbClass();
- Class beanClass = udi.classLoader.loadClass(ejbClassName);
- setupEndpoint(wsMetaData, udi, beanClass, ejbName);
- }
-
- log.debug("END buildMetaData: " + wsMetaData);
- return wsMetaData;
- }
- catch (RuntimeException rte)
- {
- throw rte;
- }
- catch (Exception ex)
- {
- throw new WSException("Cannot build meta data: " + ex.getMessage(),
ex);
- }
- }
-}
Copied:
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilderEJB21.java
(from rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilderEJB21.java)
Deleted:
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilderEJB3.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilderEJB3.java 2006-12-07
10:43:36 UTC (rev 1600)
+++
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilderEJB3.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -1,104 +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.builder.jaxws;
-
-import java.util.Iterator;
-
-import javax.jws.WebService;
-
-import org.jboss.annotation.security.SecurityDomain;
-import org.jboss.logging.Logger;
-import org.jboss.ws.WSException;
-import org.jboss.ws.core.server.UnifiedDeploymentInfo;
-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
- *
- * @author Thomas.Diesler(a)jboss.org
- * @author <a href="mailto:jason.greene@jboss.com">Jason T.
Greene</a>
- * @since 19-May-2005
- */
-public class JAXWSMetaDataBuilderEJB3 extends JAXWSServerMetaDataBuilder
-{
- // provide logging
- private final Logger log = Logger.getLogger(JAXWSMetaDataBuilderEJB3.class);
-
- protected Class annotatedClass;
-
- /** Build from webservices.xml
- */
- public UnifiedMetaData buildMetaData(UnifiedDeploymentInfo udi)
- {
- log.debug("START buildMetaData: [name=" + udi.getCanonicalName() +
"]");
- try
- {
- UnifiedMetaData wsMetaData = new UnifiedMetaData();
- wsMetaData.setDeploymentName(udi.getCanonicalName());
- wsMetaData.setClassLoader(udi.classLoader);
-
- if (udi.classLoader == null)
- throw new WSException("Deployment class loader not initialized");
-
- // The container objects below provide access to all of the ejb metadata
- UnifiedApplicationMetaData appMetaData =
(UnifiedApplicationMetaData)udi.metaData;
- Iterator<UnifiedBeanMetaData> it = appMetaData.getEnterpriseBeans();
- while (it.hasNext())
- {
- UnifiedBeanMetaData beanMetaData = it.next();
- String ejbClassName = beanMetaData.getEjbClass();
- Class<?> beanClass = udi.classLoader.loadClass(ejbClassName);
- if (beanClass.isAnnotationPresent(WebService.class))
- {
- String ejbLink = beanMetaData.getEjbName();
- setupEndpoint(wsMetaData, udi, beanClass, ejbLink);
-
- // setup the security domain
- if (beanClass.isAnnotationPresent(SecurityDomain.class))
- {
- SecurityDomain anSecurityDomain =
(SecurityDomain)beanClass.getAnnotation(SecurityDomain.class);
- String lastDomain = wsMetaData.getSecurityDomain();
- String securityDomain = anSecurityDomain.value();
- if (lastDomain != null && lastDomain.equals(securityDomain) ==
false)
- throw new IllegalStateException("Multiple security domains not
supported: " + securityDomain);
-
- wsMetaData.setSecurityDomain(securityDomain);
- }
- }
- }
-
- log.debug("END buildMetaData: " + wsMetaData);
- return wsMetaData;
- }
- catch (RuntimeException rte)
- {
- throw rte;
- }
- catch (Exception ex)
- {
- throw new WSException("Cannot build meta data: " + ex.getMessage(),
ex);
- }
- }
-}
Copied:
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilderEJB3.java
(from rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilderEJB3.java)
Deleted:
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilderJSE.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilderJSE.java 2006-12-07
10:43:36 UTC (rev 1600)
+++
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilderJSE.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -1,88 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-// $Id$
-package org.jboss.ws.metadata.builder.jaxws;
-
-import java.util.Map;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.WSException;
-import org.jboss.ws.core.server.UnifiedDeploymentInfo;
-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
- *
- * @author Thomas.Diesler(a)jboss.org
- * @author <a href="mailto:jason.greene@jboss.com">Jason T.
Greene</a>
- * @since 23-Jul-2005
- */
-public class JAXWSMetaDataBuilderJSE extends JAXWSServerMetaDataBuilder
-{
- // provide logging
- private final Logger log = Logger.getLogger(JAXWSMetaDataBuilderJSE.class);
-
- /** Build from annotations
- */
- public UnifiedMetaData buildMetaData(UnifiedDeploymentInfo udi)
- {
- log.debug("START buildMetaData: [name=" + udi.getCanonicalName() +
"]");
- try
- {
- UnifiedMetaData wsMetaData = new UnifiedMetaData();
- wsMetaData.setDeploymentName(udi.getCanonicalName());
- wsMetaData.setClassLoader(udi.classLoader);
-
- if (udi.classLoader == null)
- throw new WSException("Deployment class loader not initialized");
-
- // For every bean
- UnifiedWebMetaData webMetaData = (UnifiedWebMetaData)udi.metaData;
- Map<String, String> servletClassMap = webMetaData.getServletClassNames();
- for (String servletName : servletClassMap.keySet())
- {
- String servletClassName = servletClassMap.get(servletName);
- try
- {
- Class beanClass = udi.classLoader.loadClass(servletClassName);
- setupEndpoint(wsMetaData, udi, beanClass, servletName);
- }
- catch (ClassNotFoundException ex)
- {
- log.warn("Cannot load service endpoint class: " +
servletClassName);
- }
- }
-
- log.debug("END buildMetaData: " + wsMetaData);
- return wsMetaData;
- }
- catch (RuntimeException rte)
- {
- throw rte;
- }
- catch (Exception ex)
- {
- throw new WSException("Cannot build meta data: " + ex.getMessage(),
ex);
- }
- }
-}
Copied:
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilderJSE.java (from
rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilderJSE.java)
Deleted:
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSProviderMetaDataBuilder.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSProviderMetaDataBuilder.java 2006-12-07
10:43:36 UTC (rev 1600)
+++
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSProviderMetaDataBuilder.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -1,169 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-// $Id$
-package org.jboss.ws.metadata.builder.jaxws;
-
-import javax.jws.WebService;
-import javax.jws.soap.SOAPBinding.ParameterStyle;
-import javax.management.ObjectName;
-import javax.xml.namespace.QName;
-import javax.xml.soap.SOAPMessage;
-import javax.xml.transform.Source;
-import javax.xml.ws.Provider;
-import javax.xml.ws.ServiceMode;
-import javax.xml.ws.WebServiceException;
-import javax.xml.ws.WebServiceProvider;
-import javax.xml.ws.Service.Mode;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.Constants;
-import org.jboss.ws.core.jaxrpc.Style;
-import org.jboss.ws.core.server.UnifiedDeploymentInfo;
-import org.jboss.ws.core.utils.JavaUtils;
-import org.jboss.ws.metadata.builder.MetaDataBuilder;
-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.UnifiedMetaData;
-import org.jboss.ws.metadata.umdm.EndpointMetaData.Type;
-import org.jboss.ws.metadata.wsdl.WSDLUtils;
-
-/**
- * A server side meta data builder that is based on JSR-181 annotations
- *
- * @author Thomas.Diesler(a)jboss.org
- * @author <a href="mailto:jason.greene@jboss.com">Jason T.
Greene</a>
- * @since 23-Jul-2005
- */
-public class JAXWSProviderMetaDataBuilder extends JAXWSEndpointMetaDataBuilder
-{
- // provide logging
- private final Logger log = Logger.getLogger(JAXWSProviderMetaDataBuilder.class);
-
- /** Build from annotations
- */
-
- @Override
- public ServerEndpointMetaData buildEndpoint(UnifiedMetaData wsMetaData,
UnifiedDeploymentInfo udi, Class<?> sepClass, String linkName)
- {
- // 5.3 Conformance (Provider implementation): A Provider based service endpoint
implementation MUST
- // implement a typed Provider interface.
- if (JavaUtils.isAssignableFrom(Provider.class, sepClass) == false)
- throw new WebServiceException("Endpoint implementation does not implement
javax.xml.ws.Provider: " + sepClass.getName());
-
- // 5.4 Conformance (WebServiceProvider annotation): A Provider based service
endpoint implementation
- // MUST carry a WebServiceProvider annotation
- WebServiceProvider anWebServiceProvider =
(WebServiceProvider)sepClass.getAnnotation(WebServiceProvider.class);
- if (anWebServiceProvider == null)
- throw new WebServiceException("Cannot obtain @WebServiceProvider annotation
from: " + sepClass.getName());
-
- // 7.3 Conformance (WebServiceProvider and WebService): A class annotated with the
WebServiceProvider
- // annotation MUST NOT carry a WebService annotation
- if (sepClass.isAnnotationPresent(WebService.class))
- throw new WebServiceException("Provider cannot carry @WebService
annotation: " + sepClass.getName());
-
- WSDLUtils wsdlUtils = WSDLUtils.getInstance();
-
- String name = wsdlUtils.getJustClassName(sepClass);
-
- String serviceName = anWebServiceProvider.serviceName();
- if (serviceName.length() == 0)
- serviceName = name + "Service";
-
- String targetNS = anWebServiceProvider.targetNamespace();
- if (targetNS.length() == 0)
- targetNS = wsdlUtils.getTypeNamespace(sepClass);
-
- String portName = anWebServiceProvider.portName();
- if (portName.length() == 0)
- portName = name + "Port";
-
- ServiceMetaData serviceMetaData = new ServiceMetaData(wsMetaData, new
QName(targetNS, serviceName));
- wsMetaData.addService(serviceMetaData);
-
- // Setup the ServerEndpointMetaData
- QName portQName = new QName(targetNS, portName);
- QName portTypeQName = new QName(targetNS, name);
- ServerEndpointMetaData sepMetaData = new ServerEndpointMetaData(serviceMetaData,
portQName, portTypeQName, Type.JAXWS);
- sepMetaData.setLinkName(linkName);
-
- sepMetaData.setStyle(Style.DOCUMENT);
- sepMetaData.setParameterStyle(ParameterStyle.BARE);
-
- sepMetaData.setServiceEndpointImplName(sepClass.getName());
- sepMetaData.setServiceEndpointInterfaceName(sepClass.getName());
-
- ServiceMode anServiceMode = sepClass.getAnnotation(ServiceMode.class);
- if (anServiceMode != null)
- sepMetaData.setServiceMode(anServiceMode.value());
- else sepMetaData.setServiceMode(Mode.PAYLOAD);
-
- serviceMetaData.addEndpoint(sepMetaData);
-
- // Process invoke method
- processInvokeMethod(sepMetaData);
-
- // Process WSDL
- String wsdlLocation = anWebServiceProvider.wsdlLocation();
- if (wsdlLocation != null)
- serviceMetaData.setWsdlFile(wsdlLocation);
-
- // Set the endpoint address
- processPortComponent(udi, sepClass, linkName, sepMetaData);
-
- // Init the endpoint address
- MetaDataBuilder.initEndpointAddress(udi, sepMetaData, linkName);
-
- // A provider may not have a WSDL file
- if (sepMetaData.getServiceMetaData().getWsdlFile() != null)
- MetaDataBuilder.replaceAddressLocation(sepMetaData);
-
- // init service endpoint id
- ObjectName sepID = MetaDataBuilder.getServiceEndpointID(udi, sepMetaData);
- sepMetaData.setServiceEndpointID(sepID);
-
- return sepMetaData;
- }
-
- private void processInvokeMethod(ServerEndpointMetaData epMetaData)
- {
- String javaName = "invoke";
- String targetNS = epMetaData.getQName().getNamespaceURI();
- OperationMetaData opMetaData = new OperationMetaData(epMetaData, new
QName(targetNS, javaName), javaName);
- epMetaData.addOperation(opMetaData);
-
- Mode serviceMode = epMetaData.getServiceMode();
- Class paramType = (serviceMode == Mode.MESSAGE ? SOAPMessage.class :
Source.class);
-
- // Setup invoke param
- QName xmlName = new QName("invokeParam");
- QName xmlType = Constants.TYPE_LITERAL_ANYTYPE;
- ParameterMetaData pmd = new ParameterMetaData(opMetaData, xmlName, xmlType,
paramType.getName());
- opMetaData.addParameter(pmd);
-
- // Setup invoke return
- xmlName = new QName("invokeReturn");
- ParameterMetaData retMetaData = new ParameterMetaData(opMetaData, xmlName, xmlType,
paramType.getName());
- opMetaData.setReturnParameter(retMetaData);
- }
-}
\ No newline at end of file
Copied:
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSProviderMetaDataBuilder.java
(from rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSProviderMetaDataBuilder.java)
Deleted:
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSServerMetaDataBuilder.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSServerMetaDataBuilder.java 2006-12-07
10:43:36 UTC (rev 1600)
+++
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSServerMetaDataBuilder.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -1,59 +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.builder.jaxws;
-
-// $Id$
-
-import javax.jws.WebService;
-import javax.xml.ws.WebServiceProvider;
-
-import org.jboss.ws.core.server.UnifiedDeploymentInfo;
-import org.jboss.ws.metadata.umdm.UnifiedMetaData;
-
-/** An abstract annotation meta data builder.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 27-Jun-2006
- */
-public abstract class JAXWSServerMetaDataBuilder extends JAXWSMetaDataBuilder
-{
- public abstract UnifiedMetaData buildMetaData(UnifiedDeploymentInfo udi);
-
- protected JAXWSEndpointMetaDataBuilder getEndpointBuilder(Class<?> bean)
- {
- if (bean.isAnnotationPresent(WebServiceProvider.class))
- return new JAXWSProviderMetaDataBuilder();
-
- if (bean.isAnnotationPresent(WebService.class))
- return new JAXWSWebServiceMetaDataBuilder();
-
- return null;
- }
-
- protected void setupEndpoint(UnifiedMetaData umd, UnifiedDeploymentInfo udi,
Class<?> beanClass, String beanName)
- throws SecurityException, ClassNotFoundException, NoSuchMethodException
- {
- JAXWSEndpointMetaDataBuilder builder = getEndpointBuilder(beanClass);
- if (builder != null)
- builder.buildEndpoint(umd, udi, beanClass, beanName);
- }
-}
Copied:
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSServerMetaDataBuilder.java
(from rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSServerMetaDataBuilder.java)
Deleted:
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSWebServiceMetaDataBuilder.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSWebServiceMetaDataBuilder.java 2006-12-07
10:43:36 UTC (rev 1600)
+++
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSWebServiceMetaDataBuilder.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -1,1047 +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.builder.jaxws;
-
-// $Id$
-
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.Writer;
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Method;
-import java.lang.reflect.ParameterizedType;
-import java.lang.reflect.Type;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.rmi.RemoteException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-
-import javax.jws.HandlerChain;
-import javax.jws.Oneway;
-import javax.jws.WebMethod;
-import javax.jws.WebParam;
-import javax.jws.WebResult;
-import javax.jws.WebService;
-import javax.jws.soap.SOAPBinding;
-import javax.jws.soap.SOAPMessageHandlers;
-import javax.jws.soap.SOAPBinding.ParameterStyle;
-import javax.management.ObjectName;
-import javax.xml.bind.JAXBException;
-import javax.xml.namespace.QName;
-import javax.xml.rpc.ParameterMode;
-import javax.xml.ws.BindingType;
-import javax.xml.ws.RequestWrapper;
-import javax.xml.ws.ResponseWrapper;
-import javax.xml.ws.WebFault;
-import javax.xml.ws.addressing.AddressingProperties;
-
-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.jaxrpc.Use;
-import org.jboss.ws.core.jaxws.DynamicWrapperGenerator;
-import org.jboss.ws.core.jaxws.WrapperGenerator;
-import org.jboss.ws.core.server.UnifiedDeploymentInfo;
-import org.jboss.ws.core.utils.HolderUtils;
-import org.jboss.ws.core.utils.IOUtils;
-import org.jboss.ws.core.utils.JBossWSEntityResolver;
-import org.jboss.ws.core.utils.JavaUtils;
-import org.jboss.ws.extensions.addressing.AddressingPropertiesImpl;
-import org.jboss.ws.extensions.addressing.metadata.AddressingOpMetaExt;
-import org.jboss.ws.metadata.acessor.JAXBAccessor;
-import org.jboss.ws.metadata.builder.MetaDataBuilder;
-import org.jboss.ws.metadata.config.jaxws.WSEndpointConfigJAXWS;
-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.WrappedParameter;
-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;
-import org.jboss.ws.metadata.wsse.WSSecurityConfiguration;
-import org.jboss.ws.tools.jaxws.JAXBWSDLGenerator;
-import org.jboss.ws.tools.jaxws.WSDLGenerator;
-import org.jboss.ws.tools.wsdl.WSDLWriter;
-import org.jboss.ws.tools.wsdl.WSDLWriterResolver;
-import org.jboss.xb.binding.ObjectModelFactory;
-import org.jboss.xb.binding.Unmarshaller;
-import org.jboss.xb.binding.UnmarshallerFactory;
-
-import com.sun.xml.bind.api.JAXBRIContext;
-import com.sun.xml.bind.api.TypeReference;
-
-/** An abstract annotation meta data builder.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @author <a href="mailto:jason.greene@jboss.com">Jason T.
Greene</a>
- * @since 15-Oct-2005
- */
-@SuppressWarnings("deprecation")
-public class JAXWSWebServiceMetaDataBuilder extends JAXWSEndpointMetaDataBuilder
-{
- private static class EndpointResult
- {
- private Class<?> klass;
- private ServerEndpointMetaData semd;
- private ServiceMetaData smd;
- private String wsdlLocation;
- }
-
- // provide logging
- private static final Logger log =
Logger.getLogger(JAXWSWebServiceMetaDataBuilder.class);
- private List<Class> javaTypes = new ArrayList<Class>();
- private JAXBRIContext jaxbCtx;
- private List<TypeReference> typeRefs = new ArrayList<TypeReference>();
-
- private WrapperGenerator wrapperGenerator;
-
- public JAXWSWebServiceMetaDataBuilder()
- {
- }
-
- private void addFault(OperationMetaData omd, Class<?> exception)
- {
- if (omd.isOneWay())
- throw new IllegalStateException("JSR-181 4.3.1 - 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.");
-
- WebFault annotation = exception.getAnnotation(WebFault.class);
-
- String name;
- String namespace;
- String faultBeanName = null;
-
- // Only the element name is effected by @WebFault, the type uses the same
convention
- QName xmlType = new QName(omd.getQName().getNamespaceURI(),
exception.getSimpleName());
-
- /*
- * If @WebFault is present, and the exception contains getFaultInfo, the
- * return value should be used. Otherwise we need to generate the bean.
- */
- boolean generate = true;
- if (annotation != null)
- {
- name = annotation.name();
- namespace = annotation.targetNamespace();
- if (namespace.length() == 0)
- namespace = omd.getQName().getNamespaceURI();
-
- Class<?> faultBean = getFaultInfo(exception);
- if (faultBean != null)
- {
- generate = false;
- faultBeanName = faultBean.getName();
- }
- }
- else
- {
- name = xmlType.getLocalPart();
- namespace = xmlType.getNamespaceURI();
- }
-
- if (faultBeanName == null)
- faultBeanName =
JavaUtils.getPackageName(omd.getEndpointMetaData().getServiceEndpointInterface()) +
".jaxws." + exception.getSimpleName() + "Bean";
-
- QName xmlName = new QName(namespace, name);
-
- FaultMetaData fmd = new FaultMetaData(omd, xmlName, xmlType, exception.getName());
- fmd.setFaultBeanName(faultBeanName);
-
- if (generate)
- wrapperGenerator.generate(fmd);
-
- javaTypes.add(fmd.getFaultBean());
- typeRefs.add(new TypeReference(fmd.getXmlName(), fmd.getFaultBean()));
-
- omd.addFault(fmd);
- }
-
- private String convertToVariable(String localName)
- {
- return JAXBRIContext.mangleNameToVariableName(localName);
- }
-
- private String[] convertTypeArguments(Class rawType, Type type)
- {
- if (!Collection.class.isAssignableFrom(rawType) &&
!Map.class.isAssignableFrom(rawType))
- return null;
-
- if (!(type instanceof ParameterizedType))
- return null;
-
- ParameterizedType paramType = (ParameterizedType)type;
- Type[] arguments = paramType.getActualTypeArguments();
- String[] ret = new String[arguments.length];
- for (int i = 0; i < arguments.length; i++)
- ret[i] = JavaUtils.erasure(arguments[i]).getName();
-
- return ret;
- }
-
- private ParameterMetaData createRequestWrapper(OperationMetaData operation, Method
method)
- {
- String requestWrapperType = null;
- QName xmlName = operation.getQName();
- QName xmlType = xmlName;
- if (method.isAnnotationPresent(RequestWrapper.class))
- {
- RequestWrapper anReqWrapper = method.getAnnotation(RequestWrapper.class);
-
- String localName = anReqWrapper.localName().length() > 0 ?
anReqWrapper.localName() : xmlName.getLocalPart();
- String targetNamespace = anReqWrapper.targetNamespace().length() > 0 ?
anReqWrapper.targetNamespace() : xmlName.getNamespaceURI();
- xmlName = new QName(targetNamespace, localName);
-
- if (anReqWrapper.className().length() > 0)
- requestWrapperType = anReqWrapper.className();
- }
-
- // Conformance 3.18, the default value must be the same as the method name
- if (requestWrapperType == null)
- {
- String packageName = JavaUtils.getPackageName(method.getDeclaringClass()) +
".jaxws";
- requestWrapperType = packageName + "." +
JavaUtils.capitalize(method.getName());
- }
-
- // JAX-WS p.37 pg.1, the annotation only affects the element name, not the type
name
- ParameterMetaData wrapperParameter = new ParameterMetaData(operation, xmlName,
xmlType, requestWrapperType);
- wrapperParameter.setAccessorFactoryCreator(JAXBAccessor.FACTORY_CREATOR);
- operation.addParameter(wrapperParameter);
-
- return wrapperParameter;
- }
-
- private ParameterMetaData createResponseWrapper(OperationMetaData operation, Method
method)
- {
- QName operationQName = operation.getQName();
- QName xmlName = new QName(operationQName.getNamespaceURI(),
operationQName.getLocalPart() + "Response");
- QName xmlType = xmlName;
-
- String responseWrapperType = null;
- if (method.isAnnotationPresent(ResponseWrapper.class))
- {
- ResponseWrapper anResWrapper = method.getAnnotation(ResponseWrapper.class);
-
- String localName = anResWrapper.localName().length() > 0 ?
anResWrapper.localName() : xmlName.getLocalPart();
- String targetNamespace = anResWrapper.targetNamespace().length() > 0 ?
anResWrapper.targetNamespace() : xmlName.getNamespaceURI();
- xmlName = new QName(targetNamespace, localName);
-
- if (anResWrapper.className().length() > 0)
- responseWrapperType = anResWrapper.className();
- }
-
- if (responseWrapperType == null)
- {
- String packageName = JavaUtils.getPackageName(method.getDeclaringClass()) +
".jaxws";
- responseWrapperType = packageName + "." +
JavaUtils.capitalize(method.getName()) + "Response";
- }
-
- ParameterMetaData retMetaData = new ParameterMetaData(operation, xmlName, xmlType,
responseWrapperType);
- retMetaData.setAccessorFactoryCreator(JAXBAccessor.FACTORY_CREATOR);
- operation.setReturnParameter(retMetaData);
-
- return retMetaData;
- }
-
- private Class<?> getFaultInfo(Class<?> exception)
- {
- try
- {
- Method method = exception.getMethod("getFaultInfo");
- Class<?> returnType = method.getReturnType();
- if (returnType == void.class)
- return null;
-
- return returnType;
- }
- catch (SecurityException e)
- {
- throw new WSException("Unexpected security exception: " +
e.getMessage(), e);
- }
- catch (NoSuchMethodException e)
- {
- return null;
- }
- }
-
- private ParameterMode getParameterMode(WebParam anWebParam, Class javaType)
- {
- if (anWebParam != null)
- {
- if (anWebParam.mode() == WebParam.Mode.INOUT)
- return ParameterMode.INOUT;
- if (anWebParam.mode() == WebParam.Mode.OUT)
- return ParameterMode.OUT;
- }
-
- return HolderUtils.isHolderType(javaType) ? ParameterMode.INOUT :
ParameterMode.IN;
- }
-
- private WebParam getWebParamAnnotation(Method method, int pos)
- {
- for (Annotation annotation : method.getParameterAnnotations()[pos])
- if (annotation instanceof WebParam)
- return (WebParam)annotation;
-
- return null;
- }
-
- private QName getWebParamName(OperationMetaData opMetaData, int index, Class javaType,
WebParam webParam)
- {
- String namespace = null;
- String name = null;
- boolean header = false;
-
- if (webParam != null)
- {
- if (webParam.targetNamespace().length() > 0)
- namespace = webParam.targetNamespace();
-
- if (webParam.name().length() > 0)
- name = webParam.name();
-
- header = webParam.header();
- }
-
- // Bare and headers must be qualified
- if (namespace == null && (opMetaData.isDocumentBare() || header))
- namespace = opMetaData.getQName().getNamespaceURI();
-
- // RPC body parts must have no namespace
- else if (opMetaData.isRPCLiteral() && !header)
- namespace = null;
-
- // Bare uses the operation name as the default, everything else is generated
- if (name == null)
- name = opMetaData.isDocumentBare() && !header ?
opMetaData.getQName().getLocalPart() : "arg" + index;
-
- return (namespace != null) ? new QName(namespace, name) : new QName(name);
- }
-
- private QName getWebResultName(OperationMetaData opMetaData, Class javaType, WebResult
anWebResult)
- {
- String name = null;
- String namespace = null;
- boolean header = false;
-
- if (anWebResult != null)
- {
- if (anWebResult.targetNamespace().length() > 0)
- namespace = anWebResult.targetNamespace();
-
- if (anWebResult.name().length() > 0)
- name = anWebResult.name();
-
- header = anWebResult.header();
- }
-
- // Bare and headers must be qualified
- if (namespace == null && (opMetaData.isDocumentBare() || header))
- namespace = opMetaData.getQName().getNamespaceURI();
-
- // RPC body parts must have no namespace
- else if (opMetaData.isRPCLiteral() && !header)
- namespace = null;
-
- // Bare uses the operation name as the default, everything else is generated
- if (name == null)
- name = opMetaData.isDocumentBare() && !header ?
opMetaData.getResponseName().getLocalPart() : "return";
-
- return (namespace != null) ? new QName(namespace, name) : new QName(name);
- }
-
- private void populateXmlType(FaultMetaData faultMetaData)
- {
- EndpointMetaData epMetaData =
faultMetaData.getOperationMetaData().getEndpointMetaData();
- TypesMetaData types = epMetaData.getServiceMetaData().getTypesMetaData();
-
- QName xmlType = faultMetaData.getXmlType();
- String faultBeanName = faultMetaData.getFaultBeanName();
-
- types.addTypeMapping(new TypeMappingMetaData(types, xmlType, faultBeanName));
- }
-
- private void populateXmlType(ParameterMetaData paramMetaData)
- {
- EndpointMetaData epMetaData =
paramMetaData.getOperationMetaData().getEndpointMetaData();
- TypesMetaData types = epMetaData.getServiceMetaData().getTypesMetaData();
-
- QName xmlName = paramMetaData.getXmlName();
- QName xmlType = paramMetaData.getXmlType();
- Class javaType = paramMetaData.getJavaType();
- String javaName = paramMetaData.getJavaTypeName();
-
- if (xmlType == null)
- {
- try
- {
- xmlType = jaxbCtx.getTypeName(new TypeReference(xmlName, javaType));
- }
- catch (IllegalArgumentException e)
- {
- throw new IllegalStateException("Cannot obtain xml type for:
[xmlName=" + xmlName + ",javaName=" + javaName + "]");
- }
-
- /* Anonymous type.
- *
- * Currently the design of our stack is based on the
- * notion of their always being a unique type. In order to lookup the
- * appropriate (de)serializer you must have a type. So we use a fake
- * name. This is an illegal NCName, so it shouldn't collide.
- */
- if (xmlType == null)
- xmlType = new QName(xmlName.getNamespaceURI(), ">" +
xmlName.getLocalPart());
-
- paramMetaData.setXmlType(xmlType);
- }
-
- types.addTypeMapping(new TypeMappingMetaData(types, xmlType, javaName));
- }
-
- /**
- * Process operation meta data extensions.
- */
- private void processMetaExtensions(EndpointMetaData epMetaData, OperationMetaData
opMetaData)
- {
- // Until there is a addressing annotion we fallback to implicit action asosciation
- // TODO: figure out a way to assign message name instead of IN and OUT
- String tns = epMetaData.getQName().getNamespaceURI();
- String portTypeName = epMetaData.getQName().getLocalPart();
-
- AddressingProperties ADDR = new AddressingPropertiesImpl();
- AddressingOpMetaExt addrExt = new AddressingOpMetaExt(ADDR.getNamespaceURI());
- addrExt.setInboundAction(tns + "/" + portTypeName + "/IN");
-
- if (!opMetaData.isOneWay())
- addrExt.setOutboundAction(tns + "/" + portTypeName +
"/OUT");
-
- opMetaData.addExtension(addrExt);
- }
-
- private void processWebMethod(EndpointMetaData epMetaData, Method method)
- {
- String javaName = method.getName();
-
- // skip asnyc methods, they dont need meta data representation
- if (method.getName().endsWith(Constants.ASYNC_METHOD_SUFFIX))
- return;
-
- // reflection defaults
- String soapAction = "";
- String operationName = method.getName();
-
- // annotation values that override defaults
- if (method.isAnnotationPresent(WebMethod.class))
- {
- WebMethod anWebMethod = method.getAnnotation(WebMethod.class);
- soapAction = anWebMethod.action();
- if (anWebMethod.operationName().length() > 0)
- {
- operationName = anWebMethod.operationName();
- }
- }
-
- String targetNS = epMetaData.getInterfaceQName().getNamespaceURI();
- OperationMetaData opMetaData = new OperationMetaData(epMetaData, new
QName(targetNS, operationName), javaName);
- opMetaData.setOneWay(method.isAnnotationPresent(Oneway.class));
- opMetaData.setSOAPAction(soapAction);
- epMetaData.addOperation(opMetaData);
-
- // Build parameter meta data
- Class[] parameterTypes = method.getParameterTypes();
- Type[] genericTypes = method.getGenericParameterTypes();
- Annotation[][] parameterAnnotations = method.getParameterAnnotations();
- ParameterMetaData wrapperParameter = null, wrapperOutputParameter = null;
- List<WrappedParameter> wrappedParameters = null, wrappedOutputParameters =
null;
-
- // Force paramter style to wrapped
- if (method.isAnnotationPresent(RequestWrapper.class) ||
method.isAnnotationPresent(ResponseWrapper.class))
- {
- epMetaData.setParameterStyle(ParameterStyle.WRAPPED);
- }
-
- if (opMetaData.isDocumentWrapped())
- {
- wrapperParameter = createRequestWrapper(opMetaData, method);
- wrappedParameters = new
ArrayList<WrappedParameter>(parameterTypes.length);
- wrapperParameter.setWrappedParameters(wrappedParameters);
-
- if (!opMetaData.isOneWay())
- {
- wrapperOutputParameter = createResponseWrapper(opMetaData, method);
- wrappedOutputParameters = new
ArrayList<WrappedParameter>(parameterTypes.length + 1);
- wrapperOutputParameter.setWrappedParameters(wrappedOutputParameters);
- }
- }
-
- for (int i = 0; i < parameterTypes.length; i++)
- {
- Class javaType = parameterTypes[i];
- Type genericType = genericTypes[i];
- String javaTypeName = javaType.getName();
- WebParam anWebParam = getWebParamAnnotation(method, i);
- boolean isHeader = anWebParam != null && anWebParam.header();
- boolean isWrapped = opMetaData.isDocumentWrapped() && !isHeader;
- ParameterMode mode = getParameterMode(anWebParam, javaType);
-
- // Assert one-way
- if (opMetaData.isOneWay() && mode != ParameterMode.IN)
- throw new IllegalArgumentException("A one-way operation can not have
output parameters [" + "method = " + method.getName() + ", parameter =
" + i + "]");
-
- if (HolderUtils.isHolderType(javaType))
- {
- genericType = HolderUtils.getGenericValueType(genericType);
- javaType = JavaUtils.erasure(genericType);
- javaTypeName = javaType.getName();
- }
-
- if (isWrapped)
- {
- QName wrappedElementName = getWebParamName(opMetaData, i, javaType,
anWebParam);
- String variable = convertToVariable(wrappedElementName.getLocalPart());
-
- WrappedParameter wrappedParameter = new WrappedParameter(wrappedElementName,
javaTypeName, variable, i);
- wrappedParameter.setTypeArguments(convertTypeArguments(javaType,
genericType));
-
- if (mode != ParameterMode.OUT)
- wrappedParameters.add(wrappedParameter);
- if (mode != ParameterMode.IN)
- {
- wrappedOutputParameters.add(wrappedParameter);
- wrappedParameter.setHolder(true);
- }
- }
- else
- {
- QName xmlName = getWebParamName(opMetaData, i, javaType, anWebParam);
-
- ParameterMetaData paramMetaData = new ParameterMetaData(opMetaData, xmlName,
javaTypeName);
- paramMetaData.setInHeader(isHeader);
- paramMetaData.setIndex(i);
- paramMetaData.setMode(mode);
-
- opMetaData.addParameter(paramMetaData);
- javaTypes.add(javaType);
- typeRefs.add(new TypeReference(xmlName, genericType,
parameterAnnotations[i]));
- }
- }
-
- // Build result meta data
- Class returnType = method.getReturnType();
- Type genericReturnType = method.getGenericReturnType();
- String returnTypeName = returnType.getName();
- if ((returnType == void.class) == false)
- {
- if (opMetaData.isOneWay())
- throw new IllegalArgumentException("[JSR-181 2.5.1] The method
'" + method.getName() + "' can not have a return value if it is marked
OneWay");
-
- WebResult anWebResult = method.getAnnotation(WebResult.class);
- boolean isHeader = anWebResult != null && anWebResult.header();
- boolean isWrapped = opMetaData.isDocumentWrapped() && !isHeader;
- QName xmlName = getWebResultName(opMetaData, returnType, anWebResult);
-
- if (isWrapped)
- {
- WrappedParameter wrapped = new WrappedParameter(xmlName, returnTypeName,
convertToVariable(xmlName.getLocalPart()), -1);
- wrapped.setTypeArguments(convertTypeArguments(returnType,
genericReturnType));
-
- // insert at the beginning just for prettiness
- wrappedOutputParameters.add(0, wrapped);
- }
- else
- {
- ParameterMetaData retMetaData = new ParameterMetaData(opMetaData, xmlName,
returnTypeName);
- retMetaData.setInHeader(isHeader);
- opMetaData.setReturnParameter(retMetaData);
-
- javaTypes.add(returnType);
- typeRefs.add(new TypeReference(xmlName, genericReturnType,
method.getAnnotations()));
- }
- }
-
- // Generate wrapper beans
- if (opMetaData.isDocumentWrapped())
- {
- wrapperGenerator.generate(wrapperParameter);
- Class wrapperClass = wrapperParameter.getJavaType();
- javaTypes.add(wrapperClass);
- // In case there is no @XmlRootElement
- typeRefs.add(new TypeReference(wrapperParameter.getXmlName(), wrapperClass));
- if (!opMetaData.isOneWay())
- {
- wrapperGenerator.generate(wrapperOutputParameter);
- wrapperClass = wrapperOutputParameter.getJavaType();
- javaTypes.add(wrapperClass);
- // In case there is no @XmlRootElement
- typeRefs.add(new TypeReference(wrapperOutputParameter.getXmlName(),
wrapperClass));
- }
- }
-
- // Add faults
- for (Class exClass : method.getExceptionTypes())
- if (!RemoteException.class.isAssignableFrom(exClass))
- addFault(opMetaData, exClass);
-
- // process op meta data extension
- processMetaExtensions(epMetaData, opMetaData);
- }
-
- private EndpointResult processWebService(UnifiedMetaData wsMetaData, Class<?>
sepClass, ClassLoader loader) throws ClassNotFoundException
- {
- WebService anWebService = sepClass.getAnnotation(WebService.class);
- if (anWebService == null)
- throw new WSException("Cannot obtain @WebService annotation from: " +
sepClass.getName());
-
- Class<?> seiClass = null;
- String seiName = null;
- WSDLUtils wsdlUtils = WSDLUtils.getInstance();
-
- String name = anWebService.name();
- if (name.length() == 0)
- name = WSDLUtils.getJustClassName(sepClass);
-
- String serviceName = anWebService.serviceName();
- if (serviceName.length() == 0)
- serviceName = name + "Service";
-
- String serviceNS = anWebService.targetNamespace();
- if (serviceNS.length() == 0)
- serviceNS = wsdlUtils.getTypeNamespace(sepClass);
-
- String portName = anWebService.portName();
- if (portName.length() == 0)
- portName = name + "Port";
-
- String wsdlLocation = anWebService.wsdlLocation();
- String interfaceNS = serviceNS;
-
- if (anWebService.endpointInterface().length() > 0)
- {
- seiName = anWebService.endpointInterface();
- seiClass = loader.loadClass(seiName);
- anWebService = seiClass.getAnnotation(WebService.class);
-
- if (anWebService == null)
- throw new WSException("Interface does not have a @WebService annotation:
" + seiName);
- else
- {
- if(anWebService.portName().length()>0
- || anWebService.serviceName().length()>0
- || anWebService.endpointInterface().length()>0
- )
- {
- throw new WSException("The service endpoint interface MUST NOT
include the JSR-181 annotation" +
- "elements portName, serviceName and endpointInterface of the
annotation @WebService.");
- }
- }
-
- name = anWebService.name();
- if (name.length() == 0)
- name = WSDLUtils.getJustClassName(seiClass);
-
- interfaceNS = anWebService.targetNamespace();
- if (interfaceNS.length() == 0)
- interfaceNS = wsdlUtils.getTypeNamespace(seiClass);
-
- // The spec states that WSDL location should be allowed on an SEI, although it
- // makes far more sense on the implementation bean, so we ALWAYS override the
SEI
- // when wsdlLocation is defined on the bean
-
- if (wsdlLocation.length() == 0)
- wsdlLocation = anWebService.wsdlLocation();
- }
-
- // Setup the ServerEndpointMetaData
- QName portQName = new QName(serviceNS, portName);
- QName portTypeQName = new QName(interfaceNS, name);
-
- EndpointResult result = new EndpointResult();
- result.smd = new ServiceMetaData(wsMetaData, new QName(serviceNS, serviceName));
- result.semd = new ServerEndpointMetaData(result.smd, portQName, portTypeQName,
EndpointMetaData.Type.JAXWS);
- result.klass = (seiClass != null ? seiClass : sepClass);
- result.wsdlLocation = wsdlLocation;
-
- result.smd.addEndpoint(result.semd);
- wsMetaData.addService(result.smd);
-
- return result;
- }
-
- protected void createJAXBContext(EndpointMetaData epMetaData)
- {
- try
- {
- String targetNS = epMetaData.getInterfaceQName().getNamespaceURI();
- log.debug("JAXBContext [types=" + javaTypes + ",tns=" +
targetNS + "]");
- jaxbCtx = JAXBRIContext.newInstance(javaTypes.toArray(new Class[0]), typeRefs,
targetNS, false);
- }
- catch (JAXBException ex)
- {
- throw new IllegalStateException("Cannot build JAXB context", ex);
- }
- }
-
- protected void populateXmlTypes(EndpointMetaData epMetaData)
- {
- for (OperationMetaData operation : epMetaData.getOperations())
- {
- // parameters
- for (ParameterMetaData paramMetaData : operation.getParameters())
- {
- populateXmlType(paramMetaData);
- }
-
- // return value
- ParameterMetaData returnParameter = operation.getReturnParameter();
- if (returnParameter != null)
- populateXmlType(returnParameter);
-
- // faults
- for (FaultMetaData faultMetaData : operation.getFaults())
- {
- populateXmlType(faultMetaData);
- }
- }
- }
-
- /**
- * Process an optional @HandlerChain annotation
- *
- * Location of the handler chain file. The location supports 2 formats.
- *
- * 1. An absolute java.net.URL in externalForm.
- * (ex:
http://myhandlers.foo.com/handlerfile1.xml)
- *
- * 2. A relative path from the source file or class file.
- * (ex: bar/handlerfile1.xml)
- */
- protected void processHandlerChain(EndpointMetaData epMetaData, Class<?>
wsClass)
- {
- if (wsClass.isAnnotationPresent(SOAPMessageHandlers.class))
- throw new WSException("Cannot combine @HandlerChain with
@SOAPMessageHandlers");
-
- HandlerChain anHandlerChain =
(HandlerChain)wsClass.getAnnotation(HandlerChain.class);
-
- URL fileURL = null;
- String filename = anHandlerChain.file();
-
- // Try the filename as URL
- try
- {
- fileURL = new URL(filename);
- }
- catch (MalformedURLException ex)
- {
- // ignore
- }
-
- // Try the filename as File
- if (fileURL == null)
- {
- try
- {
- File file = new File(filename);
- if (file.exists())
- fileURL = file.toURL();
- }
- catch (MalformedURLException e)
- {
- // ignore
- }
- }
-
- // Try the filename as Resource
- if (fileURL == null)
- {
- fileURL = epMetaData.getClassLoader().getResource(filename);
- }
-
- // Try the filename relative to class
- if (fileURL == null)
- {
- String packagePath = wsClass.getPackage().getName().replace('.',
'/');
- fileURL = epMetaData.getClassLoader().getResource(packagePath + "/" +
filename);
- }
-
- if (fileURL == null)
- throw new WSException("Cannot resolve handler file '" + filename +
"' on " + wsClass.getName());
-
- try
- {
- HandlerChainsMetaData handlerChainsMetaData = null;
- InputStream is = fileURL.openStream();
- try
- {
- Unmarshaller unmarshaller =
UnmarshallerFactory.newInstance().newUnmarshaller();
- unmarshaller.setValidation(true);
- unmarshaller.setSchemaValidation(true);
- unmarshaller.setEntityResolver(new JBossWSEntityResolver());
- ObjectModelFactory factory = new HandlerChainFactory();
- handlerChainsMetaData = (HandlerChainsMetaData)unmarshaller.unmarshal(is,
factory, null);
- }
- finally
- {
- is.close();
- }
-
- // Setup the endpoint handlers
- for (HandlerChainMetaData handlerChainMetaData :
handlerChainsMetaData.getHandlerChains())
- {
- for (UnifiedHandlerMetaData uhmd : handlerChainMetaData.getHandlers())
- {
- epMetaData.addHandler(uhmd.getHandlerMetaDataJAXWS(epMetaData,
HandlerType.ENDPOINT));
- }
- }
- }
- catch (RuntimeException rte)
- {
- throw rte;
- }
- catch (Exception ex)
- {
- throw new WSException("Cannot process handler chain: " + filename,
ex);
- }
- }
-
- protected void processOrGenerateWSDL(Class wsClass, ServiceMetaData serviceMetaData,
String wsdlLocation, EndpointMetaData epMetaData)
- {
- if (wsdlLocation.length() > 0)
- {
- serviceMetaData.setWsdlFile(wsdlLocation);
- }
- else
- {
- try
- {
- String serviceName = serviceMetaData.getServiceName().getLocalPart();
-
- WSDLGenerator generator = new JAXBWSDLGenerator(jaxbCtx);
- WSDLDefinitions wsdlDefinitions = generator.generate(serviceMetaData);
-
- // Ensure that types are only in the interface qname
-
wsdlDefinitions.getWsdlTypes().setNamespace(epMetaData.getInterfaceQName().getNamespaceURI());
-
- final File tmpdir = IOUtils.createTempDirectory();
- File wsdlTmpFile = File.createTempFile(serviceName, ".wsdl",
tmpdir);
- wsdlTmpFile.deleteOnExit();
-
- Writer writer = IOUtils.getCharsetFileWriter(wsdlTmpFile,
Constants.DEFAULT_XML_CHARSET);
- new WSDLWriter(wsdlDefinitions).write(writer, Constants.DEFAULT_XML_CHARSET,
new WSDLWriterResolver()
- {
- public WSDLWriterResolver resolve(String suggestedFile) throws
IOException
- {
- File newTmpFile = File.createTempFile(suggestedFile, ".wsdl",
tmpdir);
- newTmpFile.deleteOnExit();
- actualFile = newTmpFile.getName();
- charset = Constants.DEFAULT_XML_CHARSET;
- writer = IOUtils.getCharsetFileWriter(newTmpFile,
Constants.DEFAULT_XML_CHARSET);
- return this;
- }
- });
- writer.close();
-
- serviceMetaData.setWsdlFile(wsdlTmpFile.toURL().toExternalForm());
- }
- catch (RuntimeException rte)
- {
- throw rte;
- }
- catch (IOException e)
- {
- throw new WSException("Cannot write generated wsdl", e);
- }
- }
- }
-
- protected void processSOAPBinding(EndpointMetaData epMetaData, Class<?>
wsClass)
- {
- SOAPBinding anSoapBinding = (SOAPBinding)wsClass.getAnnotation(SOAPBinding.class);
-
- SOAPBinding.Style attrStyle = anSoapBinding.style();
- Style style = (attrStyle == SOAPBinding.Style.RPC ? Style.RPC : Style.DOCUMENT);
- epMetaData.setStyle(style);
-
- SOAPBinding.Use attrUse = anSoapBinding.use();
- if (attrUse == SOAPBinding.Use.ENCODED)
- throw new WSException("SOAP encoding is not supported for JSR-181
deployments");
-
- epMetaData.setEncodingStyle(Use.LITERAL);
-
- ParameterStyle paramStyle = anSoapBinding.parameterStyle();
- epMetaData.setParameterStyle(paramStyle);
- }
-
- // If the implementation bean does not implement a service endpoint interface and
- // there are no @WebMethod annotations in the implementation bean (excluding
- // @WebMethod annotations used to exclude inherited @WebMethods), all public
- // methods other than those inherited from java.lang.Object will be exposed as Web
- // Service operations, subject to the inheritance rules specified in Common
- // Annotations for the Java Platform [12], section 2.1.
- protected void processWebMethods(EndpointMetaData epMetaData, Class wsClass)
- {
- epMetaData.clearOperations();
-
- // Process @WebMethod annotations
- int webMethodCount = 0;
- for (Method method : wsClass.getMethods())
- {
- WebMethod annotation = method.getAnnotation(WebMethod.class);
- boolean exclude = annotation != null && annotation.exclude();
- if (!exclude && (annotation != null || wsClass.isInterface()))
- {
- processWebMethod(epMetaData, method);
- webMethodCount++;
- }
- }
-
- // @WebService should expose all inherited methods if @WebMethod is never
specified
- if (webMethodCount == 0 && !wsClass.isInterface())
- {
- for (Method method : wsClass.getMethods())
- {
- WebMethod annotation = method.getAnnotation(WebMethod.class);
- boolean exclude = annotation != null && annotation.exclude();
- if (!exclude && method.getDeclaringClass() != Object.class)
- {
- processWebMethod(epMetaData, method);
- webMethodCount++;
- }
- }
- }
-
- if (webMethodCount == 0)
- throw new WSException("No exposable methods found");
- }
-
- protected void resetMetaDataBuilder(ClassLoader loader)
- {
- wrapperGenerator = new DynamicWrapperGenerator(loader);
- javaTypes.clear();
- typeRefs.clear();
- jaxbCtx = null;
- }
-
- public ServerEndpointMetaData buildEndpoint(UnifiedMetaData wsMetaData,
UnifiedDeploymentInfo udi, Class<?> sepClass, String linkName)
- {
- try
- {
- EndpointResult result = processWebService(wsMetaData, sepClass,
udi.classLoader);
-
- // Clear the java types, etc.
- resetMetaDataBuilder(udi.classLoader);
-
- ServerEndpointMetaData sepMetaData = result.semd;
- ServiceMetaData serviceMetaData = result.smd;
- Class<?> wsClass = result.klass;
- sepMetaData.setLinkName(linkName);
-
- // Assign the WS-Security configuration,
- WSSecurityConfiguration securityConfiguration =
MetaDataBuilder.getWsSecurityConfiguration(udi);
- serviceMetaData.setSecurityConfiguration(securityConfiguration);
-
- sepMetaData.setServiceEndpointImplName(sepClass.getName());
- sepMetaData.setServiceEndpointInterfaceName(wsClass.getName());
-
- // Process an optional @SOAPBinding annotation
- if (wsClass.isAnnotationPresent(SOAPBinding.class))
- processSOAPBinding(sepMetaData, wsClass);
-
- // Process an optional @BindingType annotation
- if (wsClass.isAnnotationPresent(BindingType.class))
- processBindingType(sepMetaData, wsClass);
-
- // Init the transport guarantee
- initTransportGuaranteeJSE(udi, sepMetaData, linkName);
-
- // Process web methods
- processWebMethods(sepMetaData, wsClass);
-
- // Initialize types
- createJAXBContext(sepMetaData);
- populateXmlTypes(sepMetaData);
-
- // Process or generate WSDL
- processOrGenerateWSDL(wsClass, serviceMetaData, result.wsdlLocation,
sepMetaData);
-
- // Read the generated WSDL and initialize the schema model
- // FIXME - This should be removed
- WSDLDefinitions wsdlDefinitions = serviceMetaData.getWsdlDefinitions();
- JBossXSModel schemaModel =
WSDLUtils.getSchemaModel(wsdlDefinitions.getWsdlTypes());
- serviceMetaData.getTypesMetaData().setSchemaModel(schemaModel);
-
- // Set the endpoint address
- processPortComponent(udi, wsClass, linkName, sepMetaData);
-
- // Init the endpoint address
- MetaDataBuilder.initEndpointAddress(udi, sepMetaData, linkName);
-
- // replace the SOAP address
- MetaDataBuilder.replaceAddressLocation(sepMetaData);
-
- // Process an optional @SOAPMessageHandlers annotation
- if (sepClass.isAnnotationPresent(SOAPMessageHandlers.class) ||
wsClass.isAnnotationPresent(SOAPMessageHandlers.class))
- log.warn("@SOAPMessageHandlers is deprecated as of JAX-WS 2.0 with no
replacement.");
-
- // Add pre handlers
- WSEndpointConfigJAXWS jaxrpcConfig =
(WSEndpointConfigJAXWS)sepMetaData.getEndpointConfig();
- sepMetaData.addHandlers(jaxrpcConfig.getHandlers(sepMetaData,
HandlerType.PRE));
-
- // Process an optional @HandlerChain annotation
- if (sepClass.isAnnotationPresent(HandlerChain.class))
- processHandlerChain(sepMetaData, sepClass);
- else if (wsClass.isAnnotationPresent(HandlerChain.class))
- processHandlerChain(sepMetaData, wsClass);
-
- // Add post handlers
- sepMetaData.addHandlers(jaxrpcConfig.getHandlers(sepMetaData,
HandlerType.POST));
-
- // init service endpoint id
- ObjectName sepID = MetaDataBuilder.getServiceEndpointID(udi, sepMetaData);
- sepMetaData.setServiceEndpointID(sepID);
-
- return sepMetaData;
- }
- catch (RuntimeException rte)
- {
- throw rte;
- }
- catch (Exception ex)
- {
- throw new WSException("Cannot build meta data: " + ex.getMessage(),
ex);
- }
- }
-}
Copied:
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSWebServiceMetaDataBuilder.java
(from rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSWebServiceMetaDataBuilder.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSWebServiceMetaDataBuilder.java 2006-12-07
10:43:36 UTC (rev 1600)
+++
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSWebServiceMetaDataBuilder.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -0,0 +1,1036 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, 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.builder.jaxws;
+
+// $Id$
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.Writer;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Method;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.rmi.RemoteException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+
+import javax.jws.HandlerChain;
+import javax.jws.Oneway;
+import javax.jws.WebMethod;
+import javax.jws.WebParam;
+import javax.jws.WebResult;
+import javax.jws.WebService;
+import javax.jws.soap.SOAPBinding;
+import javax.jws.soap.SOAPMessageHandlers;
+import javax.jws.soap.SOAPBinding.ParameterStyle;
+import javax.management.ObjectName;
+import javax.xml.bind.JAXBException;
+import javax.xml.namespace.QName;
+import javax.xml.rpc.ParameterMode;
+import javax.xml.ws.BindingType;
+import javax.xml.ws.RequestWrapper;
+import javax.xml.ws.ResponseWrapper;
+import javax.xml.ws.WebFault;
+import javax.xml.ws.addressing.AddressingProperties;
+
+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.jaxrpc.Use;
+import org.jboss.ws.core.jaxws.DynamicWrapperGenerator;
+import org.jboss.ws.core.jaxws.WrapperGenerator;
+import org.jboss.ws.core.server.UnifiedDeploymentInfo;
+import org.jboss.ws.core.utils.HolderUtils;
+import org.jboss.ws.core.utils.IOUtils;
+import org.jboss.ws.core.utils.JBossWSEntityResolver;
+import org.jboss.ws.core.utils.JavaUtils;
+import org.jboss.ws.extensions.addressing.AddressingPropertiesImpl;
+import org.jboss.ws.extensions.addressing.metadata.AddressingOpMetaExt;
+import org.jboss.ws.metadata.acessor.JAXBAccessor;
+import org.jboss.ws.metadata.builder.MetaDataBuilder;
+import org.jboss.ws.metadata.config.jaxws.WSEndpointConfigJAXWS;
+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.WrappedParameter;
+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;
+import org.jboss.ws.metadata.wsse.WSSecurityConfiguration;
+import org.jboss.ws.tools.jaxws.JAXBWSDLGenerator;
+import org.jboss.ws.tools.jaxws.WSDLGenerator;
+import org.jboss.ws.tools.wsdl.WSDLWriter;
+import org.jboss.ws.tools.wsdl.WSDLWriterResolver;
+import org.jboss.xb.binding.ObjectModelFactory;
+import org.jboss.xb.binding.Unmarshaller;
+import org.jboss.xb.binding.UnmarshallerFactory;
+
+import com.sun.xml.bind.api.JAXBRIContext;
+import com.sun.xml.bind.api.TypeReference;
+
+/** An abstract annotation meta data builder.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @author <a href="mailto:jason.greene@jboss.com">Jason T.
Greene</a>
+ * @since 15-Oct-2005
+ */
+@SuppressWarnings("deprecation")
+public class JAXWSWebServiceMetaDataBuilder extends JAXWSEndpointMetaDataBuilder
+{
+ private static class EndpointResult
+ {
+ private Class<?> klass;
+ private ServerEndpointMetaData semd;
+ private ServiceMetaData smd;
+ private String wsdlLocation;
+ }
+
+ // provide logging
+ private static final Logger log =
Logger.getLogger(JAXWSWebServiceMetaDataBuilder.class);
+ private List<Class> javaTypes = new ArrayList<Class>();
+ private JAXBRIContext jaxbCtx;
+ private List<TypeReference> typeRefs = new ArrayList<TypeReference>();
+
+ private WrapperGenerator wrapperGenerator;
+
+ public JAXWSWebServiceMetaDataBuilder()
+ {
+ }
+
+ private void addFault(OperationMetaData omd, Class<?> exception)
+ {
+ if (omd.isOneWay())
+ throw new IllegalStateException("JSR-181 4.3.1 - 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.");
+
+ WebFault annotation = exception.getAnnotation(WebFault.class);
+
+ String name;
+ String namespace;
+ String faultBeanName = null;
+
+ // Only the element name is effected by @WebFault, the type uses the same
convention
+ QName xmlType = new QName(omd.getQName().getNamespaceURI(),
exception.getSimpleName());
+
+ /*
+ * If @WebFault is present, and the exception contains getFaultInfo, the
+ * return value should be used. Otherwise we need to generate the bean.
+ */
+ boolean generate = true;
+ if (annotation != null)
+ {
+ name = annotation.name();
+ namespace = annotation.targetNamespace();
+ if (namespace.length() == 0)
+ namespace = omd.getQName().getNamespaceURI();
+
+ Class<?> faultBean = getFaultInfo(exception);
+ if (faultBean != null)
+ {
+ generate = false;
+ faultBeanName = faultBean.getName();
+ }
+ }
+ else
+ {
+ name = xmlType.getLocalPart();
+ namespace = xmlType.getNamespaceURI();
+ }
+
+ if (faultBeanName == null)
+ faultBeanName =
JavaUtils.getPackageName(omd.getEndpointMetaData().getServiceEndpointInterface()) +
".jaxws." + exception.getSimpleName() + "Bean";
+
+ QName xmlName = new QName(namespace, name);
+
+ FaultMetaData fmd = new FaultMetaData(omd, xmlName, xmlType, exception.getName());
+ fmd.setFaultBeanName(faultBeanName);
+
+ if (generate)
+ wrapperGenerator.generate(fmd);
+
+ javaTypes.add(fmd.getFaultBean());
+ typeRefs.add(new TypeReference(fmd.getXmlName(), fmd.getFaultBean()));
+
+ omd.addFault(fmd);
+ }
+
+ private String convertToVariable(String localName)
+ {
+ return JAXBRIContext.mangleNameToVariableName(localName);
+ }
+
+ private String[] convertTypeArguments(Class rawType, Type type)
+ {
+ if (!Collection.class.isAssignableFrom(rawType) &&
!Map.class.isAssignableFrom(rawType))
+ return null;
+
+ if (!(type instanceof ParameterizedType))
+ return null;
+
+ ParameterizedType paramType = (ParameterizedType)type;
+ Type[] arguments = paramType.getActualTypeArguments();
+ String[] ret = new String[arguments.length];
+ for (int i = 0; i < arguments.length; i++)
+ ret[i] = JavaUtils.erasure(arguments[i]).getName();
+
+ return ret;
+ }
+
+ private ParameterMetaData createRequestWrapper(OperationMetaData operation, Method
method)
+ {
+ String requestWrapperType = null;
+ QName xmlName = operation.getQName();
+ QName xmlType = xmlName;
+ if (method.isAnnotationPresent(RequestWrapper.class))
+ {
+ RequestWrapper anReqWrapper = method.getAnnotation(RequestWrapper.class);
+
+ String localName = anReqWrapper.localName().length() > 0 ?
anReqWrapper.localName() : xmlName.getLocalPart();
+ String targetNamespace = anReqWrapper.targetNamespace().length() > 0 ?
anReqWrapper.targetNamespace() : xmlName.getNamespaceURI();
+ xmlName = new QName(targetNamespace, localName);
+
+ if (anReqWrapper.className().length() > 0)
+ requestWrapperType = anReqWrapper.className();
+ }
+
+ // Conformance 3.18, the default value must be the same as the method name
+ if (requestWrapperType == null)
+ {
+ String packageName = JavaUtils.getPackageName(method.getDeclaringClass()) +
".jaxws";
+ requestWrapperType = packageName + "." +
JavaUtils.capitalize(method.getName());
+ }
+
+ // JAX-WS p.37 pg.1, the annotation only affects the element name, not the type
name
+ ParameterMetaData wrapperParameter = new ParameterMetaData(operation, xmlName,
xmlType, requestWrapperType);
+ wrapperParameter.setAccessorFactoryCreator(JAXBAccessor.FACTORY_CREATOR);
+ operation.addParameter(wrapperParameter);
+
+ return wrapperParameter;
+ }
+
+ private ParameterMetaData createResponseWrapper(OperationMetaData operation, Method
method)
+ {
+ QName operationQName = operation.getQName();
+ QName xmlName = new QName(operationQName.getNamespaceURI(),
operationQName.getLocalPart() + "Response");
+ QName xmlType = xmlName;
+
+ String responseWrapperType = null;
+ if (method.isAnnotationPresent(ResponseWrapper.class))
+ {
+ ResponseWrapper anResWrapper = method.getAnnotation(ResponseWrapper.class);
+
+ String localName = anResWrapper.localName().length() > 0 ?
anResWrapper.localName() : xmlName.getLocalPart();
+ String targetNamespace = anResWrapper.targetNamespace().length() > 0 ?
anResWrapper.targetNamespace() : xmlName.getNamespaceURI();
+ xmlName = new QName(targetNamespace, localName);
+
+ if (anResWrapper.className().length() > 0)
+ responseWrapperType = anResWrapper.className();
+ }
+
+ if (responseWrapperType == null)
+ {
+ String packageName = JavaUtils.getPackageName(method.getDeclaringClass()) +
".jaxws";
+ responseWrapperType = packageName + "." +
JavaUtils.capitalize(method.getName()) + "Response";
+ }
+
+ ParameterMetaData retMetaData = new ParameterMetaData(operation, xmlName, xmlType,
responseWrapperType);
+ retMetaData.setAccessorFactoryCreator(JAXBAccessor.FACTORY_CREATOR);
+ operation.setReturnParameter(retMetaData);
+
+ return retMetaData;
+ }
+
+ private Class<?> getFaultInfo(Class<?> exception)
+ {
+ try
+ {
+ Method method = exception.getMethod("getFaultInfo");
+ Class<?> returnType = method.getReturnType();
+ if (returnType == void.class)
+ return null;
+
+ return returnType;
+ }
+ catch (SecurityException e)
+ {
+ throw new WSException("Unexpected security exception: " +
e.getMessage(), e);
+ }
+ catch (NoSuchMethodException e)
+ {
+ return null;
+ }
+ }
+
+ private ParameterMode getParameterMode(WebParam anWebParam, Class javaType)
+ {
+ if (anWebParam != null)
+ {
+ if (anWebParam.mode() == WebParam.Mode.INOUT)
+ return ParameterMode.INOUT;
+ if (anWebParam.mode() == WebParam.Mode.OUT)
+ return ParameterMode.OUT;
+ }
+
+ return HolderUtils.isHolderType(javaType) ? ParameterMode.INOUT :
ParameterMode.IN;
+ }
+
+ private WebParam getWebParamAnnotation(Method method, int pos)
+ {
+ for (Annotation annotation : method.getParameterAnnotations()[pos])
+ if (annotation instanceof WebParam)
+ return (WebParam)annotation;
+
+ return null;
+ }
+
+ private QName getWebParamName(OperationMetaData opMetaData, int index, Class javaType,
WebParam webParam)
+ {
+ String namespace = null;
+ String name = null;
+ boolean header = false;
+
+ if (webParam != null)
+ {
+ if (webParam.targetNamespace().length() > 0)
+ namespace = webParam.targetNamespace();
+
+ if (webParam.name().length() > 0)
+ name = webParam.name();
+
+ header = webParam.header();
+ }
+
+ // Bare and headers must be qualified
+ if (namespace == null && (opMetaData.isDocumentBare() || header))
+ namespace = opMetaData.getQName().getNamespaceURI();
+
+ // RPC body parts must have no namespace
+ else if (opMetaData.isRPCLiteral() && !header)
+ namespace = null;
+
+ // Bare uses the operation name as the default, everything else is generated
+ if (name == null)
+ name = opMetaData.isDocumentBare() && !header ?
opMetaData.getQName().getLocalPart() : "arg" + index;
+
+ return (namespace != null) ? new QName(namespace, name) : new QName(name);
+ }
+
+ private QName getWebResultName(OperationMetaData opMetaData, Class javaType, WebResult
anWebResult)
+ {
+ String name = null;
+ String namespace = null;
+ boolean header = false;
+
+ if (anWebResult != null)
+ {
+ if (anWebResult.targetNamespace().length() > 0)
+ namespace = anWebResult.targetNamespace();
+
+ if (anWebResult.name().length() > 0)
+ name = anWebResult.name();
+
+ header = anWebResult.header();
+ }
+
+ // Bare and headers must be qualified
+ if (namespace == null && (opMetaData.isDocumentBare() || header))
+ namespace = opMetaData.getQName().getNamespaceURI();
+
+ // RPC body parts must have no namespace
+ else if (opMetaData.isRPCLiteral() && !header)
+ namespace = null;
+
+ // Bare uses the operation name as the default, everything else is generated
+ if (name == null)
+ name = opMetaData.isDocumentBare() && !header ?
opMetaData.getResponseName().getLocalPart() : "return";
+
+ return (namespace != null) ? new QName(namespace, name) : new QName(name);
+ }
+
+ private void populateXmlType(FaultMetaData faultMetaData)
+ {
+ EndpointMetaData epMetaData =
faultMetaData.getOperationMetaData().getEndpointMetaData();
+ TypesMetaData types = epMetaData.getServiceMetaData().getTypesMetaData();
+
+ QName xmlType = faultMetaData.getXmlType();
+ String faultBeanName = faultMetaData.getFaultBeanName();
+
+ types.addTypeMapping(new TypeMappingMetaData(types, xmlType, faultBeanName));
+ }
+
+ private void populateXmlType(ParameterMetaData paramMetaData)
+ {
+ EndpointMetaData epMetaData =
paramMetaData.getOperationMetaData().getEndpointMetaData();
+ TypesMetaData types = epMetaData.getServiceMetaData().getTypesMetaData();
+
+ QName xmlName = paramMetaData.getXmlName();
+ QName xmlType = paramMetaData.getXmlType();
+ Class javaType = paramMetaData.getJavaType();
+ String javaName = paramMetaData.getJavaTypeName();
+
+ if (xmlType == null)
+ {
+ try
+ {
+ xmlType = jaxbCtx.getTypeName(new TypeReference(xmlName, javaType));
+ }
+ catch (IllegalArgumentException e)
+ {
+ throw new IllegalStateException("Cannot obtain xml type for:
[xmlName=" + xmlName + ",javaName=" + javaName + "]");
+ }
+
+ /* Anonymous type.
+ *
+ * Currently the design of our stack is based on the
+ * notion of their always being a unique type. In order to lookup the
+ * appropriate (de)serializer you must have a type. So we use a fake
+ * name. This is an illegal NCName, so it shouldn't collide.
+ */
+ if (xmlType == null)
+ xmlType = new QName(xmlName.getNamespaceURI(), ">" +
xmlName.getLocalPart());
+
+ paramMetaData.setXmlType(xmlType);
+ }
+
+ types.addTypeMapping(new TypeMappingMetaData(types, xmlType, javaName));
+ }
+
+ /**
+ * Process operation meta data extensions.
+ */
+ private void processMetaExtensions(EndpointMetaData epMetaData, OperationMetaData
opMetaData)
+ {
+ // Until there is a addressing annotion we fallback to implicit action asosciation
+ // TODO: figure out a way to assign message name instead of IN and OUT
+ String tns = epMetaData.getQName().getNamespaceURI();
+ String portTypeName = epMetaData.getQName().getLocalPart();
+
+ AddressingProperties ADDR = new AddressingPropertiesImpl();
+ AddressingOpMetaExt addrExt = new AddressingOpMetaExt(ADDR.getNamespaceURI());
+ addrExt.setInboundAction(tns + "/" + portTypeName + "/IN");
+
+ if (!opMetaData.isOneWay())
+ addrExt.setOutboundAction(tns + "/" + portTypeName +
"/OUT");
+
+ opMetaData.addExtension(addrExt);
+ }
+
+ private void processWebMethod(EndpointMetaData epMetaData, Method method)
+ {
+ String javaName = method.getName();
+
+ // skip asnyc methods, they dont need meta data representation
+ if (method.getName().endsWith(Constants.ASYNC_METHOD_SUFFIX))
+ return;
+
+ // reflection defaults
+ String soapAction = "";
+ String operationName = method.getName();
+
+ // annotation values that override defaults
+ if (method.isAnnotationPresent(WebMethod.class))
+ {
+ WebMethod anWebMethod = method.getAnnotation(WebMethod.class);
+ soapAction = anWebMethod.action();
+ if (anWebMethod.operationName().length() > 0)
+ {
+ operationName = anWebMethod.operationName();
+ }
+ }
+
+ String targetNS = epMetaData.getInterfaceQName().getNamespaceURI();
+ OperationMetaData opMetaData = new OperationMetaData(epMetaData, new
QName(targetNS, operationName), javaName);
+ opMetaData.setOneWay(method.isAnnotationPresent(Oneway.class));
+ opMetaData.setSOAPAction(soapAction);
+ epMetaData.addOperation(opMetaData);
+
+ // Build parameter meta data
+ Class[] parameterTypes = method.getParameterTypes();
+ Type[] genericTypes = method.getGenericParameterTypes();
+ Annotation[][] parameterAnnotations = method.getParameterAnnotations();
+ ParameterMetaData wrapperParameter = null, wrapperOutputParameter = null;
+ List<WrappedParameter> wrappedParameters = null, wrappedOutputParameters =
null;
+
+ // Force paramter style to wrapped
+ if (method.isAnnotationPresent(RequestWrapper.class) ||
method.isAnnotationPresent(ResponseWrapper.class))
+ {
+ epMetaData.setParameterStyle(ParameterStyle.WRAPPED);
+ }
+
+ if (opMetaData.isDocumentWrapped())
+ {
+ wrapperParameter = createRequestWrapper(opMetaData, method);
+ wrappedParameters = new
ArrayList<WrappedParameter>(parameterTypes.length);
+ wrapperParameter.setWrappedParameters(wrappedParameters);
+
+ if (!opMetaData.isOneWay())
+ {
+ wrapperOutputParameter = createResponseWrapper(opMetaData, method);
+ wrappedOutputParameters = new
ArrayList<WrappedParameter>(parameterTypes.length + 1);
+ wrapperOutputParameter.setWrappedParameters(wrappedOutputParameters);
+ }
+ }
+
+ for (int i = 0; i < parameterTypes.length; i++)
+ {
+ Class javaType = parameterTypes[i];
+ Type genericType = genericTypes[i];
+ String javaTypeName = javaType.getName();
+ WebParam anWebParam = getWebParamAnnotation(method, i);
+ boolean isHeader = anWebParam != null && anWebParam.header();
+ boolean isWrapped = opMetaData.isDocumentWrapped() && !isHeader;
+ ParameterMode mode = getParameterMode(anWebParam, javaType);
+
+ // Assert one-way
+ if (opMetaData.isOneWay() && mode != ParameterMode.IN)
+ throw new IllegalArgumentException("A one-way operation can not have
output parameters [" + "method = " + method.getName() + ", parameter =
" + i + "]");
+
+ if (HolderUtils.isHolderType(javaType))
+ {
+ genericType = HolderUtils.getGenericValueType(genericType);
+ javaType = JavaUtils.erasure(genericType);
+ javaTypeName = javaType.getName();
+ }
+
+ if (isWrapped)
+ {
+ QName wrappedElementName = getWebParamName(opMetaData, i, javaType,
anWebParam);
+ String variable = convertToVariable(wrappedElementName.getLocalPart());
+
+ WrappedParameter wrappedParameter = new WrappedParameter(wrappedElementName,
javaTypeName, variable, i);
+ wrappedParameter.setTypeArguments(convertTypeArguments(javaType,
genericType));
+
+ if (mode != ParameterMode.OUT)
+ wrappedParameters.add(wrappedParameter);
+ if (mode != ParameterMode.IN)
+ {
+ wrappedOutputParameters.add(wrappedParameter);
+ wrappedParameter.setHolder(true);
+ }
+ }
+ else
+ {
+ QName xmlName = getWebParamName(opMetaData, i, javaType, anWebParam);
+
+ ParameterMetaData paramMetaData = new ParameterMetaData(opMetaData, xmlName,
javaTypeName);
+ paramMetaData.setInHeader(isHeader);
+ paramMetaData.setIndex(i);
+ paramMetaData.setMode(mode);
+
+ opMetaData.addParameter(paramMetaData);
+ javaTypes.add(javaType);
+ typeRefs.add(new TypeReference(xmlName, genericType,
parameterAnnotations[i]));
+ }
+ }
+
+ // Build result meta data
+ Class returnType = method.getReturnType();
+ Type genericReturnType = method.getGenericReturnType();
+ String returnTypeName = returnType.getName();
+ if ((returnType == void.class) == false)
+ {
+ if (opMetaData.isOneWay())
+ throw new IllegalArgumentException("[JSR-181 2.5.1] The method
'" + method.getName() + "' can not have a return value if it is marked
OneWay");
+
+ WebResult anWebResult = method.getAnnotation(WebResult.class);
+ boolean isHeader = anWebResult != null && anWebResult.header();
+ boolean isWrapped = opMetaData.isDocumentWrapped() && !isHeader;
+ QName xmlName = getWebResultName(opMetaData, returnType, anWebResult);
+
+ if (isWrapped)
+ {
+ WrappedParameter wrapped = new WrappedParameter(xmlName, returnTypeName,
convertToVariable(xmlName.getLocalPart()), -1);
+ wrapped.setTypeArguments(convertTypeArguments(returnType,
genericReturnType));
+
+ // insert at the beginning just for prettiness
+ wrappedOutputParameters.add(0, wrapped);
+ }
+ else
+ {
+ ParameterMetaData retMetaData = new ParameterMetaData(opMetaData, xmlName,
returnTypeName);
+ retMetaData.setInHeader(isHeader);
+ opMetaData.setReturnParameter(retMetaData);
+
+ javaTypes.add(returnType);
+ typeRefs.add(new TypeReference(xmlName, genericReturnType,
method.getAnnotations()));
+ }
+ }
+
+ // Generate wrapper beans
+ if (opMetaData.isDocumentWrapped())
+ {
+ wrapperGenerator.generate(wrapperParameter);
+ Class wrapperClass = wrapperParameter.getJavaType();
+ javaTypes.add(wrapperClass);
+ // In case there is no @XmlRootElement
+ typeRefs.add(new TypeReference(wrapperParameter.getXmlName(), wrapperClass));
+ if (!opMetaData.isOneWay())
+ {
+ wrapperGenerator.generate(wrapperOutputParameter);
+ wrapperClass = wrapperOutputParameter.getJavaType();
+ javaTypes.add(wrapperClass);
+ // In case there is no @XmlRootElement
+ typeRefs.add(new TypeReference(wrapperOutputParameter.getXmlName(),
wrapperClass));
+ }
+ }
+
+ // Add faults
+ for (Class exClass : method.getExceptionTypes())
+ if (!RemoteException.class.isAssignableFrom(exClass))
+ addFault(opMetaData, exClass);
+
+ // process op meta data extension
+ processMetaExtensions(epMetaData, opMetaData);
+ }
+
+ private EndpointResult processWebService(UnifiedMetaData wsMetaData, Class<?>
sepClass, ClassLoader loader) throws ClassNotFoundException
+ {
+ WebService anWebService = sepClass.getAnnotation(WebService.class);
+ if (anWebService == null)
+ throw new WSException("Cannot obtain @WebService annotation from: " +
sepClass.getName());
+
+ Class<?> seiClass = null;
+ String seiName = null;
+ WSDLUtils wsdlUtils = WSDLUtils.getInstance();
+
+ String name = anWebService.name();
+ if (name.length() == 0)
+ name = WSDLUtils.getJustClassName(sepClass);
+
+ String serviceName = anWebService.serviceName();
+ if (serviceName.length() == 0)
+ serviceName = name + "Service";
+
+ String serviceNS = anWebService.targetNamespace();
+ if (serviceNS.length() == 0)
+ serviceNS = wsdlUtils.getTypeNamespace(sepClass);
+
+ String portName = anWebService.portName();
+ if (portName.length() == 0)
+ portName = name + "Port";
+
+ String wsdlLocation = anWebService.wsdlLocation();
+ String interfaceNS = serviceNS;
+
+ if (anWebService.endpointInterface().length() > 0)
+ {
+ seiName = anWebService.endpointInterface();
+ seiClass = loader.loadClass(seiName);
+ anWebService = seiClass.getAnnotation(WebService.class);
+
+ if (anWebService == null)
+ throw new WSException("Interface does not have a @WebService annotation:
" + seiName);
+
+ name = anWebService.name();
+ if (name.length() == 0)
+ name = WSDLUtils.getJustClassName(seiClass);
+
+ interfaceNS = anWebService.targetNamespace();
+ if (interfaceNS.length() == 0)
+ interfaceNS = wsdlUtils.getTypeNamespace(seiClass);
+
+ // The spec states that WSDL location should be allowed on an SEI, although it
+ // makes far more sense on the implementation bean, so we ALWAYS override the
SEI
+ // when wsdlLocation is defined on the bean
+
+ if (wsdlLocation.length() == 0)
+ wsdlLocation = anWebService.wsdlLocation();
+ }
+
+ // Setup the ServerEndpointMetaData
+ QName portQName = new QName(serviceNS, portName);
+ QName portTypeQName = new QName(interfaceNS, name);
+
+ EndpointResult result = new EndpointResult();
+ result.smd = new ServiceMetaData(wsMetaData, new QName(serviceNS, serviceName));
+ result.semd = new ServerEndpointMetaData(result.smd, portQName, portTypeQName,
EndpointMetaData.Type.JAXWS);
+ result.klass = (seiClass != null ? seiClass : sepClass);
+ result.wsdlLocation = wsdlLocation;
+
+ result.smd.addEndpoint(result.semd);
+ wsMetaData.addService(result.smd);
+
+ return result;
+ }
+
+ protected void createJAXBContext(EndpointMetaData epMetaData)
+ {
+ try
+ {
+ String targetNS = epMetaData.getInterfaceQName().getNamespaceURI();
+ log.debug("JAXBContext [types=" + javaTypes + ",tns=" +
targetNS + "]");
+ jaxbCtx = JAXBRIContext.newInstance(javaTypes.toArray(new Class[0]), typeRefs,
targetNS, false);
+ }
+ catch (JAXBException ex)
+ {
+ throw new IllegalStateException("Cannot build JAXB context", ex);
+ }
+ }
+
+ protected void populateXmlTypes(EndpointMetaData epMetaData)
+ {
+ for (OperationMetaData operation : epMetaData.getOperations())
+ {
+ // parameters
+ for (ParameterMetaData paramMetaData : operation.getParameters())
+ {
+ populateXmlType(paramMetaData);
+ }
+
+ // return value
+ ParameterMetaData returnParameter = operation.getReturnParameter();
+ if (returnParameter != null)
+ populateXmlType(returnParameter);
+
+ // faults
+ for (FaultMetaData faultMetaData : operation.getFaults())
+ {
+ populateXmlType(faultMetaData);
+ }
+ }
+ }
+
+ /**
+ * Process an optional @HandlerChain annotation
+ *
+ * Location of the handler chain file. The location supports 2 formats.
+ *
+ * 1. An absolute java.net.URL in externalForm.
+ * (ex:
http://myhandlers.foo.com/handlerfile1.xml)
+ *
+ * 2. A relative path from the source file or class file.
+ * (ex: bar/handlerfile1.xml)
+ */
+ protected void processHandlerChain(EndpointMetaData epMetaData, Class<?>
wsClass)
+ {
+ if (wsClass.isAnnotationPresent(SOAPMessageHandlers.class))
+ throw new WSException("Cannot combine @HandlerChain with
@SOAPMessageHandlers");
+
+ HandlerChain anHandlerChain =
(HandlerChain)wsClass.getAnnotation(HandlerChain.class);
+
+ URL fileURL = null;
+ String filename = anHandlerChain.file();
+
+ // Try the filename as URL
+ try
+ {
+ fileURL = new URL(filename);
+ }
+ catch (MalformedURLException ex)
+ {
+ // ignore
+ }
+
+ // Try the filename as File
+ if (fileURL == null)
+ {
+ try
+ {
+ File file = new File(filename);
+ if (file.exists())
+ fileURL = file.toURL();
+ }
+ catch (MalformedURLException e)
+ {
+ // ignore
+ }
+ }
+
+ // Try the filename as Resource
+ if (fileURL == null)
+ {
+ fileURL = epMetaData.getClassLoader().getResource(filename);
+ }
+
+ // Try the filename relative to class
+ if (fileURL == null)
+ {
+ String packagePath = wsClass.getPackage().getName().replace('.',
'/');
+ fileURL = epMetaData.getClassLoader().getResource(packagePath + "/" +
filename);
+ }
+
+ if (fileURL == null)
+ throw new WSException("Cannot resolve handler file '" + filename +
"' on " + wsClass.getName());
+
+ try
+ {
+ HandlerChainsMetaData handlerChainsMetaData = null;
+ InputStream is = fileURL.openStream();
+ try
+ {
+ Unmarshaller unmarshaller =
UnmarshallerFactory.newInstance().newUnmarshaller();
+ unmarshaller.setValidation(true);
+ unmarshaller.setSchemaValidation(true);
+ unmarshaller.setEntityResolver(new JBossWSEntityResolver());
+ ObjectModelFactory factory = new HandlerChainFactory();
+ handlerChainsMetaData = (HandlerChainsMetaData)unmarshaller.unmarshal(is,
factory, null);
+ }
+ finally
+ {
+ is.close();
+ }
+
+ // Setup the endpoint handlers
+ for (HandlerChainMetaData handlerChainMetaData :
handlerChainsMetaData.getHandlerChains())
+ {
+ for (UnifiedHandlerMetaData uhmd : handlerChainMetaData.getHandlers())
+ {
+ epMetaData.addHandler(uhmd.getHandlerMetaDataJAXWS(epMetaData,
HandlerType.ENDPOINT));
+ }
+ }
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (Exception ex)
+ {
+ throw new WSException("Cannot process handler chain: " + filename,
ex);
+ }
+ }
+
+ protected void processOrGenerateWSDL(Class wsClass, ServiceMetaData serviceMetaData,
String wsdlLocation, EndpointMetaData epMetaData)
+ {
+ if (wsdlLocation.length() > 0)
+ {
+ serviceMetaData.setWsdlFile(wsdlLocation);
+ }
+ else
+ {
+ try
+ {
+ String serviceName = serviceMetaData.getServiceName().getLocalPart();
+
+ WSDLGenerator generator = new JAXBWSDLGenerator(jaxbCtx);
+ WSDLDefinitions wsdlDefinitions = generator.generate(serviceMetaData);
+
+ // Ensure that types are only in the interface qname
+
wsdlDefinitions.getWsdlTypes().setNamespace(epMetaData.getInterfaceQName().getNamespaceURI());
+
+ final File tmpdir = IOUtils.createTempDirectory();
+ File wsdlTmpFile = File.createTempFile(serviceName, ".wsdl",
tmpdir);
+ wsdlTmpFile.deleteOnExit();
+
+ Writer writer = IOUtils.getCharsetFileWriter(wsdlTmpFile,
Constants.DEFAULT_XML_CHARSET);
+ new WSDLWriter(wsdlDefinitions).write(writer, Constants.DEFAULT_XML_CHARSET,
new WSDLWriterResolver()
+ {
+ public WSDLWriterResolver resolve(String suggestedFile) throws
IOException
+ {
+ File newTmpFile = File.createTempFile(suggestedFile, ".wsdl",
tmpdir);
+ newTmpFile.deleteOnExit();
+ actualFile = newTmpFile.getName();
+ charset = Constants.DEFAULT_XML_CHARSET;
+ writer = IOUtils.getCharsetFileWriter(newTmpFile,
Constants.DEFAULT_XML_CHARSET);
+ return this;
+ }
+ });
+ writer.close();
+
+ serviceMetaData.setWsdlFile(wsdlTmpFile.toURL().toExternalForm());
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (IOException e)
+ {
+ throw new WSException("Cannot write generated wsdl", e);
+ }
+ }
+ }
+
+ protected void processSOAPBinding(EndpointMetaData epMetaData, Class<?>
wsClass)
+ {
+ SOAPBinding anSoapBinding = (SOAPBinding)wsClass.getAnnotation(SOAPBinding.class);
+
+ SOAPBinding.Style attrStyle = anSoapBinding.style();
+ Style style = (attrStyle == SOAPBinding.Style.RPC ? Style.RPC : Style.DOCUMENT);
+ epMetaData.setStyle(style);
+
+ SOAPBinding.Use attrUse = anSoapBinding.use();
+ if (attrUse == SOAPBinding.Use.ENCODED)
+ throw new WSException("SOAP encoding is not supported for JSR-181
deployments");
+
+ epMetaData.setEncodingStyle(Use.LITERAL);
+
+ ParameterStyle paramStyle = anSoapBinding.parameterStyle();
+ epMetaData.setParameterStyle(paramStyle);
+ }
+
+ // If the implementation bean does not implement a service endpoint interface and
+ // there are no @WebMethod annotations in the implementation bean (excluding
+ // @WebMethod annotations used to exclude inherited @WebMethods), all public
+ // methods other than those inherited from java.lang.Object will be exposed as Web
+ // Service operations, subject to the inheritance rules specified in Common
+ // Annotations for the Java Platform [12], section 2.1.
+ protected void processWebMethods(EndpointMetaData epMetaData, Class wsClass)
+ {
+ epMetaData.clearOperations();
+
+ // Process @WebMethod annotations
+ int webMethodCount = 0;
+ for (Method method : wsClass.getMethods())
+ {
+ WebMethod annotation = method.getAnnotation(WebMethod.class);
+ boolean exclude = annotation != null && annotation.exclude();
+ if (!exclude && (annotation != null || wsClass.isInterface()))
+ {
+ processWebMethod(epMetaData, method);
+ webMethodCount++;
+ }
+ }
+
+ // @WebService should expose all inherited methods if @WebMethod is never
specified
+ if (webMethodCount == 0 && !wsClass.isInterface())
+ {
+ for (Method method : wsClass.getMethods())
+ {
+ WebMethod annotation = method.getAnnotation(WebMethod.class);
+ boolean exclude = annotation != null && annotation.exclude();
+ if (!exclude && method.getDeclaringClass() != Object.class)
+ {
+ processWebMethod(epMetaData, method);
+ webMethodCount++;
+ }
+ }
+ }
+
+ if (webMethodCount == 0)
+ throw new WSException("No exposable methods found");
+ }
+
+ protected void resetMetaDataBuilder(ClassLoader loader)
+ {
+ wrapperGenerator = new DynamicWrapperGenerator(loader);
+ javaTypes.clear();
+ typeRefs.clear();
+ jaxbCtx = null;
+ }
+
+ public ServerEndpointMetaData buildEndpoint(UnifiedMetaData wsMetaData,
UnifiedDeploymentInfo udi, Class<?> sepClass, String linkName)
+ {
+ try
+ {
+ EndpointResult result = processWebService(wsMetaData, sepClass,
udi.classLoader);
+
+ // Clear the java types, etc.
+ resetMetaDataBuilder(udi.classLoader);
+
+ ServerEndpointMetaData sepMetaData = result.semd;
+ ServiceMetaData serviceMetaData = result.smd;
+ Class<?> wsClass = result.klass;
+ sepMetaData.setLinkName(linkName);
+
+ // Assign the WS-Security configuration,
+ WSSecurityConfiguration securityConfiguration =
MetaDataBuilder.getWsSecurityConfiguration(udi);
+ serviceMetaData.setSecurityConfiguration(securityConfiguration);
+
+ sepMetaData.setServiceEndpointImplName(sepClass.getName());
+ sepMetaData.setServiceEndpointInterfaceName(wsClass.getName());
+
+ // Process an optional @SOAPBinding annotation
+ if (wsClass.isAnnotationPresent(SOAPBinding.class))
+ processSOAPBinding(sepMetaData, wsClass);
+
+ // Process an optional @BindingType annotation
+ if (wsClass.isAnnotationPresent(BindingType.class))
+ processBindingType(sepMetaData, wsClass);
+
+ // Init the transport guarantee
+ initTransportGuaranteeJSE(udi, sepMetaData, linkName);
+
+ // Process web methods
+ processWebMethods(sepMetaData, wsClass);
+
+ // Initialize types
+ createJAXBContext(sepMetaData);
+ populateXmlTypes(sepMetaData);
+
+ // Process or generate WSDL
+ processOrGenerateWSDL(wsClass, serviceMetaData, result.wsdlLocation,
sepMetaData);
+
+ // Read the generated WSDL and initialize the schema model
+ // FIXME - This should be removed
+ WSDLDefinitions wsdlDefinitions = serviceMetaData.getWsdlDefinitions();
+ JBossXSModel schemaModel =
WSDLUtils.getSchemaModel(wsdlDefinitions.getWsdlTypes());
+ serviceMetaData.getTypesMetaData().setSchemaModel(schemaModel);
+
+ // Set the endpoint address
+ processPortComponent(udi, wsClass, linkName, sepMetaData);
+
+ // Init the endpoint address
+ MetaDataBuilder.initEndpointAddress(udi, sepMetaData, linkName);
+
+ // replace the SOAP address
+ MetaDataBuilder.replaceAddressLocation(sepMetaData);
+
+ // Process an optional @SOAPMessageHandlers annotation
+ if (sepClass.isAnnotationPresent(SOAPMessageHandlers.class) ||
wsClass.isAnnotationPresent(SOAPMessageHandlers.class))
+ log.warn("@SOAPMessageHandlers is deprecated as of JAX-WS 2.0 with no
replacement.");
+
+ // Add pre handlers
+ WSEndpointConfigJAXWS jaxrpcConfig =
(WSEndpointConfigJAXWS)sepMetaData.getEndpointConfig();
+ sepMetaData.addHandlers(jaxrpcConfig.getHandlers(sepMetaData,
HandlerType.PRE));
+
+ // Process an optional @HandlerChain annotation
+ if (sepClass.isAnnotationPresent(HandlerChain.class))
+ processHandlerChain(sepMetaData, sepClass);
+ else if (wsClass.isAnnotationPresent(HandlerChain.class))
+ processHandlerChain(sepMetaData, wsClass);
+
+ // Add post handlers
+ sepMetaData.addHandlers(jaxrpcConfig.getHandlers(sepMetaData,
HandlerType.POST));
+
+ // init service endpoint id
+ ObjectName sepID = MetaDataBuilder.getServiceEndpointID(udi, sepMetaData);
+ sepMetaData.setServiceEndpointID(sepID);
+
+ return sepMetaData;
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (Exception ex)
+ {
+ throw new WSException("Cannot build meta data: " + ex.getMessage(),
ex);
+ }
+ }
+}
Copied: trunk/src/main/java/org/jboss/ws/metadata/config (from rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/config)
Deleted: trunk/src/main/java/org/jboss/ws/metadata/config/WSCommonConfig.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/config/WSCommonConfig.java 2006-12-07
10:43:36 UTC (rev 1600)
+++ trunk/src/main/java/org/jboss/ws/metadata/config/WSCommonConfig.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -1,53 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.ws.metadata.config;
-
-//$Id$
-
-import java.util.List;
-
-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
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 18-Dec-2005
- */
-public abstract class WSCommonConfig
-{
- private String configName;
-
- public String getConfigName()
- {
- return configName;
- }
-
- public void setConfigName(String configName)
- {
- this.configName = configName;
- }
-
- public abstract List<HandlerMetaData> getHandlers(EndpointMetaData epMetaData,
HandlerType type);
-}
Copied: trunk/src/main/java/org/jboss/ws/metadata/config/WSCommonConfig.java (from rev
1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/config/WSCommonConfig.java)
Deleted: trunk/src/main/java/org/jboss/ws/metadata/config/WSConfigFactory.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/config/WSConfigFactory.java 2006-12-07
10:43:36 UTC (rev 1600)
+++ trunk/src/main/java/org/jboss/ws/metadata/config/WSConfigFactory.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -1,129 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.ws.metadata.config;
-
-//$Id$
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.WSException;
-import org.jboss.ws.core.utils.DOMUtils;
-import org.jboss.ws.core.utils.JBossWSEntityResolver;
-import org.jboss.ws.metadata.config.jaxrpc.WSConfigFactoryJAXRPC;
-import org.jboss.ws.metadata.config.jaxws.WSConfigFactoryJAXWS;
-import org.jboss.xb.binding.JBossXBException;
-import org.jboss.xb.binding.Unmarshaller;
-import org.jboss.xb.binding.UnmarshallerFactory;
-import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding;
-import org.jboss.xb.binding.sunday.unmarshalling.XsdBinder;
-import org.w3c.dom.Element;
-
-/**
- * A factory for the JBossWS endpoint/client configuration
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 18-Dec-2005
- */
-public class WSConfigFactory
-{
- // provide logging
- private final Logger log = Logger.getLogger(WSConfigFactory.class);
-
- private static String URN_JAXRPC_CONFIG = "urn:jboss:jaxrpc-config:2.0";
- private static String URN_JAXWS_CONFIG = "urn:jboss:jaxws-config:2.0";
-
- // Hide constructor
- private WSConfigFactory()
- {
- }
-
- /** Create a new instance of the factory
- */
- public static WSConfigFactory newInstance()
- {
- return new WSConfigFactory();
- }
-
- public Object parseWithSchemaBinding(URL configURL) throws IOException,
JBossXBException
- {
- log.debug("parse: " + configURL);
-
- String configSchema = "schema/jaxrpc-config_2_0.xsd";
- URL xsdURL =
Thread.currentThread().getContextClassLoader().getResource(configSchema);
- if (xsdURL == null)
- throw new WSException("Cannot find: " + configSchema);
-
- InputStream xsd = xsdURL.openStream();
- SchemaBinding schemaBinding = XsdBinder.bind(xsd, "UTF-8");
-
- Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
- unmarshaller.setValidation(true);
- unmarshaller.setSchemaValidation(true);
- unmarshaller.setEntityResolver(new JBossWSEntityResolver());
- Object wsConfig = unmarshaller.unmarshal(configURL.openStream(), schemaBinding);
- return wsConfig;
- }
-
- // Below is ObjectModelFactory stuff, which should be removed when
parseWithSchemaBinding works.
-
- public Object parseWithObjectModelFactory(URL configURL) throws IOException,
JBossXBException
- {
- log.debug("parse: " + configURL);
-
- Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
- unmarshaller.setValidation(true);
- unmarshaller.setSchemaValidation(true);
-
- Object wsConfig;
- String nsURI = getNamespaceURI(configURL);
- if (URN_JAXRPC_CONFIG.equals(nsURI))
- {
- wsConfig = unmarshaller.unmarshal(configURL.openStream(), new
WSConfigFactoryJAXRPC(), null);
- }
- else if (URN_JAXWS_CONFIG.equals(nsURI))
- {
- wsConfig = unmarshaller.unmarshal(configURL.openStream(), new
WSConfigFactoryJAXWS(), null);
- }
- else
- {
- throw new WSException("Invalid config namespace: " + nsURI);
- }
-
- return wsConfig;
- }
-
- private String getNamespaceURI(URL configURL)
- {
- try
- {
- Element root = DOMUtils.parse(configURL.openStream());
- return root.getNamespaceURI();
- }
- catch (IOException ex)
- {
- throw new WSException(ex);
- }
- }
-}
Copied: trunk/src/main/java/org/jboss/ws/metadata/config/WSConfigFactory.java (from rev
1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/config/WSConfigFactory.java)
Copied: trunk/src/main/java/org/jboss/ws/metadata/config/jaxrpc (from rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/config/jaxrpc)
Deleted:
trunk/src/main/java/org/jboss/ws/metadata/config/jaxrpc/WSClientConfigJAXRPC.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/config/jaxrpc/WSClientConfigJAXRPC.java 2006-12-07
10:43:36 UTC (rev 1600)
+++
trunk/src/main/java/org/jboss/ws/metadata/config/jaxrpc/WSClientConfigJAXRPC.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -1,35 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.ws.metadata.config.jaxrpc;
-
-
-// $Id$
-
-/**
- * A JBossWS client configuration
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 18-Dec-2005
- */
-public class WSClientConfigJAXRPC extends WSCommonConfigJAXRPC
-{
-}
Copied: trunk/src/main/java/org/jboss/ws/metadata/config/jaxrpc/WSClientConfigJAXRPC.java
(from rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/config/jaxrpc/WSClientConfigJAXRPC.java)
Deleted:
trunk/src/main/java/org/jboss/ws/metadata/config/jaxrpc/WSCommonConfigJAXRPC.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/config/jaxrpc/WSCommonConfigJAXRPC.java 2006-12-07
10:43:36 UTC (rev 1600)
+++
trunk/src/main/java/org/jboss/ws/metadata/config/jaxrpc/WSCommonConfigJAXRPC.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -1,91 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.ws.metadata.config.jaxrpc;
-
-import java.util.ArrayList;
-import java.util.List;
-
-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$
-
-/**
- * A JBossWS client configuration
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 18-Dec-2005
- */
-public abstract class WSCommonConfigJAXRPC extends WSCommonConfig
-{
- private HandlerChainMetaData preHandlerChain;
- private HandlerChainMetaData postHandlerChain;
-
- public HandlerChainMetaData getPostHandlerChain()
- {
- return postHandlerChain;
- }
-
- public void setPostHandlerChain(HandlerChainMetaData postHandlerChain)
- {
- this.postHandlerChain = postHandlerChain;
- }
-
- public HandlerChainMetaData getPreHandlerChain()
- {
- return preHandlerChain;
- }
-
- public void setPreHandlerChain(HandlerChainMetaData preHandlerChain)
- {
- this.preHandlerChain = preHandlerChain;
- }
-
- @Override
- public List<HandlerMetaData> getHandlers(EndpointMetaData epMetaData,
HandlerType type)
- {
- List<HandlerMetaData> handlers = new ArrayList<HandlerMetaData>();
-
- HandlerChainMetaData handlerChain;
- if (type == HandlerType.PRE)
- handlerChain = getPreHandlerChain();
- else if (type == HandlerType.POST)
- handlerChain = getPostHandlerChain();
- else
- throw new IllegalArgumentException("Invalid handler type: " + type);
-
- if (handlerChain != null)
- {
- for (UnifiedHandlerMetaData uhmd : handlerChain.getHandlers())
- {
- handlers.add(uhmd.getHandlerMetaDataJAXRPC(epMetaData, type));
- }
- }
-
- return handlers;
- }
-}
Copied: trunk/src/main/java/org/jboss/ws/metadata/config/jaxrpc/WSCommonConfigJAXRPC.java
(from rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/config/jaxrpc/WSCommonConfigJAXRPC.java)
Deleted:
trunk/src/main/java/org/jboss/ws/metadata/config/jaxrpc/WSConfigFactoryJAXRPC.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/config/jaxrpc/WSConfigFactoryJAXRPC.java 2006-12-07
10:43:36 UTC (rev 1600)
+++
trunk/src/main/java/org/jboss/ws/metadata/config/jaxrpc/WSConfigFactoryJAXRPC.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -1,161 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.ws.metadata.config.jaxrpc;
-
-//$Id$
-
-import java.util.List;
-
-import org.jboss.logging.Logger;
-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.xb.binding.ObjectModelFactory;
-import org.jboss.xb.binding.UnmarshallingContext;
-import org.xml.sax.Attributes;
-
-/**
- * A factory for the JBossWS endpoint/client configuration
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 18-Dec-2005
- */
-public class WSConfigFactoryJAXRPC implements ObjectModelFactory
-{
- // provide logging
- private final Logger log = Logger.getLogger(WSConfigFactoryJAXRPC.class);
-
- public Object newRoot(Object root, UnmarshallingContext ctx, String namespaceURI,
String localName, Attributes attrs)
- {
- return new WSConfigRootJAXRPC();
- }
-
- public Object completeRoot(Object root, UnmarshallingContext ctx, String namespaceURI,
String localName)
- {
- return root;
- }
-
- /**
- * Called when parsing of a new element started.
- */
- public Object newChild(WSConfigRootJAXRPC wsConfig, UnmarshallingContext navigator,
String namespaceURI, String localName, Attributes attrs)
- {
- log.trace("WSConfig newChild: " + localName);
- if ("endpoint-config".equals(localName))
- {
- WSEndpointConfigJAXRPC wsEndpointConfig = new WSEndpointConfigJAXRPC();
- wsConfig.getEndpointConfig().add(wsEndpointConfig);
- return wsEndpointConfig;
- }
- if ("client-config".equals(localName))
- {
- WSClientConfigJAXRPC wsClientConfig = new WSClientConfigJAXRPC();
- wsConfig.getClientConfig().add(wsClientConfig);
- return wsClientConfig;
- }
- return null;
- }
-
- /**
- * Called when a new simple child element with text value was read from the XML
content.
- */
- public void setValue(WSCommonConfigJAXRPC wsCommonConfig, UnmarshallingContext
navigator, String namespaceURI, String localName, String value)
- {
- if (log.isTraceEnabled())
- log.trace("WSCommonConfig setValue: nuri=" + namespaceURI + "
localName=" + localName + " value=" + value);
-
- if (localName.equals("config-name"))
- wsCommonConfig.setConfigName(value);
- }
-
- /**
- * Called when parsing of a new element started.
- */
- public Object newChild(WSCommonConfigJAXRPC wsCommonConfig, UnmarshallingContext
navigator, String namespaceURI, String localName, Attributes attrs)
- {
- log.trace("WSCommonConfig newChild: " + localName);
-
- if ("pre-handler-chain".equals(localName))
- {
- HandlerChainMetaData preHandlerChain = new HandlerChainMetaData(null);
- wsCommonConfig.setPreHandlerChain(preHandlerChain);
- return preHandlerChain;
- }
- if ("post-handler-chain".equals(localName))
- {
- HandlerChainMetaData postHandlerChain = new HandlerChainMetaData(null);
- wsCommonConfig.setPostHandlerChain(postHandlerChain);
- return postHandlerChain;
- }
- return null;
- }
-
- /**
- * Called when parsing of a new element started.
- */
- public Object newChild(HandlerChainMetaData handlerChainMetaData, UnmarshallingContext
navigator, String namespaceURI, String localName, Attributes attrs)
- {
- log.trace("WSHandlerChainConfig newChild: " + localName);
- if ("handler".equals(localName))
- {
- UnifiedHandlerMetaData handler = new
UnifiedHandlerMetaData(handlerChainMetaData);
- List<UnifiedHandlerMetaData> handlers =
handlerChainMetaData.getHandlers();
- handlers.add(handler);
- return handler;
- }
- return null;
- }
-
- /**
- * Called when a new simple child element with text value was read from the XML
content.
- */
- public void setValue(UnifiedHandlerMetaData handler, UnmarshallingContext navigator,
String namespaceURI, String localName, String value)
- {
- if (log.isTraceEnabled())
- log.trace("UnifiedHandlerMetaData setValue: nuri=" + namespaceURI +
" localName=" + localName + " value=" + value);
-
- if (localName.equals("handler-name"))
- handler.setHandlerName(value);
- else if (localName.equals("handler-class"))
- handler.setHandlerClass(value);
- else if (localName.equals("soap-header"))
- handler.addSoapHeader(navigator.resolveQName(value));
- else if (localName.equals("soap-role"))
- handler.addSoapRole(value);
- 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: trunk/src/main/java/org/jboss/ws/metadata/config/jaxrpc/WSConfigFactoryJAXRPC.java
(from rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/config/jaxrpc/WSConfigFactoryJAXRPC.java)
Deleted: trunk/src/main/java/org/jboss/ws/metadata/config/jaxrpc/WSConfigRootJAXRPC.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/config/jaxrpc/WSConfigRootJAXRPC.java 2006-12-07
10:43:36 UTC (rev 1600)
+++
trunk/src/main/java/org/jboss/ws/metadata/config/jaxrpc/WSConfigRootJAXRPC.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -1,94 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.ws.metadata.config.jaxrpc;
-
-import java.util.ArrayList;
-import java.util.List;
-
-
-/**
- * A JBossWS configuration
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 18-Dec-2005
- */
-public class WSConfigRootJAXRPC
-{
- private List<WSClientConfigJAXRPC> clientConfigList = new
ArrayList<WSClientConfigJAXRPC>();
- private List<WSEndpointConfigJAXRPC> endpointConfigList = new
ArrayList<WSEndpointConfigJAXRPC>();
-
- public List<WSClientConfigJAXRPC> getClientConfig()
- {
- return clientConfigList;
- }
-
- public void setClientConfig(List<WSClientConfigJAXRPC> clientConfig)
- {
- this.clientConfigList = clientConfig;
- }
-
- public List<WSEndpointConfigJAXRPC> getEndpointConfig()
- {
- return endpointConfigList;
- }
-
- public void setEndpointConfig(List<WSEndpointConfigJAXRPC> endpointConfig)
- {
- this.endpointConfigList = endpointConfig;
- }
-
- public WSClientConfigJAXRPC getClientConfigByName(String configName)
- {
- WSClientConfigJAXRPC config = null;
- for(WSClientConfigJAXRPC aux : clientConfigList)
- {
- if (aux.getConfigName().equals(configName))
- {
- config = aux;
- break;
- }
- }
-
- if (config == null && clientConfigList.size() == 1)
- config = clientConfigList.get(0);
-
- return config;
- }
-
- public WSEndpointConfigJAXRPC getEndpointConfigByName(String configName)
- {
- WSEndpointConfigJAXRPC config = null;
- for(WSEndpointConfigJAXRPC aux : endpointConfigList)
- {
- if (aux.getConfigName().equals(configName))
- {
- config = aux;
- break;
- }
- }
-
- if (config == null && endpointConfigList.size() == 1)
- config = endpointConfigList.get(0);
-
- return config;
- }
-}
Copied: trunk/src/main/java/org/jboss/ws/metadata/config/jaxrpc/WSConfigRootJAXRPC.java
(from rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/config/jaxrpc/WSConfigRootJAXRPC.java)
Deleted:
trunk/src/main/java/org/jboss/ws/metadata/config/jaxrpc/WSEndpointConfigJAXRPC.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/config/jaxrpc/WSEndpointConfigJAXRPC.java 2006-12-07
10:43:36 UTC (rev 1600)
+++
trunk/src/main/java/org/jboss/ws/metadata/config/jaxrpc/WSEndpointConfigJAXRPC.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -1,36 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.ws.metadata.config.jaxrpc;
-
-
-
-// $Id$
-
-/**
- * A JBossWS endpoint configuration
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 18-Dec-2005
- */
-public class WSEndpointConfigJAXRPC extends WSCommonConfigJAXRPC
-{
-}
Copied:
trunk/src/main/java/org/jboss/ws/metadata/config/jaxrpc/WSEndpointConfigJAXRPC.java (from
rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/config/jaxrpc/WSEndpointConfigJAXRPC.java)
Copied: trunk/src/main/java/org/jboss/ws/metadata/config/jaxws (from rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/config/jaxws)
Deleted: trunk/src/main/java/org/jboss/ws/metadata/config/jaxws/WSClientConfigJAXWS.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/config/jaxws/WSClientConfigJAXWS.java 2006-12-07
10:43:36 UTC (rev 1600)
+++
trunk/src/main/java/org/jboss/ws/metadata/config/jaxws/WSClientConfigJAXWS.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -1,35 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.ws.metadata.config.jaxws;
-
-
-// $Id$
-
-/**
- * A JBossWS client configuration
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 18-Dec-2005
- */
-public class WSClientConfigJAXWS extends WSCommonConfigJAXWS
-{
-}
Copied: trunk/src/main/java/org/jboss/ws/metadata/config/jaxws/WSClientConfigJAXWS.java
(from rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/config/jaxws/WSClientConfigJAXWS.java)
Deleted: trunk/src/main/java/org/jboss/ws/metadata/config/jaxws/WSCommonConfigJAXWS.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/config/jaxws/WSCommonConfigJAXWS.java 2006-12-07
10:43:36 UTC (rev 1600)
+++
trunk/src/main/java/org/jboss/ws/metadata/config/jaxws/WSCommonConfigJAXWS.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -1,91 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.ws.metadata.config.jaxws;
-
-import java.util.ArrayList;
-import java.util.List;
-
-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$
-
-/**
- * A JBossWS client configuration
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 18-Dec-2005
- */
-public abstract class WSCommonConfigJAXWS extends WSCommonConfig
-{
- private WSHandlerChainsConfigJAXWS preHandlerChains;
- private WSHandlerChainsConfigJAXWS postHandlerChains;
-
- public WSHandlerChainsConfigJAXWS getPostHandlerChains()
- {
- return postHandlerChains;
- }
-
- public void setPostHandlerChains(WSHandlerChainsConfigJAXWS postHandlerChain)
- {
- this.postHandlerChains = postHandlerChain;
- }
-
- public WSHandlerChainsConfigJAXWS getPreHandlerChains()
- {
- return preHandlerChains;
- }
-
- public void setPreHandlerChains(WSHandlerChainsConfigJAXWS preHandlerChains)
- {
- this.preHandlerChains = preHandlerChains;
- }
-
- public List<HandlerMetaData> getHandlers(EndpointMetaData epMetaData,
HandlerType type)
- {
- List<HandlerMetaData> handlers = new ArrayList<HandlerMetaData>();
-
- WSHandlerChainsConfigJAXWS handlerChains;
- if (type == HandlerType.PRE)
- handlerChains = getPreHandlerChains();
- else if (type == HandlerType.POST)
- handlerChains = getPostHandlerChains();
- else throw new IllegalArgumentException("Invalid handler type: " +
type);
-
- if (handlerChains != null)
- {
- for (HandlerChainMetaData handlerChainMetaData :
handlerChains.getHandlerChains())
- {
- for (UnifiedHandlerMetaData uhmd : handlerChainMetaData.getHandlers())
- {
- handlers.add(uhmd.getHandlerMetaDataJAXWS(epMetaData, type));
- }
- }
- }
-
- return handlers;
- }
-}
Copied: trunk/src/main/java/org/jboss/ws/metadata/config/jaxws/WSCommonConfigJAXWS.java
(from rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/config/jaxws/WSCommonConfigJAXWS.java)
Deleted: trunk/src/main/java/org/jboss/ws/metadata/config/jaxws/WSConfigFactoryJAXWS.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/config/jaxws/WSConfigFactoryJAXWS.java 2006-12-07
10:43:36 UTC (rev 1600)
+++
trunk/src/main/java/org/jboss/ws/metadata/config/jaxws/WSConfigFactoryJAXWS.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -1,123 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.ws.metadata.config.jaxws;
-
-//$Id$
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.metadata.jsr181.HandlerChainFactory;
-import org.jboss.ws.metadata.jsr181.HandlerChainMetaData;
-import org.jboss.xb.binding.UnmarshallingContext;
-import org.xml.sax.Attributes;
-
-/**
- * A factory for the JBossWS endpoint/client configuration
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 18-Dec-2005
- */
-public class WSConfigFactoryJAXWS extends HandlerChainFactory
-{
- // provide logging
- private final Logger log = Logger.getLogger(WSConfigFactoryJAXWS.class);
-
- public Object newRoot(Object root, UnmarshallingContext ctx, String namespaceURI,
String localName, Attributes attrs)
- {
- return new WSConfigRootJAXWS();
- }
-
- public Object completeRoot(Object root, UnmarshallingContext ctx, String namespaceURI,
String localName)
- {
- return root;
- }
-
- /**
- * Called when parsing of a new element started.
- */
- public Object newChild(WSConfigRootJAXWS wsConfig, UnmarshallingContext navigator,
String namespaceURI, String localName, Attributes attrs)
- {
- log.trace("WSConfig newChild: " + localName);
- if ("endpoint-config".equals(localName))
- {
- WSEndpointConfigJAXWS wsEndpointConfig = new WSEndpointConfigJAXWS();
- wsConfig.getEndpointConfig().add(wsEndpointConfig);
- return wsEndpointConfig;
- }
- if ("client-config".equals(localName))
- {
- WSClientConfigJAXWS wsClientConfig = new WSClientConfigJAXWS();
- wsConfig.getClientConfig().add(wsClientConfig);
- return wsClientConfig;
- }
- return null;
- }
-
- /**
- * Called when a new simple child element with text value was read from the XML
content.
- */
- public void setValue(WSCommonConfigJAXWS wsCommonConfig, UnmarshallingContext
navigator, String namespaceURI, String localName, String value)
- {
- if (log.isTraceEnabled())
- log.trace("WSCommonConfig setValue: nuri=" + namespaceURI + "
localName=" + localName + " value=" + value);
-
- if (localName.equals("config-name"))
- wsCommonConfig.setConfigName(value);
- }
-
- /**
- * Called when parsing of a new element started.
- */
- public Object newChild(WSCommonConfigJAXWS wsCommonConfig, UnmarshallingContext
navigator, String namespaceURI, String localName, Attributes attrs)
- {
- log.trace("WSCommonConfig newChild: " + localName);
-
- if ("pre-handler-chains".equals(localName))
- {
- WSHandlerChainsConfigJAXWS preHandlerChains = new WSHandlerChainsConfigJAXWS();
- wsCommonConfig.setPreHandlerChains(preHandlerChains);
- return preHandlerChains;
- }
- if ("post-handler-chains".equals(localName))
- {
- WSHandlerChainsConfigJAXWS postHandlerChains = new
WSHandlerChainsConfigJAXWS();
- wsCommonConfig.setPostHandlerChains(postHandlerChains);
- return postHandlerChains;
- }
- return null;
- }
-
- /**
- * Called when parsing of a new element started.
- */
- public Object newChild(WSHandlerChainsConfigJAXWS wsHandlerChains,
UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs)
- {
- log.trace("WSHandlerChainsConfig newChild: " + localName);
-
- if ("handler-chain".equals(localName))
- {
- HandlerChainMetaData handlerChain = new HandlerChainMetaData(null);
- wsHandlerChains.getHandlerChains().add(handlerChain);
- return handlerChain;
- }
- return null;
- }
-}
Copied: trunk/src/main/java/org/jboss/ws/metadata/config/jaxws/WSConfigFactoryJAXWS.java
(from rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/config/jaxws/WSConfigFactoryJAXWS.java)
Deleted: trunk/src/main/java/org/jboss/ws/metadata/config/jaxws/WSConfigRootJAXWS.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/config/jaxws/WSConfigRootJAXWS.java 2006-12-07
10:43:36 UTC (rev 1600)
+++
trunk/src/main/java/org/jboss/ws/metadata/config/jaxws/WSConfigRootJAXWS.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -1,94 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.ws.metadata.config.jaxws;
-
-import java.util.ArrayList;
-import java.util.List;
-
-
-/**
- * A JBossWS configuration
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 18-Dec-2005
- */
-public class WSConfigRootJAXWS
-{
- private List<WSClientConfigJAXWS> clientConfigList = new
ArrayList<WSClientConfigJAXWS>();
- private List<WSEndpointConfigJAXWS> endpointConfigList = new
ArrayList<WSEndpointConfigJAXWS>();
-
- public List<WSClientConfigJAXWS> getClientConfig()
- {
- return clientConfigList;
- }
-
- public void setClientConfig(List<WSClientConfigJAXWS> clientConfig)
- {
- this.clientConfigList = clientConfig;
- }
-
- public List<WSEndpointConfigJAXWS> getEndpointConfig()
- {
- return endpointConfigList;
- }
-
- public void setEndpointConfig(List<WSEndpointConfigJAXWS> endpointConfig)
- {
- this.endpointConfigList = endpointConfig;
- }
-
- public WSClientConfigJAXWS getClientConfigByName(String configName)
- {
- WSClientConfigJAXWS config = null;
- for(WSClientConfigJAXWS aux : clientConfigList)
- {
- if (aux.getConfigName().equals(configName))
- {
- config = aux;
- break;
- }
- }
-
- if (config == null && clientConfigList.size() == 1)
- config = clientConfigList.get(0);
-
- return config;
- }
-
- public WSEndpointConfigJAXWS getEndpointConfigByName(String configName)
- {
- WSEndpointConfigJAXWS config = null;
- for(WSEndpointConfigJAXWS aux : endpointConfigList)
- {
- if (aux.getConfigName().equals(configName))
- {
- config = aux;
- break;
- }
- }
-
- if (config == null && endpointConfigList.size() == 1)
- config = endpointConfigList.get(0);
-
- return config;
- }
-}
Copied: trunk/src/main/java/org/jboss/ws/metadata/config/jaxws/WSConfigRootJAXWS.java
(from rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/config/jaxws/WSConfigRootJAXWS.java)
Deleted:
trunk/src/main/java/org/jboss/ws/metadata/config/jaxws/WSEndpointConfigJAXWS.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/config/jaxws/WSEndpointConfigJAXWS.java 2006-12-07
10:43:36 UTC (rev 1600)
+++
trunk/src/main/java/org/jboss/ws/metadata/config/jaxws/WSEndpointConfigJAXWS.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -1,35 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.ws.metadata.config.jaxws;
-
-
-// $Id$
-
-/**
- * A JBossWS endpoint configuration
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 18-Dec-2005
- */
-public class WSEndpointConfigJAXWS extends WSCommonConfigJAXWS
-{
-}
Copied: trunk/src/main/java/org/jboss/ws/metadata/config/jaxws/WSEndpointConfigJAXWS.java
(from rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/config/jaxws/WSEndpointConfigJAXWS.java)
Deleted:
trunk/src/main/java/org/jboss/ws/metadata/config/jaxws/WSHandlerChainsConfigJAXWS.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/config/jaxws/WSHandlerChainsConfigJAXWS.java 2006-12-07
10:43:36 UTC (rev 1600)
+++
trunk/src/main/java/org/jboss/ws/metadata/config/jaxws/WSHandlerChainsConfigJAXWS.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -1,48 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.ws.metadata.config.jaxws;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.jboss.ws.metadata.jsr181.HandlerChainMetaData;
-
-
-/**
- * A JBossWS handler chains configuration
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 18-Dec-2005
- */
-public class WSHandlerChainsConfigJAXWS
-{
- private List<HandlerChainMetaData> chains = new
ArrayList<HandlerChainMetaData>();
-
- public WSHandlerChainsConfigJAXWS()
- {
- }
-
- public List<HandlerChainMetaData> getHandlerChains()
- {
- return chains;
- }
-}
Copied:
trunk/src/main/java/org/jboss/ws/metadata/config/jaxws/WSHandlerChainsConfigJAXWS.java
(from rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/config/jaxws/WSHandlerChainsConfigJAXWS.java)
Copied: trunk/src/main/java/org/jboss/ws/metadata/j2ee (from rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/j2ee)
Deleted: trunk/src/main/java/org/jboss/ws/metadata/j2ee/UnifiedApplicationMetaData.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/j2ee/UnifiedApplicationMetaData.java 2006-12-07
10:43:36 UTC (rev 1600)
+++
trunk/src/main/java/org/jboss/ws/metadata/j2ee/UnifiedApplicationMetaData.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -1,131 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.ws.metadata.j2ee;
-
-//$Id$
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-/**
- * The container independent top level meta data from the jboss.xml and ejb-jar.xml
descriptor.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 05-May-2006
- */
-public class UnifiedApplicationMetaData
-{
- /** ArrayList<BeanMetaData> for the ejbs */
- private List<UnifiedBeanMetaData> beans = new
ArrayList<UnifiedBeanMetaData>();
- /** The optional JBossWS config-name */
- private String configName;
- /** The optional JBossWS config-file */
- private String configFile;
- /** The web context root to use for web services */
- private String webServiceContextRoot;
- /** The security-domain value assigned to the application */
- private String securityDomain;
- /** A HashMap<String, String> for webservice description publish locations */
- private PublishLocationAdapter publishLocationAdapter;
-
- public UnifiedBeanMetaData getBeanByEjbName(String ejbName)
- {
- for (UnifiedBeanMetaData beanMetaData : beans)
- {
- if (beanMetaData.getEjbName().equals(ejbName))
- {
- return beanMetaData;
- }
- }
- return null;
- }
-
- public Iterator<UnifiedBeanMetaData> getEnterpriseBeans()
- {
- return beans.iterator();
- }
-
- public void setEnterpriseBeans(List<UnifiedBeanMetaData> beans)
- {
- this.beans = beans;
- }
-
- public String getConfigName()
- {
- return configName;
- }
-
- public void setConfigName(String configName)
- {
- this.configName = configName;
- }
-
- public String getConfigFile()
- {
- return configFile;
- }
-
- public void setConfigFile(String configFile)
- {
- this.configFile = configFile;
- }
-
- public String getWebServiceContextRoot()
- {
- return webServiceContextRoot;
- }
-
- public void setWebServiceContextRoot(String contextRoot)
- {
- this.webServiceContextRoot = contextRoot;
- }
-
- public String getSecurityDomain()
- {
- return securityDomain;
- }
-
- public void setSecurityDomain(String securityDomain)
- {
- this.securityDomain = securityDomain;
- }
-
- public void setPublishLocationAdapter(PublishLocationAdapter publishLocationAdapter)
- {
- this.publishLocationAdapter = publishLocationAdapter;
- }
-
- public String getWsdlPublishLocationByName(String name)
- {
- String publishLocation = null;
- if (publishLocationAdapter != null)
- publishLocation = publishLocationAdapter.getWsdlPublishLocationByName(name);
- return publishLocation;
-
- }
-
- public interface PublishLocationAdapter
- {
- String getWsdlPublishLocationByName(String name);
- }
-}
Copied: trunk/src/main/java/org/jboss/ws/metadata/j2ee/UnifiedApplicationMetaData.java
(from rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/j2ee/UnifiedApplicationMetaData.java)
Deleted: trunk/src/main/java/org/jboss/ws/metadata/j2ee/UnifiedBeanMetaData.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/j2ee/UnifiedBeanMetaData.java 2006-12-07
10:43:36 UTC (rev 1600)
+++ trunk/src/main/java/org/jboss/ws/metadata/j2ee/UnifiedBeanMetaData.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -1,138 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.ws.metadata.j2ee;
-
-//$Id$
-
-/**
- * The container independent common meta data class for the entity, message-driven and
session beans.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 05-May-2006
- */
-public class UnifiedBeanMetaData
-{
- /** The ejb-name element specifies an enterprise bean's name. */
- private String ejbName;
- /** The ejb-class element contains the fully-qualified name of the enterprise
bean's class. */
- private String ejbClass;
- /** The home element contains the fully-qualified name of the enterprise
- bean's home interface. */
- private String homeClass;
- /** The local-home element contains the fully-qualified name of the
- enterprise bean's local home interface. */
- private String localHomeClass;
- /** The service-endpoint element contains the fully-qualified name of the beans
service endpoint interface (SEI) */
- protected String seiName;
- /** The JNDI name under with the home interface should be bound */
- private String jndiName;
- /** The JNDI name under with the local home interface should be bound */
- private String localJndiName;
- /** The jboss port-component binding for a ejb webservice */
- protected UnifiedEjbPortComponentMetaData portComponent;
-
- public String getEjbName()
- {
- return ejbName;
- }
-
- public void setEjbName(String ejbName)
- {
- this.ejbName = ejbName;
- }
-
- public String getEjbClass()
- {
- return ejbClass;
- }
-
- public void setEjbClass(String ejbClass)
- {
- this.ejbClass = ejbClass;
- }
-
- public UnifiedEjbPortComponentMetaData getPortComponent()
- {
- return portComponent;
- }
-
- public void setPortComponent(UnifiedEjbPortComponentMetaData portComponent)
- {
- this.portComponent = portComponent;
- }
-
- public String getServiceEndpoint()
- {
- return seiName;
- }
-
- public void setServiceEndpoint(String seiName)
- {
- this.seiName = seiName;
- }
-
- public String getContainerObjectNameJndiName()
- {
- return getHome() != null ? getJndiName() : getLocalJndiName();
- }
-
- public String getHome()
- {
- return homeClass;
- }
-
- public void setHome(String homeClass)
- {
- this.homeClass = homeClass;
- }
-
- public String getJndiName()
- {
- return jndiName;
- }
-
- public void setJndiName(String jndiName)
- {
- this.jndiName = jndiName;
- }
-
- public String getLocalHome()
- {
- return localHomeClass;
- }
-
- public void setLocalHome(String localHomeClass)
- {
- this.localHomeClass = localHomeClass;
- }
-
- public String getLocalJndiName()
- {
- return localJndiName;
- }
-
- public void setLocalJndiName(String localJndiName)
- {
- this.localJndiName = localJndiName;
- }
-
-}
Copied: trunk/src/main/java/org/jboss/ws/metadata/j2ee/UnifiedBeanMetaData.java (from rev
1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/j2ee/UnifiedBeanMetaData.java)
Deleted:
trunk/src/main/java/org/jboss/ws/metadata/j2ee/UnifiedEjbPortComponentMetaData.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/j2ee/UnifiedEjbPortComponentMetaData.java 2006-12-07
10:43:36 UTC (rev 1600)
+++
trunk/src/main/java/org/jboss/ws/metadata/j2ee/UnifiedEjbPortComponentMetaData.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -1,90 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.ws.metadata.j2ee;
-
-
-//$Id$
-
-
-/**
- * The container independent metadata for session/port-component element from jboss.xml
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 05-May-2006
- */
-public class UnifiedEjbPortComponentMetaData
-{
- private String portComponentName;
- private String portComponentURI;
- private String authMethod;
- private String transportGuarantee;
-
- public String getPortComponentName()
- {
- return portComponentName;
- }
-
- public void setPortComponentName(String portComponentName)
- {
- this.portComponentName = portComponentName;
- }
-
- public String getPortComponentURI()
- {
- return portComponentURI;
- }
-
- public void setPortComponentURI(String portComponentURI)
- {
- this.portComponentURI = portComponentURI;
- }
-
- public String getURLPattern()
- {
- String pattern = "/*";
- if (portComponentURI != null)
- {
- return portComponentURI;
- }
- return pattern;
- }
-
- 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;
- }
-}
Copied:
trunk/src/main/java/org/jboss/ws/metadata/j2ee/UnifiedEjbPortComponentMetaData.java (from
rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/j2ee/UnifiedEjbPortComponentMetaData.java)
Deleted: trunk/src/main/java/org/jboss/ws/metadata/j2ee/UnifiedHandlerMetaData.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/j2ee/UnifiedHandlerMetaData.java 2006-12-07
10:43:36 UTC (rev 1600)
+++ trunk/src/main/java/org/jboss/ws/metadata/j2ee/UnifiedHandlerMetaData.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -1,183 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.ws.metadata.j2ee;
-
-//$Id$
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import javax.xml.namespace.QName;
-
-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.HandlerMetaDataJAXWS;
-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
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 05-May-2006
- */
-public class UnifiedHandlerMetaData implements Serializable
-{
- private static final long serialVersionUID = -3019416564080333900L;
-
- private HandlerChainMetaData chainConfig;
-
- // The required <handler-name> element
- private String handlerName;
- // The required <handler-class> element
- private String handlerClass;
- // The optional <init-param> elements
- private ArrayList<HandlerInitParam> initParams = new
ArrayList<HandlerInitParam>();
- // The optional <soap-header> elements
- private Set<QName> soapHeaders = new HashSet<QName>();
- // 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 UnifiedHandlerMetaData(HandlerChainMetaData handlerChainMetaData)
- {
- this.chainConfig = handlerChainMetaData;
- }
-
- public void setHandlerName(String value)
- {
- this.handlerName = value;
- }
-
- public String getHandlerName()
- {
- return handlerName;
- }
-
- public void setHandlerClass(String handlerClass)
- {
- this.handlerClass = handlerClass;
- }
-
- public String getHandlerClass()
- {
- return handlerClass;
- }
-
- public void addInitParam(HandlerInitParam param)
- {
- initParams.add(param);
- }
-
- public List<HandlerInitParam> getInitParams()
- {
- return initParams;
- }
-
- public void addSoapRole(String value)
- {
- soapRoles.add(value);
- }
-
- public Set<String> getSoapRoles()
- {
- return soapRoles;
- }
-
- public void addSoapHeader(QName qName)
- {
- soapHeaders.add(qName);
- }
-
- public Set<QName> getSoapHeaders()
- {
- return soapHeaders;
- }
-
- public String getProtocolBindings()
- {
- return (chainConfig != null ? chainConfig.getProtocolBindings() : null);
- }
-
- public QName getServiceNamePattern()
- {
- return (chainConfig != null ? chainConfig.getServiceNamePattern() : null);
- }
-
- public QName getPortNamePattern()
- {
- return (chainConfig != null ? chainConfig.getPortNamePattern() : null);
- }
-
- public void addPortName(String portName)
- {
- portNames.add(portName);
- }
-
- public Set<String> getPortNames()
- {
- return portNames;
- }
-
- public HandlerMetaDataJAXRPC getHandlerMetaDataJAXRPC (EndpointMetaData epMetaData,
HandlerType type)
- {
- HandlerMetaDataJAXRPC hmd = new HandlerMetaDataJAXRPC(epMetaData, type);
- hmd.setHandlerName(getHandlerName());
- hmd.setHandlerClassName(getHandlerClass());
- hmd.seiInitParams(getInitParams());
- hmd.setSoapHeaders(getSoapHeaders());
- hmd.setSoapRoles(getSoapRoles());
- hmd.setPortNames(getPortNames());
- return hmd;
- }
-
- public HandlerMetaDataJAXWS getHandlerMetaDataJAXWS (EndpointMetaData epMetaData,
HandlerType type)
- {
- HandlerMetaDataJAXWS hmd = new HandlerMetaDataJAXWS(epMetaData, type);
- hmd.setHandlerName(getHandlerName());
- hmd.setHandlerClassName(getHandlerClass());
- hmd.seiInitParams(getInitParams());
- hmd.setProtocolBindings(getProtocolBindings());
- hmd.setServiceNamePattern(getServiceNamePattern());
- hmd.setPortNamePattern(getPortNamePattern());
- return hmd;
- }
-
- public String toString()
- {
- StringBuffer buffer = new StringBuffer("\nUnifiedHandlerMetaData:");
- buffer.append("\n name=" + getHandlerName());
- buffer.append("\n class=" + getHandlerClass());
- buffer.append("\n params=" + getInitParams());
- buffer.append("\n headers=" + getSoapHeaders());
- buffer.append("\n roles=" + getSoapRoles());
- buffer.append("\n protocols=" + getProtocolBindings());
- buffer.append("\n services=" + getServiceNamePattern());
- buffer.append("\n ports=" + (getPortNamePattern() != null ?
getPortNamePattern() : portNames));
- return buffer.toString();
- }
-}
Copied: trunk/src/main/java/org/jboss/ws/metadata/j2ee/UnifiedHandlerMetaData.java (from
rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/j2ee/UnifiedHandlerMetaData.java)
Deleted: trunk/src/main/java/org/jboss/ws/metadata/j2ee/UnifiedMessageDrivenMetaData.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/j2ee/UnifiedMessageDrivenMetaData.java 2006-12-07
10:43:36 UTC (rev 1600)
+++
trunk/src/main/java/org/jboss/ws/metadata/j2ee/UnifiedMessageDrivenMetaData.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -1,47 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.ws.metadata.j2ee;
-
-
-// $Id$
-
-
-/**
- * The container independent metadata of a message driven bean.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 05-May-2006
- */
-public class UnifiedMessageDrivenMetaData extends UnifiedBeanMetaData
-{
- private String destinationJndiName;
-
- public String getDestinationJndiName()
- {
- return destinationJndiName;
- }
-
- public void setDestinationJndiName(String destinationJndiName)
- {
- this.destinationJndiName = destinationJndiName;
- }
-}
Copied: trunk/src/main/java/org/jboss/ws/metadata/j2ee/UnifiedMessageDrivenMetaData.java
(from rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/j2ee/UnifiedMessageDrivenMetaData.java)
Deleted:
trunk/src/main/java/org/jboss/ws/metadata/j2ee/UnifiedPortComponentRefMetaData.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/j2ee/UnifiedPortComponentRefMetaData.java 2006-12-07
10:43:36 UTC (rev 1600)
+++
trunk/src/main/java/org/jboss/ws/metadata/j2ee/UnifiedPortComponentRefMetaData.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -1,77 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.ws.metadata.j2ee;
-
-import java.io.Serializable;
-import java.util.Properties;
-
-//$Id$
-
-/**
- * The container independent metdata data from handler init params
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 05-May-2006
- */
-public class UnifiedPortComponentRefMetaData implements Serializable
-{
- private static final long serialVersionUID = -7030007637678646740L;
-
- // The required <service-endpoint-interface> element
- private String serviceEndpointInterface;
- // The optional <port-component-link> element
- private String portComponentLink;
-
- /** Arbitrary proxy properties given by <call-property> */
- private Properties callProperties;
-
- public String getPortComponentLink()
- {
- return portComponentLink;
- }
-
- public void setPortComponentLink(String portComponentLink)
- {
- this.portComponentLink = portComponentLink;
- }
-
- public String getServiceEndpointInterface()
- {
- return serviceEndpointInterface;
- }
-
- public void setServiceEndpointInterface(String serviceEndpointInterface)
- {
- this.serviceEndpointInterface = serviceEndpointInterface;
- }
-
- public Properties getCallProperties()
- {
- return callProperties;
- }
-
- public void setCallProperties(Properties callProperties)
- {
- this.callProperties = callProperties;
- }
-
-}
Copied:
trunk/src/main/java/org/jboss/ws/metadata/j2ee/UnifiedPortComponentRefMetaData.java (from
rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/j2ee/UnifiedPortComponentRefMetaData.java)
Deleted: trunk/src/main/java/org/jboss/ws/metadata/j2ee/UnifiedServiceRefMetaData.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/j2ee/UnifiedServiceRefMetaData.java 2006-12-07
10:43:36 UTC (rev 1600)
+++
trunk/src/main/java/org/jboss/ws/metadata/j2ee/UnifiedServiceRefMetaData.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -1,258 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.ws.metadata.j2ee;
-
-//$Id$
-
-import java.io.Serializable;
-import java.net.URL;
-import java.net.URLClassLoader;
-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;
-
-
-/**
- * The container independent metdata data from service-ref element in web.xml,
ejb-jar.xml, and
- * application-client.xml.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 05-May-2006
- */
-public class UnifiedServiceRefMetaData implements Serializable
-{
- private static final long serialVersionUID = 122554634182144069L;
-
- // The required <service-ref-name> element
- private String serviceRefName;
- // The required <service-interface> element
- private String serviceInterface;
- // The optional <wsdl-file> element
- private String wsdlFile;
- // The optional <jaxrpc-mapping-file> element
- private String jaxrpcMappingFile;
- // The optional <service-qname> element
- private QName serviceQName;
- // The LinkedHashMap<String, UnifiedPortComponentRefMetaData> for
<port-component-ref> elements
- private Map<String, UnifiedPortComponentRefMetaData> portComponentRefs = new
LinkedHashMap<String, UnifiedPortComponentRefMetaData>();
- // The optional <handler> elements
- private List<UnifiedHandlerMetaData> handlers = new
ArrayList<UnifiedHandlerMetaData>();
-
- // The optional JBossWS config-name
- private String configName;
- // The optional JBossWS config-file
- private String configFile;
- /** The URL of the actual WSDL to use, <wsdl-override> */
- private URL wsdlOverride;
- /** Arbitrary proxy properties given by <call-property> */
- private Properties callProperties;
-
- // The wsdl definition, if we have one
- private Object wsdlDefinition;
- // The java/wsdl mapping, if we have one
- private Object javaWsdlMapping;
-
- //The ClassLoader to load additional resources
- private transient URLClassLoader resourceCL;
-
- /** Set the resource classloader that can load the wsdl file
- * On the client side this is set expicitly after unmarshalling.
- */
- public void setResourceCL(URLClassLoader resourceCL)
- {
- if (resourceCL == null)
- throw new IllegalArgumentException("ResourceClassLoader cannot be
null");
-
- this.resourceCL = resourceCL;
- }
-
- public URLClassLoader getResourceCL()
- {
- if (resourceCL == null)
- resourceCL = new URLClassLoader(new URL[] {},
Thread.currentThread().getContextClassLoader());
-
- return resourceCL;
- }
-
- public String getJaxrpcMappingFile()
- {
- return jaxrpcMappingFile;
- }
-
- public void setJaxrpcMappingFile(String jaxrpcMappingFile)
- {
- this.jaxrpcMappingFile = jaxrpcMappingFile;
- }
-
- public URL getJavaWsdlMappingURL()
- {
- URL mappingURL = null;
- if (jaxrpcMappingFile != null)
- {
- mappingURL = getResourceCL().findResource(jaxrpcMappingFile);
- if (mappingURL == null)
- throw new IllegalStateException("Cannot find resource: " +
jaxrpcMappingFile);
- }
- return mappingURL;
- }
-
- public Object getJavaWsdlMapping()
- {
- return javaWsdlMapping;
- }
-
- public void setJavaWsdlMapping(Object javaWsdlMapping)
- {
- this.javaWsdlMapping = javaWsdlMapping;
- }
-
- public UnifiedPortComponentRefMetaData[] getPortComponentRefs()
- {
- UnifiedPortComponentRefMetaData[] array = new
UnifiedPortComponentRefMetaData[portComponentRefs.size()];
- portComponentRefs.values().toArray(array);
- return array;
- }
-
- public void setPortComponentRefs(LinkedHashMap<String,
UnifiedPortComponentRefMetaData> portComponentRefs)
- {
- this.portComponentRefs = portComponentRefs;
- }
-
- public UnifiedHandlerMetaData[] getHandlers()
- {
- UnifiedHandlerMetaData[] array = new UnifiedHandlerMetaData[handlers.size()];
- handlers.toArray(array);
- return array;
- }
-
- public void setHandlers(ArrayList<UnifiedHandlerMetaData> handlers)
- {
- this.handlers = handlers;
- }
-
- public String getServiceInterface()
- {
- return serviceInterface;
- }
-
- public void setServiceInterface(String serviceInterface)
- {
- this.serviceInterface = serviceInterface;
- }
-
- public QName getServiceQName()
- {
- return serviceQName;
- }
-
- public void setServiceQName(QName serviceQName)
- {
- this.serviceQName = serviceQName;
- }
-
- public String getServiceRefName()
- {
- return serviceRefName;
- }
-
- public void setServiceRefName(String serviceRefName)
- {
- this.serviceRefName = serviceRefName;
- }
-
- public String getWsdlFile()
- {
- return wsdlFile;
- }
-
- public void setWsdlFile(String wsdlFile)
- {
- this.wsdlFile = wsdlFile;
- }
-
- public String getConfigFile()
- {
- return configFile;
- }
-
- public void setConfigFile(String configFile)
- {
- this.configFile = configFile;
- }
-
- public String getConfigName()
- {
- return configName;
- }
-
- public void setConfigName(String configName)
- {
- this.configName = configName;
- }
-
- public URL getWsdlOverride()
- {
- return wsdlOverride;
- }
-
-
- public void setWsdlOverride(URL wsdlOverride)
- {
- this.wsdlOverride = wsdlOverride;
- }
-
- public URL getWsdlURL()
- {
- URL wsdlURL = wsdlOverride;
- if (wsdlURL == null && wsdlFile != null)
- {
- wsdlURL = getResourceCL().findResource(wsdlFile);
- if (wsdlURL == null)
- throw new IllegalStateException("Cannot find resource: " +
wsdlFile);
- }
- return wsdlURL;
- }
-
- public Properties getCallProperties()
- {
- return callProperties;
- }
-
- public void setCallProperties(Properties callProperties)
- {
- this.callProperties = callProperties;
- }
-
- public Object getWsdlDefinition()
- {
- return wsdlDefinition;
- }
-
- public void setWsdlDefinition(Object wsdlDefinition)
- {
- this.wsdlDefinition = wsdlDefinition;
- }
-}
Copied: trunk/src/main/java/org/jboss/ws/metadata/j2ee/UnifiedServiceRefMetaData.java
(from rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/j2ee/UnifiedServiceRefMetaData.java)
Deleted: trunk/src/main/java/org/jboss/ws/metadata/j2ee/UnifiedSessionMetaData.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/j2ee/UnifiedSessionMetaData.java 2006-12-07
10:43:36 UTC (rev 1600)
+++ trunk/src/main/java/org/jboss/ws/metadata/j2ee/UnifiedSessionMetaData.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -1,37 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.ws.metadata.j2ee;
-
-
-// $Id$
-
-
-/**
- * The container independent metadata of a message driven bean.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 05-May-2006
- */
-public class UnifiedSessionMetaData extends UnifiedBeanMetaData
-{
-
-}
Copied: trunk/src/main/java/org/jboss/ws/metadata/j2ee/UnifiedSessionMetaData.java (from
rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/j2ee/UnifiedSessionMetaData.java)
Deleted: trunk/src/main/java/org/jboss/ws/metadata/j2ee/UnifiedWebMetaData.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/j2ee/UnifiedWebMetaData.java 2006-12-07
10:43:36 UTC (rev 1600)
+++ trunk/src/main/java/org/jboss/ws/metadata/j2ee/UnifiedWebMetaData.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -1,143 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.ws.metadata.j2ee;
-
-//$Id$
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * The container independent representation of the web.xml and jboss-web.xml deployment
descriptors
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 05-May-2006
- */
-public class UnifiedWebMetaData
-{
- /** The war context root as specified at the jboss-web.xml descriptor level. */
- private String contextRoot;
- /** The servlet-mapping <servlet-name, url-pattern> */
- private Map<String, String> servletMappings = new HashMap<String,
String>();
- /** The servlet <servlet-name, servlet-class> */
- private Map<String, String> servletClassNames = new HashMap<String,
String>();
- /** The optional JBossWS config-name */
- private String configName;
- /** The optional JBossWS config-file */
- private String configFile;
- /** The security-domain value assigned to the application */
- private String securityDomain;
- /** A HashMap<String, String> for webservice description publish locations */
- private PublishLocationAdapter publishLocationAdapter;
- /** web.xml security-constraints */
- private List<UnifiedWebSecurityMetaData> securityMetaData;
-
- public String getContextRoot()
- {
- return contextRoot;
- }
-
- public void setContextRoot(String contextRoot)
- {
- this.contextRoot = contextRoot;
- }
-
- public Map<String, String> getServletMappings()
- {
- return servletMappings;
- }
-
- public void setServletMappings(Map<String, String> servletMappings)
- {
- this.servletMappings = servletMappings;
- }
-
- public Map<String, String> getServletClassNames()
- {
- return servletClassNames;
- }
-
- public void setServletClassNames(Map<String, String> servletClassNames)
- {
- this.servletClassNames = servletClassNames;
- }
-
- public String getConfigName()
- {
- return configName;
- }
-
- public void setConfigName(String configName)
- {
- this.configName = configName;
- }
-
- public String getConfigFile()
- {
- return configFile;
- }
-
- public void setConfigFile(String configFile)
- {
- this.configFile = configFile;
- }
-
- public String getSecurityDomain()
- {
- return securityDomain;
- }
-
- public void setSecurityDomain(String securityDomain)
- {
- this.securityDomain = securityDomain;
- }
-
- public List<UnifiedWebSecurityMetaData> getSecurityMetaData()
- {
- return securityMetaData;
- }
-
- public void setSecurityMetaData(List<UnifiedWebSecurityMetaData>
securityMetaData)
- {
- this.securityMetaData = securityMetaData;
- }
-
- public void setPublishLocationAdapter(PublishLocationAdapter publishLocationAdapter)
- {
- this.publishLocationAdapter = publishLocationAdapter;
- }
-
- public String getWsdlPublishLocationByName(String name)
- {
- String publishLocation = null;
- if (publishLocationAdapter != null)
- publishLocation = publishLocationAdapter.getWsdlPublishLocationByName(name);
- return publishLocation;
-
- }
-
- public interface PublishLocationAdapter
- {
- String getWsdlPublishLocationByName(String name);
- }
-}
Copied: trunk/src/main/java/org/jboss/ws/metadata/j2ee/UnifiedWebMetaData.java (from rev
1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/j2ee/UnifiedWebMetaData.java)
Deleted: trunk/src/main/java/org/jboss/ws/metadata/j2ee/UnifiedWebSecurityMetaData.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/j2ee/UnifiedWebSecurityMetaData.java 2006-12-07
10:43:36 UTC (rev 1600)
+++
trunk/src/main/java/org/jboss/ws/metadata/j2ee/UnifiedWebSecurityMetaData.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -1,95 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.ws.metadata.j2ee;
-
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-
-/**
- *
- * @author darran.lofthouse(a)jboss.com
- * @since Oct 22, 2006
- */
-public class UnifiedWebSecurityMetaData
-{
-
- /** The optional security-constraint/user-data-constraint/transport-guarantee */
- private String transportGuarantee;
-
- /**
- * The HashMap for the security-constraint/web-resource-collection
- * elements.
- */
- private HashMap<String, UnifiedWebResourceCollection> webResources = new
HashMap<String, UnifiedWebResourceCollection>();
-
- public UnifiedWebResourceCollection addWebResource(final String name)
- {
- UnifiedWebResourceCollection wrc = new UnifiedWebResourceCollection(name);
- webResources.put(name, wrc);
-
- return wrc;
- }
-
- public Collection<UnifiedWebResourceCollection> getWebResources()
- {
- return webResources.values();
- }
-
- public String getTransportGuarantee()
- {
- return transportGuarantee;
- }
-
- public void setTransportGuarantee(String transportGuarantee)
- {
- this.transportGuarantee = transportGuarantee;
- }
-
- public static class UnifiedWebResourceCollection
- {
- private String name;
- /** The required url-pattern element(s) */
- private HashSet<String> urlPatterns = new HashSet<String>();
-
- public UnifiedWebResourceCollection(final String name)
- {
- this.name = name;
- }
-
- public String getName()
- {
- return name;
- }
-
- public void addPattern(String pattern)
- {
- urlPatterns.add(pattern);
- }
-
- public HashSet<String> getUrlPatterns()
- {
- return urlPatterns;
- }
- }
-
-}
Copied: trunk/src/main/java/org/jboss/ws/metadata/j2ee/UnifiedWebSecurityMetaData.java
(from rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/j2ee/UnifiedWebSecurityMetaData.java)
Copied: trunk/src/main/java/org/jboss/ws/metadata/jaxrpcmapping (from rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/jaxrpcmapping)
Deleted: trunk/src/main/java/org/jboss/ws/metadata/jaxrpcmapping/ExceptionMapping.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/jaxrpcmapping/ExceptionMapping.java 2006-12-07
10:43:36 UTC (rev 1600)
+++
trunk/src/main/java/org/jboss/ws/metadata/jaxrpcmapping/ExceptionMapping.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -1,113 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
-*/
-package org.jboss.ws.metadata.jaxrpcmapping;
-
-// $Id$
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Iterator;
-
-import javax.xml.namespace.QName;
-
-/**
- * XML mapping of the java-wsdl-mapping/exception-mapping element.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 14-May-2004
- */
-public class ExceptionMapping implements Serializable
-{
- private static final long serialVersionUID = 2964098233936811614L;
-
- // The parent <java-wsdl-mapping> element
- private JavaWsdlMapping javaWsdlMapping;
-
- // The required <exception-type> element
- private String exceptionType;
- // The required <wsdl-message> element
- private QName wsdlMessage;
- // The optional <constructor-parameter-order> element
- private ArrayList constructorParameterOrder = new ArrayList();
-
- public ExceptionMapping(JavaWsdlMapping javaWsdlMapping)
- {
- this.javaWsdlMapping = javaWsdlMapping;
- }
-
- public JavaWsdlMapping getJavaWsdlMapping()
- {
- return javaWsdlMapping;
- }
-
- public String getExceptionType()
- {
- return exceptionType;
- }
-
- public void setExceptionType(String exceptionType)
- {
- this.exceptionType = exceptionType;
- }
-
- public QName getWsdlMessage()
- {
- return wsdlMessage;
- }
-
- public void setWsdlMessage(QName wsdlMessage)
- {
- this.wsdlMessage = wsdlMessage;
- }
-
- public String[] getConstructorParameterOrder()
- {
- String[] arr = new String[constructorParameterOrder.size()];
- constructorParameterOrder.toArray(arr);
- return arr;
- }
-
- public void addConstructorParameter(String elementName)
- {
- constructorParameterOrder.add(elementName);
- }
-
- public String serialize()
- {
- StringBuffer sb = new StringBuffer();
- sb.append("<exception-mapping>");
-
sb.append("<exception-type>").append(exceptionType).append("</exception-type>");
- sb.append("<wsdl-message
xmlns:exMsgNS='").append(wsdlMessage.getNamespaceURI()).append("'>");
-
sb.append("exMsgNS").append(":").append(wsdlMessage.getLocalPart());
- sb.append("</wsdl-message>");
-
- if (constructorParameterOrder.size() > 0)
- {
- sb.append("<constructor-parameter-order>");
- for (Iterator i = constructorParameterOrder.iterator(); i.hasNext();)
-
sb.append("<element-name>").append(i.next()).append("</element-name>");
- sb.append("</constructor-parameter-order>");
- }
- sb.append("</exception-mapping>");
- return sb.toString();
- }
-}
\ No newline at end of file
Copied: trunk/src/main/java/org/jboss/ws/metadata/jaxrpcmapping/ExceptionMapping.java
(from rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/jaxrpcmapping/ExceptionMapping.java)
Deleted: trunk/src/main/java/org/jboss/ws/metadata/jaxrpcmapping/JavaWsdlMapping.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/jaxrpcmapping/JavaWsdlMapping.java 2006-12-07
10:43:36 UTC (rev 1600)
+++
trunk/src/main/java/org/jboss/ws/metadata/jaxrpcmapping/JavaWsdlMapping.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -1,317 +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.jaxrpcmapping;
-
-// $Id$
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import javax.xml.namespace.QName;
-
-import org.jboss.logging.Logger;
-
-/**
- * XML mapping of the java-wsdl-mapping root element in jaxrpc-mapping.xml
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 14-May-2004
- */
-public class JavaWsdlMapping implements Serializable
-{
- private static final long serialVersionUID = -142671631068024054L;
-
- // provide logging
- private static Logger log = Logger.getLogger(JavaWsdlMapping.class);
-
- // One or more <package-mapping> elements
- private List packageMappings = new ArrayList();
- // Zero or more <java-xml-type-mapping> elements
- private List javaXmlTypeMappings = new ArrayList();
- // Zero or more <exception-mapping> elements
- private List exceptionMappings = new ArrayList();
- // Zero or more <service-interface-mapping> elements
- private List serviceInterfaceMappings = new ArrayList();
- // Zero or more <service-endpoint-interface-mapping> elements
- private List serviceEndpointInterfaceMappings = new ArrayList();
-
- public PackageMapping[] getPackageMappings()
- {
- PackageMapping[] arr = new PackageMapping[packageMappings.size()];
- packageMappings.toArray(arr);
- return arr;
- }
-
- public JavaXmlTypeMapping[] getJavaXmlTypeMappings()
- {
- JavaXmlTypeMapping[] arr = new JavaXmlTypeMapping[javaXmlTypeMappings.size()];
- javaXmlTypeMappings.toArray(arr);
- return arr;
- }
-
- public ExceptionMapping[] getExceptionMappings()
- {
- ExceptionMapping[] arr = new ExceptionMapping[exceptionMappings.size()];
- exceptionMappings.toArray(arr);
- return arr;
- }
-
- public ServiceInterfaceMapping[] getServiceInterfaceMappings()
- {
- ServiceInterfaceMapping[] arr = new
ServiceInterfaceMapping[serviceInterfaceMappings.size()];
- serviceInterfaceMappings.toArray(arr);
- return arr;
- }
-
- public ServiceEndpointInterfaceMapping[] getServiceEndpointInterfaceMappings()
- {
- ServiceEndpointInterfaceMapping[] arr = new
ServiceEndpointInterfaceMapping[serviceEndpointInterfaceMappings.size()];
- serviceEndpointInterfaceMappings.toArray(arr);
- return arr;
- }
-
- // convenience methods
********************************************************************
-
- /** Get the package string for a given URI
- */
- public String getPackageNameForNamespaceURI(String nsURI)
- {
- String packageStr = null;
- for (int i = 0; packageStr == null && i < packageMappings.size(); i++)
- {
- PackageMapping mapping = (PackageMapping)packageMappings.get(i);
- if (mapping.getNamespaceURI().equals(nsURI))
- packageStr = mapping.getPackageType();
- }
- return packageStr;
- }
-
- /** Get the type mapping fo a given root-type-qname
- */
- public JavaXmlTypeMapping getTypeMappingForQName(QName xmlType)
- {
- JavaXmlTypeMapping typeMapping = null;
-
- if (xmlType != null)
- {
- // Check the <root-type-qname>
- Iterator it = javaXmlTypeMappings.iterator();
- while (typeMapping == null && it.hasNext())
- {
- JavaXmlTypeMapping mapping = (JavaXmlTypeMapping)it.next();
- if (xmlType.equals(mapping.getRootTypeQName()))
- typeMapping = mapping;
- }
-
- // Check the <anonymous-type-qname>
- it = javaXmlTypeMappings.iterator();
- while (typeMapping == null && it.hasNext())
- {
- JavaXmlTypeMapping mapping = (JavaXmlTypeMapping)it.next();
- QName anonymousQName = mapping.getAnonymousTypeQName();
- if (anonymousQName != null)
- {
- if (xmlType.getNamespaceURI().equals(anonymousQName.getNamespaceURI()))
- {
- String localPart = xmlType.getLocalPart();
- if (anonymousQName.getLocalPart().equals(localPart))
- typeMapping = mapping;
- if (anonymousQName.getLocalPart().equals(">" +
localPart))
- typeMapping = mapping;
- }
- }
- }
-
- if (typeMapping == null)
- log.warn("Cannot find jaxrpc-mapping for type: " + xmlType);
- }
-
- return typeMapping;
- }
-
- /** Get the exception mapping fo a given wsdl message
- */
- public ExceptionMapping getExceptionMappingForMessageQName(QName wsdlMessage)
- {
- ExceptionMapping exMapping = null;
-
- if (wsdlMessage != null)
- {
- Iterator it = exceptionMappings.iterator();
- while (it.hasNext())
- {
- ExceptionMapping mapping = (ExceptionMapping)it.next();
- if (wsdlMessage.equals(mapping.getWsdlMessage()))
- exMapping = mapping;
- }
- }
-
- return exMapping;
- }
-
- /** Get the exception mapping fo a given exception type
- */
- public ExceptionMapping getExceptionMappingForExceptionType(String javaType)
- {
- ExceptionMapping exMapping = null;
-
- if (javaType != null)
- {
- Iterator it = exceptionMappings.iterator();
- while (it.hasNext())
- {
- ExceptionMapping mapping = (ExceptionMapping)it.next();
- if (javaType.equals(mapping.getExceptionType()))
- exMapping = mapping;
- }
- }
-
- return exMapping;
- }
-
- /** Get the port type qname for a given service endpoint infterface
- */
- public QName getPortTypeQNameForServiceEndpointInterface(String seiName)
- {
- QName portTypeQName = null;
-
- ServiceEndpointInterfaceMapping[] seiMappings =
getServiceEndpointInterfaceMappings();
- for (int i = 0; i < seiMappings.length; i++)
- {
- ServiceEndpointInterfaceMapping aux = seiMappings[i];
- if (aux.getServiceEndpointInterface().equals(seiName))
- portTypeQName = aux.getWsdlPortType();
- }
-
- return portTypeQName;
- }
-
- /** Get the service endpoint infterfacemapping for a given port type qname
- */
- public ServiceEndpointInterfaceMapping
getServiceEndpointInterfaceMappingByPortType(QName portType)
- {
- ServiceEndpointInterfaceMapping seiMapping = null;
-
- ServiceEndpointInterfaceMapping[] seiMappings =
getServiceEndpointInterfaceMappings();
- for (int i = 0; seiMapping == null && i < seiMappings.length; i++)
- {
- ServiceEndpointInterfaceMapping aux = seiMappings[i];
- if (aux.getWsdlPortType().equals(portType))
- seiMapping = aux;
- }
-
- return seiMapping;
- }
-
- /** Get the service endpoint infterface mapping for a service endpoint infterface
- */
- public ServiceEndpointInterfaceMapping getServiceEndpointInterfaceMapping(String
seiName)
- {
- ServiceEndpointInterfaceMapping seiMapping = null;
-
- ServiceEndpointInterfaceMapping[] seiMappings =
getServiceEndpointInterfaceMappings();
- for (int i = 0; seiMapping == null && i < seiMappings.length; i++)
- {
- ServiceEndpointInterfaceMapping aux = seiMappings[i];
- if (aux.getServiceEndpointInterface().equals(seiName))
- seiMapping = aux;
- }
-
- return seiMapping;
- }
-
- /**
- * Serialize the model as a String (Should return the mapping file)
- *
- * @return
- */
- public String serialize()
- {
- StringBuffer sb = new StringBuffer();
- //Append Standard Namespace Header
- sb.append("<java-wsdl-mapping version='1.1'
").append("xmlns='http://java.sun.com/xml/ns/j2ee' ");
-
sb.append("xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance&...
");
-
sb.append("xsi:schemaLocation='http://java.sun.com/xml/ns/j2ee ");
-
sb.append("http://www.ibm.com/webservices/xsd/j2ee_jaxrpc_mapping_1_...;
-
- Iterator piter = packageMappings.iterator();
- while (piter != null && piter.hasNext())
- sb.append(((PackageMapping)piter.next()).serialize());
-
- Iterator jxiter = javaXmlTypeMappings.iterator();
- while (jxiter.hasNext())
- sb.append(((JavaXmlTypeMapping)jxiter.next()).serialize());
-
- for (Iterator i = exceptionMappings.iterator(); i.hasNext();)
- sb.append(((ExceptionMapping)i.next()).serialize());
-
- // A <service-interface-mapping> is followed by 1 or many
<service-endpoint-interface-mapping> elements
- int lenSIM = serviceInterfaceMappings.size();
- for (int i = 0; i < lenSIM; i++)
- {
- ServiceInterfaceMapping sim =
(ServiceInterfaceMapping)serviceInterfaceMappings.get(i);
- sb.append(sim.serialize());
- ServiceEndpointInterfaceMapping seim =
(ServiceEndpointInterfaceMapping)serviceEndpointInterfaceMappings.get(i);
- sb.append(seim.serialize());
- }
-
- int lenSEI = serviceEndpointInterfaceMappings.size();
- for (int i = lenSIM; i < lenSEI; i++)
- {
- ServiceEndpointInterfaceMapping seim =
(ServiceEndpointInterfaceMapping)serviceEndpointInterfaceMappings.get(i);
- sb.append(seim.serialize());
- }
-
- sb.append("</java-wsdl-mapping>");
-
- return sb.toString();
- }
-
- // factory methods
********************************************************************
-
- public void addPackageMapping(PackageMapping packageMapping)
- {
- packageMappings.add(packageMapping);
- }
-
- public void addJavaXmlTypeMappings(JavaXmlTypeMapping typeMapping)
- {
- javaXmlTypeMappings.add(typeMapping);
- }
-
- public void addExceptionMappings(ExceptionMapping exceptionMapping)
- {
- exceptionMappings.add(exceptionMapping);
- }
-
- public void addServiceInterfaceMappings(ServiceInterfaceMapping
serviceInterfaceMapping)
- {
- serviceInterfaceMappings.add(serviceInterfaceMapping);
- }
-
- public void addServiceEndpointInterfaceMappings(ServiceEndpointInterfaceMapping
serviceEndpointInterfaceMapping)
- {
- serviceEndpointInterfaceMappings.add(serviceEndpointInterfaceMapping);
- }
-}
Copied: trunk/src/main/java/org/jboss/ws/metadata/jaxrpcmapping/JavaWsdlMapping.java (from
rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/jaxrpcmapping/JavaWsdlMapping.java)
Deleted:
trunk/src/main/java/org/jboss/ws/metadata/jaxrpcmapping/JavaWsdlMappingFactory.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/jaxrpcmapping/JavaWsdlMappingFactory.java 2006-12-07
10:43:36 UTC (rev 1600)
+++
trunk/src/main/java/org/jboss/ws/metadata/jaxrpcmapping/JavaWsdlMappingFactory.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -1,578 +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.jaxrpcmapping;
-
-// $Id$
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-
-import javax.xml.namespace.QName;
-
-import org.jboss.logging.Logger;
-import org.jboss.xb.binding.JBossXBException;
-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;
-
-/**
- * A JBossXB factory for {@link org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping}
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 14-May-2004
- */
-public class JavaWsdlMappingFactory implements ObjectModelFactory
-{
- // provide logging
- private static Logger log = Logger.getLogger(JavaWsdlMappingFactory.class);
-
- // Hide constructor
- private JavaWsdlMappingFactory()
- {
- }
-
- /**
- * Create a new instance of a jaxrpc-mapping factory
- */
- public static JavaWsdlMappingFactory newInstance()
- {
- return new JavaWsdlMappingFactory();
- }
-
- /**
- * Factory method for JavaWsdlMapping
- */
- public JavaWsdlMapping parse(URL jaxrpcMappingFile) throws IOException
- {
- if (jaxrpcMappingFile == null)
- {
- throw new IllegalArgumentException("URL cannot be null");
- }
-
- // setup the XML binding Unmarshaller
- Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
- InputStream is = jaxrpcMappingFile.openStream();
- try
- {
- JavaWsdlMapping javaWsdlMapping = (JavaWsdlMapping)unmarshaller.unmarshal(is,
this, null);
- return javaWsdlMapping;
- }
- catch (JBossXBException e)
- {
- IOException ioex = new IOException("Cannot parse: " +
jaxrpcMappingFile);
- Throwable cause = e.getCause();
- if (cause != null)
- ioex.initCause(cause);
- throw ioex;
- }
- finally
- {
- is.close();
- }
- }
-
- /**
- * This method is called on the factory by the object model builder when the parsing
starts.
- */
- public Object newRoot(Object root, UnmarshallingContext navigator, String
namespaceURI, String localName, Attributes attrs)
- {
- return new JavaWsdlMapping();
- }
-
- public Object completeRoot(Object root, UnmarshallingContext ctx, String uri, String
name)
- {
- return root;
- }
-
- /**
- * Called when parsing of a new element started.
- */
- public Object newChild(JavaWsdlMapping javaWsdlMapping, UnmarshallingContext
navigator, String namespaceURI, String localName, Attributes attrs)
- {
- log.trace("newChild: " + localName);
- if ("package-mapping".equals(localName))
- {
- return new PackageMapping(javaWsdlMapping);
- }
- if ("java-xml-type-mapping".equals(localName))
- {
- return new JavaXmlTypeMapping(javaWsdlMapping);
- }
- if ("exception-mapping".equals(localName))
- {
- return new ExceptionMapping(javaWsdlMapping);
- }
- if ("service-interface-mapping".equals(localName))
- {
- return new ServiceInterfaceMapping(javaWsdlMapping);
- }
- if ("service-endpoint-interface-mapping".equals(localName))
- {
- return new ServiceEndpointInterfaceMapping(javaWsdlMapping);
- }
- return null;
- }
-
- /**
- * Called when parsing character is complete.
- */
- public void addChild(JavaWsdlMapping javaWsdlMapping, PackageMapping packageMapping,
UnmarshallingContext navigator, String namespaceURI, String localName)
- {
- log.trace("addChild: [obj=" + javaWsdlMapping + ",child=" +
packageMapping + "]");
- javaWsdlMapping.addPackageMapping(packageMapping);
- }
-
- /**
- * Called when parsing character is complete.
- */
- public void addChild(JavaWsdlMapping javaWsdlMapping, JavaXmlTypeMapping typeMapping,
UnmarshallingContext navigator, String namespaceURI, String localName)
- {
- log.trace("addChild: [obj=" + javaWsdlMapping + ",child=" +
typeMapping + "]");
- javaWsdlMapping.addJavaXmlTypeMappings(typeMapping);
- }
-
- /**
- * Called when parsing character is complete.
- */
- public void addChild(JavaWsdlMapping javaWsdlMapping, ExceptionMapping
exceptionMapping, UnmarshallingContext navigator, String namespaceURI, String localName)
- {
- log.trace("addChild: [obj=" + javaWsdlMapping + ",child=" +
exceptionMapping + "]");
- javaWsdlMapping.addExceptionMappings(exceptionMapping);
- }
-
- /**
- * Called when parsing character is complete.
- */
- public void addChild(JavaWsdlMapping javaWsdlMapping, ServiceInterfaceMapping
siMapping, UnmarshallingContext navigator, String namespaceURI, String localName)
- {
- log.trace("addChild: [obj=" + javaWsdlMapping + ",child=" +
siMapping + "]");
- javaWsdlMapping.addServiceInterfaceMappings(siMapping);
- }
-
- /**
- * Called when parsing character is complete.
- */
- public void addChild(JavaWsdlMapping javaWsdlMapping, ServiceEndpointInterfaceMapping
seiMapping, UnmarshallingContext navigator, String namespaceURI,
- String localName)
- {
- log.trace("addChild: [obj=" + javaWsdlMapping + ",child=" +
seiMapping + "]");
- javaWsdlMapping.addServiceEndpointInterfaceMappings(seiMapping);
- }
-
- /**
- * Called when a new simple child element with text value was read from the XML
content.
- */
- public void setValue(PackageMapping packageMapping, UnmarshallingContext navigator,
String namespaceURI, String localName, String value)
- {
- log.trace("setValue: [obj=" + packageMapping + ",localName=" +
localName + ",value=" + value + "]");
- if ("package-type".equals(localName))
- {
- packageMapping.setPackageType(value);
- }
- else if ("namespaceURI".equals(localName))
- {
- packageMapping.setNamespaceURI(value);
- }
- }
-
- /**
- * Called when parsing of a new element started.
- */
- public Object newChild(JavaXmlTypeMapping typeMapping, UnmarshallingContext navigator,
String namespaceURI, String localName, Attributes attrs)
- {
- log.trace("newChild: " + localName);
- if ("variable-mapping".equals(localName))
- {
- return new VariableMapping(typeMapping);
- }
- return null;
- }
-
- /**
- * Called when parsing character is complete.
- */
- public void addChild(JavaXmlTypeMapping typeMapping, VariableMapping variableMapping,
UnmarshallingContext navigator, String namespaceURI, String localName)
- {
- log.trace("addChild: [obj=" + typeMapping + ",child=" +
variableMapping + "]");
- typeMapping.addVariableMapping(variableMapping);
- }
-
- /**
- * Called when a new simple child element with text value was read from the XML
content.
- */
- public void setValue(JavaXmlTypeMapping typeMapping, UnmarshallingContext navigator,
String namespaceURI, String localName, String value)
- {
- log.trace("setValue: [obj=" + typeMapping + ",localName=" +
localName + ",value=" + value + "]");
- if ("java-type".equals(localName))
- {
- typeMapping.setJavaType(value);
- }
- else if ("root-type-qname".equals(localName))
- {
- QName qname = navigator.resolveQName(value);
- typeMapping.setRootTypeQName(qname);
- }
- else if ("anonymous-type-qname".equals(localName))
- {
- QName qname = null;
- try
- {
- // <anonymous-type-qname
xmlns:typeNS="http://org.jboss.ws/anonymous/types">typeNS:>root</anonymous-type-qname>
- qname = navigator.resolveQName(value);
- }
- catch (Exception e)
- {
- // ignore unresolved qname
- }
-
- if (qname == null)
- {
- //
<
anonymous-type-qname>http://example.com/stockquote/schemas:>Get...
- int index = value.lastIndexOf(':');
- if (index > 0)
- {
- String nsURI = value.substring(0, index);
- String localPart = value.substring(index + 1);
- qname = new QName(nsURI, localPart);
- }
- }
-
- if (qname == null)
- throw new IllegalArgumentException("Invalid anonymous qname: " +
value);
-
- typeMapping.setAnonymousTypeQName(qname);
- }
- else if ("qname-scope".equals(localName))
- {
- typeMapping.setQNameScope(value);
- }
- }
-
- /**
- * Called when a new simple child element with text value was read from the XML
content.
- */
- public void setValue(ExceptionMapping exceptionMapping, UnmarshallingContext
navigator, String namespaceURI, String localName, String value)
- {
- log.trace("setValue: [obj=" + exceptionMapping + ",localName="
+ localName + ",value=" + value + "]");
- if ("exception-type".equals(localName))
- {
- exceptionMapping.setExceptionType(value);
- }
- else if ("wsdl-message".equals(localName))
- {
- exceptionMapping.setWsdlMessage(navigator.resolveQName(value));
- }
- else if ("constructor-parameter-order".equals(localName))
- {
- exceptionMapping.addConstructorParameter(value);
- }
- }
-
- /**
- * Called when parsing of a new element started.
- */
- public Object newChild(ServiceInterfaceMapping siMapping, UnmarshallingContext
navigator, String namespaceURI, String localName, Attributes attrs)
- {
- log.trace("newChild: " + localName);
- if ("port-mapping".equals(localName))
- {
- return new PortMapping(siMapping);
- }
- return null;
- }
-
- /**
- * Called when parsing character is complete.
- */
- public void addChild(ServiceInterfaceMapping siMapping, PortMapping portMapping,
UnmarshallingContext navigator, String namespaceURI, String localName)
- {
- log.trace("addChild: [obj=" + siMapping + ",child=" +
portMapping + "]");
- siMapping.addPortMapping(portMapping);
- }
-
- /**
- * Called when a new simple child element with text value was read from the XML
content.
- */
- public void setValue(ServiceInterfaceMapping siMapping, UnmarshallingContext
navigator, String namespaceURI, String localName, String value)
- {
- log.trace("setValue: [obj=" + siMapping + ",localName=" +
localName + ",value=" + value + "]");
- if ("service-interface".equals(localName))
- {
- siMapping.setServiceInterface(value);
- }
- else if ("wsdl-service-name".equals(localName))
- {
- siMapping.setWsdlServiceName(navigator.resolveQName(value));
- }
- }
-
- /**
- * Called when parsing of a new element started.
- */
- public Object newChild(ServiceEndpointInterfaceMapping seiMapping,
UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs)
- {
- log.trace("newChild: " + localName);
- if ("service-endpoint-method-mapping".equals(localName))
- {
- return new ServiceEndpointMethodMapping(seiMapping);
- }
- return null;
- }
-
- /**
- * Called when parsing character is complete.
- */
- public void addChild(ServiceEndpointInterfaceMapping seiMapping,
ServiceEndpointMethodMapping seiMethodMapping, UnmarshallingContext navigator, String
namespaceURI,
- String localName)
- {
- log.trace("addChild: [obj=" + seiMapping + ",child=" +
seiMapping + "]");
- seiMapping.addServiceEndpointMethodMapping(seiMethodMapping);
- }
-
- /**
- * Called when a new simple child element with text value was read from the XML
content.
- */
- public void setValue(ServiceEndpointInterfaceMapping seiMapping, UnmarshallingContext
navigator, String namespaceURI, String localName, String value)
- {
- log.trace("setValue: [obj=" + seiMapping + ",localName=" +
localName + ",value=" + value + "]");
- if ("service-endpoint-interface".equals(localName))
- {
- seiMapping.setServiceEndpointInterface(value);
- }
- else if ("wsdl-port-type".equals(localName))
- {
- seiMapping.setWsdlPortType(navigator.resolveQName(value));
- }
- else if ("wsdl-binding".equals(localName))
- {
- seiMapping.setWsdlBinding(navigator.resolveQName(value));
- }
- }
-
- /**
- * Called when a new simple child element with text value was read from the XML
content.
- */
- public void setValue(VariableMapping variableMapping, UnmarshallingContext navigator,
String namespaceURI, String localName, String value)
- {
- log.trace("setValue: [obj=" + variableMapping + ",localName=" +
localName + ",value=" + value + "]");
- if ("java-variable-name".equals(localName))
- {
- variableMapping.setJavaVariableName(value);
- }
- else if ("data-member".equals(localName))
- {
- variableMapping.setDataMember(true);
- }
- else if ("xml-attribute-name".equals(localName))
- {
- variableMapping.setXmlAttributeName(value);
- }
- else if ("xml-element-name".equals(localName))
- {
- variableMapping.setXmlElementName(value);
- }
- }
-
- /**
- * Called when parsing of a new element started.
- */
- public Object newChild(VariableMapping variableMapping, UnmarshallingContext
navigator, String namespaceURI, String localName, Attributes attrs)
- {
- log.trace("newChild: " + localName);
- if ("data-member".equals(localName))
- {
- variableMapping.setDataMember(true);
- }
- else if ("xml-wildcard".equals(localName))
- {
- variableMapping.setXmlWildcard(true);
- }
- return null;
- }
-
- /**
- * Called when a new simple child element with text value was read from the XML
content.
- */
- public void setValue(PortMapping portMapping, UnmarshallingContext navigator, String
namespaceURI, String localName, String value)
- {
- log.trace("setValue: [obj=" + portMapping + ",localName=" +
localName + ",value=" + value + "]");
- if ("port-name".equals(localName))
- {
- portMapping.setPortName(value);
- }
- else if ("java-port-name".equals(localName))
- {
- portMapping.setJavaPortName(value);
- }
- }
-
- /**
- * Called when parsing of a new element started.
- */
- public Object newChild(ServiceEndpointMethodMapping methodMapping,
UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs)
- {
- log.trace("newChild: " + localName);
- if ("method-param-parts-mapping".equals(localName))
- {
- return new MethodParamPartsMapping(methodMapping);
- }
- if ("wsdl-return-value-mapping".equals(localName))
- {
- return new WsdlReturnValueMapping(methodMapping);
- }
- if ("wrapped-element".equals(localName))
- {
- methodMapping.setWrappedElement(true);
- }
- return null;
- }
-
- /**
- * Called when parsing character is complete.
- */
- public void addChild(ServiceEndpointMethodMapping methodMapping,
MethodParamPartsMapping partsMapping, UnmarshallingContext navigator, String
namespaceURI,
- String localName)
- {
- log.trace("addChild: [obj=" + methodMapping + ",child=" +
partsMapping + "]");
- methodMapping.addMethodParamPartsMapping(partsMapping);
- }
-
- /**
- * Called when parsing character is complete.
- */
- public void addChild(ServiceEndpointMethodMapping methodMapping,
WsdlReturnValueMapping returnValueMapping, UnmarshallingContext navigator, String
namespaceURI,
- String localName)
- {
- log.trace("addChild: [obj=" + methodMapping + ",child=" +
returnValueMapping + "]");
- methodMapping.setWsdlReturnValueMapping(returnValueMapping);
- }
-
- /**
- * Called when a new simple child element with text value was read from the XML
content.
- */
- public void setValue(ServiceEndpointMethodMapping methodMapping, UnmarshallingContext
navigator, String namespaceURI, String localName, String value)
- {
- log.trace("setValue: [obj=" + methodMapping + ",localName=" +
localName + ",value=" + value + "]");
- if ("java-method-name".equals(localName))
- {
- methodMapping.setJavaMethodName(value);
- }
- else if ("wsdl-operation".equals(localName))
- {
- methodMapping.setWsdlOperation(value);
- }
- }
-
- /**
- * Called when parsing of a new element started.
- */
- public Object newChild(MethodParamPartsMapping partsMapping, UnmarshallingContext
navigator, String namespaceURI, String localName, Attributes attrs)
- {
- log.trace("newChild: " + localName);
- if ("wsdl-message-mapping".equals(localName))
- {
- return new WsdlMessageMapping(partsMapping);
- }
- return null;
- }
-
- /**
- * Called when parsing character is complete.
- */
- public void addChild(MethodParamPartsMapping partsMapping, WsdlMessageMapping
msgMapping, UnmarshallingContext navigator, String namespaceURI, String localName)
- {
- log.trace("addChild: [obj=" + partsMapping + ",child=" +
msgMapping + "]");
- partsMapping.setWsdlMessageMapping(msgMapping);
- }
-
- /**
- * Called when a new simple child element with text value was read from the XML
content.
- */
- public void setValue(MethodParamPartsMapping partsMapping, UnmarshallingContext
navigator, String namespaceURI, String localName, String value)
- {
- log.trace("setValue: [obj=" + partsMapping + ",localName=" +
localName + ",value=" + value + "]");
- if ("param-position".equals(localName))
- {
- partsMapping.setParamPosition(new Integer(value).intValue());
- }
- else if ("param-type".equals(localName))
- {
- partsMapping.setParamType(value);
- }
- }
-
- /**
- * Called when a new simple child element with text value was read from the XML
content.
- */
- public void setValue(WsdlReturnValueMapping retValueMapping, UnmarshallingContext
navigator, String namespaceURI, String localName, String value)
- {
- log.trace("setValue: [obj=" + retValueMapping + ",localName=" +
localName + ",value=" + value + "]");
- if ("method-return-value".equals(localName))
- {
- retValueMapping.setMethodReturnValue(value);
- }
- else if ("wsdl-message".equals(localName))
- {
- retValueMapping.setWsdlMessage(navigator.resolveQName(value));
- }
- else if ("wsdl-message-part-name".equals(localName))
- {
- retValueMapping.setWsdlMessagePartName(value);
- }
- }
-
- /**
- * Called when a new simple child element with text value was read from the XML
content.
- */
- public void setValue(WsdlMessageMapping msgMapping, UnmarshallingContext navigator,
String namespaceURI, String localName, String value)
- {
- log.trace("setValue: [obj=" + msgMapping + ",localName=" +
localName + ",value=" + value + "]");
- if ("wsdl-message".equals(localName))
- {
- msgMapping.setWsdlMessage(navigator.resolveQName(value));
- }
- else if ("wsdl-message-part-name".equals(localName))
- {
- msgMapping.setWsdlMessagePartName(value);
- }
- else if ("parameter-mode".equals(localName))
- {
- msgMapping.setParameterMode(value);
- }
- }
-
- /**
- * Called when parsing of a new element started.
- */
- public Object newChild(WsdlMessageMapping msgMapping, UnmarshallingContext navigator,
String namespaceURI, String localName, Attributes attrs)
- {
- log.trace("newChild: " + localName);
- if ("soap-header".equals(localName))
- {
- msgMapping.setSoapHeader(true);
- }
- return null;
- }
-}
Copied:
trunk/src/main/java/org/jboss/ws/metadata/jaxrpcmapping/JavaWsdlMappingFactory.java (from
rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/jaxrpcmapping/JavaWsdlMappingFactory.java)
Deleted: trunk/src/main/java/org/jboss/ws/metadata/jaxrpcmapping/JavaXmlTypeMapping.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/jaxrpcmapping/JavaXmlTypeMapping.java 2006-12-07
10:43:36 UTC (rev 1600)
+++
trunk/src/main/java/org/jboss/ws/metadata/jaxrpcmapping/JavaXmlTypeMapping.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -1,158 +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.jaxrpcmapping;
-
-// $Id$
-
-import java.io.Serializable;
-import java.util.ArrayList;
-
-import javax.xml.namespace.QName;
-
-/**
- * XML mapping of the java-wsdl-mapping/java-xml-type-mapping element.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 14-May-2004
- */
-public class JavaXmlTypeMapping implements Serializable
-{
- private static final long serialVersionUID = -7671078579082015103L;
-
- // The parent <java-wsdl-mapping> element
- private JavaWsdlMapping javaWsdlMapping;
-
- /** The required <java-type> element
- * The java-type element is the fully qualified class name of a Java class.
- */
- private String javaType;
- // The choice <root-type-qname> element
- private QName rootTypeQName;
- // The choice <anonymous-type-qname> element
- private QName anonymousTypeQName;
-
- /** The required <qname-scope> element
- * The qname-scope elements scopes the reference of a QName to the WSDL element type
it applies to.
- * The value of qname-scope may be simpleType, complexType, or element
- */
- private String qnameScope;
-
- // Zero or more <variable-mapping> elements
- private ArrayList variableMappings = new ArrayList();
-
- public JavaXmlTypeMapping(JavaWsdlMapping javaWsdlMapping)
- {
- this.javaWsdlMapping = javaWsdlMapping;
- }
-
- public JavaWsdlMapping getJavaWsdlMapping()
- {
- return javaWsdlMapping;
- }
-
- public String getJavaType()
- {
- return javaType;
- }
-
- public void setJavaType(String javaType)
- {
- this.javaType = javaType;
- }
-
- public String getQnameScope()
- {
- return qnameScope;
- }
-
- public void setQNameScope(String qnameScope)
- {
- this.qnameScope = qnameScope;
- }
-
- public QName getRootTypeQName()
- {
- return rootTypeQName;
- }
-
- public void setRootTypeQName(QName rootTypeQName)
- {
- this.rootTypeQName = rootTypeQName;
- }
-
- public QName getAnonymousTypeQName()
- {
- return anonymousTypeQName;
- }
-
- public void setAnonymousTypeQName(QName anonymousTypeQName)
- {
- this.anonymousTypeQName = anonymousTypeQName;
- }
-
- public VariableMapping[] getVariableMappings()
- {
- VariableMapping[] arr = new VariableMapping[variableMappings.size()];
- variableMappings.toArray(arr);
- return arr;
- }
-
- public void addVariableMapping(VariableMapping variableMapping)
- {
- variableMappings.add(variableMapping);
- }
-
- public String toString()
- {
- return "[qname=" + rootTypeQName + ",javaType=" + javaType +
",scope=" + qnameScope + "]";
- }
-
- public String serialize()
- {
- StringBuffer sb = new StringBuffer();
- sb.append("<java-xml-type-mapping>");
-
sb.append("<java-type>").append(javaType).append("</java-type>");
-
- if (rootTypeQName != null)
- {
- sb.append("<root-type-qname
xmlns:typeNS='").append(rootTypeQName.getNamespaceURI()).append("'>");
-
sb.append(rootTypeQName.getPrefix()).append(":").append(rootTypeQName.getLocalPart());
- sb.append("</root-type-qname>");
- }
-
- if (anonymousTypeQName != null)
- {
- sb.append("<anonymous-type-qname
xmlns:typeNS='").append(anonymousTypeQName.getNamespaceURI()).append("'>");
-
sb.append(anonymousTypeQName.getPrefix()).append(":").append(anonymousTypeQName.getLocalPart());
- sb.append("</anonymous-type-qname>");
- }
-
-
sb.append("<qname-scope>").append(qnameScope).append("</qname-scope>");
-
- int len = variableMappings.size();
- for(int i = 0 ; i < len ; i ++)
- sb.append(((VariableMapping)variableMappings.get(i)).serialize());
-
- sb.append("</java-xml-type-mapping>");
- return sb.toString();
- }
-}
Copied: trunk/src/main/java/org/jboss/ws/metadata/jaxrpcmapping/JavaXmlTypeMapping.java
(from rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/jaxrpcmapping/JavaXmlTypeMapping.java)
Deleted:
trunk/src/main/java/org/jboss/ws/metadata/jaxrpcmapping/MethodParamPartsMapping.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/jaxrpcmapping/MethodParamPartsMapping.java 2006-12-07
10:43:36 UTC (rev 1600)
+++
trunk/src/main/java/org/jboss/ws/metadata/jaxrpcmapping/MethodParamPartsMapping.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -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.jaxrpcmapping;
-
-import java.io.Serializable;
-
-// $Id$
-
-/**
- * XML mapping of the
java-wsdl-mapping/service-endpoint-interface-mapping/service-endpoint-method-mapping/method-param-parts-mapping
element.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 14-May-2004
- */
-public class MethodParamPartsMapping implements Serializable
-{
- private static final long serialVersionUID = -1351920471783503813L;
-
- // The parent <service-endpoint-method-mapping> element
- private ServiceEndpointMethodMapping serviceEndpointMethodMapping;
-
- // The required <param-position> element
- private int paramPosition;
- // The required <param-type> element
- private String paramType;
- // The required <wsdl-message-mapping> element
- private WsdlMessageMapping wsdlMessageMapping;
-
- public MethodParamPartsMapping(ServiceEndpointMethodMapping
serviceEndpointMethodMapping)
- {
- this.serviceEndpointMethodMapping = serviceEndpointMethodMapping;
- }
-
- public ServiceEndpointMethodMapping getServiceEndpointMethodMapping()
- {
- return serviceEndpointMethodMapping;
- }
-
- public int getParamPosition()
- {
- return paramPosition;
- }
-
- public void setParamPosition(int paramPosition)
- {
- this.paramPosition = paramPosition;
- }
-
- public String getParamType()
- {
- return paramType;
- }
-
- public void setParamType(String paramType)
- {
- this.paramType = paramType;
- }
-
- public WsdlMessageMapping getWsdlMessageMapping()
- {
- return wsdlMessageMapping;
- }
-
- public void setWsdlMessageMapping(WsdlMessageMapping wsdlMessageMapping)
- {
- this.wsdlMessageMapping = wsdlMessageMapping;
- }
-
- public String serialize()
- {
- StringBuffer sb = new StringBuffer();
-
sb.append("<method-param-parts-mapping><param-position>").append(paramPosition).append("</param-position>");
-
sb.append("<param-type>").append(paramType).append("</param-type>");
- if(wsdlMessageMapping == null)
- throw new IllegalStateException("wsdlMessageMapping is null");
- sb.append(wsdlMessageMapping.serialize());
-
- sb.append("</method-param-parts-mapping>");
- return sb.toString();
- }
-}
Copied:
trunk/src/main/java/org/jboss/ws/metadata/jaxrpcmapping/MethodParamPartsMapping.java (from
rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/jaxrpcmapping/MethodParamPartsMapping.java)
Deleted: trunk/src/main/java/org/jboss/ws/metadata/jaxrpcmapping/PackageMapping.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/jaxrpcmapping/PackageMapping.java 2006-12-07
10:43:36 UTC (rev 1600)
+++ trunk/src/main/java/org/jboss/ws/metadata/jaxrpcmapping/PackageMapping.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -1,88 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
-*/
-package org.jboss.ws.metadata.jaxrpcmapping;
-
-import java.io.Serializable;
-
-// $Id$
-
-/**
- * XML mapping of the java-wsdl-mapping/package-mapping element.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 14-May-2004
- */
-public class PackageMapping implements Serializable
-{
- private static final long serialVersionUID = 8105452343429986503L;
-
- // The parent <java-wsdl-mapping> element
- private JavaWsdlMapping javaWsdlMapping;
-
- // The required <package-type> element
- private String packageType;
- // The required <namespaceURI> element
- private String namespaceURI;
-
- public PackageMapping(JavaWsdlMapping javaWsdlMapping)
- {
- this.javaWsdlMapping = javaWsdlMapping;
- }
-
- public JavaWsdlMapping getJavaWsdlMapping()
- {
- return javaWsdlMapping;
- }
-
- public String getNamespaceURI()
- {
- return namespaceURI;
- }
-
- public void setNamespaceURI(String namespaceURI)
- {
- this.namespaceURI = namespaceURI;
- }
-
- public String getPackageType()
- {
- return packageType;
- }
-
- public void setPackageType(String packageType)
- {
- this.packageType = packageType;
- }
-
- public String toString()
- {
- return "[namespaceURI=" + namespaceURI + ",packageType=" +
packageType + "]";
- }
-
- public String serialize()
- {
- StringBuffer sb = new StringBuffer();
-
sb.append("<package-mapping>").append("<package-type>").append(packageType).append("</package-type>");
-
sb.append("<namespaceURI>").append(namespaceURI).append("</namespaceURI>").append("</package-mapping>");
- return sb.toString();
- }
-}
Copied: trunk/src/main/java/org/jboss/ws/metadata/jaxrpcmapping/PackageMapping.java (from
rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/jaxrpcmapping/PackageMapping.java)
Deleted: trunk/src/main/java/org/jboss/ws/metadata/jaxrpcmapping/PortMapping.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/jaxrpcmapping/PortMapping.java 2006-12-07
10:43:36 UTC (rev 1600)
+++ trunk/src/main/java/org/jboss/ws/metadata/jaxrpcmapping/PortMapping.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -1,84 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
-*/
-package org.jboss.ws.metadata.jaxrpcmapping;
-
-import java.io.Serializable;
-
-// $Id$
-
-/**
- * XML mapping of the java-wsdl-mapping/service-interface-mapping/port-mapping element.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 14-May-2004
- */
-public class PortMapping implements Serializable
-{
- private static final long serialVersionUID = 8229257516720800393L;
-
- // The parent <service-interface-mapping> element
- private ServiceInterfaceMapping serviceInterfaceMapping;
-
- // The required <port-name> element
- private String portName;
- // The required <java-port-name> element
- private String javaPortName;
-
- public PortMapping(ServiceInterfaceMapping serviceInterfaceMapping)
- {
- this.serviceInterfaceMapping = serviceInterfaceMapping;
- }
-
- public ServiceInterfaceMapping getServiceInterfaceMapping()
- {
- return serviceInterfaceMapping;
- }
-
- public String getJavaPortName()
- {
- return javaPortName;
- }
-
- public void setJavaPortName(String javaPortName)
- {
- this.javaPortName = javaPortName;
- }
-
- public String getPortName()
- {
- return portName;
- }
-
- public void setPortName(String portName)
- {
- this.portName = portName;
- }
-
- public String serialize()
- {
- StringBuffer sb = new StringBuffer();
-
sb.append("<port-mapping><port-name>").append(portName).append("</port-name><java-port-name>");
-
sb.append(javaPortName).append("</java-port-name></port-mapping>");
- return sb.toString();
- }
-}
-
Copied: trunk/src/main/java/org/jboss/ws/metadata/jaxrpcmapping/PortMapping.java (from rev
1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/jaxrpcmapping/PortMapping.java)
Deleted:
trunk/src/main/java/org/jboss/ws/metadata/jaxrpcmapping/ServiceEndpointInterfaceMapping.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/jaxrpcmapping/ServiceEndpointInterfaceMapping.java 2006-12-07
10:43:36 UTC (rev 1600)
+++
trunk/src/main/java/org/jboss/ws/metadata/jaxrpcmapping/ServiceEndpointInterfaceMapping.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -1,140 +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.jaxrpcmapping;
-
-// $Id$
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import javax.xml.namespace.QName;
-
-/**
- * XML mapping of the java-wsdl-mapping/service-endpoint-interface-mapping element.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 14-May-2004
- */
-public class ServiceEndpointInterfaceMapping implements Serializable
-{
- private static final long serialVersionUID = 3336973427288868587L;
-
- // The parent <java-wsdl-mapping> element
- private JavaWsdlMapping javaWsdlMapping;
-
- // The required <service-endpoint-interface> element
- private String serviceEndpointInterface;
- // The required <wsdl-port-type> element
- private QName wsdlPortType;
- // The required <wsdl-binding> element
- private QName wsdlBinding;
- // Zero or more <service-endpoint-method-mapping> elements
- private List serviceEndpointMethodMappings = new ArrayList();
-
- public ServiceEndpointInterfaceMapping(JavaWsdlMapping javaWsdlMapping)
- {
- this.javaWsdlMapping = javaWsdlMapping;
- }
-
- public JavaWsdlMapping getJavaWsdlMapping()
- {
- return javaWsdlMapping;
- }
-
- public String getServiceEndpointInterface()
- {
- return serviceEndpointInterface;
- }
-
- public void setServiceEndpointInterface(String serviceEndpointInterface)
- {
- this.serviceEndpointInterface = serviceEndpointInterface;
- }
-
- public QName getWsdlPortType()
- {
- return wsdlPortType;
- }
-
- public void setWsdlPortType(QName wsdlPortType)
- {
- this.wsdlPortType = wsdlPortType;
- }
-
- public QName getWsdlBinding()
- {
- return wsdlBinding;
- }
-
- public void setWsdlBinding(QName wsdlBinding)
- {
- this.wsdlBinding = wsdlBinding;
- }
-
- public ServiceEndpointMethodMapping[] getServiceEndpointMethodMappings()
- {
- ServiceEndpointMethodMapping[] arr = new
ServiceEndpointMethodMapping[serviceEndpointMethodMappings.size()];
- serviceEndpointMethodMappings.toArray(arr);
- return arr;
- }
-
- public void addServiceEndpointMethodMapping(ServiceEndpointMethodMapping
serviceEndpointMethodMapping)
- {
- serviceEndpointMethodMappings.add(serviceEndpointMethodMapping);
- }
-
- public ServiceEndpointMethodMapping
getServiceEndpointMethodMappingByWsdlOperation(String wsdlOperation)
- {
- ServiceEndpointMethodMapping semMapping = null;
-
- Iterator it = serviceEndpointMethodMappings.iterator();
- while (it.hasNext())
- {
- ServiceEndpointMethodMapping aux = (ServiceEndpointMethodMapping)it.next();
- if (aux.getWsdlOperation().equals(wsdlOperation))
- semMapping = aux;
- }
- return semMapping;
- }
-
- public String serialize()
- {
- StringBuffer sb = new StringBuffer();
-
sb.append("<service-endpoint-interface-mapping><service-endpoint-interface>");
-
sb.append(this.serviceEndpointInterface).append("</service-endpoint-interface>");
- sb.append("<wsdl-port-type
xmlns:").append(wsdlPortType.getPrefix()).append("='");
-
sb.append(wsdlPortType.getNamespaceURI()).append("'>").append(wsdlPortType.getPrefix());
-
sb.append(":").append(wsdlPortType.getLocalPart()).append("</wsdl-port-type>");
-
- sb.append("<wsdl-binding
xmlns:").append(wsdlBinding.getPrefix()).append("='");
-
sb.append(wsdlBinding.getNamespaceURI()).append("'>").append(wsdlBinding.getPrefix());
-
sb.append(":").append(wsdlBinding.getLocalPart()).append("</wsdl-binding>");
-
- Iterator iter = serviceEndpointMethodMappings.iterator();
- while(iter != null && iter.hasNext())
- sb.append(((ServiceEndpointMethodMapping)iter.next()).serialize());
- sb.append("</service-endpoint-interface-mapping>");
- return sb.toString();
- }
-}
Copied:
trunk/src/main/java/org/jboss/ws/metadata/jaxrpcmapping/ServiceEndpointInterfaceMapping.java
(from rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/jaxrpcmapping/ServiceEndpointInterfaceMapping.java)
Deleted:
trunk/src/main/java/org/jboss/ws/metadata/jaxrpcmapping/ServiceEndpointMethodMapping.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/jaxrpcmapping/ServiceEndpointMethodMapping.java 2006-12-07
10:43:36 UTC (rev 1600)
+++
trunk/src/main/java/org/jboss/ws/metadata/jaxrpcmapping/ServiceEndpointMethodMapping.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -1,156 +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.jaxrpcmapping;
-
-// $Id$
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-/**
- * XML mapping of the
java-wsdl-mapping/service-endpoint-interface-mapping/service-endpoint-method-mapping
element.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 14-May-2004
- */
-public class ServiceEndpointMethodMapping implements Serializable
-{
- private static final long serialVersionUID = 7857267872017006227L;
-
- // The parent <service-endpoint-interface-mapping> element
- private ServiceEndpointInterfaceMapping serviceEndpointInterfaceMapping;
-
- // The required <java-method-name> element
- private String javaMethodName;
- // The required <wsdl-operation> element
- private String wsdlOperation;
- // The optional <wrapped-element> element
- private boolean wrappedElement;
- // Zero or more <method-param-parts-mapping> elements
- private List methodParamPartsMappings = new ArrayList();
- // The optional <wsdl-return-value-mapping> element
- private WsdlReturnValueMapping wsdlReturnValueMapping;
-
- public ServiceEndpointMethodMapping(ServiceEndpointInterfaceMapping
serviceEndpointInterfaceMapping)
- {
- this.serviceEndpointInterfaceMapping = serviceEndpointInterfaceMapping;
- }
-
- public ServiceEndpointInterfaceMapping getServiceEndpointInterfaceMapping()
- {
- return serviceEndpointInterfaceMapping;
- }
-
- public String getJavaMethodName()
- {
- return javaMethodName;
- }
-
- public void setJavaMethodName(String javaMethodName)
- {
- this.javaMethodName = javaMethodName;
- }
-
- public MethodParamPartsMapping[] getMethodParamPartsMappings()
- {
- MethodParamPartsMapping[] arr = new
MethodParamPartsMapping[methodParamPartsMappings.size()];
- methodParamPartsMappings.toArray(arr);
- return arr;
- }
-
- public MethodParamPartsMapping getMethodParamPartsMappingByPartName(String partName)
- {
- MethodParamPartsMapping paramMapping = null;
- for (int i = 0; paramMapping == null && i <
methodParamPartsMappings.size(); i++)
- {
- MethodParamPartsMapping aux =
(MethodParamPartsMapping)methodParamPartsMappings.get(i);
- if (aux.getWsdlMessageMapping().getWsdlMessagePartName().equals(partName))
- paramMapping = aux;
- }
- return paramMapping;
- }
-
- public MethodParamPartsMapping getMethodParamPartsMappingByPosition(int pos)
- {
- MethodParamPartsMapping paramMapping = null;
- for (int i = 0; paramMapping == null && i <
methodParamPartsMappings.size(); i++)
- {
- MethodParamPartsMapping aux =
(MethodParamPartsMapping)methodParamPartsMappings.get(i);
- if (aux.getParamPosition() == pos)
- paramMapping = aux;
- }
- return paramMapping;
- }
-
- public void addMethodParamPartsMapping(MethodParamPartsMapping
methodParamPartsMapping)
- {
- methodParamPartsMappings.add(methodParamPartsMapping);
- }
-
- public boolean isWrappedElement()
- {
- return wrappedElement;
- }
-
- public void setWrappedElement(boolean wrappedElement)
- {
- this.wrappedElement = wrappedElement;
- }
-
- public String getWsdlOperation()
- {
- return wsdlOperation;
- }
-
- public void setWsdlOperation(String wsdlOperation)
- {
- this.wsdlOperation = wsdlOperation;
- }
-
- public WsdlReturnValueMapping getWsdlReturnValueMapping()
- {
- return wsdlReturnValueMapping;
- }
-
- public void setWsdlReturnValueMapping(WsdlReturnValueMapping wsdlReturnValueMapping)
- {
- this.wsdlReturnValueMapping = wsdlReturnValueMapping;
- }
-
- public String serialize()
- {
- StringBuffer sb = new StringBuffer();
-
sb.append("<service-endpoint-method-mapping><java-method-name>").append(javaMethodName).append("</java-method-name>");
-
sb.append("<wsdl-operation>").append(wsdlOperation).append("</wsdl-operation>");
- if (wrappedElement)
- sb.append("<wrapped-element/>");
- Iterator iter = methodParamPartsMappings.iterator();
- while (iter != null && iter.hasNext())
- sb.append(((MethodParamPartsMapping)iter.next()).serialize());
- if (wsdlReturnValueMapping != null)
- sb.append(wsdlReturnValueMapping.serialize());
- sb.append("</service-endpoint-method-mapping>");
- return sb.toString();
- }
-}
Copied:
trunk/src/main/java/org/jboss/ws/metadata/jaxrpcmapping/ServiceEndpointMethodMapping.java
(from rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/jaxrpcmapping/ServiceEndpointMethodMapping.java)
Deleted:
trunk/src/main/java/org/jboss/ws/metadata/jaxrpcmapping/ServiceInterfaceMapping.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/jaxrpcmapping/ServiceInterfaceMapping.java 2006-12-07
10:43:36 UTC (rev 1600)
+++
trunk/src/main/java/org/jboss/ws/metadata/jaxrpcmapping/ServiceInterfaceMapping.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -1,111 +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.jaxrpcmapping;
-
-// $Id$
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import javax.xml.namespace.QName;
-
-/**
- * XML mapping of the java-wsdl-mapping/service-interface-mapping element.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 14-May-2004
- */
-public class ServiceInterfaceMapping implements Serializable
-{
- private static final long serialVersionUID = -447051823681281236L;
-
- // The parent <java-wsdl-mapping> element
- private JavaWsdlMapping javaWsdlMapping;
-
- // The required <service-interface> element
- private String serviceInterface;
- // The required <wsdl-service-name> element
- private QName wsdlServiceName;
- // Zero or more <port-mapping> elements
- private List portMappings = new ArrayList();
-
- public ServiceInterfaceMapping(JavaWsdlMapping javaWsdlMapping)
- {
- this.javaWsdlMapping = javaWsdlMapping;
- }
-
- public JavaWsdlMapping getJavaWsdlMapping()
- {
- return javaWsdlMapping;
- }
-
- public String getServiceInterface()
- {
- return serviceInterface;
- }
-
- public void setServiceInterface(String serviceInterface)
- {
- this.serviceInterface = serviceInterface;
- }
-
- public QName getWsdlServiceName()
- {
- return wsdlServiceName;
- }
-
- public void setWsdlServiceName(QName wsdlServiceName)
- {
- this.wsdlServiceName = wsdlServiceName;
- }
-
- public PortMapping[] getPortMappings()
- {
- PortMapping[] arr = new PortMapping[portMappings.size()];
- portMappings.toArray(arr);
- return arr;
- }
-
- public void addPortMapping(PortMapping portMapping)
- {
- portMappings.add(portMapping);
- }
-
- public String serialize()
- {
- StringBuffer sb = new StringBuffer();
- sb.append("<service-interface-mapping>");
-
sb.append("<service-interface>").append(serviceInterface).append("</service-interface>");
- sb.append("<wsdl-service-name
xmlns:").append(wsdlServiceName.getPrefix()).append("='");
- sb.append(wsdlServiceName.getNamespaceURI()).append("'>");
-
sb.append(wsdlServiceName.getPrefix()).append(":").append(wsdlServiceName.getLocalPart());
- sb.append("</wsdl-service-name>");
-
- Iterator iter = portMappings.iterator();
- while(iter != null && iter.hasNext())
- sb.append(((PortMapping)iter.next()).serialize());
- sb.append("</service-interface-mapping>");
- return sb.toString();
- }
-}
Copied:
trunk/src/main/java/org/jboss/ws/metadata/jaxrpcmapping/ServiceInterfaceMapping.java (from
rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/jaxrpcmapping/ServiceInterfaceMapping.java)
Deleted: trunk/src/main/java/org/jboss/ws/metadata/jaxrpcmapping/VariableMapping.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/jaxrpcmapping/VariableMapping.java 2006-12-07
10:43:36 UTC (rev 1600)
+++
trunk/src/main/java/org/jboss/ws/metadata/jaxrpcmapping/VariableMapping.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -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.jaxrpcmapping;
-
-import java.io.Serializable;
-
-// $Id$
-
-/**
- * XML mapping of the java-wsdl-mapping/java-xml-type-mapping/varaible-mapping element.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 14-May-2004
- */
-public class VariableMapping implements Serializable
-{
- private static final long serialVersionUID = 4168728468137337167L;
-
- // The parent <java-wsdl-mapping> element
- private JavaXmlTypeMapping typeMapping;
-
- // The required <java-variable-name> element
- private String javaVariableName;
- // The optional <data-member> element
- private boolean dataMember;
- // The choice [<xml-attribute-name> | <xml-element-name> |
<xml-wildcard>]
- private String xmlAttributeName;
- private String xmlElementName;
- private boolean xmlWildcard;
-
- public VariableMapping(JavaXmlTypeMapping typeMapping)
- {
- this.typeMapping = typeMapping;
- }
-
- public JavaXmlTypeMapping getTypeMapping()
- {
- return typeMapping;
- }
-
- public boolean isDataMember()
- {
- return dataMember;
- }
-
- public void setDataMember(boolean dataMember)
- {
- this.dataMember = dataMember;
- }
-
- public String getJavaVariableName()
- {
- return javaVariableName;
- }
-
- public void setJavaVariableName(String javaVariableName)
- {
- this.javaVariableName = javaVariableName;
- }
-
- public String getXmlAttributeName()
- {
- return xmlAttributeName;
- }
-
- public void setXmlAttributeName(String xmlAttributeName)
- {
- this.xmlAttributeName = xmlAttributeName;
- }
-
- public String getXmlElementName()
- {
- return xmlElementName;
- }
-
- public void setXmlElementName(String xmlElementName)
- {
- this.xmlElementName = xmlElementName;
- }
-
- public boolean getXmlWildcard()
- {
- return xmlWildcard;
- }
-
- public void setXmlWildcard(boolean xmlWildcard)
- {
- this.xmlWildcard = xmlWildcard;
- }
-
- public String serialize()
- {
- StringBuffer sb = new StringBuffer();
- sb.append("<variable-mapping>");
-
sb.append("<java-variable-name>").append(javaVariableName).append("</java-variable-name>");
- if(dataMember)
- {
- sb.append("<data-member/>");
- }
- if (xmlElementName != null)
- {
-
sb.append("<xml-element-name>").append(xmlElementName).append("</xml-element-name>");
- }
- else if (xmlAttributeName != null)
- {
-
sb.append("<xml-attribute-name>").append(xmlAttributeName).append("</xml-attribute-name>");
- }
- else if (xmlWildcard)
- {
- sb.append("<xml-wildcard/>");
- }
- sb.append("</variable-mapping>");
- return sb.toString();
- }
-}
Copied: trunk/src/main/java/org/jboss/ws/metadata/jaxrpcmapping/VariableMapping.java (from
rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/jaxrpcmapping/VariableMapping.java)
Deleted: trunk/src/main/java/org/jboss/ws/metadata/jaxrpcmapping/WsdlMessageMapping.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/jaxrpcmapping/WsdlMessageMapping.java 2006-12-07
10:43:36 UTC (rev 1600)
+++
trunk/src/main/java/org/jboss/ws/metadata/jaxrpcmapping/WsdlMessageMapping.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -1,116 +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.jaxrpcmapping;
-
-import java.io.Serializable;
-
-import javax.xml.namespace.QName;
-
-// $Id$
-
-/**
- * Created by IntelliJ IDEA.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 14-May-2004
- */
-public class WsdlMessageMapping implements Serializable
-{
- private static final long serialVersionUID = -3212852147033081838L;
-
- // The parent <method-param-parts-mapping> element
- private MethodParamPartsMapping methodParamPartsMapping;
- // The required <wsdl-message> element
- private QName wsdlMessage;
- // The required <wsdl-message-part-name> element
- private String wsdlMessagePartName;
- // The required <parameter-mode> element
- private String parameterMode;
- // The optional <soap-header> element
- private boolean soapHeader;
-
- public WsdlMessageMapping(MethodParamPartsMapping methodParamPartsMapping)
- {
- this.methodParamPartsMapping = methodParamPartsMapping;
- }
-
- public MethodParamPartsMapping getMethodParamPartsMapping()
- {
- return methodParamPartsMapping;
- }
-
- public String getParameterMode()
- {
- return parameterMode;
- }
-
- public void setParameterMode(String parameterMode)
- {
- if ("IN".equals(parameterMode) == false &&
"OUT".equals(parameterMode) == false &&
"INOUT".equals(parameterMode) == false)
- throw new IllegalArgumentException("Invalid parameter mode: " +
parameterMode);
- this.parameterMode = parameterMode;
- }
-
- public boolean isSoapHeader()
- {
- return soapHeader;
- }
-
- public void setSoapHeader(boolean soapHeader)
- {
- this.soapHeader = soapHeader;
- }
-
- public QName getWsdlMessage()
- {
- return wsdlMessage;
- }
-
- public void setWsdlMessage(QName wsdlMessage)
- {
- this.wsdlMessage = wsdlMessage;
- }
-
- public String getWsdlMessagePartName()
- {
- return wsdlMessagePartName;
- }
-
- public void setWsdlMessagePartName(String wsdlMessagePartName)
- {
- this.wsdlMessagePartName = wsdlMessagePartName;
- }
-
- public String serialize()
- {
- StringBuffer sb = new StringBuffer();
- sb.append(" <wsdl-message-mapping> <wsdl-message xmlns:");
-
sb.append(wsdlMessage.getPrefix()).append("='").append(wsdlMessage.getNamespaceURI()).append("'>");
-
sb.append(wsdlMessage.getPrefix()).append(":").append(wsdlMessage.getLocalPart()).append("</wsdl-message>");
-
sb.append("<wsdl-message-part-name>").append(wsdlMessagePartName).append("</wsdl-message-part-name>");
-
sb.append("<parameter-mode>").append(parameterMode).append("</parameter-mode>");
- if (soapHeader)
- sb.append("<soap-header/>");
- sb.append("</wsdl-message-mapping>");
- return sb.toString();
- }
-}
Copied: trunk/src/main/java/org/jboss/ws/metadata/jaxrpcmapping/WsdlMessageMapping.java
(from rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/jaxrpcmapping/WsdlMessageMapping.java)
Deleted:
trunk/src/main/java/org/jboss/ws/metadata/jaxrpcmapping/WsdlReturnValueMapping.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/jaxrpcmapping/WsdlReturnValueMapping.java 2006-12-07
10:43:36 UTC (rev 1600)
+++
trunk/src/main/java/org/jboss/ws/metadata/jaxrpcmapping/WsdlReturnValueMapping.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -1,101 +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.jaxrpcmapping;
-
-// $Id$
-
-import java.io.Serializable;
-
-import javax.xml.namespace.QName;
-
-/**
- * XML mapping of the
java-wsdl-mapping/service-endpoint-interface-mapping/service-endpoint-method-mapping/wsdl-return-value-mapping
element.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 14-May-2004
- */
-public class WsdlReturnValueMapping implements Serializable
-{
- private static final long serialVersionUID = -6910106650463959774L;
-
- // The parent <service-endpoint-method-mapping> element
- private ServiceEndpointMethodMapping serviceEndpointMethodMapping;
-
- // The required <method-return-value> element
- private String methodReturnValue;
- // The required <wsdl-message> element
- private QName wsdlMessage;
- // The optional <wsdl-message> element
- private String wsdlMessagePartName;
-
- public WsdlReturnValueMapping(ServiceEndpointMethodMapping
serviceEndpointMethodMapping)
- {
- this.serviceEndpointMethodMapping = serviceEndpointMethodMapping;
- }
-
- public ServiceEndpointMethodMapping getServiceEndpointMethodMapping()
- {
- return serviceEndpointMethodMapping;
- }
-
- public String getMethodReturnValue()
- {
- return methodReturnValue;
- }
-
- public void setMethodReturnValue(String methodReturnValue)
- {
- this.methodReturnValue = methodReturnValue;
- }
-
- public QName getWsdlMessage()
- {
- return wsdlMessage;
- }
-
- public void setWsdlMessage(QName wsdlMessage)
- {
- this.wsdlMessage = wsdlMessage;
- }
-
- public String getWsdlMessagePartName()
- {
- return wsdlMessagePartName;
- }
-
- public void setWsdlMessagePartName(String wsdlMessagePartName)
- {
- this.wsdlMessagePartName = wsdlMessagePartName;
- }
-
- public String serialize()
- {
- StringBuffer sb = new StringBuffer();
-
sb.append("<wsdl-return-value-mapping><method-return-value>").append(methodReturnValue).append("</method-return-value>");
- sb.append("<wsdl-message
xmlns:").append(wsdlMessage.getPrefix()).append("='").append(wsdlMessage.getNamespaceURI());
-
sb.append("'>").append(wsdlMessage.getPrefix()).append(":").append(wsdlMessage.getLocalPart()).append("</wsdl-message>");
-
sb.append("<wsdl-message-part-name>").append(wsdlMessagePartName).append("</wsdl-message-part-name>");
- sb.append("</wsdl-return-value-mapping>");
-
- return sb.toString();
- }
-}
Copied:
trunk/src/main/java/org/jboss/ws/metadata/jaxrpcmapping/WsdlReturnValueMapping.java (from
rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/jaxrpcmapping/WsdlReturnValueMapping.java)
Copied: trunk/src/main/java/org/jboss/ws/metadata/jsr181 (from rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/jsr181)
Deleted: trunk/src/main/java/org/jboss/ws/metadata/jsr181/HandlerChainFactory.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/jsr181/HandlerChainFactory.java 2006-12-07
10:43:36 UTC (rev 1600)
+++ trunk/src/main/java/org/jboss/ws/metadata/jsr181/HandlerChainFactory.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -1,164 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
-*/
-package org.jboss.ws.metadata.jsr181;
-
-// $Id$
-
-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 jsr181 the HandlerChain annotation
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 15-Oct-2005
- */
-public class HandlerChainFactory implements ObjectModelFactory
-{
- // provide logging
- private static final Logger log = Logger.getLogger(HandlerChainFactory.class);
-
- public HandlerChainFactory()
- {
- }
-
- /**
- * This method is called on the factory by the object model builder when the parsing
starts.
- *
- * @return the root of the object model.
- */
- public Object newRoot(Object root, UnmarshallingContext navigator, String
namespaceURI, String localName, Attributes attrs)
- {
- HandlerChainsMetaData handlerConfigMetaData = new
HandlerChainsMetaData(HandlerType.ENDPOINT);
- return handlerConfigMetaData;
- }
-
- public Object completeRoot(Object root, UnmarshallingContext ctx, String uri, String
name)
- {
- return root;
- }
-
- /**
- * Called when parsing of a new element started.
- */
- public Object newChild(HandlerChainsMetaData handlerConfig, UnmarshallingContext
navigator, String namespaceURI, String localName, Attributes attrs)
- {
- if ("handler-chain".equals(localName))
- return new HandlerChainMetaData(handlerConfig);
- else
- return null;
- }
-
- /**
- * Called when parsing character is complete.
- */
- public void addChild(HandlerChainsMetaData handlerConfig, HandlerChainMetaData
handlerChain, UnmarshallingContext navigator, String namespaceURI, String localName)
- {
- handlerConfig.addHandlerChain(handlerChain);
- }
-
- /**
- * Called when parsing of a new element started.
- */
- public Object newChild(HandlerChainMetaData chainConfig, UnmarshallingContext
navigator, String namespaceURI, String localName, Attributes attrs)
- {
- if ("handler".equals(localName))
- return new UnifiedHandlerMetaData(chainConfig);
- else
- return null;
- }
-
- /**
- * Called when parsing character is complete.
- */
- public void addChild(HandlerChainMetaData handlerConfig, UnifiedHandlerMetaData
handler, UnmarshallingContext navigator, String namespaceURI, String localName)
- {
- handlerConfig.addHandler(handler);
- }
-
- /**
- * Called when parsing of a new element started.
- */
- public Object newChild(UnifiedHandlerMetaData handler, UnmarshallingContext navigator,
String namespaceURI, String localName, Attributes attrs)
- {
- if ("init-param".equals(localName))
- return new HandlerInitParam();
- else return null;
- }
-
- /**
- * Called when parsing character is complete.
- */
- public void addChild(UnifiedHandlerMetaData handler, HandlerInitParam param,
UnmarshallingContext navigator, String namespaceURI, String localName)
- {
- handler.addInitParam(param);
- }
-
- /**
- * Called when a new simple child element with text value was read from the XML
content.
- */
- public void setValue(HandlerChainMetaData handlerChain, UnmarshallingContext
navigator, String namespaceURI, String localName, String value)
- {
- if (log.isTraceEnabled())
- log.trace("HandlerChainMetaData setValue: nuri=" + namespaceURI +
" localName=" + localName + " value=" + value);
-
- if (localName.equals("protocol-bindings"))
- handlerChain.setProtocolBindings(value);
- else if (localName.equals("service-name-pattern"))
- handlerChain.setServiceNamePattern(navigator.resolveQName(value));
- else if (localName.equals("port-name-pattern"))
- handlerChain.setPortNamePattern(navigator.resolveQName(value));
- }
-
- /**
- * Called when a new simple child element with text value was read from the XML
content.
- */
- public void setValue(UnifiedHandlerMetaData handler, UnmarshallingContext navigator,
String namespaceURI, String localName, String value)
- {
- if (log.isTraceEnabled())
- log.trace("UnifiedHandlerMetaData setValue: nuri=" + namespaceURI +
" localName=" + localName + " value=" + value);
-
- if (localName.equals("handler-name"))
- handler.setHandlerName(value);
- else if (localName.equals("handler-class"))
- handler.setHandlerClass(value);
- }
-
- /**
- * Called when a new simple child element with text value was read from the XML
content.
- */
- public void setValue(HandlerInitParam param, UnmarshallingContext navigator, String
namespaceURI, String localName, String value)
- {
- if (log.isTraceEnabled())
- log.trace("UnifiedInitParamMetaData setValue: nuri=" + namespaceURI +
" localName=" + localName + " value=" + value);
-
- if (localName.equals("param-name"))
- param.setParamName(value);
- else if (localName.equals("param-value"))
- param.setParamValue(value);
- }
-}
Copied: trunk/src/main/java/org/jboss/ws/metadata/jsr181/HandlerChainFactory.java (from
rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/jsr181/HandlerChainFactory.java)
Deleted: trunk/src/main/java/org/jboss/ws/metadata/jsr181/HandlerChainMetaData.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/jsr181/HandlerChainMetaData.java 2006-12-07
10:43:36 UTC (rev 1600)
+++ trunk/src/main/java/org/jboss/ws/metadata/jsr181/HandlerChainMetaData.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -1,103 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
-*/
-package org.jboss.ws.metadata.jsr181;
-
-// $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 element for handler-config/handler-chain elements
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 15-Oct-2005
- */
-public class HandlerChainMetaData
-{
- // provide logging
- private static final Logger log = Logger.getLogger(HandlerChainMetaData.class);
-
- // The parent element
- private HandlerChainsMetaData handlerChainsMetaData;
-
- private String protocolBindings;
- private QName serviceNamePattern;
- private QName portNamePattern;
- private ArrayList<UnifiedHandlerMetaData> handlers = new
ArrayList<UnifiedHandlerMetaData>();
-
- public HandlerChainMetaData(HandlerChainsMetaData handlerConfig)
- {
- this.handlerChainsMetaData = handlerConfig;
- }
-
- public HandlerChainsMetaData getHandlerChainsMetaData()
- {
- return handlerChainsMetaData;
- }
-
- public void addHandler(UnifiedHandlerMetaData handlerMetaData)
- {
- handlers.add(handlerMetaData);
- }
-
- public List<UnifiedHandlerMetaData> getHandlers()
- {
- return handlers;
- }
-
- public QName getPortNamePattern()
- {
- return portNamePattern;
- }
-
- public void setPortNamePattern(QName portNamePattern)
- {
- this.portNamePattern = portNamePattern;
- }
-
- public String getProtocolBindings()
- {
- return protocolBindings;
- }
-
- public void setProtocolBindings(String protocolBindings)
- {
- this.protocolBindings = protocolBindings;
- }
-
- public QName getServiceNamePattern()
- {
- return serviceNamePattern;
- }
-
- public void setServiceNamePattern(QName serviceNamePattern)
- {
- this.serviceNamePattern = serviceNamePattern;
- }
-
-}
Copied: trunk/src/main/java/org/jboss/ws/metadata/jsr181/HandlerChainMetaData.java (from
rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/jsr181/HandlerChainMetaData.java)
Deleted: trunk/src/main/java/org/jboss/ws/metadata/jsr181/HandlerChainsMetaData.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/jsr181/HandlerChainsMetaData.java 2006-12-07
10:43:36 UTC (rev 1600)
+++ trunk/src/main/java/org/jboss/ws/metadata/jsr181/HandlerChainsMetaData.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -1,66 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
-*/
-// $Id$
-package org.jboss.ws.metadata.jsr181;
-
-//$Id$
-
-import java.util.ArrayList;
-
-import org.jboss.ws.metadata.umdm.HandlerMetaData.HandlerType;
-
-/**
- * XML Binding root element for JSR-181 HandlerChain
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 15-Oct-2005
- */
-public class HandlerChainsMetaData
-{
- // The required handler type
- private HandlerType handlerType;
- // The required <handler-chain> elements
- private ArrayList<HandlerChainMetaData> handlerChains = new
ArrayList<HandlerChainMetaData>();
-
- public HandlerChainsMetaData(HandlerType handlerType)
- {
- this.handlerType = handlerType;
- }
-
- public HandlerType getHandlerType()
- {
- return handlerType;
- }
-
-
- public void addHandlerChain(HandlerChainMetaData handlerChain)
- {
- handlerChains.add(handlerChain);
- }
-
- public HandlerChainMetaData[] getHandlerChains()
- {
- HandlerChainMetaData[] array = new HandlerChainMetaData[handlerChains.size()];
- handlerChains.toArray(array);
- return array;
- }
-}
Copied: trunk/src/main/java/org/jboss/ws/metadata/jsr181/HandlerChainsMetaData.java (from
rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/jsr181/HandlerChainsMetaData.java)
Copied: trunk/src/main/java/org/jboss/ws/metadata/umdm (from rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/umdm)
Deleted: trunk/src/main/java/org/jboss/ws/metadata/umdm/ClientEndpointMetaData.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/umdm/ClientEndpointMetaData.java 2006-12-07
10:43:36 UTC (rev 1600)
+++ trunk/src/main/java/org/jboss/ws/metadata/umdm/ClientEndpointMetaData.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -1,170 +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.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.config.jaxws.WSConfigRootJAXWS;
-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 qname, QName
interfaceQName, Type type)
- {
- super(service, qname, interfaceQName, 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)
- {
- if (getType() == Type.JAXRPC)
- {
- configFile = "META-INF/standard-jaxrpc-client-config.xml";
- }
- else
- {
- configFile = "META-INF/standard-jaxws-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
- if (wsConfig instanceof WSConfigRootJAXRPC)
- {
- endpointConfig =
((WSConfigRootJAXRPC)wsConfig).getClientConfigByName(configName);
- if (endpointConfig == null)
- throw new WSException("Cannot obtain client config: " +
configName);
- }
- else
- {
- endpointConfig =
((WSConfigRootJAXWS)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 properties=" + getProperties());
-
- for (OperationMetaData opMetaData : getOperations())
- {
- buffer.append("\n" + opMetaData);
- }
- for (HandlerMetaData hdlMetaData : getHandlerMetaData(HandlerType.ALL))
- {
- buffer.append("\n" + hdlMetaData);
- }
- return buffer.toString();
- }
-}
Copied: trunk/src/main/java/org/jboss/ws/metadata/umdm/ClientEndpointMetaData.java (from
rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/umdm/ClientEndpointMetaData.java)
Deleted: trunk/src/main/java/org/jboss/ws/metadata/umdm/EndpointMetaData.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/umdm/EndpointMetaData.java 2006-12-07
10:43:36 UTC (rev 1600)
+++ trunk/src/main/java/org/jboss/ws/metadata/umdm/EndpointMetaData.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -1,590 +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.umdm;
-
-// $Id$
-
-import java.lang.reflect.Method;
-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 javax.xml.ws.Service.Mode;
-
-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.jaxrpc.TypeMappingImpl;
-import org.jboss.ws.core.jaxrpc.Use;
-import org.jboss.ws.core.jaxrpc.binding.JBossXBDeserializerFactory;
-import org.jboss.ws.core.jaxrpc.binding.JBossXBSerializerFactory;
-import org.jboss.ws.core.jaxrpc.binding.SOAPArrayDeserializerFactory;
-import org.jboss.ws.core.jaxrpc.binding.SOAPArraySerializerFactory;
-import org.jboss.ws.core.jaxws.JAXBDeserializerFactory;
-import org.jboss.ws.core.jaxws.JAXBSerializerFactory;
-import org.jboss.ws.core.utils.JavaUtils;
-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 name of the WSDL interface/portType
- private QName interfaceQName;
- // 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;
- // 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;
- // The JAXWS ServiceMode
- private Mode serviceMode;
- // 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>();
-
- // JAX-WS default is false
- private boolean mtomEnabled = false;
-
- public EndpointMetaData(ServiceMetaData service, QName qname, QName interfaceQName,
Type type)
- {
- this.serviceMetaData = service;
- this.portName = qname;
- this.interfaceQName = interfaceQName;
- this.type = type;
-
- // The default binding
- this.bindingId = Constants.SOAP11HTTP_BINDING;
- }
-
- public ServiceMetaData getServiceMetaData()
- {
- return serviceMetaData;
- }
-
- public QName getQName()
- {
- return portName;
- }
-
- public QName getInterfaceQName()
- {
- return interfaceQName;
- }
-
- 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 (!Constants.SOAP11HTTP_BINDING.equals(bindingId) &&
!Constants.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;
- }
-
- /**
- * 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 Mode getServiceMode()
- {
- return serviceMode;
- }
-
- public void setServiceMode(Mode serviceMode)
- {
- this.serviceMode = serviceMode;
- }
-
- public Type getType()
- {
- return type;
- }
-
- public boolean isMtomEnabled() {
- return mtomEnabled;
- }
-
- public void setMtomEnabled(boolean mtomEnabled) {
- this.mtomEnabled = mtomEnabled;
- }
-
- public String getAuthMethod()
- {
- return authMethod;
- }
-
- public void setAuthMethod(String authMethod)
- {
- this.authMethod = authMethod;
- }
-
- 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 aux : operations)
- {
- QName opQName = aux.getQName();
- String javaName = aux.getJavaName();
- if (opQName.equals(xmlName) &&
!javaName.endsWith(Constants.ASYNC_METHOD_SUFFIX))
- {
- if (opMetaData == null)
- {
- opMetaData = aux;
- }
- else
- {
- throw new WSException("Cannot uniquely indentify 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 indentify 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);
- if (opMetaData == null)
- {
- for (OperationMetaData aux : operations)
- {
- boolean doesMatch = aux.getJavaMethod().equals(method);
-
- // fallback for async methods
- if(!doesMatch &&
method.getName().endsWith(Constants.ASYNC_METHOD_SUFFIX))
- {
- String name = method.getName();
- name = name.substring(0, name.length()-5);
- doesMatch = aux.getJavaName().equals(name);
- }
-
- if (doesMatch)
- {
- opMetaDataCache.put(method, aux);
- opMetaData = aux;
- break;
- }
-
- }
- }
- 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();
-
- eagerInitializeOperations();
- eagerInitializeTypes();
- }
-
- private void eagerInitializeOperations()
- {
- 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);
- }
- }
- }
- }
-
- private void eagerInitializeTypes()
- {
- TypeMappingImpl typeMapping = serviceMetaData.getTypeMapping();
- for (TypeMappingMetaData tmMetaData :
serviceMetaData.getTypesMetaData().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 = 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
- {
- if (getType() == Type.JAXWS)
- {
- typeMapping.register(javaType, xmlType, new
JAXBSerializerFactory(), new JAXBDeserializerFactory());
- }
- else
- {
- typeMapping.register(javaType, xmlType, new
JBossXBSerializerFactory(), new JBossXBDeserializerFactory());
- }
- }
- }
- catch (ClassNotFoundException e)
- {
- log.warn("Cannot load class for type: " + xmlType +
"," + javaTypeName);
- }
- }
- }
- }
- }
-}
Copied: trunk/src/main/java/org/jboss/ws/metadata/umdm/EndpointMetaData.java (from rev
1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/umdm/EndpointMetaData.java)
Deleted: trunk/src/main/java/org/jboss/ws/metadata/umdm/ExtensibleMetaData.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/umdm/ExtensibleMetaData.java 2006-12-07
10:43:36 UTC (rev 1600)
+++ trunk/src/main/java/org/jboss/ws/metadata/umdm/ExtensibleMetaData.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -1,29 +0,0 @@
-package org.jboss.ws.metadata.umdm;
-
-import java.util.HashMap;
-import java.util.Map;
-
-
-/**
- * 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: trunk/src/main/java/org/jboss/ws/metadata/umdm/ExtensibleMetaData.java (from rev
1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/umdm/ExtensibleMetaData.java)
Deleted: trunk/src/main/java/org/jboss/ws/metadata/umdm/FaultMetaData.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/umdm/FaultMetaData.java 2006-12-07
10:43:36 UTC (rev 1600)
+++ trunk/src/main/java/org/jboss/ws/metadata/umdm/FaultMetaData.java 2006-12-07 12:05:41
UTC (rev 1603)
@@ -1,183 +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.umdm;
-
-// $Id$
-
-import javax.xml.namespace.QName;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.WSException;
-import org.jboss.ws.core.jaxws.DynamicWrapperGenerator;
-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 String faultBeanName;
- private Class javaType;
- private Class faultBean;
-
- public FaultMetaData(OperationMetaData operation, QName xmlName, QName xmlType, String
javaTypeName)
- {
- this(operation, xmlName, javaTypeName);
- setXmlType(xmlType);
- }
-
- public FaultMetaData(OperationMetaData operation, QName xmlName, String javaTypeName)
- {
- if (xmlName == null)
- throw new IllegalArgumentException("Invalid null xmlName argument");
- if (javaTypeName == null)
- throw new IllegalArgumentException("Invalid null javaTypeName argument,
for: " + xmlName);
-
- this.opMetaData = operation;
- this.xmlName = xmlName;
- this.javaTypeName = javaTypeName;
- }
-
- public OperationMetaData getOperationMetaData()
- {
- return opMetaData;
- }
-
- public QName getXmlName()
- {
- return xmlName;
- }
-
- public QName getXmlType()
- {
- return xmlType;
- }
-
- public void setXmlType(QName xmlType)
- {
- if (xmlType == null)
- throw new IllegalArgumentException("Invalid null xmlType argument, for:
" + xmlName);
-
- this.xmlType = 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 String getFaultBeanName()
- {
- return faultBeanName;
- }
-
- public void setFaultBeanName(String faultBeanName)
- {
- this.faultBeanName = faultBeanName;
- }
-
- public Class getFaultBean()
- {
- Class tmpFaultBean = faultBean;
- if (tmpFaultBean == null && faultBeanName != null)
- {
- try
- {
- ClassLoader loader = opMetaData.getEndpointMetaData().getClassLoader();
- tmpFaultBean = JavaUtils.loadJavaType(faultBeanName, loader);
- }
- catch (ClassNotFoundException ex)
- {
- throw new WSException("Cannot load fault bean: " + faultBeanName,
ex);
- }
- }
- return tmpFaultBean;
- }
-
- public void validate()
- {
- // nothing to do
- }
-
- public void eagerInitialize()
- {
- ClassLoader loader = opMetaData.getEndpointMetaData().getClassLoader();
- new DynamicWrapperGenerator(loader).generate(this);
-
- // Initialize the cache
- javaType = getJavaType();
- if (javaType == null)
- throw new WSException("Cannot load java type: " + javaTypeName);
-
- faultBean = getFaultBean();
- }
-
- public String toString()
- {
- StringBuilder buffer = new StringBuilder("\nFaultMetaData");
- buffer.append("\n xmlName=" + xmlName);
- buffer.append("\n xmlType=" + xmlType);
- buffer.append("\n javaType=" + javaTypeName);
- buffer.append("\n faultBean=" + faultBeanName);
- return buffer.toString();
- }
-}
\ No newline at end of file
Copied: trunk/src/main/java/org/jboss/ws/metadata/umdm/FaultMetaData.java (from rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/umdm/FaultMetaData.java)
Deleted: trunk/src/main/java/org/jboss/ws/metadata/umdm/HandlerMetaData.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/umdm/HandlerMetaData.java 2006-12-07
10:43:36 UTC (rev 1600)
+++ trunk/src/main/java/org/jboss/ws/metadata/umdm/HandlerMetaData.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -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.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;
-
-/**
- * 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 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 handlerClass)
- {
- this.handlerClassName = handlerClass;
- }
-
- 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(org.jboss.ws.extensions.security.jaxrpc.WSSecurityHandlerInbound.class.getName());
-
securityHandlers.add(org.jboss.ws.extensions.security.jaxrpc.WSSecurityHandlerOutbound.class.getName());
-
securityHandlers.add(org.jboss.ws.extensions.security.jaxws.WSSecurityHandlerInbound.class.getName());
-
securityHandlers.add(org.jboss.ws.extensions.security.jaxws.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: trunk/src/main/java/org/jboss/ws/metadata/umdm/HandlerMetaData.java (from rev
1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/umdm/HandlerMetaData.java)
Deleted: trunk/src/main/java/org/jboss/ws/metadata/umdm/HandlerMetaDataJAXRPC.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/umdm/HandlerMetaDataJAXRPC.java 2006-12-07
10:43:36 UTC (rev 1600)
+++ trunk/src/main/java/org/jboss/ws/metadata/umdm/HandlerMetaDataJAXRPC.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -1,82 +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.umdm;
-
-//$Id:HandlerMetaDataJAXRPC.java 915 2006-09-08 08:40:45Z thomas.diesler(a)jboss.com $
-
-import java.util.HashSet;
-import java.util.Set;
-
-
-/**
- * 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: trunk/src/main/java/org/jboss/ws/metadata/umdm/HandlerMetaDataJAXRPC.java (from
rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/umdm/HandlerMetaDataJAXRPC.java)
Deleted: trunk/src/main/java/org/jboss/ws/metadata/umdm/HandlerMetaDataJAXWS.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/umdm/HandlerMetaDataJAXWS.java 2006-12-07
10:43:36 UTC (rev 1600)
+++ trunk/src/main/java/org/jboss/ws/metadata/umdm/HandlerMetaDataJAXWS.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -1,94 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.ws.metadata.umdm;
-
-//$Id$
-
-import javax.xml.namespace.QName;
-
-
-/**
- * The JAXWS metdata data for a handler element
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 05-May-2006
- */
-public class HandlerMetaDataJAXWS extends HandlerMetaData
-{
- private static final long serialVersionUID = 7631133188974299826L;
-
- // The JAXWS protocol bindings
- private String protocolBindings;
- // The JAXWS service name pattern
- private QName serviceNamePattern;
- // The JAXWS port name pattern
- private QName portNamePattern;
-
- public HandlerMetaDataJAXWS(EndpointMetaData epMetaData, HandlerType type)
- {
- super(epMetaData, type);
- }
-
- public QName getPortNamePattern()
- {
- return portNamePattern;
- }
-
- public void setPortNamePattern(QName portNamePattern)
- {
- this.portNamePattern = portNamePattern;
- }
-
- public String getProtocolBindings()
- {
- return protocolBindings;
- }
-
- public void setProtocolBindings(String protocolBindings)
- {
- this.protocolBindings = protocolBindings;
- }
-
- public QName getServiceNamePattern()
- {
- return serviceNamePattern;
- }
-
- public void setServiceNamePattern(QName serviceNamePattern)
- {
- this.serviceNamePattern = serviceNamePattern;
- }
-
- public String toString()
- {
- StringBuffer buffer = new StringBuffer("\nHandlerMetaDataJAXWS:");
- buffer.append("\n type=" + getHandlerType());
- buffer.append("\n name=" + getHandlerName());
- buffer.append("\n class=" + getHandlerClass());
- buffer.append("\n params=" + getInitParams());
- buffer.append("\n protocols=" + getProtocolBindings());
- buffer.append("\n services=" + getServiceNamePattern());
- buffer.append("\n ports=" + getPortNamePattern());
- return buffer.toString();
- }
-
-}
Copied: trunk/src/main/java/org/jboss/ws/metadata/umdm/HandlerMetaDataJAXWS.java (from rev
1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/umdm/HandlerMetaDataJAXWS.java)
Deleted: trunk/src/main/java/org/jboss/ws/metadata/umdm/MetaDataExtension.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/umdm/MetaDataExtension.java 2006-12-07
10:43:36 UTC (rev 1600)
+++ trunk/src/main/java/org/jboss/ws/metadata/umdm/MetaDataExtension.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -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.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: trunk/src/main/java/org/jboss/ws/metadata/umdm/MetaDataExtension.java (from rev
1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/umdm/MetaDataExtension.java)
Deleted: trunk/src/main/java/org/jboss/ws/metadata/umdm/OperationMetaData.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/umdm/OperationMetaData.java 2006-12-07
10:43:36 UTC (rev 1600)
+++ trunk/src/main/java/org/jboss/ws/metadata/umdm/OperationMetaData.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -1,521 +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.umdm;
-
-// $Id$
-
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-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.Style;
-import org.jboss.ws.core.jaxrpc.Use;
-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"), new QName("mock-interface"), 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();
- if (javaName.equals(methodName))
- {
- log.trace("Found java method: " + method);
-
- // compare params by java type name
- if (matchParameters(method, true))
- {
- log.debug("Found best matching java method: " + method);
- isJavaMethod = true;
- }
-
- // compare params by assignability
- if (!isJavaMethod && matchParameters(method, 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;
- }
-
- private boolean matchParameters(Method method, boolean exact)
- {
- Class[] paramTypes = method.getParameterTypes();
- Set<Integer> matches = new HashSet<Integer>(paramTypes.length);
-
- for (ParameterMetaData param : getParameters())
- {
- if (param.matchParameter(method, matches, exact) == false)
- return false;
- }
-
- // We should have an entry for every parameter index if we match
- if (matches.size() != paramTypes.length)
- return false;
-
- ParameterMetaData returnMetaData = getReturnParameter();
- if (returnMetaData != null)
- {
- return returnMetaData.matchParameter(method, matches, exact);
- }
-
- return true;
- }
-
- /** 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;
- }
-
- public boolean isOneWay()
- {
- return oneWay;
- }
-
- public void setOneWay(boolean oneWay)
- {
- this.oneWay = oneWay;
- 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);
- returnParam.setIndex(-1);
- 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 (in > 1 || out > (oneWay ? 0 : 1))
- throw new WSException("The body of a document/literal bare message
requires at most 1 input and at most 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: trunk/src/main/java/org/jboss/ws/metadata/umdm/OperationMetaData.java (from rev
1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/umdm/OperationMetaData.java)
Deleted: trunk/src/main/java/org/jboss/ws/metadata/umdm/ParameterMetaData.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/umdm/ParameterMetaData.java 2006-12-07
10:43:36 UTC (rev 1600)
+++ trunk/src/main/java/org/jboss/ws/metadata/umdm/ParameterMetaData.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -1,476 +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.umdm;
-
-// $Id$
-
-import java.lang.reflect.Method;
-import java.lang.reflect.Type;
-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.jaxws.DynamicWrapperGenerator;
-import org.jboss.ws.core.utils.HolderUtils;
-import org.jboss.ws.core.utils.JavaUtils;
-import org.jboss.ws.extensions.xop.jaxws.ReflectiveXOPScanner;
-import org.jboss.ws.metadata.acessor.ReflectiveMethodAccessor;
-import org.jboss.ws.metadata.umdm.WrappedParameter.AccessorFactory;
-
-/**
- * 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 String partName;
- 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<WrappedParameter> wrappedParameters;
- private int index;
-
- // SOAP-ENC:Array
- private boolean soapArrayParam;
- private QName soapArrayCompType;
- private AccessorFactoryCreator accessorFactoryCreator =
ReflectiveMethodAccessor.FACTORY_CREATOR;
-
- public static interface AccessorFactoryCreator
- {
- public AccessorFactory create(ParameterMetaData parameter);
- }
-
- 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(opMetaData, xmlName, javaTypeName);
- setXmlType(xmlType);
- }
-
- public ParameterMetaData(OperationMetaData opMetaData, QName xmlName, String
javaTypeName)
- {
- if (xmlName == null)
- throw new IllegalArgumentException("Invalid null xmlName argument");
-
- // Remove the prefixes
- if (xmlName.getNamespaceURI().length() > 0)
- xmlName = new QName(xmlName.getNamespaceURI(), xmlName.getLocalPart());
-
- this.xmlName = xmlName;
- this.opMetaData = opMetaData;
- this.mode = ParameterMode.IN;
- this.partName = xmlName.getLocalPart();
- this.javaTypeName = javaTypeName;
- }
-
- private static boolean matchParameter(Method method, int index, Class expectedType,
Set<Integer> matches, boolean exact, boolean holder)
- {
- Class returnType = method.getReturnType();
- Type[] parameters = method.getGenericParameterTypes();
-
- if (index == -1 && matchTypes(returnType, expectedType, exact, false))
- return true;
-
- if (index < parameters.length && matchTypes(parameters[index],
expectedType, exact, holder))
- {
- matches.add(index);
- return true;
- }
-
- return false;
- }
-
- private static boolean matchTypes(Type actualType, Class expectedType, boolean exact,
boolean holder)
- {
- if (holder && HolderUtils.isHolderType(actualType) == false)
- return false;
-
- Type valueType = (holder ? HolderUtils.getValueType(actualType) : actualType);
- Class valueClass = JavaUtils.erasure(valueType);
- boolean matched = (exact ? valueClass.getName().equals(expectedType.getName()) :
JavaUtils.isAssignableFrom(valueClass, expectedType));
-
- return matched;
- }
-
- public OperationMetaData getOperationMetaData()
- {
- return opMetaData;
- }
-
- public QName getXmlName()
- {
- return xmlName;
- }
-
- public QName getXmlType()
- {
- return xmlType;
- }
-
- public void setXmlType(QName xmlType)
- {
- if (xmlType == null)
- throw new IllegalArgumentException("Invalid null xmlType");
-
- // Remove potential prefix
- if (xmlType.getNamespaceURI().length() > 0)
- this.xmlType = new QName(xmlType.getNamespaceURI(), xmlType.getLocalPart());
- else this.xmlType = xmlType;
-
- // Special case to identify attachments
- if (Constants.NS_ATTACHMENT_MIME_TYPE.equals(xmlType.getNamespaceURI()))
- {
- String mimeType = convertXmlTypeToMimeType(xmlType);
- setMimeTypes(mimeType);
- this.isSwA = true;
- }
- }
-
- 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 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 int getIndex()
- {
- return index;
- }
-
- public void setIndex(int index)
- {
- this.index = index;
- }
-
- public List<WrappedParameter> getWrappedParameters()
- {
- return wrappedParameters;
- }
-
- public void setWrappedParameters(List<WrappedParameter> wrappedParameters)
- {
- this.wrappedParameters = wrappedParameters;
- }
-
- public String getPartName()
- {
- return partName;
- }
-
- public void setPartName(String partName)
- {
- this.partName = partName;
- }
-
- public void validate()
- {
- // nothing to do
- }
-
- /**
- * @see UnifiedMetaData#eagerInitialize()
- */
- public void eagerInitialize()
- {
- // reset java type
- javaType = null;
-
- if (getOperationMetaData().isDocumentWrapped() && isMessageType() ==
false)
- {
- new DynamicWrapperGenerator(getClassLoader()).generate(this);
-
- // Initialize accessors
- AccessorFactory factory = accessorFactoryCreator.create(this);
- for (WrappedParameter wrapped : wrappedParameters)
- wrapped.setAccessor(factory.create(wrapped));
- }
-
- javaType = getJavaType();
- if (javaType == null)
- throw new WSException("Cannot load java type: " + javaTypeName);
-
- // check if the JavaType is an mtom parameter
- // TODO: this should only apply to JAX-WS and needs to happen outside UMD
- ReflectiveXOPScanner scanner = new ReflectiveXOPScanner();
- String mimeType = scanner.scan(javaType);
- if(mimeType!=null)
- {
- log.debug("MTOM parameter found: " + xmlName);
- setXOP(true);
- }
- }
-
-
- private ClassLoader getClassLoader()
- {
- ClassLoader loader =
opMetaData.getEndpointMetaData().getServiceMetaData().getUnifiedMetaData().getClassLoader();
- if (loader == null)
- throw new WSException("ClassLoader not available");
- return loader;
- }
-
- public boolean matchParameter(Method method, Set<Integer> matches, boolean
exact)
- {
- ClassLoader loader =
getOperationMetaData().getEndpointMetaData().getClassLoader();
- List<WrappedParameter> wrappedParameters = getWrappedParameters();
- Class wrapperType = getJavaType();
-
- // Standard type
- if (wrappedParameters == null)
- return matchParameter(method, getIndex(), getJavaType(), matches, exact, mode !=
ParameterMode.IN);
-
- // Wrapped type
- for (WrappedParameter wrapped : wrappedParameters)
- {
- String typeName = wrapped.getType();
-
- try
- {
- Class type = (typeName != null) ? JavaUtils.loadJavaType(typeName, loader) :
ParameterWrapping.getWrappedType(wrapped.getVariable(), wrapperType);
- if (type == null)
- return false;
- if (!matchParameter(method, wrapped.getIndex(), type, matches, exact,
wrapped.isHolder()))
- return false;
- }
- catch (Exception ex)
- {
- log.debug("Invalid wrapper type:" + typeName, ex);
- return false;
- }
- }
-
- return true;
- }
-
- public void setAccessorFactoryCreator(AccessorFactoryCreator accessorFactoryCreator)
- {
- this.accessorFactoryCreator = accessorFactoryCreator;
- }
-
- public String toString()
- {
- boolean isReturn = (opMetaData.getReturnParameter() == this);
- StringBuilder buffer = new StringBuilder("\n" + (isReturn ?
"ReturnMetaData:" : "ParameterMetaData:"));
- buffer.append("\n xmlName=" + getXmlName());
- buffer.append("\n partName=" + getPartName());
- buffer.append("\n xmlType=" + getXmlType());
- buffer.append("\n javaType=" + getJavaTypeName());
- buffer.append("\n mode=" + getMode());
- buffer.append("\n inHeader=" + isInHeader());
- buffer.append("\n index=" + index);
-
- if (soapArrayParam)
- buffer.append("\n soapArrayCompType=" + soapArrayCompType);
-
- if (isSwA())
- {
- buffer.append("\n isSwA=" + isSwA());
- buffer.append("\n mimeTypes=" + getMimeTypes());
- }
-
- if (wrappedParameters != null)
- buffer.append("\n wrappedParameters=" + wrappedParameters);
-
- if (isXOP())
- {
- buffer.append("\n isXOP=" + isXOP());
- buffer.append("\n mimeTypes=" + getMimeTypes());
- }
-
- return buffer.toString();
- }
-}
Copied: trunk/src/main/java/org/jboss/ws/metadata/umdm/ParameterMetaData.java (from rev
1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/umdm/ParameterMetaData.java)
Deleted: trunk/src/main/java/org/jboss/ws/metadata/umdm/ServerEndpointMetaData.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/umdm/ServerEndpointMetaData.java 2006-12-07
10:43:36 UTC (rev 1600)
+++ trunk/src/main/java/org/jboss/ws/metadata/umdm/ServerEndpointMetaData.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -1,300 +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.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.config.jaxws.WSConfigRootJAXWS;
-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 optional transport guarantee
- private String transportGuarantee;
- // The bean that registers with the ServiceEndpointManager
- private String managedEndpointBean = ServiceEndpoint.class.getName();
-
- public ServerEndpointMetaData(ServiceMetaData service, QName qname, QName
interfaceQName, Type type)
- {
- super(service, qname, interfaceQName, 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)
- {
- if (contextRoot != null && contextRoot.startsWith("/") == false)
- throw new IllegalArgumentException("context root should start with
'/'");
-
- 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)
- {
- if (urlPattern != null && urlPattern.startsWith("/") == false)
- throw new IllegalArgumentException("url pattern should start with
'/'");
-
- this.urlPattern = urlPattern;
- }
-
- public String getTransportGuarantee()
- {
- return transportGuarantee;
- }
-
- public void setTransportGuarantee(String transportGuarantee)
- {
- this.transportGuarantee = transportGuarantee;
- }
-
- 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)
- {
- if (getType() == Type.JAXRPC)
- {
- configFile = "META-INF/standard-jaxrpc-endpoint-config.xml";
- }
- else
- {
- configFile = "META-INF/standard-jaxws-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
- if (wsConfig instanceof WSConfigRootJAXRPC)
- {
- endpointConfig =
((WSConfigRootJAXRPC)wsConfig).getEndpointConfigByName(configName);
- if (endpointConfig == null)
- throw new WSException("Cannot obtain endpoint config: " +
configName);
- }
- else
- {
- endpointConfig =
((WSConfigRootJAXWS)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 serviceMode=" + getServiceMode());
- 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: trunk/src/main/java/org/jboss/ws/metadata/umdm/ServerEndpointMetaData.java (from
rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/umdm/ServerEndpointMetaData.java)
Deleted: trunk/src/main/java/org/jboss/ws/metadata/umdm/ServiceMetaData.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/umdm/ServiceMetaData.java 2006-12-07
10:43:36 UTC (rev 1600)
+++ trunk/src/main/java/org/jboss/ws/metadata/umdm/ServiceMetaData.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -1,416 +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.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.jbossxb.SchemaBindingBuilder;
-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 serviceName;
- 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 serviceName)
- {
- this.wsMetaData = wsMetaData;
- this.serviceName = serviceName;
- this.types = new TypesMetaData(this);
- }
-
- public UnifiedMetaData getUnifiedMetaData()
- {
- return wsMetaData;
- }
-
- public void setServiceName(QName serviceName)
- {
- this.serviceName = serviceName;
- }
-
- public QName getServiceName()
- {
- return serviceName;
- }
-
- 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.getClassLoader().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.getClassLoader().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 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 (getServiceName().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=" + serviceName);
- 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: trunk/src/main/java/org/jboss/ws/metadata/umdm/ServiceMetaData.java (from rev
1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/umdm/ServiceMetaData.java)
Deleted: trunk/src/main/java/org/jboss/ws/metadata/umdm/TypeMappingMetaData.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/umdm/TypeMappingMetaData.java 2006-12-07
10:43:36 UTC (rev 1600)
+++ trunk/src/main/java/org/jboss/ws/metadata/umdm/TypeMappingMetaData.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -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.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: trunk/src/main/java/org/jboss/ws/metadata/umdm/TypeMappingMetaData.java (from rev
1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/umdm/TypeMappingMetaData.java)
Deleted: trunk/src/main/java/org/jboss/ws/metadata/umdm/TypesMetaData.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/umdm/TypesMetaData.java 2006-12-07
10:43:36 UTC (rev 1600)
+++ trunk/src/main/java/org/jboss/ws/metadata/umdm/TypesMetaData.java 2006-12-07 12:05:41
UTC (rev 1603)
@@ -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.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: trunk/src/main/java/org/jboss/ws/metadata/umdm/TypesMetaData.java (from rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/umdm/TypesMetaData.java)
Deleted: trunk/src/main/java/org/jboss/ws/metadata/umdm/UnifiedMetaData.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/umdm/UnifiedMetaData.java 2006-12-07
10:43:36 UTC (rev 1600)
+++ trunk/src/main/java/org/jboss/ws/metadata/umdm/UnifiedMetaData.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -1,219 +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.umdm;
-
-// $Id$
-
-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 canonical deployment name
- private String deploymentName;
- // 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()
- {
- this.classLoader = Thread.currentThread().getContextClassLoader();
- }
-
- 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 getDeploymentName()
- {
- return deploymentName;
- }
-
- public void setDeploymentName(String deploymentName)
- {
- this.deploymentName = deploymentName;
- }
-
- 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();
- if (implementationVersion != null)
- 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 deploymentName: " + getDeploymentName());
- 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();
- }
-}
Copied: trunk/src/main/java/org/jboss/ws/metadata/umdm/UnifiedMetaData.java (from rev
1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/umdm/UnifiedMetaData.java)
Deleted: trunk/src/main/java/org/jboss/ws/metadata/umdm/WrappedParameter.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/umdm/WrappedParameter.java 2006-12-07
10:43:36 UTC (rev 1600)
+++ trunk/src/main/java/org/jboss/ws/metadata/umdm/WrappedParameter.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -1,138 +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.umdm;
-
-import javax.xml.namespace.QName;
-
-import org.jboss.ws.core.utils.JavaUtils;
-
-/**
- * WrappedParameter represents a document/literal wrapped parameter.
- *
- * @author <a href="jason.greene(a)jboss.com">Jason T. Greene</a>
- * @version $Revision$
- */
-public class WrappedParameter
-{
- public static final int RETURN = -1;
- private QName name;
- private String type;
- private String[] typeArguments;
- private String variable;
- private boolean holder = false;
- private int index = -2;
- private Accessor accessor;
-
- public static interface AccessorFactory
- {
- public Accessor create(WrappedParameter parameter);
- }
-
- public static interface Accessor
- {
- public void set(Object bean, Object value);
- public Object get(Object bean);
- }
-
- public WrappedParameter(QName name, String type, String variable, int index)
- {
- this.setName(name);
- this.setType(type);
- this.setVariable(variable);
- this.setIndex(index);
- }
-
- public Accessor accessor()
- {
- return accessor;
- }
-
- public void setName(QName name)
- {
- this.name = name;
- }
-
- public QName getName()
- {
- return name;
- }
-
- public void setType(String type)
- {
- this.type = type;
- }
-
- public String getType()
- {
- return type;
- }
-
- public void setTypeArguments(String[] typeArguments)
- {
- this.typeArguments = typeArguments;
- }
-
- public String[] getTypeArguments()
- {
- return typeArguments;
- }
-
- public void setVariable(String variable)
- {
- this.variable = variable;
- }
-
- public String getVariable()
- {
- return variable;
- }
-
- public void setHolder(boolean holder)
- {
- this.holder = holder;
- }
-
- public boolean isHolder()
- {
- return holder;
- }
-
- public void setIndex(int index)
- {
- this.index = index;
- }
-
- public int getIndex()
- {
- return index;
- }
-
- void setAccessor(Accessor accessor)
- {
- this.accessor = accessor;
- }
-
- public String toString()
- {
- return "[name = " + getName() + ", type = " + getType() +
", typeArgs = " + JavaUtils.printArray(getTypeArguments()) + ", variable =
" + getVariable() + ", index = " + getIndex() + "]";
- }
-}
\ No newline at end of file
Copied: trunk/src/main/java/org/jboss/ws/metadata/umdm/WrappedParameter.java (from rev
1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/umdm/WrappedParameter.java)
Copied: trunk/src/main/java/org/jboss/ws/metadata/webservices (from rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/webservices)
Deleted: trunk/src/main/java/org/jboss/ws/metadata/webservices/PortComponentMetaData.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/webservices/PortComponentMetaData.java 2006-12-07
10:43:36 UTC (rev 1600)
+++
trunk/src/main/java/org/jboss/ws/metadata/webservices/PortComponentMetaData.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -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.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();
- }
-}
Copied: trunk/src/main/java/org/jboss/ws/metadata/webservices/PortComponentMetaData.java
(from rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/webservices/PortComponentMetaData.java)
Deleted:
trunk/src/main/java/org/jboss/ws/metadata/webservices/WebserviceDescriptionMetaData.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/webservices/WebserviceDescriptionMetaData.java 2006-12-07
10:43:36 UTC (rev 1600)
+++
trunk/src/main/java/org/jboss/ws/metadata/webservices/WebserviceDescriptionMetaData.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -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.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();
- }
-}
Copied:
trunk/src/main/java/org/jboss/ws/metadata/webservices/WebserviceDescriptionMetaData.java
(from rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/webservices/WebserviceDescriptionMetaData.java)
Deleted: trunk/src/main/java/org/jboss/ws/metadata/webservices/WebservicesFactory.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/webservices/WebservicesFactory.java 2006-12-07
10:43:36 UTC (rev 1600)
+++
trunk/src/main/java/org/jboss/ws/metadata/webservices/WebservicesFactory.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -1,213 +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.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.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: trunk/src/main/java/org/jboss/ws/metadata/webservices/WebservicesFactory.java
(from rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/webservices/WebservicesFactory.java)
Deleted: trunk/src/main/java/org/jboss/ws/metadata/webservices/WebservicesMetaData.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/webservices/WebservicesMetaData.java 2006-12-07
10:43:36 UTC (rev 1600)
+++
trunk/src/main/java/org/jboss/ws/metadata/webservices/WebservicesMetaData.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -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.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' >");
- }
-}
Copied: trunk/src/main/java/org/jboss/ws/metadata/webservices/WebservicesMetaData.java
(from rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/webservices/WebservicesMetaData.java)
Copied: trunk/src/main/java/org/jboss/ws/metadata/wsdl (from rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl)
Deleted: trunk/src/main/java/org/jboss/ws/metadata/wsdl/DOMTypes.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/DOMTypes.java 2006-12-07
10:43:36 UTC (rev 1600)
+++ trunk/src/main/java/org/jboss/ws/metadata/wsdl/DOMTypes.java 2006-12-07 12:05:41 UTC
(rev 1603)
@@ -1,62 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
-*/
-package org.jboss.ws.metadata.wsdl;
-
-import javax.xml.namespace.QName;
-
-import org.jboss.util.NotImplementedException;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-
-/**
- * A DOM Element based schema representation. Care should be taken to ensure
- * thread safety.
- *
- * @author <a href="mailto:jason.greene@jboss.com">Jason T.
Greene</a>
- * @version $Revision$
- */
-public class DOMTypes extends WSDLTypes
-{
- /*
- * Perhaps we should consider moving this to JDOM, or some other DOM
- * framework that supports concurrent readers. For now callers must
- * synchronize properly.
- *
- * Also could use a cached StAX pool.
- */
- private Element element;
-
- public DOMTypes(Document doc)
- {
- this.element = doc.createElementNS(null, "types");
- }
-
- public Element getElement()
- {
- return element;
- }
-
- public QName getXMLType(QName name)
- {
- throw new NotImplementedException();
- }
-}
\ No newline at end of file
Copied: trunk/src/main/java/org/jboss/ws/metadata/wsdl/DOMTypes.java (from rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/DOMTypes.java)
Deleted: trunk/src/main/java/org/jboss/ws/metadata/wsdl/Extendable.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/Extendable.java 2006-12-07
10:43:36 UTC (rev 1600)
+++ trunk/src/main/java/org/jboss/ws/metadata/wsdl/Extendable.java 2006-12-07 12:05:41 UTC
(rev 1603)
@@ -1,86 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
-*/
-package org.jboss.ws.metadata.wsdl;
-
-// $Id$
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import org.jboss.logging.Logger;
-
-/**
- * An abstract base class of a WSDL extendable element.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 10-Oct-2004
- */
-public abstract class Extendable implements Serializable
-{
- // provide logging
- private Logger log = Logger.getLogger(getClass());
-
- private Map features = new LinkedHashMap();
- private Map properties = new LinkedHashMap();
-
- public WSDLFeature[] getFeatures()
- {
- WSDLFeature[] arr = new WSDLFeature[features.size()];
- new ArrayList(features.values()).toArray(arr);
- return arr;
- }
-
- public void addFeature(WSDLFeature feature)
- {
- log.trace("addFeature: " + feature);
- String uri = feature.getURI();
- features.put(uri, feature);
- }
-
- public WSDLFeature getFeature(String uri)
- {
- WSDLFeature feature = (WSDLFeature)features.get(uri);
- return feature;
- }
-
- public WSDLProperty[] getProperties()
- {
- WSDLProperty[] arr = new WSDLProperty[properties.size()];
- new ArrayList(properties.values()).toArray(arr);
- return arr;
- }
-
- public void addProperty(WSDLProperty property)
- {
- log.trace("addProperty: " + property);
- String uri = property.getURI();
- properties.put(uri, property);
- }
-
- public WSDLProperty getProperty(String uri)
- {
- WSDLProperty property = (WSDLProperty)properties.get(uri);
- return property;
- }
-}
Copied: trunk/src/main/java/org/jboss/ws/metadata/wsdl/Extendable.java (from rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/Extendable.java)
Deleted: trunk/src/main/java/org/jboss/ws/metadata/wsdl/NCName.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/NCName.java 2006-12-07
10:43:36 UTC (rev 1600)
+++ trunk/src/main/java/org/jboss/ws/metadata/wsdl/NCName.java 2006-12-07 12:05:41 UTC
(rev 1603)
@@ -1,76 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
-*/
-package org.jboss.ws.metadata.wsdl;
-
-import java.io.Serializable;
-
-import javax.xml.namespace.QName;
-
-// $Id$
-
-
-/**
- * The value space of the wsdls:NCName type is the subset of the value space of the
wsdls:Token type
- * consisting of tokens that do not contain the space (#x20) and ':' characters.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 10-Oct-2004
- */
-public class NCName implements Serializable
-{
- private static final long serialVersionUID = -4997456323552864649L;
-
- private String name;
-
- public NCName(QName qname)
- {
- this(qname != null ? qname.getLocalPart() : null);
- }
-
- public NCName(String name)
- {
- if (name == null || name.indexOf(':') >= 0 || name.indexOf(' ')
>= 0)
- throw new IllegalArgumentException("Illegal NCName: " + name);
-
- this.name = name;
- }
-
- public boolean equals(Object obj)
- {
- if (obj instanceof NCName)
- return name.equals(((NCName)obj).name);
- if (obj instanceof String)
- return name.equals(((String)obj));
-
- return false;
- }
-
- public int hashCode()
- {
- return name.hashCode();
- }
-
- public String toString()
- {
- return name;
- }
-}
Copied: trunk/src/main/java/org/jboss/ws/metadata/wsdl/NCName.java (from rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/NCName.java)
Deleted: trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLBinding.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLBinding.java 2006-12-07
10:43:36 UTC (rev 1600)
+++ trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLBinding.java 2006-12-07 12:05:41
UTC (rev 1603)
@@ -1,185 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
-*/
-package org.jboss.ws.metadata.wsdl;
-
-// $Id$
-
-import java.io.Serializable;
-import java.util.ArrayList;
-
-import javax.xml.namespace.QName;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.WSException;
-
-/**
- * A Binding component describes a concrete message format and transmission protocol
which may be used
- * to define an endpoint (see 2.14 Endpoint [p.62] ). That is, a Binding component
defines the
- * implementation details necessary to accessing the service.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 10-Oct-2004
- */
-public class WSDLBinding implements Serializable
-{
- private static final long serialVersionUID = -7699953670233209811L;
-
- // provide logging
- private static final Logger log = Logger.getLogger(WSDLBinding.class);
-
- // The parent WSDL definitions element.
- private WSDLDefinitions wsdlDefinitions;
-
- /** The REQUIRED name attribute information item together with the targetNamespace
attribute information item
- * of the definitions element information item forms the QName of the binding.*/
- private NCName name;
-
- /** Derived QName identifier.
- */
- private QName qname;
-
- /** The OPTIONAL interface attribute information item refers, by QName, to an
Interface component. */
- private QName interfaceName;
-
- /** The REQUIRED type attribute information item identifies the kind of binding
details contained in the Binding
- * component. See wsdl20-bindings for valid values. */
- private String type;
-
- /** The set of Binding Fault components corresponding to the fault element
- * information items in [children], if any.*/
- private ArrayList<WSDLBindingFault> faults = new
ArrayList<WSDLBindingFault>();
-
- /** The set of Binding Operation components corresponding to the operation element
- * information items in [children], if any.*/
- private ArrayList<WSDLBindingOperation> operations = new
ArrayList<WSDLBindingOperation>();
-
- public WSDLBinding(WSDLDefinitions wsdlDefinitions)
- {
- log.trace("new WSDLBinding");
- this.wsdlDefinitions = wsdlDefinitions;
- }
-
- public WSDLDefinitions getWsdlDefinitions()
- {
- return wsdlDefinitions;
- }
-
- public NCName getName()
- {
- return name;
- }
-
- public void setName(NCName name)
- {
- log.trace("setName: " + name);
- this.name = name;
- }
-
- public QName getQName()
- {
- if (qname == null)
- {
- String tnsURI = wsdlDefinitions.getTargetNamespace();
- qname = new QName(tnsURI, name.toString());
- }
- return qname;
- }
-
-
- public void setQName(QName qname)
- {
- log.trace("setQName: " + qname);
- this.qname = qname;
- }
-
- public QName getInterfaceName()
- {
- return interfaceName;
- }
-
- public void setInterfaceName(QName interfaceName)
- {
- log.trace("setInterfaceName: " + name);
- this.interfaceName = interfaceName;
- }
-
- public WSDLInterface getInterface()
- {
- WSDLInterface wsdlInterface = wsdlDefinitions.getInterface(new
NCName(interfaceName.getLocalPart()));
- if (wsdlInterface == null)
- throw new WSException("Cannot get interface for name: " +
interfaceName);
- return wsdlInterface;
- }
-
- public String getType()
- {
- return type;
- }
-
- public void setType(String type)
- {
- this.type = type;
- }
-
- public WSDLBindingFault[] getFaults()
- {
- WSDLBindingFault[] arr = new WSDLBindingFault[faults.size()];
- faults.toArray(arr);
- return arr;
- }
-
- public void addFault(WSDLBindingFault fault)
- {
- faults.add(fault);
- }
-
- public WSDLBindingOperation[] getOperations()
- {
- WSDLBindingOperation[] arr = new WSDLBindingOperation[operations.size()];
- operations.toArray(arr);
- return arr;
- }
-
- public WSDLBindingOperation getOperationByRef(QName qname)
- {
- WSDLBindingOperation wsdlBindingOperation = null;
- for (WSDLBindingOperation aux : operations)
- {
- if (aux.getRef().equals(qname))
- {
- if (wsdlBindingOperation != null)
- log.warn("Multiple binding operations reference: " + qname);
- wsdlBindingOperation = aux;
- }
- }
-
- if (wsdlBindingOperation == null)
- log.warn("Cannot obtain binding operation for ref: " + qname);
-
- return wsdlBindingOperation;
- }
-
- public void addOperation(WSDLBindingOperation operation)
- {
- operations.add(operation);
- }
-}
\ No newline at end of file
Copied: trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLBinding.java (from rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLBinding.java)
Deleted: trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLBindingFault.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLBindingFault.java 2006-12-07
10:43:36 UTC (rev 1600)
+++ trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLBindingFault.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -1,69 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
-*/
-package org.jboss.ws.metadata.wsdl;
-
-// $Id$
-
-import java.io.Serializable;
-
-import javax.xml.namespace.QName;
-
-/**
- * A Binding Fault component describes a concrete binding of a particular fault within an
interface to a
- * particular concrete message format. A particular fault of an interface is uniquely
identified by the target
- * namespace of the interface and the name of the fault within that interface.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 10-Oct-2004
- */
-public class WSDLBindingFault implements Serializable
-{
- private static final long serialVersionUID = 6306975072558524200L;
-
- // The parent WSDL binding
- private WSDLBinding wsdlBinding;
-
- /** An REQUIRED Interface Fault component in the {faults} property of the Interface
- * component identified by the {interface} property of the parent Binding component.
This is the
- * Interface Fault component for which binding information is being specified.*/
- private QName ref;
-
- public WSDLBindingFault(WSDLBinding wsdlBinding)
- {
- this.wsdlBinding = wsdlBinding;
- }
-
- public WSDLBinding getWsdlBinding()
- {
- return wsdlBinding;
- }
-
- public QName getRef()
- {
- return ref;
- }
-
- public void setRef(QName ref)
- {
- this.ref = ref;
- }
-}
Copied: trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLBindingFault.java (from rev
1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLBindingFault.java)
Deleted: trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLBindingMessageReference.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLBindingMessageReference.java 2006-12-07
10:43:36 UTC (rev 1600)
+++
trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLBindingMessageReference.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -1,126 +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.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-/**
- * A Binding Message Reference component describes a concrete binding of a
- * particular message participating in an operation to a particular concrete
- * message format.
- *
- * @author <a href="mailto:jason.greene@jboss.com">Jason T.
Greene</a>
- * @version $Revision$
- */
-public abstract class WSDLBindingMessageReference
-{
- // The parent WSDL binding operation
- private WSDLBindingOperation wsdlBindingOperation;
- private NCName messageLabel;
- private List<WSDLSOAPHeader> soapHeaders = new
ArrayList<WSDLSOAPHeader>();
- private List<WSDLMIMEPart> mimeParts = new ArrayList<WSDLMIMEPart>();
-
- public WSDLBindingMessageReference(WSDLBindingOperation wsdlBindingOperation)
- {
- this.wsdlBindingOperation = wsdlBindingOperation;
- }
-
- public WSDLBindingOperation getWsdlBindingOperation()
- {
- return wsdlBindingOperation;
- }
-
- /**
- * Gets the property that identifies the role that the message for which
- * binding details are being specified. The role is part of the {message
- * exchange pattern} of the Interface Operation component being bound by the
- * containing Binding Operation component.
- */
- public NCName getMessageLabel()
- {
- return messageLabel;
- }
-
- /**
- * Sets the property that identifies the role that the message for which
- * binding details are being specified. The role is part of the {message
- * exchange pattern} of the Interface Operation component being bound by the
- * containing Binding Operation component.
- */
- public void setMessageLabel(NCName messageLabel)
- {
- this.messageLabel = messageLabel;
- }
-
- /**
- * Gets the list of SOAP headers associated with this message reference.
- *
- * @return a list of soap headers
- */
- public List<WSDLSOAPHeader> getSoapHeaders()
- {
- return soapHeaders;
- }
-
- /**
- * Sets the list of SOAP headers associated with this message reference.
- *
- * @param soapHeaders The soapHeaders to set.
- */
- public void setSoapHeaders(List<WSDLSOAPHeader> soapHeaders)
- {
- this.soapHeaders = soapHeaders;
- }
-
- /**
- * Adds a SOAP header to the SOAP header list that is associated with this
- * message reference.
- *
- * @param soapHeader the SOAP header to add
- */
- public void addSoapHeader(WSDLSOAPHeader soapHeader)
- {
- this.soapHeaders.add(soapHeader);
- }
-
- /**
- * Adds a MIME part to this message reference. This is only used for WSDL 1.1.
- *
- * @param mimePart the mime part to add
- */
- public void addMimePart(WSDLMIMEPart mimePart)
- {
- this.mimeParts.add(mimePart);
- }
-
- /**
- * Returns a list of mime parts on this message
- *
- * @return
- */
- public Collection<WSDLMIMEPart> getMimeParts()
- {
- return mimeParts;
- }
-}
\ No newline at end of file
Copied: trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLBindingMessageReference.java
(from rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLBindingMessageReference.java)
Deleted: trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLBindingOperation.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLBindingOperation.java 2006-12-07
10:43:36 UTC (rev 1600)
+++ trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLBindingOperation.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -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.metadata.wsdl;
-
-// $Id$
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.xml.namespace.QName;
-
-import org.jboss.ws.Constants;
-
-/**
- * The Binding Operation component describes the concrete message format(s) and protocol
interaction(s)
- * associated with a particular interface operation for a given endpoint. A particular
operation of an interface
- * is uniquely identified by the target namespace of the interface and the name of the
operation within that
- * interface.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @author Anil.Saldhana(a)jboss.org
- * @since 10-Oct-2004
- */
-public class WSDLBindingOperation implements Comparable, Serializable
-{
- private static final long serialVersionUID = -1986624862746844610L;
-
- // The parent WSDL binding
- private WSDLBinding wsdlBinding;
-
- /** An Interface Operation component in the {operations} property of the Interface
component
- * identified by the {interface} property of the parent Binding component.
- * This is the Interface Operation component for which binding information is being
specified.*/
- private QName ref;
-
- /** WSDL-1.1, style attribute from the soap:binding element */
- private String encodingStyle = Constants.URI_LITERAL_ENC;
- /** WSDL-1.1, soapAction attribute from the soap:operation element */
- private String soapAction;
-
- /** A OPTIONAL set of Binding Message Reference components */
- private List<WSDLBindingOperationInput> inputs = new
ArrayList<WSDLBindingOperationInput>();
- /** A OPTIONAL set of Binding Message Reference components */
- private List<WSDLBindingOperationOutput> outputs = new
ArrayList<WSDLBindingOperationOutput>();
-
- public WSDLBindingOperation(WSDLBinding wsdlBinding)
- {
- this.wsdlBinding = wsdlBinding;
- }
-
- public WSDLBinding getWsdlBinding()
- {
- return wsdlBinding;
- }
-
- public QName getRef()
- {
- return ref;
- }
-
- public void setRef(QName ref)
- {
- this.ref = ref;
- }
-
- public String getEncodingStyle()
- {
- return encodingStyle;
- }
-
- public void setEncodingStyle(String encodingStyle)
- {
- this.encodingStyle = encodingStyle;
- }
-
-
- public String getSOAPAction()
- {
- return soapAction;
- }
-
- public void setSOAPAction(String soapAction)
- {
- this.soapAction = soapAction;
- }
-
- public WSDLBindingOperationInput[] getInputs()
- {
- WSDLBindingOperationInput[] arr = new WSDLBindingOperationInput[inputs.size()];
- inputs.toArray(arr);
- return arr;
- }
-
- public void addInput(WSDLBindingOperationInput input)
- {
- inputs.add(input);
- }
-
- public WSDLBindingOperationOutput[] getOutputs()
- {
- WSDLBindingOperationOutput[] arr = new WSDLBindingOperationOutput[outputs.size()];
- outputs.toArray(arr);
- return arr;
- }
-
- public void addOutput(WSDLBindingOperationOutput output)
- {
- outputs.add(output);
- }
-
- /* (non-Javadoc)
- * @see java.lang.Comparable#compareTo(T)
- */
- public int compareTo(Object obj)
- {
- int c = -1;
- if (obj instanceof WSDLBindingOperation)
- {
- WSDLBindingOperation w = (WSDLBindingOperation)obj;
- String oname = w.getRef().getLocalPart();
- String myname = ref.getLocalPart();
- c = myname.compareTo(oname);
- }
- return c;
- }
-}
Copied: trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLBindingOperation.java (from rev
1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLBindingOperation.java)
Deleted: trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLBindingOperationInput.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLBindingOperationInput.java 2006-12-07
10:43:36 UTC (rev 1600)
+++
trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLBindingOperationInput.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -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.metadata.wsdl;
-
-import java.io.Serializable;
-
-// $Id$
-
-/**
- * A Binding Message Reference component describes a concrete binding of a particular
message
- * participating in an operation to a particular concrete message format.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @author <a href="mailto:jason.greene@jboss.com">Jason T.
Greene</a>
- * @since 10-Oct-2004
- */
-public class WSDLBindingOperationInput extends WSDLBindingMessageReference implements
Serializable
-{
- private static final long serialVersionUID = -3945310906418557565L;
-
- public WSDLBindingOperationInput(WSDLBindingOperation wsdlBindingOperation)
- {
- super(wsdlBindingOperation);
- }
-}
Copied: trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLBindingOperationInput.java
(from rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLBindingOperationInput.java)
Deleted: trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLBindingOperationOutput.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLBindingOperationOutput.java 2006-12-07
10:43:36 UTC (rev 1600)
+++
trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLBindingOperationOutput.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -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.metadata.wsdl;
-
-import java.io.Serializable;
-
-// $Id$
-
-/**
- * A Binding Message Reference component describes a concrete binding of a particular
message
- * participating in an operation to a particular concrete message format.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @author <a href="mailto:jason.greene@jboss.com">Jason T.
Greene</a>
- * @since 10-Oct-2004
- */
-public class WSDLBindingOperationOutput extends WSDLBindingMessageReference implements
Serializable
-{
- private static final long serialVersionUID = -999199387765793475L;
-
- public WSDLBindingOperationOutput(WSDLBindingOperation wsdlBindingOperation)
- {
- super(wsdlBindingOperation);
- }
-}
Copied: trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLBindingOperationOutput.java
(from rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLBindingOperationOutput.java)
Deleted: trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLDefinitions.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLDefinitions.java 2006-12-07
10:43:36 UTC (rev 1600)
+++ trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLDefinitions.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -1,298 +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.Serializable;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.wsdl.Definition;
-import javax.xml.namespace.QName;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.Constants;
-import org.jboss.xb.binding.NamespaceRegistry;
-import org.w3c.dom.Document;
-
-/**
- * The top level Definitions component is just a container for two categories of
components;
- * WSDL components and type system components. WSDL components are interfaces, bindings
and services.
- *
- * Type system components describe the constraints on a message�s content.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 10-Oct-2004
- */
-public class WSDLDefinitions implements Serializable
-{
- private static final long serialVersionUID = 1643422922694990226L;
-
- // provide logging
- private final Logger log = Logger.getLogger(WSDLDefinitions.class);
-
- /** The REQUIRED targetNamespace attribute information item defines the namespace
affiliation of top-level
- * components defined in this definitions element information item. Interfaces,
Bindings and Services
- * are top-level components. */
- private String targetNamespace;
- /** The REQUIRED wsdl namespace. For WSDL-2.0 it is
http://www.w3.org/2003/11/wsdl,
- * for WSDL-1.1 it is
http://schemas.xmlsoap.org/wsdl/ */
- private String wsdlNamespace;
- /** Zero or more import element information items */
- private List<WSDLImport> imports = new ArrayList<WSDLImport>();
- /** Zero or more include element information items */
- private List<WSDLInclude> includes = new ArrayList<WSDLInclude>();
- /** Types element information item */
- private WSDLTypes types;
- /** Zero or more interface element information items */
- private Map<NCName, WSDLInterface> interfaces = new LinkedHashMap<NCName,
WSDLInterface>();
- /** Zero or more binding element information items */
- private Map<NCName, WSDLBinding> bindings = new LinkedHashMap<NCName,
WSDLBinding>();
- /** Zero or more service element information items */
- private Map<NCName, WSDLService> services = new LinkedHashMap<NCName,
WSDLService>();
-
- // Zero or more namespace definitions
- // [TODO] What is this doing here?
- private NamespaceRegistry namespaces = new NamespaceRegistry();
-
- // The original wsdl4j definition if we have wsdl-1.1
- private Definition wsdlOneOneDefinition;
- // The WSDL document
- private Document wsdlDocument;
-
- public WSDLDefinitions() {}
-
- /** Set the wsdl4j definition if we have wsdl-1.1 */
- public void setWsdlOneOneDefinition(Definition wsdlDefinition)
- {
- this.wsdlOneOneDefinition = wsdlDefinition;
- }
-
- /**
- * Get the wsdl4j definition if we have wsdl-1.1.
- *
- * Note: This object is NOT THREAD-SAFE
- */
- public Definition getWsdlOneOneDefinition()
- {
- return wsdlOneOneDefinition;
- }
-
- public Document getWsdlDocument()
- {
- return wsdlDocument;
- }
-
- public void setWsdlDocument(Document wsdlDocument)
- {
- this.wsdlDocument = wsdlDocument;
- }
-
- /** Register the given namespaceURI/prefix combination */
- public String registerNamespaceURI(String nsURI, String prefix)
- {
- String pre = namespaces.getPrefix(nsURI);
- if (pre == null || pre == "")
- {
- pre = namespaces.registerURI(nsURI, prefix);
- log.trace("registerNamespaceURI: " + pre + "=" + nsURI);
- }
- return pre;
- }
-
- /** Register a QName and return a QName that is guarantied to have a prefix */
- public QName registerQName(QName qname)
- {
- return namespaces.registerQName(qname);
- }
-
- /** Get the prefix for a given namespaceURI */
- public String getPrefix(String namespaceURI)
- {
- return namespaces.getPrefix(namespaceURI);
- }
-
- /** Get the namespaceURI for a given prefix */
- public String getNamespaceURI(String prefix)
- {
- return namespaces.getNamespaceURI(prefix);
- }
-
- /** Get the prefix for the target namespace */
- public String getTargetPrefix()
- {
- return namespaces.getPrefix(targetNamespace);
- }
-
- /** Get an iterator for registered namespace URIs */
- public Iterator getRegisteredNamespaceURIs()
- {
- return namespaces.getRegisteredURIs();
- }
-
- /** Get an iterator for registered prefixs */
- public Iterator getRegisteredPrefix()
- {
- return namespaces.getRegisteredPrefixes();
- }
-
- public String getTargetNamespace()
- {
- return targetNamespace;
- }
-
- public void setTargetNamespace(String namespaceURI)
- {
- if(namespaceURI == null)
- throw new IllegalArgumentException("Illegal Null
Argument:namespaceURI");
-
- log.trace("setTargetNamespace: " + namespaceURI);
- this.targetNamespace = namespaceURI;
- }
-
- public String getWsdlNamespace()
- {
- return wsdlNamespace;
- }
-
- public void setWsdlNamespace(String namespaceURI)
- {
- if (Constants.NS_WSDL11.equals(namespaceURI) == false &&
Constants.NS_WSDL20.equals(namespaceURI) == false)
- throw new IllegalArgumentException("Invalid default namespace: " +
namespaceURI);
-
- this.wsdlNamespace = namespaceURI;
- }
-
- public WSDLImport[] getImports()
- {
- WSDLImport[] arr = new WSDLImport[imports.size()];
- imports.toArray(arr);
- return arr;
- }
-
- public void addImport(WSDLImport anImport)
- {
- imports.add(anImport);
- }
-
- public WSDLInclude[] getIncludes()
- {
- WSDLInclude[] arr = new WSDLInclude[includes.size()];
- includes.toArray(arr);
- return arr;
- }
-
- public void addInclude(WSDLInclude include)
- {
- includes.add(include);
- }
-
- public WSDLTypes getWsdlTypes()
- {
- return types;
- }
-
- public void setWsdlTypes(WSDLTypes types)
- {
- this.types = types;
- this.types.setWSDLDefintiions(this);
- }
-
- public WSDLInterface getInterface(NCName ncName)
- {
- return interfaces.get(ncName);
- }
-
- public WSDLInterface[] getInterfaces()
- {
- WSDLInterface[] arr = new WSDLInterface[interfaces.size()];
- new ArrayList<WSDLInterface>(interfaces.values()).toArray(arr);
- return arr;
- }
-
- public void addInterface(WSDLInterface wsdlInterface)
- {
- interfaces.put(wsdlInterface.getName(), wsdlInterface);
- }
-
- public WSDLBinding[] getBindings()
- {
- WSDLBinding[] arr = new WSDLBinding[bindings.size()];
- new ArrayList<WSDLBinding>(bindings.values()).toArray(arr);
- return arr;
- }
-
- public WSDLBinding getBinding(NCName ncName)
- {
- return bindings.get(ncName);
- }
-
- public WSDLBinding getBindingByInterfaceName(QName qname)
- {
- WSDLBinding wsdlBinding = null;
- for (WSDLBinding aux : bindings.values())
- {
- if (aux.getInterfaceName().equals(qname))
- {
- if (wsdlBinding != null)
- log.warn("Multiple WSDL bindings referrence the same interface:
" + qname);
-
- wsdlBinding = aux;
- }
- }
- return wsdlBinding;
- }
-
- public void addBinding(WSDLBinding binding)
- {
- bindings.put(binding.getName(), binding);
- }
-
- public WSDLService[] getServices()
- {
- WSDLService[] arr = new WSDLService[services.size()];
- new ArrayList<WSDLService>(services.values()).toArray(arr);
- return arr;
- }
-
- public void addService(WSDLService service)
- {
- services.put(service.getName(), service);
- }
-
- public WSDLService getService(NCName name)
- {
- return services.get(name);
- }
-
- /** Unregister the given namespaceURI/prefix combination */
- public void unRegisterNamespaceURI(String namespaceURI, String prefix)
- {
- String pre = namespaces.getPrefix(namespaceURI);
- if(pre != null && pre.equals(prefix))
- namespaces.removePrefixMapping(prefix);
- }
-}
\ No newline at end of file
Copied: trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLDefinitions.java (from rev
1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLDefinitions.java)
Deleted: trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLDocumentation.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLDocumentation.java 2006-12-07
10:43:36 UTC (rev 1600)
+++ trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLDocumentation.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -1,46 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
-*/
-package org.jboss.ws.metadata.wsdl;
-
-import java.io.Serializable;
-
-/**
- * Represents a WSDL Document element that can be embedded in other WSDL elements
- * such as Fault
- * @author <mailto:Anil.Saldhana@jboss.org>Anil Saldhana
- */
-public class WSDLDocumentation implements Serializable
-{
- private static final long serialVersionUID = -5931204963635014975L;
-
- protected String documentContent = "";
-
- public WSDLDocumentation(String str)
- {
- this.documentContent = str;
- }
-
- public String getContent()
- {
- return this.documentContent;
- }
-}
Copied: trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLDocumentation.java (from rev
1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLDocumentation.java)
Deleted: trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLEndpoint.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLEndpoint.java 2006-12-07
10:43:36 UTC (rev 1600)
+++ trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLEndpoint.java 2006-12-07 12:05:41
UTC (rev 1603)
@@ -1,166 +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 javax.xml.namespace.QName;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.WSException;
-
-/**
- * An Endpoint component defines the particulars of a specific endpoint at which a given
service is available.
- * Endpoint components are local to a given Service component; they cannot be referred to
by QName.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 10-Oct-2004
- */
-public class WSDLEndpoint extends Extendable
-{
- private static final long serialVersionUID = 4991302339046047865L;
-
- // provide logging
- private static final Logger log = Logger.getLogger(WSDLEndpoint.class);
-
- // The parent service
- private WSDLService wsdlService;
-
- /** The REQUIRED name attribute information item together with the targetNamespace
attribute information item
- * of the definitions element information item forms the QName of the endpoint. */
- private NCName name;
-
- /** Derived QName identifier.
- */
- private QName qname;
-
- /** The REQUIRED binding attribute information item refers, by QName, to a Binding
component */
- private QName binding;
-
- /** The OPTIONAL address attribute information item specifies the address of the
endpoint. */
- private String address;
-
- public WSDLEndpoint(WSDLService wsdlService)
- {
- log.trace("new WSDLEndpoint");
- this.wsdlService = wsdlService;
- }
-
- public WSDLService getWsdlService()
- {
- return wsdlService;
- }
-
- /** Get the WSDLInteraface associated to this endpoint
- *
- * @return A WSDLInterface or null
- */
- public WSDLInterface getInterface()
- {
- WSDLInterface wsdlInterface = null;
-
- WSDLDefinitions wsdlDefinitions = wsdlService.getWsdlDefinitions();
- if (wsdlService.getInterfaceName() != null)
- {
- QName qname = wsdlService.getInterfaceName();
- wsdlInterface = wsdlDefinitions.getInterface(new NCName(qname));
- }
- else
- {
- WSDLBinding wsdlBinding = wsdlDefinitions.getBinding(new NCName(binding));
- if (wsdlBinding == null)
- throw new WSException("Cannot obtain the binding: " + binding);
-
- if (wsdlBinding.getInterfaceName() != null)
- {
- QName qname = wsdlBinding.getInterfaceName();
- wsdlInterface = wsdlDefinitions.getInterface(new NCName(qname));
- }
- }
-
- if (wsdlInterface == null)
- throw new WSException("Cannot obtain the interface associated with this
endpoint: " + name);
-
- return wsdlInterface;
- }
-
- /** Get the WSDLInterafceOperation for the given opName
- *
- * @param opName the operation name
- * @return A WSDLOperation or null
- */
- public WSDLInterfaceOperation getInterfaceOperation(NCName opName)
- {
- WSDLInterface wsdlInterface = getInterface();
- WSDLInterfaceOperation wsdlInterfaceOperation =
wsdlInterface.getWSDLInterfaceOperation(opName);
- return wsdlInterfaceOperation;
- }
-
- public NCName getName()
- {
- return name;
- }
-
- public void setName(NCName name)
- {
- log.trace("setName: " + name);
- this.name = name;
- }
-
- public QName getQName()
- {
- if (qname == null)
- {
- String tnsURI = wsdlService.getWsdlDefinitions().getTargetNamespace();
- qname = new QName(tnsURI, name.toString());
- }
- return qname;
- }
-
-
- public void setQName(QName qname)
- {
- log.trace("setQName: " + qname);
- this.qname = qname;
- }
-
- public QName getBinding()
- {
- return binding;
- }
-
- public void setBinding(QName binding)
- {
- log.trace("setBinding: " + binding);
- this.binding = binding;
- }
-
- public String getAddress()
- {
- return address;
- }
-
- public void setAddress(String address)
- {
- this.address = address;
- }
-}
Copied: trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLEndpoint.java (from rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLEndpoint.java)
Deleted: trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLException.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLException.java 2006-12-07
10:43:36 UTC (rev 1600)
+++ trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLException.java 2006-12-07 12:05:41
UTC (rev 1603)
@@ -1,93 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
-*/
-package org.jboss.ws.metadata.wsdl;
-
-// $Id$
-
-/**
- * An exception that may occur during WSDL processing.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 10-Oct-2004
- */
-public class WSDLException extends RuntimeException
-{
- /**
- * Constructs a new exception with <code>null</code> as its detail
message.
- * The cause is not initialized, and may subsequently be initialized by a
- * call to {@link #initCause}.
- */
- public WSDLException()
- {
- }
-
- /**
- * Constructs a new exception with the specified detail message. The
- * cause is not initialized, and may subsequently be initialized by
- * a call to {@link #initCause}.
- *
- * @param message the detail message. The detail message is saved for
- * later retrieval by the {@link #getMessage()} method.
- */
- public WSDLException(String message)
- {
- super(message);
- }
-
- /**
- * Constructs a new exception with the specified cause and a detail
- * message of <tt>(cause==null ? null : cause.toString())</tt> (which
- * typically contains the class and detail message of <tt>cause</tt>).
- * This constructor is useful for exceptions that are little more than
- * wrappers for other throwables (for example, {@link
- * java.security.PrivilegedActionException}).
- *
- * @param cause the cause (which is saved for later retrieval by the
- * {@link #getCause()} method). (A <tt>null</tt> value is
- * permitted, and indicates that the cause is nonexistent or
- * unknown.)
- * @since 1.4
- */
- public WSDLException(Throwable cause)
- {
- super(cause);
- }
-
- /**
- * Constructs a new exception with the specified detail message and
- * cause. <p>Note that the detail message associated with
- * <code>cause</code> is <i>not</i> automatically incorporated
in
- * this exception's detail message.
- *
- * @param message the detail message (which is saved for later retrieval
- * by the {@link #getMessage()} method).
- * @param cause the cause (which is saved for later retrieval by the
- * {@link #getCause()} method). (A <tt>null</tt> value is
- * permitted, and indicates that the cause is nonexistent or
- * unknown.)
- * @since 1.4
- */
- public WSDLException(String message, Throwable cause)
- {
- super(message, cause);
- }
-}
Copied: trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLException.java (from rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLException.java)
Deleted: trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLFeature.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLFeature.java 2006-12-07
10:43:36 UTC (rev 1600)
+++ trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLFeature.java 2006-12-07 12:05:41
UTC (rev 1603)
@@ -1,84 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
-*/
-package org.jboss.ws.metadata.wsdl;
-
-import java.io.Serializable;
-
-// $Id$
-
-/**
- * A feature component describes an abstract piece of functionality typically associated
with the exchange of
- * messages between communicating parties. Although WSDL poses no constraints on the
potential scope of
- * such features, examples might include "reliability", "security",
"correlation", and "routing". The presence
- * of a feature component in a WSDL description indicates that the service supports the
feature and may
- * require a requester agent that interacts with the service to use that feature. Each
Feature is identified by its
- * URI.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 10-Oct-2004
- */
-public class WSDLFeature implements Serializable
-{
- private static final long serialVersionUID = 8096857958254222743L;
-
- /** A REQUIRED uri attribute information item */
- private String uri;
- /** An OPTIONAL required attribute information item */
- private boolean required;
-
- public WSDLFeature(String uri)
- {
- if (uri == null)
- throw new IllegalArgumentException("Illegal feature URI: " + uri);
-
- this.uri = uri;
- }
-
- public WSDLFeature(String uri, boolean required)
- {
- if (uri == null)
- throw new IllegalArgumentException("Illegal feature URI: " + uri);
-
- this.uri = uri;
- this.required = required;
- }
-
- public String getURI()
- {
- return uri;
- }
-
- public boolean isRequired()
- {
- return required;
- }
-
- public void setRequired(boolean required)
- {
- this.required = required;
- }
-
- public String toString()
- {
- return uri;
- }
-}
Copied: trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLFeature.java (from rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLFeature.java)
Deleted: trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLImport.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLImport.java 2006-12-07
10:43:36 UTC (rev 1600)
+++ trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLImport.java 2006-12-07 12:05:41 UTC
(rev 1603)
@@ -1,90 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
-*/
-package org.jboss.ws.metadata.wsdl;
-
-import java.io.Serializable;
-
-
-// $Id$
-
-/**
- * The WSDL import element information item, like the include element information item
(see 4.1 Including Descriptions [p.73] )
- * also allows for the separation of the different components of a WSDL description into
independent descriptions,
- * but in this case with different target namespaces, which can be imported as needed.
This technique helps writing
- * clearer WSDL descriptions by separating the definitions according to their level of
abstraction, and maximizes reusability.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 10-Oct-2004
- */
-public class WSDLImport implements Serializable
-{
- private static final long serialVersionUID = -2641009286158029207L;
-
- // The parent WSDL definitions
- private WSDLDefinitions wsdlDefinitions;
-
- /** The REQUIRED namespace attribute information item is of type xs:anyURI . Its
actual value indicates that the
- * containing WSDL document MAY contain qualified references to WSDL definitions in
that namespace
- * (via one or more prefixes declared with namespace declarations in the normal way).
This value MUST
- * NOT match the actual value of the enclosing WSDL document targetNamespace
attribute
- * information item. If the import statement results in the import of a WSDL document
then the actual value
- * of the namespace attribute information item MUST be identical to the actual value
of the imported
- * WSDL document's targetNamespace attribute information item. */
- private String namespace;
-
- /** The OPTIONAL location attribute information item is of type xs:anyURI . Its actual
value is the location of
- * some information about the namespace identified by the namespace attribute
information item.
- * The location attribute information item is optional. This allows WSDL components to
be constructed
- * from information other than serialized XML 1.0. It also allows the development of
WSDL processors that
- * have a priori (i.e., built-in) knowledge of certain namespaces. */
- private String location;
-
- public WSDLImport(WSDLDefinitions wsdlDefinitions)
- {
- this.wsdlDefinitions = wsdlDefinitions;
- }
-
- public WSDLDefinitions getWsdlDefinitions()
- {
- return wsdlDefinitions;
- }
-
- public String getNamespace()
- {
- return namespace;
- }
-
- public void setNamespace(String namespace)
- {
- this.namespace = namespace;
- }
-
- public String getLocation()
- {
- return location;
- }
-
- public void setLocation(String location)
- {
- this.location = location;
- }
-}
Copied: trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLImport.java (from rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLImport.java)
Deleted: trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLInclude.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLInclude.java 2006-12-07
10:43:36 UTC (rev 1600)
+++ trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLInclude.java 2006-12-07 12:05:41
UTC (rev 1603)
@@ -1,69 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
-*/
-package org.jboss.ws.metadata.wsdl;
-
-import java.io.Serializable;
-
-
-// $Id$
-
-
-/**
- * The WSDL include element information item allows for the separation of different
components of a
- * service definition, belonging the same target namespace, into independent WSDL
documents which can be
- * merged as needed.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 10-Oct-2004
- */
-public class WSDLInclude implements Serializable
-{
- private static final long serialVersionUID = 1210980063899094649L;
-
- // The parent WSDL definitions
- private WSDLDefinitions wsdlDefinitions;
-
- /** A location attribute information item is of type xs:anyURI . Its actual value is
the location of some
- * information about the namespace identified by the targetNamespace attribute
information item of the
- * containing definitions element information item.*/
- private String location;
-
- public WSDLInclude(WSDLDefinitions wsdlDefinitions)
- {
- this.wsdlDefinitions = wsdlDefinitions;
- }
-
- public WSDLDefinitions getWsdlDefinitions()
- {
- return wsdlDefinitions;
- }
-
- public String getLocation()
- {
- return location;
- }
-
- public void setLocation(String location)
- {
- this.location = location;
- }
-}
Copied: trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLInclude.java (from rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLInclude.java)
Deleted: trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLInterface.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLInterface.java 2006-12-07
10:43:36 UTC (rev 1600)
+++ trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLInterface.java 2006-12-07 12:05:41
UTC (rev 1603)
@@ -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.
-*/
-package org.jboss.ws.metadata.wsdl;
-
-// $Id$
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import javax.xml.namespace.QName;
-
-import org.jboss.logging.Logger;
-
-/**
- * An Interface component describes sequences of messages that a service sends and/or
receives. It does this
- * by grouping related messages into operations. An operation is a sequence of input and
output messages,
- * and an interface is a set of operations. Thus, an interface defines the design of the
application.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 10-Oct-2004
- */
-public class WSDLInterface extends Extendable
-{
- // provide logging
- private static final Logger log = Logger.getLogger(WSDLInterface.class);
-
- private static final long serialVersionUID = 2453454924501233964L;
-
- // The parent WSDL definitions element.
- private WSDLDefinitions wsdlDefinitions;
-
- /** The REQUIRED name attribute information item together with the targetNamespace
attribute information item
- * of the [parent] definitions element information item forms the QName of the
interface.
- */
- private NCName name;
-
- /** Derived QName identifier.
- */
- private QName qname;
-
- /** The OPTIONAL extends attribute information item lists the interfaces that this
interface derives from.
- */
- private QName[] extendList;
-
- /** The OPTIONAL styleDefault attribute information item indicates the default style
used to construct the
- * {element} properties of {message references} of all operations contained within the
[owner] interface
- */
- private String styleDefault;
-
- /** Zero or more operation element information items */
- private Map operations = new LinkedHashMap();
- /** Zero or more fault element information items */
- private Map faults = new LinkedHashMap();
-
- /** Construct a WSDL interface for a given WSDL definition */
- public WSDLInterface(WSDLDefinitions wsdlDefinitions)
- {
- log.trace("new WSDLInterface");
- this.wsdlDefinitions = wsdlDefinitions;
- }
-
- /** Get a WSDLOperation for a given name
- *
- * @param name The name of the operation
- * @return A WSDLOperation or null
- */
- public WSDLInterfaceOperation getWSDLInterfaceOperation(NCName name)
- {
- return (WSDLInterfaceOperation)operations.get(name);
- }
-
- public WSDLDefinitions getWsdlDefinitions()
- {
- return wsdlDefinitions;
- }
-
- public NCName getName()
- {
- return name;
- }
-
- public void setName(NCName name)
- {
- log.trace("setName: " + name);
- this.name = name;
- }
-
- public QName getQName()
- {
- if (qname == null)
- {
- String tnsURI = wsdlDefinitions.getTargetNamespace();
- qname = new QName(tnsURI, name.toString());
- }
- return qname;
- }
-
-
- public void setQName(QName qname)
- {
- log.trace("setQName: " + qname);
- this.qname = qname;
- }
-
- public QName[] getExtendList()
- {
- return extendList;
- }
-
- public void setExtendList(QName[] extendList)
- {
- this.extendList = extendList;
- }
-
- public String getStyleDefault()
- {
- return styleDefault;
- }
-
- public void setStyleDefault(String styleDefault)
- {
- this.styleDefault = styleDefault;
- }
-
- public WSDLInterfaceOperation[] getOperations()
- {
- WSDLInterfaceOperation[] arr = new WSDLInterfaceOperation[operations.size()];
- new ArrayList(operations.values()).toArray(arr);
- return arr;
- }
-
- public WSDLInterfaceOperation[] getSortedOperations()
- {
- WSDLInterfaceOperation[] arr = new WSDLInterfaceOperation[operations.size()];
- new ArrayList(operations.values()).toArray(arr);
- Arrays.sort(arr);
- return arr;
- }
-
- public WSDLInterfaceOperation getOperation(NCName opName)
- {
- WSDLInterfaceOperation operation = (WSDLInterfaceOperation)operations.get(opName);
- return operation;
- }
-
- public void addOperation(WSDLInterfaceOperation operation)
- {
- operations.put(operation.getName(), operation);
- }
-
- public WSDLInterfaceFault[] getFaults()
- {
- WSDLInterfaceFault[] arr = new WSDLInterfaceFault[faults.size()];
- new ArrayList(faults.values()).toArray(arr);
- return arr;
- }
-
- public WSDLInterfaceFault getFault(NCName fName)
- {
- WSDLInterfaceFault fault = (WSDLInterfaceFault)faults.get(fName);
- return fault;
- }
-
- public void addFault(WSDLInterfaceFault fault)
- {
- faults.put(fault.getName(), fault);
- }
-
- public boolean containsInterfaceOperation(NCName name)
- {
- return operations.containsKey(name);
- }
-}
Copied: trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLInterface.java (from rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLInterface.java)
Deleted: trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLInterfaceFault.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLInterfaceFault.java 2006-12-07
10:43:36 UTC (rev 1600)
+++ trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLInterfaceFault.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -1,104 +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.Serializable;
-
-import javax.xml.namespace.QName;
-
-/**
- * An Interface Fault component describes a fault that MAY occur during invocation of an
operation of the
- * interface. The Interface Fault component declares an abstract fault by naming it and
indicating the
- * contents of the fault message. When and how the fault message flows is indicated by
the Interface
- * Operation component 2.4 Interface Operation [p.22] .
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 10-Oct-2004
- */
-public class WSDLInterfaceFault implements Serializable
-{
- private static final long serialVersionUID = 7820459380133521551L;
-
- // The parent interface.
- private WSDLInterface wsdlInterface;
-
- /** The REQUIRED name attribute information item identifies a given fault element
information item inside a given
- * interface element information item.
- */
- private NCName name;
- /** The OPTIONAL element attribute information item refers, by QName, to an element
declaration component.
- */
- private QName element;
-
- protected WSDLDocumentation documentationElement = null;
-
- public WSDLInterfaceFault(WSDLInterface wsdlInterface)
- {
- this.wsdlInterface = wsdlInterface;
- }
-
- public WSDLInterface getWsdlInterface()
- {
- return wsdlInterface;
- }
-
- public NCName getName()
- {
- return name;
- }
-
- public void setName(NCName name)
- {
- this.name = name;
- }
-
- public QName getElement()
- {
- return element;
- }
-
- public void setElement(QName element)
- {
- this.element = element;
- }
-
- public WSDLDocumentation getDocumentation()
- {
- return this.documentationElement;
- }
-
- public void setDocumentation(WSDLDocumentation doc)
- {
- this.documentationElement = doc;
- }
-
- /** Get the xmlType for this interface fault.
- */
- public QName getXmlType()
- {
- WSDLDefinitions wsdlDefinitions = wsdlInterface.getWsdlDefinitions();
- WSDLTypes wsdlTypes = wsdlDefinitions.getWsdlTypes();
- return wsdlTypes.getXMLType(element);
- }
-}
Copied: trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLInterfaceFault.java (from rev
1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLInterfaceFault.java)
Deleted:
trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLInterfaceMessageReference.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLInterfaceMessageReference.java 2006-12-07
10:43:36 UTC (rev 1600)
+++
trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLInterfaceMessageReference.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -1,246 +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: WSDLInterfaceOperationPart.java 275 2006-05-04 21:36:29Z
-// jason.greene(a)jboss.com $
-
-import java.util.Collection;
-import java.util.LinkedHashMap;
-
-import javax.xml.namespace.QName;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.Constants;
-import org.jboss.ws.WSException;
-
-/**
- * A Message Reference component associates a defined type with a message
- * exchanged in an operation. By default, the type system is based upon the XML
- * Infoset
- *
- * @author Thomas.Diesler(a)jboss.org
- * @author <a href="mailto:jason.greene@jboss.com">Jason T.
Greene</a>
- * @since 10-Oct-2004
- */
-public abstract class WSDLInterfaceMessageReference extends Extendable implements
Comparable
-{
- // provide logging
- protected Logger log = Logger.getLogger(getClass());
-
- // The parent interface operation
- private WSDLInterfaceOperation wsdlOperation;
-
- /**
- * The OPTIONAL messageLabel attribute information item identifies the role
- * of this message in the message exchange pattern of the given operation
- * element information item.
- */
- private NCName messageLabel;
-
- /**
- * The OPTIONAL element attribute information item is the element declaration
- * from the {element declarations} property resolved by the value of the
- * element attribute information item, otherwise empty.
- */
- private QName element;
-
- /**
- * Used mainly for WSDL 1.1 compatibility, indicates rpc parts.
- * Although, this could be used to represent WSDL 2.0 RPC style.
- */
- private LinkedHashMap<String, WSDLRPCPart> childParts = new
LinkedHashMap<String, WSDLRPCPart>();
-
- /**
- * Used for WSDL 1.1
- */
- private String partName;
-
- /**
- * Used for WSDL 1.1
- */
- private QName messageName;
-
- public WSDLInterfaceMessageReference(WSDLInterfaceOperation wsdlOperation)
- {
- log.trace("New part for wsdlOperation: " + wsdlOperation.getName());
- this.wsdlOperation = wsdlOperation;
- }
-
- public WSDLInterfaceOperation getWsdlOperation()
- {
- return wsdlOperation;
- }
-
- public NCName getMessageLabel()
- {
- return messageLabel;
- }
-
- public void setMessageLabel(NCName messageLabel)
- {
- log.trace("setMessageLabel: " + messageLabel);
- this.messageLabel = messageLabel;
- }
-
- public QName getElement()
- {
- return element;
- }
-
- public void setElement(QName element)
- {
- log.trace("setElement: " + element);
- this.element = element;
- }
-
- /**
- * Get the xmlType for this operation part.
- */
- public QName getXMLType()
- {
- QName xmlType = null;
-
- // First try to read it from the schema
- WSDLDefinitions wsdlDefinitions =
wsdlOperation.getWsdlInterface().getWsdlDefinitions();
- WSDLTypes wsdlTypes = wsdlDefinitions.getWsdlTypes();
- xmlType = wsdlTypes.getXMLType(element);
-
- // Fall back to the property
- if (xmlType == null)
- {
- WSDLProperty property = getProperty(Constants.WSDL_PROPERTY_RPC_XMLTYPE);
- if (property != null)
- {
- String qnameRef = property.getValue();
- int colIndex = qnameRef.indexOf(':');
- String prefix = qnameRef.substring(0, colIndex);
- String localPart = qnameRef.substring(colIndex + 1);
- String nsURI = wsdlDefinitions.getNamespaceURI(prefix);
- xmlType = new QName(nsURI, localPart, prefix);
- }
- }
-
- if (xmlType == null)
- throw new WSException("Cannot obtain xmlType for element: " +
element);
-
- return xmlType;
- }
-
- /**
- * Gets the child parts associated with this message reference. This is only
- * used for RPC style, and currently only supported by WSDL 1.1.
- *
- * @return the list of rpc parts that make up the message
- */
- public Collection<WSDLRPCPart> getChildParts()
- {
- return childParts.values();
- }
-
- /**
- * Gets the child part associated with this message reference by part name.
- * This is only used for RPC style, and currently only supported by WSDL 1.1.
- *
- * @param name the part name
- * @return the part or null if not found
- */
- public WSDLRPCPart getChildPart(String name)
- {
- return childParts.get(name);
- }
-
- /**
- * Adds a child part to this mesage reference. This is only used for RPC
- * style, and currently only supported by WSDL 1.1.
- *
- * @param childPart the list of rpc parts that make up the message
- */
- public void addChildPart(WSDLRPCPart childPart)
- {
- this.childParts.put(childPart.getName(), childPart);
- }
-
- /**
- * Removes a speficied child part. This is This is only used for RPC
- * style, and currently only supported by WSDL 1.1.
- *
- * @param name the name of the part
- */
- public void removeChildPart(String name)
- {
- this.childParts.remove(name);
- }
-
- /**
- * Gets the WSDL 1.1 part name.
- *
- * @return the part name
- */
- public String getPartName()
- {
- return partName;
- }
-
- /**
- * Sets the WSDL 1.1 message name.
- *
- * @param messageName The part name
- */
- public void setMessageName(QName messageName)
- {
- this.messageName = messageName;
- }
-
- /**
- * Gets the WSDL 1.1 message name.
- *
- * @return the message name
- */
- public QName getMessageName()
- {
- return messageName;
- }
-
- /**
- * Sets the WSDL 1.1 part name.
- *
- * @param partName The part name
- */
- public void setPartName(String partName)
- {
- this.partName = partName;
- }
-
- public int compareTo(Object o)
- {
- int c = -1;
- if (o instanceof WSDLInterfaceMessageReference)
- {
- WSDLInterfaceMessageReference w = (WSDLInterfaceMessageReference) o;
- String oname = w.getElement().getLocalPart();
- String myname = getElement().getLocalPart();
- c = myname.compareTo(oname);
- }
- return c;
- }
-}
\ No newline at end of file
Copied: trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLInterfaceMessageReference.java
(from rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLInterfaceMessageReference.java)
Deleted: trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLInterfaceOperation.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLInterfaceOperation.java 2006-12-07
10:43:36 UTC (rev 1600)
+++ trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLInterfaceOperation.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -1,284 +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.util.ArrayList;
-import java.util.Collection;
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import javax.xml.namespace.QName;
-
-import org.jboss.ws.Constants;
-import org.jboss.ws.WSException;
-import org.jboss.ws.metadata.wsdl.WSDLRPCSignatureItem.Direction;
-
-// $Id$
-
-/**
- * An Interface Operation component describes an operation that a given interface
supports. An operation is
- * an interaction with the service consisting of a set (ordinary and fault) messages
exchanged between the
- * service and the other roles involved in the interaction, in particular the service
requester. The sequencing
- * and cardinality of the messages involved in a particular interaction is governed by
the message exchange
- * pattern used by the operation (see {message exchange pattern} property).
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 10-Oct-2004
- */
-public class WSDLInterfaceOperation extends Extendable implements Comparable
-{
- private static final long serialVersionUID = -5014918078197942626L;
-
- // The parent interface
- private WSDLInterface wsdlInterface;
-
- /** The REQUIRED name attribute information item identifies a given operation element
information item inside a
- * given interface element information item.
- */
- private NCName name;
-
- /** The OPTIONAL pattern attribute information item identifies the message exchange
pattern a given operation uses.
- */
- private String pattern;
-
- /** The OPTIONAL style attribute information item indicates the rules that were used
to construct the {element}
- * properties of the Message Reference components which are members of the {message
references}
- * property of the [owner] operation.
- */
- private String style = Constants.URI_STYLE_RPC;
-
- /** The OPTIONAL safe attribute information item indicates whether the operation is
safe or not.
- */
- private boolean safe;
-
- /** Zero or more input element information items */
- private Map<QName, WSDLInterfaceOperationInput> inputs = new
LinkedHashMap<QName, WSDLInterfaceOperationInput>();
- /** Zero or more output element information items */
- private Map<QName, WSDLInterfaceOperationOutput> outputs = new
LinkedHashMap<QName, WSDLInterfaceOperationOutput>();
- /** Zero or more infault element information items */
- private ArrayList<WSDLInterfaceOperationInfault> infaults = new
ArrayList<WSDLInterfaceOperationInfault>();
- /** Zero or more outfault element information items */
- private ArrayList<WSDLInterfaceOperationOutfault> outfaults = new
ArrayList<WSDLInterfaceOperationOutfault>();
- /** Zero or more signature items */
- private LinkedHashMap<String, WSDLRPCSignatureItem> rpcSignatureItems = new
LinkedHashMap<String, WSDLRPCSignatureItem>();
-
- public WSDLInterfaceOperation(WSDLInterface wsdlInterface)
- {
- this.wsdlInterface = wsdlInterface;
- }
-
- public WSDLInterface getWsdlInterface()
- {
- return wsdlInterface;
- }
-
- public NCName getName()
- {
- return name;
- }
-
- public void setName(NCName name)
- {
- this.name = name;
- }
-
- public QName getQName()
- {
- String nsURI = wsdlInterface.getQName().getNamespaceURI();
- return new QName(nsURI, name.toString());
- }
-
- public String getPattern()
- {
- return pattern;
- }
-
- public void setPattern(String pattern)
- {
- this.pattern = pattern;
- }
-
- public String getStyle()
- {
- return style;
- }
-
- public void setStyle(String style)
- {
- this.style = style;
- }
-
- public boolean isSafe()
- {
- return safe;
- }
-
- public void setSafe(boolean safe)
- {
- this.safe = safe;
- }
-
- public WSDLInterfaceOperationInput[] getInputs()
- {
- WSDLInterfaceOperationInput[] arr = new
WSDLInterfaceOperationInput[inputs.size()];
- new ArrayList<WSDLInterfaceOperationInput>(inputs.values()).toArray(arr);
- return arr;
- }
-
- public void addInput(WSDLInterfaceOperationInput input)
- {
- QName xmlName = input.getElement();
- if (inputs.get(xmlName) != null)
- throw new WSException("Attempt to map multiple operation inputs to: "
+ xmlName);
- inputs.put(xmlName, input);
- }
-
- public WSDLInterfaceOperationInput getInput(QName qname)
- {
- WSDLInterfaceOperationInput opInput =
(WSDLInterfaceOperationInput)inputs.get(qname);
- return opInput;
- }
-
- public void removeInput(QName element)
- {
- inputs.remove(element);
- }
-
- public WSDLInterfaceOperationInput getInputByPartName(String partName)
- {
- WSDLInterfaceOperationInput opInput = null;
- for (WSDLInterfaceOperationInput auxInput : inputs.values())
- {
- WSDLProperty property =
auxInput.getProperty(Constants.WSDL_PROPERTY_PART_NAME);
- if (property != null && property.getValue().equals(partName))
- opInput = auxInput;
- }
- return opInput;
- }
-
- public WSDLInterfaceOperationOutput[] getOutputs()
- {
- WSDLInterfaceOperationOutput[] arr = new
WSDLInterfaceOperationOutput[outputs.size()];
- new ArrayList<WSDLInterfaceOperationOutput>(outputs.values()).toArray(arr);
- return arr;
- }
-
- public void addOutput(WSDLInterfaceOperationOutput output)
- {
- QName xmlName = output.getElement();
- if (outputs.get(xmlName) != null)
- throw new WSException("Attempt to map multiple operation outputs to: "
+ xmlName);
- outputs.put(xmlName, output);
- }
-
- public WSDLInterfaceOperationOutput getOutput(QName qname)
- {
- WSDLInterfaceOperationOutput opOutput =
(WSDLInterfaceOperationOutput)outputs.get(qname);
- return opOutput;
- }
-
- public WSDLInterfaceOperationOutput getOutputByPartName(String partName)
- {
- WSDLInterfaceOperationOutput opOutput = null;
- for (WSDLInterfaceOperationOutput auxOutput : outputs.values())
- {
- WSDLProperty property =
auxOutput.getProperty(Constants.WSDL_PROPERTY_PART_NAME);
- if (property != null && property.getValue().equals(partName))
- opOutput = auxOutput;
- }
- return opOutput;
- }
-
- public WSDLInterfaceOperationInfault[] getInfaults()
- {
- WSDLInterfaceOperationInfault[] arr = new
WSDLInterfaceOperationInfault[infaults.size()];
- infaults.toArray(arr);
- return arr;
- }
-
- public void addInfault(WSDLInterfaceOperationInfault infault)
- {
- infaults.add(infault);
- }
-
- public WSDLInterfaceOperationOutfault[] getOutfaults()
- {
- WSDLInterfaceOperationOutfault[] arr = new
WSDLInterfaceOperationOutfault[outfaults.size()];
- outfaults.toArray(arr);
- return arr;
- }
-
- public void addOutfault(WSDLInterfaceOperationOutfault outfault)
- {
- outfaults.add(outfault);
- }
-
- public Collection<WSDLRPCSignatureItem> getRpcSignatureItems()
- {
- return rpcSignatureItems.values();
- }
-
-
- public void addRpcSignatureItem(WSDLRPCSignatureItem item)
- {
- if (item.getDirection() != Direction.RETURN)
- item.setPosition(rpcSignatureItems.size());
- rpcSignatureItems.put(item.getName(), item);
- }
-
- public WSDLRPCSignatureItem getRpcSignatureitem(String name)
- {
- return rpcSignatureItems.get(name);
- }
-
- /**
- * Attempts to locate a binding operation for this interface operation.
- *
- * @return the binding operation, or null if not found;
- */
- public WSDLBindingOperation getBindingOperation()
- {
- WSDLInterface wsdlInterface = getWsdlInterface();
- WSDLBinding binding =
wsdlInterface.getWsdlDefinitions().getBindingByInterfaceName(wsdlInterface.getQName());
- if (binding == null)
- return null;
-
- WSDLBindingOperation bindingOperation = binding.getOperationByRef(getQName());
- if (bindingOperation == null)
- return null;
-
- return bindingOperation;
- }
-
- public int compareTo(Object o)
- {
- int c = -1;
- if (o instanceof WSDLInterfaceOperation)
- {
- WSDLInterfaceOperation w = (WSDLInterfaceOperation)o;
- String oname = w.getName().toString();
- String myname = name.toString();
- c = myname.compareTo(oname);
- }
- return c;
- }
-}
Copied: trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLInterfaceOperation.java (from
rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLInterfaceOperation.java)
Deleted:
trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLInterfaceOperationInfault.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLInterfaceOperationInfault.java 2006-12-07
10:43:36 UTC (rev 1600)
+++
trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLInterfaceOperationInfault.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -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.wsdl;
-
-// $Id$
-
-import javax.xml.namespace.QName;
-
-/**
- * A Fault Reference component associates a defined type, specified by an Interface Fault
component, to a
- * fault message exchanged in an operation.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 10-Oct-2004
- */
-public class WSDLInterfaceOperationInfault extends Extendable
-{
- private static final long serialVersionUID = 1124693747462594773L;
-
- // The parent interface operation
- private WSDLInterfaceOperation wsdlInterfaceOperation;
-
- /** A REQUIRED reference to an Interface Fault component in the {faults} property of
the parent
- * Interface Operation component's parent Interface component. Identifying the
Interface Fault
- * component therefore indirectly defines the actual content or payload of the fault
message.
- */
- private QName ref;
-
- /** An OPTIONAL identifier of the message this fault relates to among those defined in
the {message exchange
- * pattern} property of the Interface Operation component it is contained within. The
value of this
- * property MUST match the name of a placeholder message defined by the message
exchange pattern.
- */
- private NCName messageLabel;
-
- public WSDLInterfaceOperationInfault(WSDLInterfaceOperation wsdlInterfaceOperation)
- {
- this.wsdlInterfaceOperation = wsdlInterfaceOperation;
- }
-
- public WSDLInterfaceOperation getWsdlInterfaceOperation()
- {
- return wsdlInterfaceOperation;
- }
-
- public QName getRef()
- {
- return ref;
- }
-
- public void setRef(QName ref)
- {
- this.ref = ref;
- }
-
- public NCName getMessageLabel()
- {
- return messageLabel;
- }
-
- public void setMessageLabel(NCName messageLabel)
- {
- this.messageLabel = messageLabel;
- }
-}
Copied: trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLInterfaceOperationInfault.java
(from rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLInterfaceOperationInfault.java)
Deleted: trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLInterfaceOperationInput.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLInterfaceOperationInput.java 2006-12-07
10:43:36 UTC (rev 1600)
+++
trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLInterfaceOperationInput.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -1,41 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
-*/
-package org.jboss.ws.metadata.wsdl;
-
-// $Id$
-
-/**
- * A Message Reference component associates a defined type with a message exchanged in an
operation. By
- * default, the type system is based upon the XML Infoset
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 10-Oct-2004
- */
-public class WSDLInterfaceOperationInput extends WSDLInterfaceMessageReference
-{
- private static final long serialVersionUID = -4691488323709300920L;
-
- public WSDLInterfaceOperationInput(WSDLInterfaceOperation wsdlOperation)
- {
- super(wsdlOperation);
- }
-}
\ No newline at end of file
Copied: trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLInterfaceOperationInput.java
(from rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLInterfaceOperationInput.java)
Deleted:
trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLInterfaceOperationOutfault.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLInterfaceOperationOutfault.java 2006-12-07
10:43:36 UTC (rev 1600)
+++
trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLInterfaceOperationOutfault.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -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.wsdl;
-
-// $Id$
-
-import javax.xml.namespace.QName;
-
-/**
- * A Fault Reference component associates a defined type, specified by an Interface Fault
component, to a
- * fault message exchanged in an operation.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 10-Oct-2004
- */
-public class WSDLInterfaceOperationOutfault extends Extendable
-{
- private static final long serialVersionUID = 1365062002410904728L;
-
- // The parent interface operation
- private WSDLInterfaceOperation wsdlInterfaceOperation;
-
- /** A REQUIRED reference to an Interface Fault component in the {faults} property of
the parent
- * Interface Operation component's parent Interface component. Identifying the
Interface Fault
- * component therefore indirectly defines the actual content or payload of the fault
message.
- */
- private QName ref;
-
- /** An OPTIONAL identifier of the message this fault relates to among those defined in
the {message exchange
- * pattern} property of the Interface Operation component it is contained within. The
value of this
- * property MUST match the name of a placeholder message defined by the message
exchange pattern.
- */
- private NCName messageLabel;
-
- public WSDLInterfaceOperationOutfault(WSDLInterfaceOperation wsdlInterfaceOperation)
- {
- this.wsdlInterfaceOperation = wsdlInterfaceOperation;
- }
-
- public WSDLInterfaceOperation getWsdlInterfaceOperation()
- {
- return wsdlInterfaceOperation;
- }
-
- public QName getRef()
- {
- return ref;
- }
-
- public void setRef(QName ref)
- {
- this.ref = ref;
- }
-
- public NCName getMessageLabel()
- {
- return messageLabel;
- }
-
- public void setMessageLabel(NCName messageLabel)
- {
- this.messageLabel = messageLabel;
- }
-}
Copied: trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLInterfaceOperationOutfault.java
(from rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLInterfaceOperationOutfault.java)
Deleted: trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLInterfaceOperationOutput.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLInterfaceOperationOutput.java 2006-12-07
10:43:36 UTC (rev 1600)
+++
trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLInterfaceOperationOutput.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -1,41 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
-*/
-package org.jboss.ws.metadata.wsdl;
-
-// $Id$
-
-/**
- * A Message Reference component associates a defined type with a message exchanged in an
operation. By
- * default, the type system is based upon the XML Infoset
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 10-Oct-2004
- */
-public class WSDLInterfaceOperationOutput extends WSDLInterfaceMessageReference
-{
- private static final long serialVersionUID = 5096501821825901473L;
-
- public WSDLInterfaceOperationOutput(WSDLInterfaceOperation wsdlOperation)
- {
- super(wsdlOperation);
- }
-}
\ No newline at end of file
Copied: trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLInterfaceOperationOutput.java
(from rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLInterfaceOperationOutput.java)
Deleted: trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLMIMEPart.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLMIMEPart.java 2006-12-07
10:43:36 UTC (rev 1600)
+++ trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLMIMEPart.java 2006-12-07 12:05:41
UTC (rev 1603)
@@ -1,78 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.ws.metadata.wsdl;
-
-import java.io.Serializable;
-
-import javax.xml.namespace.QName;
-
-/**
- * Represents a WSDL 1.1 MIME Multipart attachment.
- *
- * @author <a href="mailto:jason.greene@jboss.com">Jason T.
Greene</a>
- * @version $Revision$
- */
-public class WSDLMIMEPart implements Serializable
-{
- private static final long serialVersionUID = -3102495235178249853L;
-
- private final String partName;
- private final QName xmlType;
- private final String mimeTypes;
-
- public WSDLMIMEPart(String partName, QName xmlType, String mimeTypes)
- {
- this.mimeTypes = mimeTypes;
- this.partName = partName;
- this.xmlType = xmlType;
- }
-
- /**
- * Returns the xml type of this attachment. Typically xsd:hexBinary
- *
- * @return the name of the header schema element
- */
- public QName getXmlType()
- {
- return xmlType;
- }
-
- /**
- * Returns the name of the WSDL 1.1 part, if the output is WSDL 1.1
- *
- * @return the name of the part
- */
- public String getPartName()
- {
- return partName;
- }
-
- /**
- * Returns a comma seperated list of allowed mime types.
- *
- * @return the mime types
- */
- public String getMimeTypes()
- {
- return mimeTypes;
- }
-}
\ No newline at end of file
Copied: trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLMIMEPart.java (from rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLMIMEPart.java)
Deleted: trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLProperty.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLProperty.java 2006-12-07
10:43:36 UTC (rev 1600)
+++ trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLProperty.java 2006-12-07 12:05:41
UTC (rev 1603)
@@ -1,117 +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.Serializable;
-
-import javax.xml.namespace.QName;
-
-// $Id$
-
-
-/**
- * A "property" in the Features and Properties architecture represents a named
runtime value which affects
- * the behaviour of some aspect of a Web service interaction, much like an environment
variable. For
- * example, a reliable messaging SOAP module may specify a property to control the number
of retries in the
- * case of network failure. WSDL documents may specify the value constraints for these
properties by
- * referring to a Schema type, or by specifying a particular value. Properties, and hence
property values, can
- * be shared amongst features/bindings/modules, and are named with URIs precisely to
allow this type of
- * sharing.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 10-Oct-2004
- */
-public class WSDLProperty implements Serializable
-{
- private static final long serialVersionUID = -7528676719881753461L;
-
- /** A REQUIRED uri attribute information item */
- private String uri;
- /** An OPTIONAL required attribute information item */
- private boolean required;
- /** The OPTIONAL value of the property, an ordered list of child information items,
as
- * specified by the [children] property of element information items */
- private String value;
- /** A OPTIONAL type definition constraining the value of the property, or the token
- * #value if the {value} property is not empty.*/
- private QName constraint;
-
- public WSDLProperty(String uri, String value)
- {
- if (uri == null)
- throw new IllegalArgumentException("Illegal property URI: " + uri);
-
- this.uri = uri;
- this.value = value;
- }
-
- public WSDLProperty(String uri, boolean required, String value, QName constraint)
- {
- if (uri == null)
- throw new IllegalArgumentException("Illegal property URI: " + uri);
-
- this.uri = uri;
- this.required = required;
- this.value = value;
- this.constraint = constraint;
- }
-
- public String getURI()
- {
- return uri;
- }
-
- public boolean isRequired()
- {
- return required;
- }
-
- public void setRequired(boolean required)
- {
- this.required = required;
- }
-
- public String getValue()
- {
- return value;
- }
-
- public void setValue(String value)
- {
- this.value = value;
- }
-
- public QName getConstraint()
- {
- return constraint;
- }
-
- public void setConstraint(QName constraint)
- {
- this.constraint = constraint;
- }
-
- public String toString()
- {
- return "[" + uri + "=" + value + "]";
- }
-}
Copied: trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLProperty.java (from rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLProperty.java)
Deleted: trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLRPCPart.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLRPCPart.java 2006-12-07
10:43:36 UTC (rev 1600)
+++ trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLRPCPart.java 2006-12-07 12:05:41
UTC (rev 1603)
@@ -1,63 +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 javax.xml.namespace.QName;
-
-/**
- * Represents a child part of a RPC style message reference. This is currently
- * only used for WSDL 1.1 compatibility.
- *
- * @author <a href="mailto:jason.greene@jboss.com">Jason T.
Greene</a>
- * @version $Revision$
- */
-public class WSDLRPCPart
-{
- private final String name;
- private final QName type;
-
- public WSDLRPCPart(String name, QName type)
- {
- this.name = name;
- this.type = type;
- }
-
- /**
- * Gets the XML local name of this part.
- *
- * @return the XML local name
- */
- public String getName()
- {
- return name;
- }
-
- /**
- * Gets the XML type of this part.
- *
- * @return the XML type
- */
- public QName getType()
- {
- return type;
- }
-}
\ No newline at end of file
Copied: trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLRPCPart.java (from rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLRPCPart.java)
Deleted: trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLRPCSignatureItem.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLRPCSignatureItem.java 2006-12-07
10:43:36 UTC (rev 1600)
+++ trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLRPCSignatureItem.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -1,75 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
-*/
-package org.jboss.ws.metadata.wsdl;
-
-
-/**
- * Represents an individual item of a wrpc:signature
- *
- * @author <a href="mailto:jason.greene@jboss.com">Jason T.
Greene</a>
- * @version $Revision$
- */
-public class WSDLRPCSignatureItem
-{
- public enum Direction {IN, OUT, INOUT, RETURN};
-
- private Direction direction;
- private final String name;
- private int position;
-
- public WSDLRPCSignatureItem(String name)
- {
- this.name = name;
- this.direction = Direction.IN;
- }
-
- public WSDLRPCSignatureItem(String name, Direction direction)
- {
- this.direction = direction;
- this.name = name;
- }
-
- public String getName()
- {
- return name;
- }
-
- public Direction getDirection()
- {
- return direction;
- }
-
- public void setDirection(Direction direction)
- {
- this.direction = direction;
- }
-
- public void setPosition(int position)
- {
- this.position = position;
- }
-
- public int getPosition()
- {
- return position;
- }
-}
Copied: trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLRPCSignatureItem.java (from rev
1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLRPCSignatureItem.java)
Deleted: trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLSOAPHeader.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLSOAPHeader.java 2006-12-07
10:43:36 UTC (rev 1600)
+++ trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLSOAPHeader.java 2006-12-07 12:05:41
UTC (rev 1603)
@@ -1,144 +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.Serializable;
-
-import javax.xml.namespace.QName;
-
-/**
- * Represents a WSDL 2.0 SOAP Header Block. The presence of the SOAP Header
- * Block component indicates that the service supports headers and MAY require a
- * web service consumer/client to use the header. It may appear up to one time
- * in the message.
- *
- * @author <a href="mailto:jason.greene@jboss.com">Jason T.
Greene</a>
- * @version $Revision$
- */
-public class WSDLSOAPHeader implements Serializable
-{
- private static final long serialVersionUID = -3102495235178249853L;
-
- private final QName element;
- private final String partName;
- private boolean required = false;
- private boolean mustUnderstand = false;
- private boolean includeInSignature = false;
-
- public WSDLSOAPHeader(QName element, String partName)
- {
- this.element = element;
- this.partName = partName;
- }
-
- /**
- * Returns the name of the header schema element that describes the header's
- * contents.
- *
- * @return the name of the header schema element
- */
- public QName getElement()
- {
- return element;
- }
-
- /**
- * Returns the name of the WSDL 1.1 part, if the output is WSDL 1.1
- *
- * @return the name of the part
- */
- public String getPartName()
- {
- return partName;
- }
-
- /**
- * Indicates whether the resulting SOAP header has a mustUnderstand attribute
- * set to true.
- *
- * @return the value of the SOAP mustUnderstand attribute
- */
- public boolean isMustUnderstand()
- {
- return mustUnderstand;
- }
-
- /**
- * Specifies whether the resulting SOAP Header has a mustUnderstand attribute
- * set to true.
- *
- * @param mustUnderstand the value of the SOAP mustUnderstand attribute
- */
- public void setMustUnderstand(boolean mustUnderstand)
- {
- this.mustUnderstand = mustUnderstand;
- }
-
- /**
- * Indicates whether the resulting SOAP header must be present in the
- * message.
- *
- * @return true if the header must be present, otherwise false
- */
- public boolean isRequired()
- {
- return required;
- }
-
- /**
- * Specifies whether the resulting SOAP header is required to be present on
- * the message.
- *
- * @param required true if the header must be present, otherwise false
- */
- public void setRequired(boolean required)
- {
- this.required = required;
- }
-
- /**
- * Indicates the resulting WSDL should include this header as part of the
- * interface message. This is currently only valid for WSDL 1.1, as WSDL 2.0
- * does not have an equivalent way to specify this. This serves as a hint to
- * binding tools that the header should be mapped to a Java parameter.
- *
- * @return whether the header should be part of the interface message
- */
- public boolean isIncludeInSignature()
- {
- return includeInSignature;
- }
-
- /**
- * Speficies the resulting WSDL should include this header as part of the
- * interface message. This is currently only valid for WSDL 1.1, as WSDL 2.0
- * does not have an equivalent way to specify this. This serves as a hint to
- * binding tools that the header should be mapped to a Java parameter.
- *
- * @param includeInSignature whether the header should be part of the
- * interface message
- */
- public void setIncludeInSignature(boolean includeInSignature)
- {
- this.includeInSignature = includeInSignature;
- }
-}
\ No newline at end of file
Copied: trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLSOAPHeader.java (from rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLSOAPHeader.java)
Deleted: trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLService.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLService.java 2006-12-07
10:43:36 UTC (rev 1600)
+++ trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLService.java 2006-12-07 12:05:41
UTC (rev 1603)
@@ -1,139 +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.util.ArrayList;
-import java.util.Iterator;
-
-import javax.xml.namespace.QName;
-
-import org.jboss.logging.Logger;
-
-/**
- * A Service component describes a set of endpoints (see 2.14 Endpoint [p.62] ) at which
a particular
- * deployed implementation of the service is provided. The endpoints thus are in effect
alternate places at
- * which the service is provided.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 10-Oct-2004
- */
-public class WSDLService extends Extendable
-{
- private static final long serialVersionUID = 1274166611190648479L;
-
- // provide logging
- private static final Logger log = Logger.getLogger(WSDLService.class);
-
- // The parent WSDL definitions element.
- private WSDLDefinitions wsdlDefinitions;
-
- /** The REQUIRED name attribute information item together with the targetNamespace
attribute information item
- * of the definitions element information item forms the QName of the service.*/
- private NCName name;
-
- /** Derived QName identifier.
- */
- private QName qname;
-
- /** The interface attribute information item identifies the interface that the service
is an instance of. */
- private QName interfaceName;
-
- /** One or more endpoint element information items */
- private ArrayList<WSDLEndpoint> endpoints = new
ArrayList<WSDLEndpoint>();
-
- public WSDLService(WSDLDefinitions wsdlDefinitions)
- {
- log.trace("new WSDLService");
- this.wsdlDefinitions = wsdlDefinitions;
- }
-
- public WSDLDefinitions getWsdlDefinitions()
- {
- return wsdlDefinitions;
- }
-
- public NCName getName()
- {
- return name;
- }
-
- public void setName(NCName name)
- {
- log.trace("setName: " + name);
- this.name = name;
- }
-
- public QName getQName()
- {
- if (qname == null)
- {
- String tnsURI = wsdlDefinitions.getTargetNamespace();
- qname = new QName(tnsURI, name.toString());
- }
- return qname;
- }
-
-
- public void setQName(QName qname)
- {
- log.trace("setQName: " + qname);
- this.qname = qname;
- }
-
- public QName getInterfaceName()
- {
- return interfaceName;
- }
-
- public void setInterfaceName(QName interfaceName)
- {
- this.interfaceName = interfaceName;
- }
-
- public WSDLEndpoint[] getEndpoints()
- {
- WSDLEndpoint[] arr = new WSDLEndpoint[endpoints.size()];
- endpoints.toArray(arr);
- return arr;
- }
-
- public void addEndpoint(WSDLEndpoint endpoint)
- {
- endpoints.add(endpoint);
- }
-
- /** Get an endpoint for the given name
- */
- public WSDLEndpoint getEndpoint(QName portName)
- {
- Iterator it = endpoints.iterator();
- while (it.hasNext())
- {
- WSDLEndpoint wsdlEndpoint = (WSDLEndpoint)it.next();
- if (portName.equals(wsdlEndpoint.getQName()))
- return wsdlEndpoint;
- }
- return null;
- }
-}
Copied: trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLService.java (from rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLService.java)
Deleted: trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLTypes.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLTypes.java 2006-12-07
10:43:36 UTC (rev 1600)
+++ trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLTypes.java 2006-12-07 12:05:41 UTC
(rev 1603)
@@ -1,76 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
-*/
-package org.jboss.ws.metadata.wsdl;
-
-//$Id$
-
-import java.io.Serializable;
-
-import javax.xml.namespace.QName;
-
-import org.jboss.logging.Logger;
-
-/**
- * WSDL types.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @author Anil.Saldhana(a)jboss.org
- * @since 10-Oct-2004
- */
-public abstract class WSDLTypes implements Serializable
-{
- private static final long serialVersionUID = 7919937323521372194L;
-
- // provide logging
- static private final Logger log = Logger.getLogger(WSDLTypes.class);
-
- private WSDLDefinitions wsdlDefinitions;
- private String namespace;
-
- public abstract QName getXMLType(QName name);
-
- public WSDLDefinitions getWsdlDefinitions()
- {
- return wsdlDefinitions;
- }
-
- void setWSDLDefintiions(WSDLDefinitions parent)
- {
- wsdlDefinitions = parent;
- }
-
- /**
- * Gets the namespace associate with this types declaration. Currently this is used to
filter
- * which WSDL file receives this types definition. Null means all files.
- *
- * @return the namespace associated with this type definition
- */
- public String getNamespace()
- {
- return namespace;
- }
-
- public void setNamespace(String namespace)
- {
- this.namespace = namespace;
- }
-}
Copied: trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLTypes.java (from rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLTypes.java)
Deleted: trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLUtils.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLUtils.java 2006-12-07
10:43:36 UTC (rev 1600)
+++ trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLUtils.java 2006-12-07 12:05:41 UTC
(rev 1603)
@@ -1,887 +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.File;
-import java.io.IOException;
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-import java.math.BigDecimal;
-import java.math.BigInteger;
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Stack;
-import java.util.StringTokenizer;
-
-import javax.ejb.SessionBean;
-import javax.jws.WebMethod;
-import javax.jws.WebService;
-import javax.xml.namespace.QName;
-import javax.xml.rpc.holders.BigDecimalHolder;
-import javax.xml.rpc.holders.BigIntegerHolder;
-import javax.xml.rpc.holders.BooleanHolder;
-import javax.xml.rpc.holders.BooleanWrapperHolder;
-import javax.xml.rpc.holders.ByteArrayHolder;
-import javax.xml.rpc.holders.ByteHolder;
-import javax.xml.rpc.holders.ByteWrapperHolder;
-import javax.xml.rpc.holders.CalendarHolder;
-import javax.xml.rpc.holders.DoubleHolder;
-import javax.xml.rpc.holders.DoubleWrapperHolder;
-import javax.xml.rpc.holders.FloatHolder;
-import javax.xml.rpc.holders.FloatWrapperHolder;
-import javax.xml.rpc.holders.Holder;
-import javax.xml.rpc.holders.IntHolder;
-import javax.xml.rpc.holders.IntegerWrapperHolder;
-import javax.xml.rpc.holders.LongHolder;
-import javax.xml.rpc.holders.LongWrapperHolder;
-import javax.xml.rpc.holders.ObjectHolder;
-import javax.xml.rpc.holders.QNameHolder;
-import javax.xml.rpc.holders.ShortHolder;
-import javax.xml.rpc.holders.ShortWrapperHolder;
-import javax.xml.rpc.holders.StringHolder;
-
-import org.apache.xerces.xs.XSComplexTypeDefinition;
-import org.apache.xerces.xs.XSTypeDefinition;
-import org.jboss.ws.Constants;
-import org.jboss.ws.WSException;
-import org.jboss.ws.core.jaxrpc.ParameterWrapping;
-import org.jboss.ws.core.utils.HolderUtils;
-import org.jboss.ws.metadata.wsdl.xmlschema.JBossXSModel;
-import org.jboss.xb.binding.Util;
-
-/**
- * Singleton utils class used for Java2WSDL and WSDL2Java operations
- *
- * @author <mailto:Anil.Saldhana@jboss.org>Anil Saldhana
- * @since Nov 3, 2004
- */
-
-public class WSDLUtils
-{
- private String newline = "\n";
- private static WSDLUtils instance = new WSDLUtils();
-
- private List wrapperlist = null;
- private List primlist = null;
-
- private final Map primitiveMap = new HashMap();
-
- private final static Map<String,Class> schemaBasicTypes = new
HashMap<String,Class>();
-
- private final static Map<Class,Class> holderTypes = new
HashMap<Class,Class>();
- private final static Map<Class,Class> reverseHolderTypes = new
HashMap<Class,Class>();
-
- // Skip these methods when generating wsdl operations
- private List<String> ignoredMethods;
-
- static
- {
- schemaBasicTypes.put("anyURI", java.net.URI.class);
- schemaBasicTypes.put("boolean", Boolean.TYPE);
- schemaBasicTypes.put("byte", Byte.TYPE);
- schemaBasicTypes.put("decimal", java.math.BigDecimal.class);
- schemaBasicTypes.put("double", Double.TYPE);
- schemaBasicTypes.put("dateTime", Calendar.class);
- schemaBasicTypes.put("float", Float.TYPE);
- schemaBasicTypes.put("int", Integer.TYPE);
- schemaBasicTypes.put("integer", BigInteger.class);
- schemaBasicTypes.put("long", Long.TYPE);
- schemaBasicTypes.put("QName", QName.class);
- schemaBasicTypes.put("short", Short.TYPE);
- schemaBasicTypes.put("String", String.class);
- }
-
- static
- {
- holderTypes.put(BigDecimal.class,BigDecimalHolder.class);
- holderTypes.put(BigInteger.class,BigIntegerHolder.class);
- holderTypes.put(boolean.class,BooleanHolder.class);
- holderTypes.put(Boolean.class,BooleanWrapperHolder.class);
- holderTypes.put(byte.class,ByteHolder.class);
- holderTypes.put(Byte.class,ByteWrapperHolder.class);
- holderTypes.put(Byte[].class,ByteArrayHolder.class);
- holderTypes.put(Calendar.class,CalendarHolder.class);
- holderTypes.put(double.class,DoubleHolder.class);
- holderTypes.put(Double.class,DoubleWrapperHolder.class);
- holderTypes.put(float.class, FloatHolder.class);
- holderTypes.put(Float.class, FloatWrapperHolder.class);
- holderTypes.put(int.class,IntHolder.class);
- holderTypes.put(Integer.class,IntegerWrapperHolder.class);
- holderTypes.put(long.class,LongHolder.class);
- holderTypes.put(Long.class,LongWrapperHolder.class);
- holderTypes.put(Object.class,ObjectHolder.class);
- holderTypes.put(QName.class,QNameHolder.class);
- holderTypes.put(short.class,ShortHolder.class);
- holderTypes.put(Short.class,ShortWrapperHolder.class);
- holderTypes.put(String.class,StringHolder.class);
- }
-
- static
- {
- reverseHolderTypes.put(BigDecimalHolder.class , BigDecimal.class);
- reverseHolderTypes.put(BigIntegerHolder.class , BigInteger.class);
- reverseHolderTypes.put(BooleanHolder.class , boolean.class);
- reverseHolderTypes.put(BooleanWrapperHolder.class, Boolean.class);
- reverseHolderTypes.put(ByteArrayHolder.class, Byte[].class);
- reverseHolderTypes.put(ByteHolder.class, byte.class);
- reverseHolderTypes.put(ByteWrapperHolder.class,Byte.class );
- reverseHolderTypes.put(CalendarHolder.class,Calendar.class);
- reverseHolderTypes.put(DoubleHolder.class,double.class );
- reverseHolderTypes.put(DoubleWrapperHolder.class,Double.class);
- reverseHolderTypes.put(FloatHolder.class,float.class);
- reverseHolderTypes.put(FloatWrapperHolder.class, Float.class);
- reverseHolderTypes.put(IntHolder.class,int.class );
- reverseHolderTypes.put(IntegerWrapperHolder.class,Integer.class );
- reverseHolderTypes.put(LongHolder.class, long.class);
- reverseHolderTypes.put(LongWrapperHolder.class,Long.class);
- reverseHolderTypes.put(ObjectHolder.class,Object.class);
- reverseHolderTypes.put(QNameHolder.class,QName.class);
- reverseHolderTypes.put(ShortHolder.class,short.class);
- reverseHolderTypes.put(ShortWrapperHolder.class,Short.class);
- reverseHolderTypes.put(StringHolder.class,String.class);
- }
-
-
- /**
- * Singleton - Only way to get an instance
- * @return
- */
- public static WSDLUtils getInstance()
- {
- return instance;
- }
-
- private WSDLUtils()
- {
- wrapperlist = new ArrayList();
- primlist = new ArrayList();
- populatePrimList();
- populateWrapperList();
- createPrimitiveMap();
- }
-
- /**
- * Check if it is of Primitive Type
- * @param str
- * @return
- */
- public boolean isPrimitive(String str)
- {
- return primlist.contains(str);
- }
-
- /**
- * Check if it is of Wrapper Type
- * @param str
- * @return
- */
- public boolean isWrapper(String str)
- {
- return wrapperlist.contains(str);
- }
-
- /**
- * For the given complex type, check if its base type is the regular xsd type
(xsd:anyType)
- * which can be ignored
- * @param baseType
- * @param t ComplexTypeDefinition
- * @return true:ignorable, false-otherwise(user defined base type)
- */
- public boolean isBaseTypeIgnorable(XSTypeDefinition baseType, XSComplexTypeDefinition
t)
- {
- boolean bool = false;
-
- //Check baseType is xsd:anyType
- if (baseType != null)
- {
- if (baseType.getNamespace() == Constants.NS_SCHEMA_XSD &&
- baseType.getName().equals("anyType"))
- bool = true; //Ignore this baseType
- }
- if (XSComplexTypeDefinition.CONTENTTYPE_SIMPLE == t.getContentType())
- {
- bool = true; //ComplexType has a simplecontent
- }
-
- return bool;
-
- }
-
-
- /**
- * Check if the class is a Java standard class
- * @param cls
- * @return true if class belongs to java.* or javax.* package
- */
- public boolean checkIgnoreClass(Class cls)
- {
- if(cls == null)
- throw new IllegalArgumentException("Illegal null argument:cls");
- //if (cls.isArray()) cls = cls.getComponentType();
- if (!cls.isArray())
- {
- String pkgname = cls.getPackage() != null ? cls.getPackage().getName() : null;
- if (pkgname != null && pkgname.startsWith("java")) return
true;
-
- if (ParameterWrapping.WrapperType.class.isAssignableFrom(cls))
- return true;
-
- }
- return false;
- }
-
-
- /** Check if this method should be ignored
- */
- public boolean checkIgnoreMethod(Method method)
- {
- String methodname = method.getName();
- if (ignoredMethods == null)
- {
- ignoredMethods = new ArrayList<String>();
- Method[] objMethods = Object.class.getMethods();
- for (int i = 0; i < objMethods.length; i++)
- {
- ignoredMethods.add(objMethods[i].getName());
- }
- //Add the SessionBean Methods to the ignore list
- Method[] sbMethods = SessionBean.class.getMethods();
- for (int i = 0; i < sbMethods.length; i++)
- {
- ignoredMethods.add(sbMethods[i].getName());
- }
- }
-
- boolean ignoreMethod = ignoredMethods.contains(methodname);
-
- // FIXME: This code is a duplicate, it should read from the UMDM
- if (method.getDeclaringClass().isAnnotationPresent(WebService.class) &&
method.isAnnotationPresent(WebMethod.class) == false)
- ignoreMethod = true;
-
- return ignoreMethod;
- }
-
-
- /**
- * Chop "PortType" at the end of the String
- * @param name
- * @return
- */
- public String chopPortType(String name)
- {
- int index = name.lastIndexOf("PortType");
- if (index > 0) return name.substring(0, index);
-
- return name;
- }
-
- /**
- * Chop chopstr at the end of the String
- * @param name
- * @param chopstr the string that is the key Eg: Fault
- * @return
- */
- public String chop(String name, String chopstr)
- {
- int index = name.lastIndexOf(chopstr);
- if (index > 0) return name.substring(0, index);
-
- return name;
- }
-
- /**
- * Given a packageName, start creating the package structure
- * @param packageName
- */
- public File createPackage(String path, String packageName)
- {
- if(packageName == null )
- throw new IllegalArgumentException("Illegal Null Argument:
packageName");
- if(path == null)
- throw new IllegalArgumentException("Illegal Null Argument: path");
- String pac = packageName.replace('.', '/');
- File dir = new File(path + "/" + pac);
- dir.mkdirs();
- return dir;
- }
-
- /**
- * Create a file on the disk
- * @param loc Location where the file has to be created
- * @param fname File Name to which '.java' will be appended
- * @return
- * @throws IOException Problem creating the file
- */
- public File createPhysicalFile(File loc, String fname)
- throws IOException
- {
- if(loc == null )
- throw new IllegalArgumentException("Illegal Null Argument: loc");
- if(fname == null)
- throw new IllegalArgumentException("Illegal Null Argument: fname");
- File sei = new File(loc.getAbsolutePath() + "/" + fname +
".java");
- //Delete the sei if already exists
- if (sei.exists()) sei.delete();
- boolean boolCreate = sei.createNewFile();
- if (!boolCreate)
- throw new WSException("SEI " + fname + ".java cannot be
created");
- return sei;
- }
-
-
- /**
- * Create the basic template of a class
- * @param pkgname Package Name
- * @param fname File Name to which '.java' will be appended
- * @param type XSDType to obtain base class info (if Complex Type)
- * @param importList Strings representing imports
- * @return
- */
- public StringBuilder createClassBasicStructure(String pkgname,
- String fname,
- XSTypeDefinition type,
- List importList, String baseName)
- {
- StringBuilder buf = new StringBuilder();
- writeJbossHeader(buf);
- buf.append(newline);
- buf.append("package " + pkgname + ";");
- buf.append(newline);
- buf.append(newline);
- if (importList != null)
- {
- Iterator iter = importList.iterator();
- while (iter.hasNext())
- {
- buf.append("import " + (String)iter.next() + ";");
- buf.append(newline);
- }
- }
- buf.append(newline);
- XSTypeDefinition baseType = null;
- if (type instanceof XSComplexTypeDefinition)
- {
- XSComplexTypeDefinition t = (XSComplexTypeDefinition)type;
-
- baseType = t.getBaseType();
- //Check baseType is xsd:anyType
- if (baseType != null)
- {
- if (baseType.getNamespace() == Constants.NS_SCHEMA_XSD &&
- baseType.getName().equals("anyType"))
- baseType = null; //Ignore this baseType
- }
- if (XSComplexTypeDefinition.CONTENTTYPE_SIMPLE == t.getContentType())
- {
- baseType = null; //ComplexType has a simplecontent
- }
- }
-
- buf.append("public class " + fname);
- if(baseName == null && baseType != null)
- baseName = baseType.getName();
- if(baseName != null)
- buf.append(" extends " + baseName);
- buf.append(newline);
- buf.append("{");
- buf.append(newline);
-
- return buf;
- }
-
- /**
- * Checks whether there exists a public field with the given name
- * @param javaType Class Object
- * @param name Field name to check
- * @return true - if public field exists, false-otherwise
- */
- public boolean doesPublicFieldExist( Class javaType, String name)
- {
- Field fld = null;
- try
- {
- fld = javaType.getField(name);
- }
- catch (SecurityException e)
- {
- throw e;
- }
- catch (NoSuchFieldException e)
- {
- return false;
- }
- int mod = fld.getModifiers();
- if ((mod == Modifier.PUBLIC))
- return true;
- return false;
- }
-
-
- /**
- * Ensure that the first alphabet is uppercase
- * @param fname
- * @return
- */
- public String firstLetterUpperCase(String fname)
- {
- if (fname == "" || fname == null)
- throw new WSException("String passed is null");
- //Ensure that the first character is uppercase
- if (Character.isLowerCase(fname.charAt(0)))
- {
- char[] chars = fname.toCharArray();
- char f = Character.toUpperCase(chars[0]);
- chars[0] = f;
- fname = new String(chars);
- }
- return fname;
- }
-
- /**
- * Get the dimension of an array
- * @param arr
- * @return dimension of an array
- */
- public int getArrayDimension(Class arr)
- {
- if(arr == null || arr.isArray() == false)
- throw new IllegalArgumentException("Illegal null or array arg:arr");
- int counter = 0;
- while(arr.isArray()) {
- counter += 1;
- arr = arr.getComponentType();
- }
- return counter;
- }
-
- /**
- * Return the Jaxrpc holder that
- * represents the class
- * @param cls
- * @return Jaxrpc Holder object if exists
- */
- public Class getHolder(Class cls)
- {
- return holderTypes.get(cls);
- }
-
- /**
- * Return the Java class that is represented by
- * the Jaxrpc holder
- * @param cls The jaxrpc holder type
- * @return Jaxrpc Holder object if exists
- */
- public Class getJavaTypeForHolder(Class cls)
- {
- if(Holder.class.isAssignableFrom(cls))
- return HolderUtils.getValueType(cls);
- else
- return cls;
- //return reverseHolderTypes.get(cls);
- }
-
-
- /**
- * An input of "HelloObjArray" is converted into arrayOfHelloObj
- * Applied in the input part for WSDL 1.1 Messages
- * @param arrayStr
- * @return
- */
-
- public String getMessagePartForArray(Class javaType)
- {
- StringBuilder sb = new StringBuilder();
- while (javaType.isArray())
- {
- sb.append("arrayOf");
- javaType = javaType.getComponentType();
- }
-
- sb.append(getJustClassName(javaType));
- return sb.toString();
- }
-
- /**
- * Given a class, strip out the package name
- *
- * @param cls
- * @return just the classname
- */
-
- public static String getJustClassName(Class cls)
- {
- if (cls == null) return null;
- if (cls.isArray())
- {
- Class c = cls.getComponentType();
- return getJustClassName(c.getName());
- }
-
- return getJustClassName(cls.getName());
- }
-
- /**
- * Given a FQN of a class, strip out the package name
- *
- * @param classname
- * @return just the classname
- */
- public static String getJustClassName(String classname)
- {
- int index = classname.lastIndexOf(".");
- if (index < 0)
- index = 0;
- else
- index = index + 1;
- return classname.substring(index);
- }
-
- /**
- * From the list of fields defined by this class (not superclasses)
- * get the fields that are relevant (public)
- */
- public Field[] getPublicFields(Class cls)
- {
- ArrayList list = new ArrayList();
-
- Field[] fld = cls.getDeclaredFields();
- for (int i = 0; i < fld.length; i++)
- {
- Field field = fld[i];
- int mod = field.getModifiers();
- if ((mod == Modifier.PUBLIC))
- list.add(field);
- }//end for
-
- Field[] retarr = new Field[list.size()];
- list.toArray(retarr);
-
- return retarr;
- }
-
- /**
- * From the list of fields defined by this class (not superclasses)
- * get the fields that are relevant (public/protected)
- *
- * @param methods
- * @return
- */
- public Method[] getPublicProtectedMethods(Method[] methods)
- {
- ArrayList list = new ArrayList();
- int len = methods.length;
-
- for (int i = 0; i < len; i++)
- {
- Method method = methods[i];
- int mod = method.getModifiers();
- if ((mod == Modifier.PUBLIC || mod == Modifier.PROTECTED))
- list.add(method);
- }//end for
-
- Method[] retarr = new Method[list.size()];
- list.toArray(retarr);
- return retarr;
- }
-
- /**
- * Given the XMLType, we will check if it is of basic schema
- * types that are mapped to Java primitives and wrappers
- * Jaxrpc 1.1 Section 5.3
- * @param xmlType
- * @return
- */
- public Class getJavaType(QName xmlType)
- {
- if (xmlType == null) return null;
- String localPart = xmlType.getLocalPart();
- return (Class)schemaBasicTypes.get(localPart);
- }
-
- /**
- * Change the first character to uppercase
- * @param str
- * @return
- */
- public String getMixedCase(String str)
- {
- if (str == null || str.length() == 0)
- throw new IllegalArgumentException("String passed to WSDLUtils.getMixedCase
is null");
-
- if (str.length() == 1) return str.toUpperCase();
- char[] charr = str.toCharArray();
- charr[0] = Character.toUpperCase(charr[0]);
- return new String(charr);
- }
-
-
-
- /**
- * Given a QName, provide a string that is prefix:localpart
- * @param qn
- * @return formatted string
- */
- public String getFormattedString(QName qn)
- {
- if (qn == null)
- throw new IllegalArgumentException(" QName passed is null");
- StringBuilder sb = new StringBuilder();
- String prefix = qn.getPrefix();
- String localpart = qn.getLocalPart();
- if (prefix == null || prefix == "") prefix = Constants.PREFIX_TNS;
- sb.append(prefix + ":");
- sb.append(localpart);
-
- return sb.toString();
- }
-
- /**
- * Return a QName given a formatted string
- * @param formattedStr string that is prefix:localpart
- * @return QName
- */
- public QName getQName( String formattedStr)
- {
- QName qn = null;
- int ind = formattedStr.lastIndexOf(":");
- if(ind < 0)
- throw new IllegalArgumentException("Formatted String is not of format
prefix:localpart");
- String prefix = formattedStr.substring(0,ind);
- String nsuri = null;
- if(Constants.PREFIX_XSD.equals(prefix)) nsuri = Constants.NS_SCHEMA_XSD;
- if(nsuri == null)
- qn = new QName( formattedStr.substring(ind+1) );
- else
- qn = new QName( nsuri,formattedStr.substring(ind+1),prefix);
- return qn;
- }
-
-
- /**
- * Return the primitive for a wrapper equivalent (Integer -> int)
- * @param str
- * @return
- */
- public String getPrimitive(String str)
- {
- return (String)primitiveMap.get(str);
- }
-
- /**
- * Extracts the package name from the typeNS
- * @param typeNS
- * @return
- */
- public String getPackageName(String typeNS)
- {
- String pkgname = Util.xmlNamespaceToJavaPackage(typeNS);
- int len = pkgname.length();
- return pkgname;
- }
-
- public String getTypeNamespace(Class javaType)
- {
- return getTypeNamespace(javaType.getPackage().getName());
- }
-
- /**
- * Extracts the typeNS given the package name
- * Algorithm is based on the one specified in JAWS v2.0 spec
- * @param packageName
- * @return the type namespace
- */
- public String getTypeNamespace(String packageName)
- {
- StringBuilder sb = new StringBuilder("http://");
-
- //Generate tokens with '.' as delimiter
- StringTokenizer st = new StringTokenizer(packageName,".");
-
- //Have a LIFO queue for the tokens
- Stack<String> stk = new Stack<String>();
- while(st != null && st.hasMoreTokens())
- {
- stk.push(st.nextToken());
- }
-
- String next;
- while(!stk.isEmpty() && (next=stk.pop())!=null)
- {
- if(sb.toString().equals("http://") == false)
sb.append(".");
- sb.append(next);
- }
-
- // trailing slash
- sb.append("/");
-
- return sb.toString();
- }
-
- /**
- * Given WSDLDefinitions, detect the wsdl style
- *
- * @param wsdl
- * @return Constants.RPC_LITERAL or Constants.DOCUMENT_LITERAL
- */
- public String getWSDLStyle(WSDLDefinitions wsdl)
- {
- WSDLInterface wi = wsdl.getInterfaces()[0];
- WSDLInterfaceOperation wio = wi.getOperations()[0];
- String style = wio.getStyle();
- if(style == null || style.equals(Constants.URI_STYLE_RPC) ||
"rpc".equalsIgnoreCase(style))
- return Constants.RPC_LITERAL;
- else
- return Constants.DOCUMENT_LITERAL;
- }
-
- public static JBossXSModel getSchemaModel(WSDLTypes types)
- {
- if (types instanceof XSModelTypes)
- return ((XSModelTypes) types).getSchemaModel();
-
- throw new WSException("WSDLTypes is not an XSModelTypes");
- }
-
- public static void addSchemaModel(WSDLTypes types, String namespace, JBossXSModel
model)
- {
- if (! (types instanceof XSModelTypes))
- throw new WSException("WSDLTypes is not an XSModelTypes");
-
- XSModelTypes modelTypes = (XSModelTypes) types;
- modelTypes.addSchemaModel(namespace, model);
- }
-
- /**
- * Checks whether the class is a standard jaxrpc holder
- *
- * @param cls a Class object
- * @return true: A Standard jaxrpc holder
- */
- public boolean isStandardHolder(Class cls)
- {
- if(Holder.class.isAssignableFrom(cls) == false)
- return false; //Not even a holder
- //It is a holder. Is it a standard holder?
- if(cls.getPackage().getName().startsWith("javax.xml.rpc"))
- return true;
- return false;
- }
-
- /**
- * Write the JBoss License Header at the top of generated class source files
- * @param buf
- */
- public void writeJbossHeader(StringBuilder buf)
- {
- buf.append("/*").append(newline);
- buf.append(" * JBossWS WS-Tools Generated Source").append(newline);
- buf.append(" *").append(newline);
- buf.append(" * Generation Date: " + new Date() + newline);
- buf.append(" *").append(newline);
- buf.append(" * This generated source code represents a derivative work of the
input to").append(newline);
- buf.append(" * the generator that produced it. Consult the input for the
copyright and").append(newline);
- buf.append(" * terms of use that apply to this source
code.").append(newline);
- buf.append(" */").append(newline);
- }
-
- protected void populatePrimList()
- {
- primlist.add("int");
- primlist.add("boolean");
- primlist.add("short");
- primlist.add("byte");
- primlist.add("long");
- primlist.add("float");
- primlist.add("double");
- }
-
- protected void populateWrapperList()
- {
- wrapperlist.add("java.lang.Integer");
- wrapperlist.add("java.lang.Boolean");
- wrapperlist.add("java.lang.Short");
- wrapperlist.add("java.lang.Byte");
- wrapperlist.add("java.lang.Long");
- wrapperlist.add("java.lang.Float");
- wrapperlist.add("java.lang.Double");
- wrapperlist.add("java.lang.String");
-
- wrapperlist.add("java.math.BigInteger");
- wrapperlist.add("java.math.BigDecimal");
- wrapperlist.add("java.util.Calendar");
- wrapperlist.add("javax.xml.namespace.QName");
- }
-
- private void createPrimitiveMap()
- {
- primitiveMap.put("Integer", "int");
- primitiveMap.put("Float", "float");
- primitiveMap.put("Long", "long");
- primitiveMap.put("Double", "double");
- primitiveMap.put("Short", "short");
- primitiveMap.put("Boolean", "boolean");
- primitiveMap.put("Byte", "byte");
- primitiveMap.put("java.lang.Integer", "int");
- primitiveMap.put("java.lang.Float", "float");
- primitiveMap.put("java.lang.Long", "long");
- primitiveMap.put("java.lang.Double", "double");
- primitiveMap.put("java.lang.Short", "short");
- primitiveMap.put("java.lang.Boolean", "boolean");
- primitiveMap.put("java.lang.Byte", "byte");
- }
-
- public static WSDLInterfaceOperationOutput getWsdl11Output(WSDLInterfaceOperation
operation)
- {
- WSDLInterfaceOperationOutput[] outputs = operation.getOutputs();
- if (outputs == null)
- return null;
-
- switch (outputs.length)
- {
- case 0: return null;
- case 1: return outputs[0];
- }
-
- throw new WSException("Only Request-Only and Request-Response MEPs are
allowed");
- }
-
- public static WSDLInterfaceOperationInput getWsdl11Input(WSDLInterfaceOperation
operation)
- {
- WSDLInterfaceOperationInput[] inputs = operation.getInputs();
- if (inputs == null)
- return null;
-
- switch (inputs.length)
- {
- case 0: return null;
- case 1: return inputs[0];
- }
-
- throw new WSException("Only Request-Only and Request-Response MEPs are
allowed");
- }
-}
\ No newline at end of file
Copied: trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLUtils.java (from rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLUtils.java)
Deleted: trunk/src/main/java/org/jboss/ws/metadata/wsdl/XSModelTypes.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/XSModelTypes.java 2006-12-07
10:43:36 UTC (rev 1600)
+++ trunk/src/main/java/org/jboss/ws/metadata/wsdl/XSModelTypes.java 2006-12-07 12:05:41
UTC (rev 1603)
@@ -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.metadata.wsdl;
-
-import javax.xml.namespace.QName;
-
-import org.apache.xerces.xs.XSElementDeclaration;
-import org.apache.xerces.xs.XSTypeDefinition;
-import org.jboss.logging.Logger;
-import org.jboss.ws.WSException;
-import org.jboss.ws.metadata.wsdl.xmlschema.JBossXSModel;
-
-/**
- * A JBossXSModel based type definition.
- *
- * @author <a href="mailto:jason.greene@jboss.com">Jason T.
Greene</a>
- * @version $Revision$
- */
-public class XSModelTypes extends WSDLTypes
-{
- private static final Logger log = Logger.getLogger(XSModelTypes.class);
-
- private JBossXSModel schemaModel;
-
- public XSModelTypes()
- {
- this.schemaModel = new JBossXSModel();
- }
-
- /**
- * Add a schema model for a given namespaceURI
- * @param nsURI the namespaceURI under which the model has been generated
- * @param schema the Schema Model that needs to be added to existing schema
- * model in WSDLTypes
- * <dt>Warning:</dd>
- * <p>Passing a null nsURI will replace the internal schema model
- * held by WSDLTypes by the model passed as an argument.</p>
- */
- public void addSchemaModel(String nsURI, JBossXSModel schema)
- {
- if(nsURI == null)
- {
- log.trace("nsURI passed to addSchemaModel is null. Replacing Schema
Model");
- schemaModel = schema;
- }
- else
- schemaModel.merge(schema);
- }
-
- /**
- * Return the global Schema Model
- * @return
- */
- public JBossXSModel getSchemaModel()
- {
- return schemaModel;
- }
-
- /** Get the xmlType from a given element xmlName
- */
- public QName getXMLType(QName xmlName)
- {
- QName xmlType = null;
- String nsURI = xmlName.getNamespaceURI();
- String localPart = xmlName.getLocalPart();
- XSElementDeclaration xsel = schemaModel.getElementDeclaration(localPart, nsURI);
- if (xsel != null)
- {
- XSTypeDefinition xstype = xsel.getTypeDefinition();
- if (xstype == null)
- throw new WSException("Cannot obtain XSTypeDefinition for: " +
xmlName);
-
- if (xstype.getAnonymous() == false)
- {
- xmlType = new QName(xstype.getNamespace(), xstype.getName());
- }
- else
- {
- xmlType = new QName(xstype.getNamespace(), ">" + localPart);
- }
- }
- return xmlType;
- }
-
- public String toString()
- {
- StringBuilder buffer = new StringBuilder("WSDLTypes:\n");
- buffer.append(schemaModel != null ? schemaModel.serialize() :
"<schema/>");
- return buffer.toString();
- }
-}
Copied: trunk/src/main/java/org/jboss/ws/metadata/wsdl/XSModelTypes.java (from rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/XSModelTypes.java)
Copied: trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema (from rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema)
Deleted:
trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSComplexTypeDefinition.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSComplexTypeDefinition.java 2006-12-07
10:43:36 UTC (rev 1600)
+++
trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSComplexTypeDefinition.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -1,259 +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.xmlschema;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.xerces.xs.XSAttributeUse;
-import org.apache.xerces.xs.XSComplexTypeDefinition;
-import org.apache.xerces.xs.XSConstants;
-import org.apache.xerces.xs.XSObjectList;
-import org.apache.xerces.xs.XSParticle;
-import org.apache.xerces.xs.XSSimpleTypeDefinition;
-import org.apache.xerces.xs.XSTypeDefinition;
-import org.apache.xerces.xs.XSWildcard;
-
-/**
- * @author <mailto:Anil.Saldhana@jboss.org>Anil Saldhana
- * @since Apr 21, 2005
- */
-public class JBossXSComplexTypeDefinition
- extends JBossXSTypeDefinition
- implements XSComplexTypeDefinition
-{
- private boolean isAbstract;
- private XSSimpleTypeDefinition xsSimple;
- private XSParticle xspart;
- private XSObjectList annots;
-
- private String prefix;
-
- private List<XSAttributeUse> attList = new ArrayList<XSAttributeUse>();
-
- //Content Type
- private short contentType = XSComplexTypeDefinition.CONTENTTYPE_ELEMENT;
-
- private short deriveMethod = XSConstants.DERIVATION_NONE;
-
- public JBossXSComplexTypeDefinition( )
- {
- }
-
- public JBossXSComplexTypeDefinition(String name, String namespace)
- {
- super(name, namespace);
- }
-
- public JBossXSComplexTypeDefinition(XSComplexTypeDefinition xc)
- {
- super(xc.getName(),xc.getNamespace());
- setAnonymous(xc.getAnonymous());
- xspart = xc.getParticle();
- xsSimple = xc.getSimpleType();
- deriveMethod = xc.getDerivationMethod();
- this.baseType = new JBossXSTypeDefinition(xc.getBaseType());
- }
-
- /**
- * [derivation method]: either <code>DERIVATION_EXTENSION</code>,
- * <code>DERIVATION_RESTRICTION</code>, or
<code>DERIVATION_NONE</code>
- * (see <code>XSConstants</code>).
- */
- public short getDerivationMethod()
- {
- return deriveMethod;
- }
-
- /**
- * [abstract]: a boolean. Complex types for which <code>abstract</code>
is
- * true must not be used as the type definition for the validation of
- * element information items.
- */
- public boolean getAbstract()
- {
- return isAbstract;
- }
-
- /**
- * A set of attribute uses if it exists, otherwise an empty
- * <code>XSObjectList</code>.
- */
- public XSObjectList getAttributeUses()
- {
- JBossXSObjectList oblist = new JBossXSObjectList();
- for(XSAttributeUse xa:attList)
- {
- oblist.addItem(xa);
- }
- return oblist;
- }
-
- /**
- * An attribute wildcard if it exists, otherwise <code>null</code>.
- */
- public XSWildcard getAttributeWildcard()
- {
- return null;
- }
-
- /**
- * [content type]: one of empty (<code>CONTENTTYPE_EMPTY</code>), a
simple
- * type definition (<code>CONTENTTYPE_SIMPLE</code>), mixed (
- * <code>CONTENTTYPE_MIXED</code>), or element-only (
- * <code>CONTENTTYPE_ELEMENT</code>).
- */
- public short getContentType()
- {
- return contentType;
- }
-
- /**
- * A simple type definition corresponding to a simple content model,
- * otherwise <code>null</code>.
- */
- public XSSimpleTypeDefinition getSimpleType()
- {
- return xsSimple;
- }
-
- /**
- * A particle for a mixed or element-only content model, otherwise
- * <code>null</code>.
- */
- public XSParticle getParticle()
- {
- return xspart;
- }
-
- /**
- * [prohibited substitutions]: a subset of {extension, restriction}
- * @param restriction Extension or restriction constants (see
- * <code>XSConstants</code>).
- * @return True if <code>restriction</code> is a prohibited substitution,
- * otherwise false.
- */
- public boolean isProhibitedSubstitution(short restriction)
- {
- return false;
- }
-
- /**
- * [prohibited substitutions]: A subset of {extension, restriction} or
- * <code>DERIVATION_NONE</code> represented as a bit flag (see
- * <code>XSConstants</code>).
- */
- public short getProhibitedSubstitutions()
- {
- return 0;
- }
-
- /**
- * A set of [annotations] if it exists, otherwise an empty
- * <code>XSObjectList</code>.
- */
- public XSObjectList getAnnotations()
- {
- return annots;
- }
-
- /**
- * Get the type
- */
- @Override
- public short getType()
- {
- return XSTypeDefinition.COMPLEX_TYPE;
- }
-
- /**
- * Return whether this type definition is a simple type or complex type.
- */
- @Override
- public short getTypeCategory()
- {
- return XSTypeDefinition.COMPLEX_TYPE;
- }
-
- public void setAbstract(boolean anAbstract)
- {
- isAbstract = anAbstract;
- }
-
- public void setDerivationMethod(short deriveMethod)
- {
- this.deriveMethod = deriveMethod;
- }
-
- /**
- * A simple type definition corresponding to a simple content model,
- * otherwise <code>null</code>.
- */
- public void setSimpleType(XSSimpleTypeDefinition xsSimple)
- {
- this.xsSimple = xsSimple;
- }
-
- /**
- * A particle for a mixed or element-only content model, otherwise
- * <code>null</code>.
- */
- public void setParticle(XSParticle xspart)
- {
- this.xspart = xspart;
- }
-
- /**
- * A set of [annotations] if it exists, otherwise an empty
- * <code>XSObjectList</code>.
- */
- public void setAnnotations(XSObjectList annots)
- {
- this.annots = annots;
- }
-
- /**
- * @see XSComplexTypeDefinition.CONTENTTYPE_EMPTY
- * @see XSComplexTypeDefinition.CONTENTTYPE_SIMPLE
- * @see XSComplexTypeDefinition.CONTENTTYPE_MIXED
- * @see XSComplexTypeDefinition.CONTENTTYPE_ELEMENT
- *
- * @param contentType
- */
- public void setContentType(short contentType)
- {
- this.contentType = contentType;
- }
-
- //*********************************************************************
- // Custom Methods
- //*********************************************************************
- public void addXSAttributeUse(XSAttributeUse at)
- {
- attList.add(at);
- }
-
- public String toString()
- {
- return "";
- }
-}
Copied:
trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSComplexTypeDefinition.java
(from rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSComplexTypeDefinition.java)
Deleted:
trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSElementDeclaration.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSElementDeclaration.java 2006-12-07
10:43:36 UTC (rev 1600)
+++
trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSElementDeclaration.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -1,243 +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.xmlschema;
-
-import org.apache.xerces.xs.ShortList;
-import org.apache.xerces.xs.XSAnnotation;
-import org.apache.xerces.xs.XSComplexTypeDefinition;
-import org.apache.xerces.xs.XSConstants;
-import org.apache.xerces.xs.XSElementDeclaration;
-import org.apache.xerces.xs.XSException;
-import org.apache.xerces.xs.XSNamedMap;
-import org.apache.xerces.xs.XSTypeDefinition;
-
-
-/**
- * Represents an XS Element Declaration
- * @author <mailto:Anil.Saldhana@jboss.org>Anil Saldhana
- * @since May 3, 2005
- */
-public class JBossXSElementDeclaration
- extends JBossXSObject
- implements XSElementDeclaration
-{
- protected String targetNamespace = null;
- protected JBossXSTypeDefinition xstype = null;
- protected boolean nillable = false;
- private XSElementDeclaration xsed;
-
- /**
- * Sole Annotation object
- */
- protected XSAnnotation annotation = null;
-
- /**
- *
- */
- public JBossXSElementDeclaration()
- {
- super();
- }
-
- /**
- * @param name
- * @param namespace
- */
- public JBossXSElementDeclaration(String name, String namespace)
- {
- super(name, namespace);
- }
-
- /**
- * Create a new JBossXSElementDeclaration while
- * reading data from XSElementDeclaration.
- * @param xe
- */
- public JBossXSElementDeclaration(XSElementDeclaration xe)
- {
- if(xe == null)
- throw new IllegalArgumentException("Illegal Null Argument:xe");
-
- xsed = xe;
- name= xe.getName();
- namespace = xe.getNamespace();
- XSTypeDefinition xt = xe.getTypeDefinition();
- if(xt instanceof JBossXSTypeDefinition == false
- && xt instanceof XSComplexTypeDefinition)
- {
- xstype = new JBossXSComplexTypeDefinition((XSComplexTypeDefinition)xt);
- }
- else
- if(xt instanceof JBossXSTypeDefinition == false)
- {
- xstype = new JBossXSTypeDefinition(xt);
- }
- this.annotation = xe.getAnnotation();
- }
-
- public XSElementDeclaration getXSElementDeclaration()
- {
- return xsed;
- }
-
- /**
- * One of XSConstants.SCOPE_GLOBAL, XSConstants.SCOPE_LOCAL
- * or XSConstants.SCOPE_ABSENT
- */
- protected short scope = 0;
-
- protected XSComplexTypeDefinition enclosingCTDefinition;
-
- public XSTypeDefinition getTypeDefinition()
- {
- return this.xstype;
- }
-
- public void setTypeDefinition(XSTypeDefinition xst )
- {
- if(xst instanceof JBossXSTypeDefinition)
- this.xstype = (JBossXSTypeDefinition)xst ;
- else
- if(xst instanceof XSComplexTypeDefinition)
- this.xstype = new JBossXSComplexTypeDefinition((XSComplexTypeDefinition)xst);
- }
-
- /**
- * One of XSConstants.SCOPE_GLOBAL, XSConstants.SCOPE_LOCAL
- * or XSConstants.SCOPE_ABSENT
- * @return
- */
- public short getScope()
- {
- return this.scope;
- }
-
- public void setScope(short scope)
- {
- this.scope = scope;
- }
-
- public XSComplexTypeDefinition getEnclosingCTDefinition()
- {
- return this.enclosingCTDefinition;
- }
-
- public void setEnclosingCTDefinition( XSComplexTypeDefinition enclosingCTDefinition)
- {
- this.enclosingCTDefinition = enclosingCTDefinition;
- }
-
- public String getTargetNamespace()
- {
- return targetNamespace;
- }
-
- public void setTargetNamespace(String targetNamespace)
- {
- this.targetNamespace = targetNamespace;
- this.setNamespace( targetNamespace );
- }
-
- public short getConstraintType()
- {
- return 0;
- }
-
- public String getConstraintValue()
- {
- return null;
- }
-
- public Object getActualVC() throws XSException
- {
- return null;
- }
-
- public short getActualVCType() throws XSException
- {
- return 0;
- }
-
- public ShortList getItemValueTypes() throws XSException
- {
- return null;
- }
-
- public boolean getNillable()
- {
- return this.nillable;
- }
-
- public void setNillable(boolean nillable)
- {
- this.nillable = nillable;
- }
-
- public XSNamedMap getIdentityConstraints()
- {
- return null;
- }
-
- public XSElementDeclaration getSubstitutionGroupAffiliation()
- {
- return null;
- }
-
- public boolean isSubstitutionGroupExclusion(short i)
- {
- return false;
- }
-
- public short getSubstitutionGroupExclusions()
- {
- return 0;
- }
-
- public boolean isDisallowedSubstitution(short i)
- {
- return false;
- }
-
- public short getDisallowedSubstitutions()
- {
- return 0;
- }
-
- public boolean getAbstract()
- {
- return false;
- }
-
- public XSAnnotation getAnnotation()
- {
- return this.annotation;
- }
-
- /**
- * Get the type
- */
- @Override
- public short getType()
- {
- return XSConstants.ELEMENT_DECLARATION;
- }
-}
Copied:
trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSElementDeclaration.java
(from rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSElementDeclaration.java)
Deleted:
trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSEntityResolver.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSEntityResolver.java 2006-12-07
10:43:36 UTC (rev 1600)
+++
trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSEntityResolver.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -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.wsdl.xmlschema;
-
-// $Id$
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.xerces.xni.XMLResourceIdentifier;
-import org.apache.xerces.xni.XNIException;
-import org.apache.xerces.xni.parser.XMLEntityResolver;
-import org.apache.xerces.xni.parser.XMLInputSource;
-import org.jboss.logging.Logger;
-import org.jboss.ws.Constants;
-import org.xml.sax.EntityResolver;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-
-/**
- * Entity Resolver for the default Xerces Reference parser
- * @author <a href="mailto:Anil.Saldhana@jboss.org">Anil
Saldhana</a>
- * @author Thomas.Diesler(a)jboss.org
- * @since 12-Aug-2005
- */
-public class JBossXSEntityResolver implements XMLEntityResolver
-{
- // provide logging
- private static final Logger log = Logger.getLogger(JBossXSEntityResolver.class);
-
- private Map<String, URL> schemaLocationByNamespace = new HashMap<String,
URL>();
-
- private EntityResolver delegate;
-
- public JBossXSEntityResolver(EntityResolver resolver, Map<String, URL>
schemaLocationByNamespace)
- {
- this.schemaLocationByNamespace = schemaLocationByNamespace;
- this.delegate = resolver;
- }
-
- /**
- * Resolves an external parsed entity. If the entity cannot be
- * resolved, this method should return null.
- *
- * @param resourceIdentifier description of the resource to be resolved
- * @throws XNIException Thrown on general error.
- * @throws IOException Thrown if resolved entity stream cannot be
- * opened or some other i/o error occurs.
- */
- public XMLInputSource resolveEntity(XMLResourceIdentifier resId) throws XNIException,
IOException
- {
- log.trace("Resolve entity: " + resId);
-
- // First try the JBossEntityResolver
- String publicId = resId.getPublicId();
- String systemId = resId.getLiteralSystemId();
- String namespace = resId.getNamespace();
- try
- {
- String publicURI = (publicId != null ? publicId : namespace);
- InputSource inputSource = delegate.resolveEntity(publicURI, systemId);
- if (inputSource != null)
- {
- XMLInputSource source = getXMLInputSource(inputSource, resId);
- return source;
- }
- }
- catch (Exception ex)
- {
- log.trace(ex);
- }
-
- try
- {
- String expandedSysId = resId.getExpandedSystemId();
- if (expandedSysId != null)
- {
- log.trace("Use ExpandedSystemId: " + expandedSysId);
- return getXMLInputSource(new URL(expandedSysId), resId);
- }
- }
- catch (IOException e)
- {
- log.trace(e);
- }
-
- try
- {
- if (systemId != null)
- {
- log.trace("Use LiteralSystemId: " + systemId);
- return getXMLInputSource(new URL(systemId), resId);
- }
- }
- catch (IOException e)
- {
- log.trace(e);
- }
-
- // in case of a DOCTYPE declaration ew refer to systemId
- String namespaceURI = resId.getNamespace() != null ? resId.getNamespace() :
resId.getLiteralSystemId();
-
- // The schema parser will obviously know this schema already
- if (Constants.NS_SCHEMA_XSD.equals(namespaceURI))
- return null;
-
- try
- {
- URL url = schemaLocationByNamespace.get(namespaceURI);
- if (url != null)
- {
- log.trace("Use SchemaLocationByNamespace: " + url);
- return getXMLInputSource(url, resId);
- }
-
- // Delegate to JBoss Entity Resolver
- XMLInputSource source = getXMLInputSource(
- delegate.resolveEntity(null, namespaceURI), resId);
- if (source != null)
- return source;
- }
- catch (SAXException e)
- {
- log.trace(e);
- }
-
- try
- {
- log.trace("Use NamespaceURI: " + namespaceURI);
- return getXMLInputSource(new URL(namespaceURI), resId);
- }
- catch (IOException e)
- {
- log.trace(e);
- }
-
- log.trace("Cannot obtain XMLInputSource for: " + resId);
- return null;
- }
-
- private XMLInputSource getXMLInputSource(URL url, XMLResourceIdentifier resId) throws
IOException
- {
- InputStream inputStream = url.openStream();
- InputSource inputSource = new InputSource(inputStream);
- return getXMLInputSource(inputSource, resId);
- }
-
- private XMLInputSource getXMLInputSource(InputSource inputSource,
XMLResourceIdentifier resId)
- {
- String encoding = inputSource.getEncoding();
- InputStream byteStream = inputSource.getByteStream();
- return new XMLInputSource(resId.getPublicId(), resId.getExpandedSystemId(),
resId.getBaseSystemId(), byteStream, encoding);
- }
-}
\ No newline at end of file
Copied:
trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSEntityResolver.java (from
rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSEntityResolver.java)
Deleted:
trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSErrorHandler.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSErrorHandler.java 2006-12-07
10:43:36 UTC (rev 1600)
+++
trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSErrorHandler.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -1,116 +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.xmlschema;
-
-import org.apache.xerces.xni.XNIException;
-import org.apache.xerces.xni.parser.XMLErrorHandler;
-import org.apache.xerces.xni.parser.XMLParseException;
-import org.jboss.logging.Logger;
-/**
- * Error Handler for the Xerces schema parser default implementation
- * @author <mailto:Anil.Saldhana@jboss.org>Anil Saldhana
- * @since Aug 11, 2005
- */
-public class JBossXSErrorHandler implements XMLErrorHandler
-{
- private static final Logger log = Logger.getLogger(JBossXSErrorHandler.class);
-
- /**
- * Reports a warning. Warnings are non-fatal and can be safely ignored by most
applications.
- * @param domain - The domain of the warning. The domain can be any string but is
suggested to be a valid URI. The domain can be used to conveniently specify a web site
location of the relevent specification or document pertaining to this warning.
- * @param key - The warning key. This key can be any string and is implementation
dependent.
- * @param exception - Exception.
- * @throws XNIException Thrown to signal that the parser should stop parsing the
document.
- */
- public void warning(String domain, String key, XMLParseException xexp) throws
XNIException
- {
- log.trace(getFormattedString(domain,key,xexp));
- }
-
- /**
- * Reports an error. Errors are non-fatal and usually signify that the document is
invalid with respect to its grammar(s).
- * @param domain - The domain of the warning. The domain can be any string but is
suggested to be a valid URI. The domain can be used to conveniently specify a web site
location of the relevent specification or document pertaining to this warning.
- * @param key - The warning key. This key can be any string and is implementation
dependent.
- * @param exception - Exception.
- * @throws XNIException Thrown to signal that the parser should stop parsing the
document.
- */
- public void error(String domain, String key, XMLParseException xexp) throws
XNIException
- {
- if("src-include.2.1".equals(key))
- throw new XNIException("Parser should stop:",xexp);
- log.error(getFormattedString(domain,key,xexp));
- }
-
- /**
- * Report a fatal error. Fatal errors usually occur when the document is not
well-formed
- * and signifies that the parser cannot continue normal operation.
- * @param domain - The domain of the warning. The domain can be any string but is
suggested to be a valid URI. The domain can be used to conveniently specify a web site
location of the relevent specification or document pertaining to this warning.
- * @param key - The warning key. This key can be any string and is implementation
dependent.
- * @param exception - Exception.
- * @throws XNIException Thrown to signal that the parser should stop parsing the
document.
- */
- public void fatalError(String domain, String key, XMLParseException xexp) throws
XNIException
- {
- log.fatal(getFormattedString(domain,key,xexp));
- throw new XNIException("Parser should stop:",xexp);
- }
-
- /**
- * Get the name of the schema file in question
- *
- * @param xexp
- * @return
- */
- private String getFileName(XMLParseException xexp)
- {
- String fname = xexp.getExpandedSystemId();
- if (fname != null) {
- int index = fname.lastIndexOf('/');
- if (index != -1)
- fname = fname.substring(index + 1);
- }
- else
- {
- fname = "";
- }
-
- return fname;
- }
-
- /**
- * Return a formatted string that gives as much information
- * as possible to the user
- * @param domain
- * @param key
- * @param xexp
- * @return
- */
- private String getFormattedString(String domain, String key, XMLParseException xexp)
- {
- StringBuilder buf = new StringBuilder(getFileName(xexp));
- buf.append("[domain:");
-
buf.append(domain).append("]::[key=").append(key).append("]::");
- buf.append("Message=");
- buf.append(xexp.getLocalizedMessage());
- return buf.toString();
- }
-}
Copied: trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSErrorHandler.java
(from rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSErrorHandler.java)
Deleted: trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSModel.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSModel.java 2006-12-07
10:43:36 UTC (rev 1600)
+++ trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSModel.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -1,745 +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.xmlschema;
-
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.Serializable;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.xerces.xs.StringList;
-import org.apache.xerces.xs.XSAnnotation;
-import org.apache.xerces.xs.XSAttributeDeclaration;
-import org.apache.xerces.xs.XSAttributeGroupDefinition;
-import org.apache.xerces.xs.XSComplexTypeDefinition;
-import org.apache.xerces.xs.XSConstants;
-import org.apache.xerces.xs.XSElementDeclaration;
-import org.apache.xerces.xs.XSModel;
-import org.apache.xerces.xs.XSModelGroup;
-import org.apache.xerces.xs.XSModelGroupDefinition;
-import org.apache.xerces.xs.XSNamedMap;
-import org.apache.xerces.xs.XSNamespaceItem;
-import org.apache.xerces.xs.XSNamespaceItemList;
-import org.apache.xerces.xs.XSNotationDeclaration;
-import org.apache.xerces.xs.XSObjectList;
-import org.apache.xerces.xs.XSParticle;
-import org.apache.xerces.xs.XSSimpleTypeDefinition;
-import org.apache.xerces.xs.XSTerm;
-import org.apache.xerces.xs.XSTypeDefinition;
-import org.jboss.logging.Logger;
-import org.jboss.ws.Constants;
-import org.jboss.ws.WSException;
-import org.jboss.ws.core.utils.DOMUtils;
-import org.jboss.ws.core.utils.DOMWriter;
-import org.jboss.xb.binding.NamespaceRegistry;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-
-/**
- * Represents a schema model
- * @author <mailto:Anil.Saldhana@jboss.org>Anil Saldhana
- * @since Apr 20, 2005
- */
-
-public class JBossXSModel implements XSModel, Cloneable
-{
- // provide logging
- private static final Logger log = Logger.getLogger(JBossXSModel.class);
-
- private AnonymousMapper anonymousMapper = new AnonymousMapper();
-
- private boolean qualifiedElements = false;
-
- private NamespaceRegistry namespaceRegistry = new NamespaceRegistry();
-
- protected XSNamespaceItemList nslist = null;
-
- protected HashMap<String, JBossXSNamespaceItem> nsimap = new HashMap<String,
JBossXSNamespaceItem>();
-
- public JBossXSModel()
- {
- }
-
- @Override
- public JBossXSModel clone() throws CloneNotSupportedException
- {
- return (JBossXSModel)super.clone();
- }
-
- /**
- * Convenience method. Returns a list of all namespaces that belong to
- * this schema. The value <code>null</code> is not a valid namespace
- * name, but if there are components that do not have a target namespace
- * , <code>null</code> is included in this list.
- */
- public StringList getNamespaces()
- {
- return new JBossXSStringList(nsimap.keySet());
- }
-
- /**
- * A set of namespace schema information information items (of type
- * <code>XSNamespaceItem</code>), one for each namespace name which
- * appears as the target namespace of any schema component in the schema
- * used for that assessment, and one for absent if any schema component
- * in the schema had no target namespace. For more information see
- * schema information.
- */
- public XSNamespaceItemList getNamespaceItems()
- {
-
- nslist = new JBossXSNamespaceItemList(nsimap.values());
-
- //One for the default xsd
- JBossXSNamespaceItem nsxsd = new JBossXSNamespaceItem(Constants.NS_SCHEMA_XSD,
namespaceRegistry, qualifiedElements);
- ((JBossXSNamespaceItemList)nslist).addItem(nsxsd);
- return nslist;
- }
-
- /**
- * Returns a list of top-level components, i.e. element declarations,
- * attribute declarations, etc.
- * @param objectType The type of the declaration, i.e.
- * <code>ELEMENT_DECLARATION</code>. Note that
- * <code>XSTypeDefinition.SIMPLE_TYPE</code> and
- * <code>XSTypeDefinition.COMPLEX_TYPE</code> can also be used as the
- * <code>objectType</code> to retrieve only complex types or simple
- * types, instead of all types.
- * @return A list of top-level definitions of the specified type in
- * <code>objectType</code> or an empty
<code>XSNamedMap</code> if no
- * such definitions exist.
- */
- public XSNamedMap getComponents(short objectType)
- {
- JBossXSNamedMap map = new JBossXSNamedMap();
- JBossXSStringList sl = (JBossXSStringList)getNamespaces();
- int len = sl != null ? sl.getLength() : 0;
-
- for (int i = 0; i < len; i++)
- {
- String ns = sl.item(i);
- JBossXSNamespaceItem ni = nsimap.get(ns);
- JBossXSNamedMap nm = null;
- if (ni != null)
- {
- nm = (JBossXSNamedMap)ni.getComponents(objectType);
- map.addItems(nm.toList());
- }
- }
-
- return map;
- }
-
- /**
- * Convenience method. Returns a list of top-level component declarations
- * that are defined within the specified namespace, i.e. element
- * declarations, attribute declarations, etc.
- * @param objectType The type of the declaration, i.e.
- * <code>ELEMENT_DECLARATION</code>.
- * @param namespace The namespace to which the declaration belongs or
- * <code>null</code> (for components with no target namespace).
- * @return A list of top-level definitions of the specified type in
- * <code>objectType</code> and defined in the specified
- * <code>namespace</code> or an empty
<code>XSNamedMap</code>.
- */
- public XSNamedMap getComponentsByNamespace(short objectType, String namespace)
- {
- JBossXSNamedMap map = new JBossXSNamedMap();
-
- JBossXSNamespaceItem ni = nsimap.get(namespace);
- if (ni == null)
- return map;
-
- return ni.getComponents(objectType);
- }
-
- /**
- * [annotations]: a set of annotations if it exists, otherwise an empty
- * <code>XSObjectList</code>.
- */
- public XSObjectList getAnnotations()
- {
- List lst = new ArrayList();
- JBossXSObjectList objlist = new JBossXSObjectList(lst);
- Set<String> keyset = nsimap.keySet();
- for (String ns : keyset)
- {
- XSNamespaceItem xs = nsimap.get(ns);
- objlist.addObjects(xs.getAnnotations());
- }
- return objlist;
- }
-
- /**
- * Convenience method. Returns a top-level element declaration.
- * @param name The name of the declaration.
- * @param namespace The namespace of the declaration, otherwise
- * <code>null</code>.
- * @return A top-level element declaration or <code>null</code> if such a
- * declaration does not exist.
- */
- public XSElementDeclaration getElementDeclaration(String name, String namespace)
- {
- if (name == null)
- return null;
-
- if (name.startsWith(">") || name.endsWith("]"))
- return anonymousMapper.getElementDeclaration(name, namespace);
-
- JBossXSNamespaceItem ni = nsimap.get(namespace);
- if (ni == null)
- return null;
- return ni.getElementDeclaration(name);
- }
-
- /**
- * Convenience method. Returns a top-level attribute declaration.
- * @param name The name of the declaration.
- * @param namespace The namespace of the declaration, otherwise
- * <code>null</code>.
- * @return A top-level attribute declaration or <code>null</code> if such
- * a declaration does not exist.
- */
- public XSAttributeDeclaration getAttributeDeclaration(String name, String namespace)
- {
- JBossXSNamespaceItem ni = nsimap.get(namespace);
- if (ni == null)
- return null;
- return ni.getAttributeDeclaration(name);
- }
-
- /**
- * Convenience method. Returns a top-level simple or complex type
- * definition.
- * @param name The name of the definition.
- * @param namespace The namespace of the declaration, otherwise
- * <code>null</code>.
- * @return An <code>XSTypeDefinition</code> or
<code>null</code> if such
- * a definition does not exist.
- */
- public XSTypeDefinition getTypeDefinition(String name, String namespace)
- {
- if (name == null)
- return null;
-
- if (name.startsWith(">") || name.endsWith("]"))
- return anonymousMapper.getTypeDefinition(name, namespace);
-
- JBossXSNamespaceItem ni = nsimap.get(namespace);
- if (ni == null)
- return null;
- return ni.getTypeDefinition(name);
- }
-
- /**
- * Convenience method. Returns a top-level attribute group definition.
- * @param name The name of the definition.
- * @param namespace The namespace of the definition, otherwise
- * <code>null</code>.
- * @return A top-level attribute group definition or <code>null</code> if
- * such a definition does not exist.
- */
- public XSAttributeGroupDefinition getAttributeGroup(String name, String namespace)
- {
- return null;
- }
-
- /**
- * Convenience method. Returns a top-level model group definition.
- * @param name The name of the definition.
- * @param namespace The namespace of the definition, otherwise
- * <code>null</code>.
- * @return A top-level model group definition or <code>null</code> if
- * such a definition does not exist.
- */
- public XSModelGroupDefinition getModelGroupDefinition(String name, String namespace)
- {
- return null;
- }
-
- /**
- * Convenience method. Returns a top-level notation declaration.
- * @param name The name of the declaration.
- * @param namespace The namespace of the declaration, otherwise
- * <code>null</code>.
- * @return A top-level notation declaration or <code>null</code> if such
- * a declaration does not exist.
- */
- public XSNotationDeclaration getNotationDeclaration(String name, String namespace)
- {
- return null;
- }
-
- public void addXSAnnotation(XSAnnotation xa)
- {
- String ns = xa.getNamespace();
- if (ns == null && nsimap.keySet().size() == 1)
- {
- ns = nsimap.keySet().iterator().next();
- }
- if (ns != null)
- {
- createNamespaceItemIfNotExistent(ns);
- JBossXSNamespaceItem jbnm = nsimap.get(ns);
- jbnm.addXSAnnotation(xa);
- }
- else
- {
- log.trace("Cannot assign XSAnnotation to null namespace");
- }
- }
-
- public void addXSAttributeDeclaration(XSAttributeDeclaration attr)
- {
- //Add attribute to the namespace item
- String ns = attr.getNamespace();
- JBossXSNamespaceItem jbnm = createNamespaceItemIfNotExistent(ns);
- jbnm.addXSAttributeDeclaration(attr);
- }
-
- public void addXSTypeDefinition(XSTypeDefinition xst)
- {
- //Add type to the namespace item
- String ns = xst.getNamespace();
- if (ns == null)
- throw new WSException("Illegal namespace:null");
- JBossXSNamespaceItem jbnm = createNamespaceItemIfNotExistent(ns);
- jbnm.addXSTypeDefinition(xst);
-
- anonymousMapper.rebuild();
- }
-
- public void addXSComplexTypeDefinition(XSTypeDefinition xst)
- {
- this.addXSTypeDefinition(xst);
-
- anonymousMapper.rebuild();
- }
-
- public void addXSElementDeclaration(XSElementDeclaration xsel)
- {
- //Add element to the namespace item
- String ns = xsel.getNamespace();
- JBossXSNamespaceItem jbnm = createNamespaceItemIfNotExistent(ns);
- jbnm.addXSElementDeclaration(xsel);
-
- anonymousMapper.rebuild();
- }
-
- public void addSchemaLocation(String nsURI, URL locationURL)
- {
- JBossXSNamespaceItem ni = createNamespaceItemIfNotExistent(nsURI);
- ni.addDocumentLocation(locationURL.toExternalForm());
- }
-
- public void addXSNamespaceItem(XSNamespaceItem xsitem)
- {
- ((JBossXSNamespaceItemList)nslist).addItem(xsitem);
-
- anonymousMapper.rebuild();
- }
-
- public void setXSNamespaceItemList(XSNamespaceItemList list)
- {
- this.nslist = list;
- }
-
- public void merge(JBossXSModel xsm)
- {
- JBossXSNamespaceItemList jxsm = (JBossXSNamespaceItemList)xsm.getNamespaceItems();
- int len = jxsm.getLength();
- for (int i = 0; i < len; i++)
- {
- JBossXSNamespaceItem ni = (JBossXSNamespaceItem)jxsm.item(i);
- String sns = ni.getSchemaNamespace();
- JBossXSNamespaceItem mynsi = nsimap.get(sns);
- if (mynsi != null)
- mynsi.merge(ni);
- else
- {
- //add the namespaceitem
- nsimap.put(sns, ni);
- ni.setNamespaceRegistry(namespaceRegistry);
- }
- }
-
- NamespaceRegistry xsmRegistry = xsm.getNamespaceRegistry();
- Iterator iter = xsmRegistry.getRegisteredPrefixes();
- while (iter.hasNext())
- {
- String prefix = (String)iter.next();
- String ns = xsmRegistry.getNamespaceURI(prefix);
- this.namespaceRegistry.registerURI(ns, prefix);
- }
-
- anonymousMapper.rebuild();
- }
-
- public void removeXSTypeDefinition(XSTypeDefinition xst)
- {
- String ns = xst.getNamespace();
- JBossXSNamespaceItem ni = nsimap.get(ns);
- ni.removeXSTypeDefinition(xst);
-
- anonymousMapper.rebuild();
- }
-
- /**
- * Given a namespaceuri, return the NamespaceItem that represents it
- * @param nsuri Namespace URI
- * @return JBossXSNamespaceItem
- */
- public JBossXSNamespaceItem getNamespaceItem(String nsuri)
- {
- return nsimap.get(nsuri);
- }
-
- public void writeTo(OutputStream out) throws IOException
- {
- out.write(serialize().getBytes());
- }
-
- public String serialize()
- {
- StringBuilder sb = serializeNamespaceItems();
-
- /**
- * Since the serialized string can contain multiple schema
- * definitions, we have to embed in a root element before
- * parsing for layout
- */
- sb.insert(0, "<root>");
- sb.append("</root>");
- // Layout schema
- String xsModelString = sb.toString();
-
- if (xsModelString.length() > 0)
- {
- try
- {
- Element root = DOMUtils.parse(xsModelString);
- //xsModelString = DOMWriter.printNode(root, true);
- xsModelString = this.getChildNodesSerialized(root);
- }
- catch (IOException e)
- {
- log.error("Cannot parse xsModelString: " + xsModelString, e);
- }
-
- }
-
- return xsModelString;
- }
-
- public Map<String, XSTypeDefinition> getAnonymousTypes()
- {
- return anonymousMapper.getTypes();
- }
-
- public Map<String, XSElementDeclaration> getAnonymousElements()
- {
- return anonymousMapper.getElements();
- }
-
- public boolean isQualifiedElements()
- {
- return qualifiedElements;
- }
-
- public void setQualifiedElements(boolean qualifiedElements)
- {
- this.qualifiedElements = qualifiedElements;
- for (JBossXSNamespaceItem item : nsimap.values())
- item.setQualifiedElements(qualifiedElements);
- }
-
- public NamespaceRegistry getNamespaceRegistry()
- {
- return namespaceRegistry;
- }
-
- public void eagerInitialize()
- {
- anonymousMapper.build();
- }
-
- private String registerNamespace(String ns)
- {
- String prefix = namespaceRegistry.getPrefix(ns);
-
- if (prefix != null)
- return prefix;
-
- // XML Namespace MUST ALWAYS BE the "xml" prefix
- if (Constants.NS_XML.equals(ns))
- prefix = Constants.PREFIX_XML;
-
- return namespaceRegistry.registerURI(ns, prefix);
- }
-
- private JBossXSNamespaceItem createNamespaceItemIfNotExistent(String ns)
- {
- if (ns == null)
- throw new IllegalArgumentException("Illegal null argument:ns");
-
- JBossXSNamespaceItem jbnm = nsimap.get(ns);
- if (jbnm == null)
- {
- jbnm = new JBossXSNamespaceItem(ns, namespaceRegistry, qualifiedElements);
- nsimap.put(ns, jbnm);
- registerNamespace(ns);
- }
-
- return jbnm;
- }
-
- private StringBuilder serializeNamespaceItems()
- {
- StringBuilder sb = new StringBuilder();
- //Write a schema definition for each namespaceitem that is custom
- Collection<JBossXSNamespaceItem> col = nsimap.values();
- for (JBossXSNamespaceItem i : col)
- {
- String nameS = i.getSchemaNamespace();
- if (Constants.NS_SCHEMA_XSD.equals(nameS) ||
Constants.URI_SOAP11_ENC.equals(nameS))
- continue;
-
- sb.append(i.toString());
- }
-
- return sb;
- }
-
- private String getChildNodesSerialized(Element root)
- {
- StringBuilder sb = new StringBuilder();
- Iterator iter = DOMUtils.getChildElements(root);
- while (iter != null && iter.hasNext())
- {
- Node n = (Node)iter.next();
- sb.append(DOMWriter.printNode(n, true));
- sb.append("\n");
- }
- return sb.toString();
- }
-
- private class AnonymousMapper implements Serializable
- {
- private static final long serialVersionUID = 5572350092914194023L;
-
- private HashMap<String, XSTypeDefinition> anonymousTypeMap;
-
- private HashMap<String, XSElementDeclaration> anonymousElementMap;
-
- // not really a stack, but it does contain items on the stack
- private HashSet<XSComplexTypeDefinition> stack = new
HashSet<XSComplexTypeDefinition>();
-
- /**
- * Triggers a rebuild of anonymous types only if a build has occured before.
- */
- public void rebuild()
- {
- if (anonymousTypeMap != null)
- build();
- }
-
- /**
- * Builds the anonymous type mapping. This is intended to be called lazily.
- */
- public void build()
- {
- XSModel model = JBossXSModel.this;
-
- anonymousTypeMap = new HashMap<String, XSTypeDefinition>();
-
- anonymousElementMap = new HashMap<String, XSElementDeclaration>();
-
- XSNamedMap namedMap = model.getComponents(XSConstants.TYPE_DEFINITION);
- for (int i = 0; i < namedMap.getLength(); i++)
- {
- XSTypeDefinition type = (XSTypeDefinition)namedMap.item(i);
- if (type.getTypeCategory() != XSTypeDefinition.COMPLEX_TYPE)
- continue;
-
- analyzeComplexType((XSComplexTypeDefinition)type, null,
type.getNamespace());
- }
-
- namedMap = model.getComponents(XSConstants.ELEMENT_DECLARATION);
- for (int i = 0; i < namedMap.getLength(); i++)
- {
- XSElementDeclaration element = (XSElementDeclaration)namedMap.item(i);
- analyzeElement(element, null, element.getNamespace(), null, null);
- }
- }
-
- private void analyzeElement(XSElementDeclaration element, String parentName, String
namespace, Integer minOccurs, Integer maxOccurs)
- {
- String name = element.getName();
-
- if (element.getScope() != XSConstants.SCOPE_GLOBAL)
- {
- name = parentName + ">" + name;
- anonymousElementMap.put(namespace + ":" + name, element);
- }
-
- if (maxOccurs != null && maxOccurs.intValue() > 1)
- {
- String key = namespace + ":" + name + "[" +
minOccurs.intValue() + "," + maxOccurs.intValue() + "]";
- anonymousTypeMap.put(key, createArrayWrapperComplexType(element, name,
namespace, minOccurs, maxOccurs));
- if (minOccurs.intValue() == 1)
- {
- key = namespace + ":" + name + "[" + "," +
maxOccurs.intValue() + "]";
- anonymousTypeMap.put(key, createArrayWrapperComplexType(element, name,
namespace, minOccurs, maxOccurs));
- }
- }
-
- XSTypeDefinition type = element.getTypeDefinition();
- if (type.getTypeCategory() == XSTypeDefinition.COMPLEX_TYPE)
- analyzeComplexType((XSComplexTypeDefinition)type, name, namespace);
-
- if (type.getTypeCategory() == XSTypeDefinition.SIMPLE_TYPE)
- analyzeSimpleType((XSSimpleTypeDefinition)type, name, namespace);
- }
-
- private XSComplexTypeDefinition createArrayWrapperComplexType(XSElementDeclaration
element, String name, String namespace, Integer minOccurs, Integer maxOccurs)
- {
- JBossXSComplexTypeDefinition definition = new JBossXSComplexTypeDefinition(name,
namespace);
- definition.setAnonymous(true);
-
- JBossXSModelGroup group = new JBossXSModelGroup();
- group.setCompositor(XSModelGroup.COMPOSITOR_SEQUENCE);
- List<XSParticle> particles = new ArrayList<XSParticle>(1);
- JBossXSParticle particle = new JBossXSParticle();
- particle.setMaxOccurs(maxOccurs);
- particle.setMinOccurs(minOccurs);
- particle.setTerm(element);
- particles.add(particle);
- group.setParticles(particles);
-
- particle = new JBossXSParticle();
- particle.setTerm(group);
- definition.setParticle(particle);
-
- return definition;
- }
-
- private String analyzeType(XSTypeDefinition type, String parentName, String
namespace)
- {
- String name;
- if (type.getAnonymous())
- name = ">" + parentName;
- else name = type.getName();
-
- if (type.getAnonymous())
- {
- anonymousTypeMap.put(namespace + ":" + name, type);
- log.debug("Registered as anon type: {" + namespace + ":"
+ name + "} -> " + type);
- }
- return name;
- }
-
- private void analyzeSimpleType(XSSimpleTypeDefinition simpleType, String
parentName, String namespace)
- {
- analyzeType(simpleType, parentName, namespace);
- }
-
- private void analyzeComplexType(XSComplexTypeDefinition complexType, String
parentName, String namespace)
- {
- // Prevent reentrancy
- if (stack.contains(complexType))
- return;
-
- stack.add(complexType);
- String name = analyzeType(complexType, parentName, namespace);
- analyzeParticle(complexType.getParticle(), name, namespace);
- stack.remove(complexType);
- }
-
- private void analyzeParticle(XSParticle particle, String parentName, String
namespace)
- {
- // Is this right, can a particle be null?
- if (particle == null)
- return;
- XSTerm term = particle.getTerm();
-
- // Is this right, can a term be null?
- if (term == null)
- return;
- switch (term.getType())
- {
- case XSConstants.MODEL_GROUP:
- XSModelGroup group = (XSModelGroup)term;
- XSObjectList list = group.getParticles();
- for (int i = 0; i < list.getLength(); i++)
- analyzeParticle((XSParticle)list.item(i), parentName, namespace);
- break;
- case XSConstants.ELEMENT_DECLARATION:
- XSElementDeclaration decl = (XSElementDeclaration)term;
- analyzeElement(decl, parentName, namespace, new
Integer(particle.getMinOccurs()), new Integer(particle.getMaxOccurs()));
- }
- }
-
- public XSTypeDefinition getTypeDefinition(String name, String namespace)
- {
- // We lazily build this, after the first anonymous type name lookup
- if (anonymousTypeMap == null)
- build();
-
- return anonymousTypeMap.get(namespace + ":" + name);
- }
-
- public XSElementDeclaration getElementDeclaration(String name, String namespace)
- {
- // We lazily build this, after the first anonymous type name lookup
- if (anonymousElementMap == null)
- build();
-
- return anonymousElementMap.get(namespace + ":" + name);
- }
-
- public Map<String, XSElementDeclaration> getElements()
- {
- if (anonymousElementMap == null)
- build();
-
- // avoid the copy, trust the client
- return anonymousElementMap;
- }
-
- public Map<String, XSTypeDefinition> getTypes()
- {
- if (anonymousTypeMap == null)
- build();
-
- // avoid the copy, trust the client
- return anonymousTypeMap;
- }
- }
-}
Copied: trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSModel.java (from
rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSModel.java)
Deleted: trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSModelGroup.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSModelGroup.java 2006-12-07
10:43:36 UTC (rev 1600)
+++
trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSModelGroup.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -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.wsdl.xmlschema;
-
-import java.util.Iterator;
-import java.util.List;
-
-import org.apache.xerces.xs.XSAnnotation;
-import org.apache.xerces.xs.XSConstants;
-import org.apache.xerces.xs.XSModelGroup;
-import org.apache.xerces.xs.XSObjectList;
-
-/**
- * Implements a ModelGroup of the Xerces Schema API
- * @author <mailto:Anil.Saldhana@jboss.org>Anil Saldhana
- * @since Apr 21, 2005
- */
-public class JBossXSModelGroup extends JBossXSObject
- implements XSModelGroup
-{
- private JBossXSObjectList xsparts = new JBossXSObjectList();;
- protected short compositor = 0;
-
- /**
- * [compositor]: one of all, choice or sequence. The valid constant values
- * are:
- * <code>COMPOSITOR_SEQUENCE, COMPOSITOR_CHOICE, COMPOSITOR_ALL</code>.
- */
- public short getCompositor()
- {
- return compositor;
- }
-
- /**
- * A list of [particles] if it exists, otherwise an empty
- * <code>XSObjectList</code>.
- */
- public XSObjectList getParticles()
- {
- return xsparts;
- }
-
- /**
- * An [annotation] if it exists, otherwise <code>null</code>.
- */
- public XSAnnotation getAnnotation()
- {
- return null;
- }
-
- public void setParticles(List p)
- {
- xsparts = new JBossXSObjectList();
- Iterator iter = p.iterator();
- while (iter.hasNext())
- {
- xsparts.addItem((JBossXSParticle)iter.next());
- }
- }
-
- public void setParticles(List p, boolean shouldSort)
- {
- xsparts = new JBossXSObjectList();
- if(shouldSort)
- setParticles(p);
- else
- {
- Iterator iter = p.iterator();
- while (iter.hasNext())
- {
- xsparts.addItem((JBossXSParticle)iter.next(), false);
- }
- }
-
- }
-
- public void setCompositor(short compositor)
- {
- this.compositor = compositor;
- }
-
- /**
- * Get the type
- */
- @Override
- public short getType()
- {
- return XSConstants.MODEL_GROUP;
- }
-}
Copied: trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSModelGroup.java
(from rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSModelGroup.java)
Deleted: trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSNamedMap.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSNamedMap.java 2006-12-07
10:43:36 UTC (rev 1600)
+++
trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSNamedMap.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -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.metadata.wsdl.xmlschema;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-import org.apache.xerces.xs.XSNamedMap;
-import org.apache.xerces.xs.XSObject;
-
-/**
- * @author <mailto:Anil.Saldhana@jboss.org>Anil Saldhana
- * @since Apr 20, 2005
- */
-public class JBossXSNamedMap implements XSNamedMap
-{
- protected List<XSObject> list = new ArrayList<XSObject>();
- /**
- * The number of <code>XSObjects</code> in the
<code>XSObjectList</code>.
- * The range of valid child object indices is 0 to <code>length-1</code>
- * inclusive.
- */
- public int getLength()
- {
- return list.size();
- }
-
- /**
- * Returns the <code>index</code>th item in the collection or
- * <code>null</code> if <code>index</code> is greater than or
equal to
- * the number of objects in the list. The index starts at 0.
- * @param index index into the collection.
- * @return The <code>XSObject</code> at the
<code>index</code>th
- * position in the <code>XSObjectList</code>, or
<code>null</code> if
- * the index specified is not valid.
- */
- public XSObject item(int index)
- {
- return (XSObject)list.get(index);
- }
-
- /**
- * Retrieves an <code>XSObject</code> specified by local name and
- * namespace URI.
- * <br>Per XML Namespaces, applications must use the value
<code>null</code> as the
- * <code>namespace</code> parameter for methods if they wish to specify
- * no namespace.
- * @param namespace The namespace URI of the <code>XSObject</code> to
- * retrieve, or <code>null</code> if the
<code>XSObject</code> has no
- * namespace.
- * @param localName The local name of the <code>XSObject</code> to
- * retrieve.
- * @return A <code>XSObject</code> (of any type) with the specified local
- * name and namespace URI, or <code>null</code> if they do not
- * identify any object in this map.
- */
- public XSObject itemByName(String namespace, String localName)
- {
- XSObject xso = null;
- //Since our list may contain types from xerces implementation
- for(XSObject obj: list)
- {
- if(localName.equals(obj.getName()) &&
- namespace.equals(obj.getNamespace()))
- return obj;
- }
-
- return xso;
- }
-
- public void addItem(XSObject obj)
- {
- list.add(obj);
- }
-
- public void addItems(Collection col)
- {
- list.addAll(col);
- }
-
- public List<XSObject> toList()
- {
- return list;
- }
-}
Copied: trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSNamedMap.java
(from rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSNamedMap.java)
Deleted:
trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSNamespaceItem.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSNamespaceItem.java 2006-12-07
10:43:36 UTC (rev 1600)
+++
trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSNamespaceItem.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -1,495 +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.xmlschema;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.TreeSet;
-
-import org.apache.xerces.xs.StringList;
-import org.apache.xerces.xs.XSAnnotation;
-import org.apache.xerces.xs.XSAttributeDeclaration;
-import org.apache.xerces.xs.XSAttributeGroupDefinition;
-import org.apache.xerces.xs.XSComplexTypeDefinition;
-import org.apache.xerces.xs.XSConstants;
-import org.apache.xerces.xs.XSElementDeclaration;
-import org.apache.xerces.xs.XSModelGroupDefinition;
-import org.apache.xerces.xs.XSNamedMap;
-import org.apache.xerces.xs.XSNamespaceItem;
-import org.apache.xerces.xs.XSNotationDeclaration;
-import org.apache.xerces.xs.XSObjectList;
-import org.apache.xerces.xs.XSSimpleTypeDefinition;
-import org.apache.xerces.xs.XSTypeDefinition;
-import org.jboss.logging.Logger;
-import org.jboss.ws.Constants;
-import org.jboss.xb.binding.NamespaceRegistry;
-
-/**
- * Xerces Schema API Implementation
- * @author <mailto:Anil.Saldhana@jboss.org>Anil Saldhana
- * @since Apr 20, 2005
- */
-public class JBossXSNamespaceItem implements XSNamespaceItem
-{
- // provide logging
- private static final Logger log = Logger.getLogger(JBossXSNamespaceItem.class);
-
- private String schemaNamespace = null;
- private List<String> docLocations = null;
-
- private Map<String,XSAnnotation> anns = new
HashMap<String,XSAnnotation>();
- private Map<String,XSAttributeDeclaration> attrs = new
HashMap<String,XSAttributeDeclaration>();
- private Map<String,XSElementDeclaration> elements = new
HashMap<String,XSElementDeclaration>();
- private Map<String,XSTypeDefinition> types = new
HashMap<String,XSTypeDefinition>();
-
- private boolean qualifiedElements = false;
-
- private NamespaceRegistry namespaceRegistry;
-
- public JBossXSNamespaceItem(String ns, NamespaceRegistry namespaceRegistry, boolean
qualifiedElements)
- {
- this.schemaNamespace = ns;
- this.namespaceRegistry = namespaceRegistry;
- this.qualifiedElements = qualifiedElements;
- }
-
- /**
- * [schema namespace]: A namespace name or <code>null</code> if absent.
- */
- public String getSchemaNamespace()
- {
- return schemaNamespace;
- }
-
- /**
- * [schema components]: a list of top-level components, i.e. element
- * declarations, attribute declarations, etc.
- * @param objectType The type of the declaration, i.e.
- * <code>ELEMENT_DECLARATION</code>. Note that
- * <code>XSTypeDefinition.SIMPLE_TYPE</code> and
- * <code>XSTypeDefinition.COMPLEX_TYPE</code> can also be used as the
- * <code>objectType</code> to retrieve only complex types or simple
- * types, instead of all types.
- * @return A list of top-level definition of the specified type in
- * <code>objectType</code> or an empty
<code>XSNamedMap</code> if no
- * such definitions exist.
- */
- public XSNamedMap getComponents(short objectType)
- {
- JBossXSNamedMap jbnm = new JBossXSNamedMap();
- if(objectType == XSConstants.ELEMENT_DECLARATION && elements.size() >
0)
- jbnm.addItems(elements.values());
- else
- {
- if(objectType == XSConstants.ATTRIBUTE_DECLARATION && attrs.size() >
0)
- {
- jbnm.addItems(attrs.values());
- }
- else
- if(objectType == XSConstants.TYPE_DEFINITION && types.size() > 0)
- {
- jbnm.addItems(types.values());
- }
- else
- if(objectType == XSTypeDefinition.COMPLEX_TYPE)
- {
- Collection col = types.values();
- jbnm.addItems(getTypes(col,XSTypeDefinition.COMPLEX_TYPE));
- }
- else
- if(objectType == XSTypeDefinition.SIMPLE_TYPE)
- {
- Collection col = types.values();
- jbnm.addItems(getTypes(col,XSTypeDefinition.SIMPLE_TYPE));
- }
- }
-
- return jbnm;
- }
-
- /**
- * [annotations]: a set of annotations if it exists, otherwise an empty
- * <code>XSObjectList</code>.
- */
- public XSObjectList getAnnotations()
- {
- List lst = new ArrayList();
- lst.addAll(anns.values());
- return new JBossXSObjectList(lst);
- }
-
- /**
- * Convenience method. Returns a top-level element declaration.
- * @param name The name of the declaration.
- * @return A top-level element declaration or <code>null</code> if such a
- * declaration does not exist.
- */
- public XSElementDeclaration getElementDeclaration(String name)
- {
- JBossXSElementDeclaration jbe = null;
- //Ensure we return JBossXSElementDeclaration
- if(elements != null)
- {
- XSElementDeclaration xe = elements.get(name);
- if(xe != null && !(xe instanceof JBossXSElementDeclaration))
- jbe = new JBossXSElementDeclaration(xe);
- else
- return xe;
- }
- return jbe;
- }
-
- /**
- * Convenience method. Returns a top-level attribute declaration.
- * @param name The name of the declaration.
- * @return A top-level attribute declaration or <code>null</code> if such
- * a declaration does not exist.
- */
- public XSAttributeDeclaration getAttributeDeclaration(String name)
- {
- if(attrs != null) return attrs.get(name);
- return null;
- }
-
- /**
- * Convenience method. Returns a top-level simple or complex type
- * definition.
- * @param name The name of the definition.
- * @return An <code>XSTypeDefinition</code> or
<code>null</code> if such
- * a definition does not exist.
- */
- public XSTypeDefinition getTypeDefinition(String name)
- {
- if(types != null) return types.get(name);
- return null;
- }
-
- /**
- * Convenience method. Returns a top-level attribute group definition.
- * @param name The name of the definition.
- * @return A top-level attribute group definition or <code>null</code> if
- * such a definition does not exist.
- */
- public XSAttributeGroupDefinition getAttributeGroup(String name)
- {
- return null;
- }
-
- /**
- * Convenience method. Returns a top-level model group definition.
- * @param name The name of the definition.
- * @return A top-level model group definition definition or
- * <code>null</code> if such a definition does not exist.
- */
- public XSModelGroupDefinition getModelGroupDefinition(String name)
- {
- return null;
- }
-
- /**
- * Convenience method. Returns a top-level notation declaration.
- * @param name The name of the declaration.
- * @return A top-level notation declaration or <code>null</code> if such
- * a declaration does not exist.
- */
- public XSNotationDeclaration getNotationDeclaration(String name)
- {
- return null;
- }
-
- /**
- * [document location] - a list of location URIs for the documents that
- * contributed to the <code>XSModel</code>.
- */
- public StringList getDocumentLocations()
- {
- if(docLocations == null) return new JBossXSStringList();
- JBossXSStringList strList = new JBossXSStringList(docLocations);
- return strList;
- }
-
- //Setters
-
- //Custom methods
- public void addDocumentLocation(String uri)
- {
- if(docLocations == null)
- docLocations = new ArrayList<String>();
- docLocations.add(uri);
- }
-
- public void addDocumentLocations(List<String> uri)
- {
- if(docLocations == null)
- docLocations = new ArrayList<String>();
- docLocations.addAll(uri);
- }
-
- /**
- * Add an XSAnnotation
- */
- public void addXSAnnotation(XSAnnotation xa)
- {
- if(xa == null)
- throw new IllegalArgumentException("Illegal Null Argument:xa");
- anns.put(xa.getName(),xa);
- }
-
- /**
- * Add an XSAttributeDeclaration
- */
- public void addXSAttributeDeclaration(XSAttributeDeclaration att)
- {
- if(att == null)
- throw new IllegalArgumentException("att is null");
- attrs.put(att.getName(),att);
- }
-
- /**
- * Add an XSElementDeclaration
- * @param el
- */
- public void addXSElementDeclaration(XSElementDeclaration el)
- {
- if(el == null)
- throw new IllegalArgumentException("Element is null");
- elements.put(el.getName(),el);
- }
-
- /**
- * Add an XSTypeDefinition
- * @param xsType
- */
- public void addXSTypeDefinition(XSTypeDefinition xsType)
- {
- if(xsType == null)
- throw new IllegalArgumentException("type is null");
-
- String xsTypeName = xsType.getName();
- log.trace("addXSTypeDefinition: " + xsTypeName);
-
- types.put(xsTypeName,xsType);
- }
-
-
- /**
- * Overrides the toString method
- */
- @Override
- public String toString()
- {
- /*
- * FIXME - The SOAP Encoding namespace handling should be revisited. This
- * routine should really operate purely off of the registry, instead of
- * printing constant declarations, and having to double check that the
- * registry does not contain them.
- *
- * This order is currently maintained to preserve the format of the
- * generated schema files in the test harness.
- */
- if(isEmpty()) return "";
-
- WSSchemaUtils sutils = WSSchemaUtils.getInstance(namespaceRegistry,
schemaNamespace);
-
- StringBuilder buffer = new StringBuilder();
- buffer.append( "<schema targetNamespace='" + schemaNamespace +
"'");
- buffer.append(" xmlns:" + Constants.PREFIX_SOAP11_ENC +
"='" + Constants.URI_SOAP11_ENC + "'");
- // XML Namespace can only be assigned to the XML prefix
- if (! schemaNamespace.equals(Constants.NS_XML))
- buffer.append(" xmlns:" + Constants.PREFIX_TNS + "='" +
schemaNamespace + "'");
- buffer.append(" xmlns:" + Constants.PREFIX_XSI + "='" +
Constants.NS_SCHEMA_XSI + "'");
- buffer.append(" xmlns='" + Constants.NS_SCHEMA_XSD +
"'");
-
- //Append any custom prefixes
- Iterator iter = namespaceRegistry.getRegisteredPrefixes();
- while (iter.hasNext())
- {
- String prefix = (String) iter.next();
- String ns = namespaceRegistry.getNamespaceURI(prefix);
- if (ns.equals(schemaNamespace) && ns.equals(Constants.NS_XML) == false)
- continue;
- if (ns.equals(Constants.URI_SOAP11_ENC))
- continue;
- if (ns.equals(Constants.NS_SCHEMA_XSI))
- continue;
- buffer.append(" xmlns:" + prefix + "='" + ns
+"'");
- }
-
- if (qualifiedElements)
- buffer.append(" elementFormDefault='qualified'");
-
- buffer.append(">");
-
- //Write the import namespaces
- iter = namespaceRegistry.getRegisteredURIs();
- while (iter.hasNext())
- {
- String ns = (String) iter.next();
- if (ns.equals(schemaNamespace))
- continue;
- if (ns.equals(Constants.URI_SOAP11_ENC))
- continue;
- if (ns.equals(Constants.NS_SCHEMA_XSI))
- continue;
- buffer.append("<import namespace='" + ns +
"'/>");
- }
-
- //Sort the types
- //TreeSet<String> treeset = new TreeSet<String>(types.keySet());
- TreeSet<String> treeset = new TreeSet<String>(new XSComparator());
- treeset.addAll(types.keySet());
- for(String key: treeset)
- {
- buffer.append(sutils.write(types.get(key)));
- }
-
- // Serialize the elements
- //treeset = new TreeSet<String>(elements.keySet());
- treeset = new TreeSet<String>(new XSComparator());
- treeset.addAll(elements.keySet());
- for( String key: treeset)
- {
- buffer.append(sutils.write(elements.get(key) ));
- }
- buffer.append("</schema>");
- return buffer.toString();
- }
-
- public void merge(JBossXSNamespaceItem nsi)
- {
- //Merge the attributes
- JBossXSNamedMap nmap =
(JBossXSNamedMap)nsi.getComponents(XSConstants.ATTRIBUTE_DECLARATION);
- int len = nmap.getLength();
- for(int i=0;i<len;i++)
- {
- XSAttributeDeclaration xatt = (XSAttributeDeclaration)nmap.item(i);
- this.addXSAttributeDeclaration(xatt);
- }
-
- //Merge the types
- nmap = (JBossXSNamedMap)nsi.getComponents(XSConstants.TYPE_DEFINITION);
- len = nmap.getLength();
- for(int i=0;i<len;i++)
- {
- XSTypeDefinition xt = (XSTypeDefinition)nmap.item(i);
- this.addXSTypeDefinition(xt);
- }
-
- // Merge the elements
- nmap = (JBossXSNamedMap)nsi.getComponents(XSConstants.ELEMENT_DECLARATION);
- len = nmap.getLength();
- for(int i=0;i<len;i++)
- {
- XSElementDeclaration xe = (XSElementDeclaration)nmap.item(i);
- this.addXSElementDeclaration(xe);
- }
- }
-
- /**
- * Delete a XSTypeDefinition
- *
- * @param xst
- */
- public void removeXSTypeDefinition(XSTypeDefinition xst)
- {
- String name = xst.getName();
- types.remove(name);
- }
-
- /**
- * Delete a XSTypeDefinition
- *
- * @param xst
- */
- public void removeXSElementDeclaration(XSElementDeclaration xel)
- {
- String name = xel.getName();
- elements.remove(name);
- }
-
- public boolean isQualifiedElements()
- {
- return qualifiedElements;
- }
-
- public void setQualifiedElements(boolean qualifiedElements)
- {
- this.qualifiedElements = qualifiedElements;
- }
-
- public NamespaceRegistry getNamespaceRegistry()
- {
- return namespaceRegistry;
- }
-
- public void setNamespaceRegistry(NamespaceRegistry namespaceRegistry)
- {
- this.namespaceRegistry = namespaceRegistry;
- }
-
- //PRIVATE METHODS
- private Collection getTypes(Collection col, short objectType)
- {
- if(objectType != XSTypeDefinition.SIMPLE_TYPE && objectType !=
XSTypeDefinition.COMPLEX_TYPE)
- throw new IllegalArgumentException("objectType should be simple type or
complex type");
- Collection values = new ArrayList();
- for(Object obj : col)
- {
- if(objectType == XSTypeDefinition.COMPLEX_TYPE &&
- obj instanceof XSComplexTypeDefinition )
- values.add(obj);
- else
- if(objectType == XSTypeDefinition.SIMPLE_TYPE &&
- obj instanceof XSSimpleTypeDefinition )
- values.add(obj);
- }
- return values;
- }
-
- private boolean isEmpty()
- {
- boolean bool = true;
- if(attrs.size() > 0) return false;
- if(types.size() > 0 ) return false;
- if(elements.size()>0) return false;
- return bool;
- }
-
- private class XSComparator implements Comparator
- {
- public int compare(Object arg0, Object arg1)
- {
- String str1 = (String)arg0;
- String str2 = (String)arg1;
-
- if(Character.isUpperCase(str1.charAt(0))
- && Character.isLowerCase(str2.charAt(0)) )
- return 1;
- return str1.compareTo(str2);
- }
- }
-}
Copied: trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSNamespaceItem.java
(from rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSNamespaceItem.java)
Deleted:
trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSNamespaceItemList.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSNamespaceItemList.java 2006-12-07
10:43:36 UTC (rev 1600)
+++
trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSNamespaceItemList.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -1,85 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
-*/
-package org.jboss.ws.metadata.wsdl.xmlschema;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-import org.apache.xerces.xs.XSNamespaceItem;
-import org.apache.xerces.xs.XSNamespaceItemList;
-
-/**
- *
- *
- * @author <mailto:Anil.Saldhana@jboss.org>Anil Saldhana
- * @since Apr 20, 2005
- */
-public class JBossXSNamespaceItemList implements XSNamespaceItemList
-{
- protected List xsnsList = new ArrayList();
-
- public JBossXSNamespaceItemList()
- {
- super();
- }
-
- public JBossXSNamespaceItemList(List list)
- {
- super();
- xsnsList = list;
- }
-
- public JBossXSNamespaceItemList(Collection col)
- {
- super();
- xsnsList.addAll(col);
- }
-
- /**
- * The number of <code>XSNamespaceItem</code>s in the list. The range of
- * valid child object indices is 0 to <code>length-1</code> inclusive.
- */
- public int getLength()
- {
- return xsnsList.size();
- }
-
- /**
- * Returns the <code>index</code>th item in the collection or
- * <code>null</code> if <code>index</code> is greater than or
equal to
- * the number of objects in the list. The index starts at 0.
- * @param index index into the collection.
- * @return The <code>XSNamespaceItem</code> at the
<code>index</code>th
- * position in the <code>XSNamespaceItemList</code>, or
- * <code>null</code> if the index specified is not valid.
- */
- public XSNamespaceItem item(int index)
- {
- return (XSNamespaceItem)xsnsList.get(index);
- }
-
- public void addItem(XSNamespaceItem item)
- {
- xsnsList.add(item);
- }
-}
Copied:
trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSNamespaceItemList.java
(from rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSNamespaceItemList.java)
Deleted: trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSObject.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSObject.java 2006-12-07
10:43:36 UTC (rev 1600)
+++ trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSObject.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -1,133 +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.xmlschema;
-
-import org.apache.xerces.xs.XSNamespaceItem;
-import org.apache.xerces.xs.XSObject;
-
-/**
- * @author <mailto:Anil.Saldhana@jboss.org>Anil Saldhana
- * @since Apr 20, 2005
- */
-public class JBossXSObject implements XSObject
-{
- protected String name;
- protected String namespace;
- private String prefix;
- private XSNamespaceItem xsNSItem;
- private short type;
-
- public JBossXSObject()
- {
-
- }
-
- public JBossXSObject(String name, String namespace)
- {
- this.name = name;
- this.namespace = namespace;
- }
-
- /**
- * The <code>type</code> of this object, i.e.
- * <code>ELEMENT_DECLARATION</code>.
- */
- public short getType()
- {
- return type;
- }
-
- /**
- * The name of type <code>NCName</code>, as defined in XML Namespaces, of
- * this declaration specified in the <code>{name}</code> property of the
- * component or <code>null</code> if the definition of this component
- * does not have a <code>{name}</code> property. For anonymous types,
- * the processor must construct and expose an anonymous type name that
- * is distinct from the name of every named type and the name of every
- * other anonymous type.
- */
- public String getName()
- {
- return name;
- }
-
- public void setName(String n)
- {
- name = n;
- }
-
- /**
- * The [target namespace] of this object, or <code>null</code> if it is
- * unspecified.
- */
- public String getNamespace()
- {
- return namespace;
- }
-
- public void setNamespace(String namespace)
- {
- this.namespace = namespace;
- }
-
- /**
- * A namespace schema information item corresponding to the target
- * namespace of the component, if it is globally declared; or
- * <code>null</code> otherwise.
- */
- public XSNamespaceItem getNamespaceItem()
- {
- return xsNSItem;
- }
-
- public void setNamespaceItem(XSNamespaceItem xsNSItem)
- {
- this.xsNSItem = xsNSItem;
- }
-
- public void setType(short t)
- {
- type = t;
- }
-
- public boolean equals(Object o)
- {
- if (this == o) return true;
- if (!(o instanceof JBossXSObject)) return false;
-
- final JBossXSObject jBossXSObject = (JBossXSObject)o;
-
- if (name != null ? !name.equals(jBossXSObject.name) : jBossXSObject.name != null)
return false;
- if (namespace != null ? !namespace.equals(jBossXSObject.namespace) :
jBossXSObject.namespace != null) return false;
-
- return true;
- }
-
- public int hashCode()
- {
- int result;
- result = (name != null ? name.hashCode() : 0);
- result = 29 * result + (namespace != null ? namespace.hashCode() : 0);
- return result;
- }
-
-}
Copied: trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSObject.java (from
rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSObject.java)
Deleted: trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSObjectList.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSObjectList.java 2006-12-07
10:43:36 UTC (rev 1600)
+++
trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSObjectList.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -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.metadata.wsdl.xmlschema;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.xerces.xs.XSObject;
-import org.apache.xerces.xs.XSObjectList;
-
-/**
- * Xerces Schema API
- * @author <mailto:Anil.Saldhana@jboss.org>Anil Saldhana
- * @since Apr 20, 2005
- */
-public class JBossXSObjectList implements XSObjectList
-{
- protected List list = new ArrayList();
-
- public JBossXSObjectList()
- {
- }
-
- public JBossXSObjectList(List lst)
- {
- this.list = lst;
- }
-
-
- /**
- * The number of <code>XSObjects</code> in the list. The range of valid
- * child object indices is 0 to <code>length-1</code> inclusive.
- */
- public int getLength()
- {
- int len = list.size();
- return len;
- }
-
- /**
- * Returns the <code>index</code>th item in the collection or
- * <code>null</code> if <code>index</code> is greater than or
equal to
- * the number of objects in the list. The index starts at 0.
- * @param index index into the collection.
- * @return The <code>XSObject</code> at the
<code>index</code>th
- * position in the <code>XSObjectList</code>, or
<code>null</code> if
- * the index specified is not valid.
- */
- public XSObject item(int index)
- {
- return (XSObject)list.get(index);
- }
-
- public void addItem(XSObject xsobj)
- {
- list.add(xsobj);
- }
-
- public void addItem(XSObject xsobj, boolean shouldSort)
- {
- if(shouldSort)
- addItem(xsobj);
- else
- list.add(xsobj);
- }
-
- //CUSTOM METHODS
- public void addObjects(XSObjectList lst)
- {
- if(lst instanceof JBossXSObjectList)
- list.addAll(((JBossXSObjectList)lst).toList());
- else
- {
- int len = lst != null ? lst.getLength() : 0 ;
- for(int i=0; i < len; i++)
- {
- list.add(lst.item(i));
- }
- }
- }
-
- public List toList()
- {
- return list;
- }
-}
Copied: trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSObjectList.java
(from rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSObjectList.java)
Deleted: trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSParticle.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSParticle.java 2006-12-07
10:43:36 UTC (rev 1600)
+++
trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSParticle.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -1,132 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
-*/
-package org.jboss.ws.metadata.wsdl.xmlschema;
-
-import org.apache.xerces.xs.XSConstants;
-import org.apache.xerces.xs.XSParticle;
-import org.apache.xerces.xs.XSTerm;
-
-/**
- * @author <mailto:Anil.Saldhana@jboss.org>Anil Saldhana
- * @since Apr 21, 2005
- */
-public class JBossXSParticle
- extends JBossXSObject implements XSParticle, Comparable
-{
- protected int minOccurs = 0;
- protected int maxOccurs = 0;
- protected XSTerm term = null;
-
- public JBossXSParticle()
- {
- }
-
- public JBossXSParticle(String name, String namespace)
- {
- super(name, namespace);
- }
-
- /**
- * [min occurs]: determines the minimum number of terms that can occur.
- */
- public int getMinOccurs()
- {
- return minOccurs;
- }
-
- /**
- * [max occurs]: determines the maximum number of terms that can occur.
- * To query for the value of unbounded use
- * <code>maxOccursUnbounded</code>. When the value of
- * <code>maxOccursUnbounded</code> is <code>true</code>, the
value of
- * <code>maxOccurs</code> is unspecified.
- */
- public int getMaxOccurs()
- {
- return maxOccurs;
- }
-
- /**
- * [max occurs]: whether the maxOccurs value is unbounded.
- */
- public boolean getMaxOccursUnbounded()
- {
- return (maxOccurs == -1);
- }
-
- /**
- * [term]: one of a model group, a wildcard, or an element declaration.
- */
- public XSTerm getTerm()
- {
- return term;
- }
-
- /**
- * Get the type
- */
- @Override
- public short getType()
- {
- return XSConstants.PARTICLE;
- }
-
- public void setMinOccurs(int minOccurs)
- {
- this.minOccurs = minOccurs;
- }
-
- public void setMaxOccurs(int maxOccurs)
- {
- this.maxOccurs = maxOccurs;
- }
-
- public void setTerm(XSTerm term)
- {
- this.term = term;
- }
-
- /* (non-Javadoc)
- * @see java.lang.Comparable#compareTo(T)
- */
- public int compareTo(Object o)
- {
- int c = -1;
- if(o instanceof JBossXSParticle)
- {
- JBossXSParticle w = (JBossXSParticle)o;
- String oname = w.getTerm().getName();
- String termName = term.getName() ;
- if( termName != null )
- c = termName.compareTo(oname);
- //In the case of doclit, need to be careful about String_1,SimpleType_2
- if( termName != null)
- {
- char num1 = termName.charAt(termName.length()-1);
- char num2 = oname.charAt(oname.length()-1);
- if(Character.isDigit(num1) && Character.isDigit(num2))
- c = (""+num1).compareTo((""+num2));
- }
- }
- return c;
- }
-}
Copied: trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSParticle.java
(from rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSParticle.java)
Deleted:
trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSSimpleTypeDefinition.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSSimpleTypeDefinition.java 2006-12-07
10:43:36 UTC (rev 1600)
+++
trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSSimpleTypeDefinition.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -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.
-*/
-package org.jboss.ws.metadata.wsdl.xmlschema;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.xerces.xs.StringList;
-import org.apache.xerces.xs.XSObjectList;
-import org.apache.xerces.xs.XSSimpleTypeDefinition;
-import org.apache.xerces.xs.XSTypeDefinition;
-
-/**
- * XSSimpleTypeDefinition
- * @author <mailto:Anil.Saldhana@jboss.org>Anil Saldhana
- * @since Aug 4, 2005
- */
-public class JBossXSSimpleTypeDefinition
-extends JBossXSTypeDefinition
-implements XSSimpleTypeDefinition
-{
- private XSSimpleTypeDefinition xsSimple = null;
-
- private List<String> enumerations = new ArrayList<String>();
-
- public JBossXSSimpleTypeDefinition()
- {
- }
-
- public JBossXSSimpleTypeDefinition(XSSimpleTypeDefinition xs)
- {
- this.xsSimple = xs;
- }
-
- public short getVariety()
- {
- return xsSimple.getVariety();
- }
-
- public XSSimpleTypeDefinition getPrimitiveType()
- {
- return xsSimple.getPrimitiveType();
- }
-
- public short getBuiltInKind()
- {
- return xsSimple.getBuiltInKind();
- }
-
- public XSSimpleTypeDefinition getItemType()
- {
- return xsSimple.getItemType();
- }
-
- public XSObjectList getMemberTypes()
- {
- return xsSimple.getMemberTypes();
- }
-
- public short getDefinedFacets()
- {
- return xsSimple.getDefinedFacets();
- }
-
- public boolean isDefinedFacet(short arg0)
- {
- return xsSimple.isDefinedFacet(arg0);
- }
-
- public short getFixedFacets()
- {
- return xsSimple.getFixedFacets();
- }
-
- public boolean isFixedFacet(short arg0)
- {
- return xsSimple.isFixedFacet(arg0);
- }
-
- public String getLexicalFacetValue(short arg0)
- {
- return xsSimple.getLexicalFacetValue(arg0);
- }
-
- public StringList getLexicalEnumeration()
- {
- if (xsSimple == null)
- return new JBossXSStringList(enumerations);
-
- return xsSimple.getLexicalEnumeration();
- }
-
- public void addLexicalEnumeration(String enumeration)
- {
- this.enumerations.add(enumeration);
- }
-
- public StringList getLexicalPattern()
- {
- return xsSimple.getLexicalPattern();
- }
-
- public short getOrdered()
- {
- return xsSimple.getOrdered();
- }
-
- public boolean getFinite()
- {
- return xsSimple.getFinite();
- }
-
- public boolean getBounded()
- {
- return xsSimple.getBounded();
- }
-
- public boolean getNumeric()
- {
- return xsSimple.getNumeric();
- }
-
- public XSObjectList getFacets()
- {
- return xsSimple.getFacets();
- }
-
- public XSObjectList getMultiValueFacets()
- {
- return xsSimple.getMultiValueFacets();
- }
-
- public XSObjectList getAnnotations()
- {
- return xsSimple.getAnnotations();
- }
-
- /**
- * Get the type
- */
- @Override
- public short getType()
- {
- return XSTypeDefinition.SIMPLE_TYPE;
- }
-
- /**
- * Return whether this type definition is a simple type or complex type.
- */
- @Override
- public short getTypeCategory()
- {
- return XSTypeDefinition.SIMPLE_TYPE;
- }
-
-
- //***************************
- //Override base class methods
- //****************************
- @Override
- public String getName()
- {
- if (xsSimple == null)
- return name;
- return xsSimple.getName();
- }
-
- @Override
- public String getNamespace()
- {
- if (xsSimple == null)
- return namespace;
- return xsSimple.getNamespace();
- }
-}
Copied:
trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSSimpleTypeDefinition.java
(from rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSSimpleTypeDefinition.java)
Deleted: trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSStringList.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSStringList.java 2006-12-07
10:43:36 UTC (rev 1600)
+++
trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSStringList.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -1,103 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.ws.metadata.wsdl.xmlschema;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-import org.apache.xerces.xs.StringList;
-
-/**
- * Implements the StringList interface
- * @author <mailto:Anil.Saldhana@jboss.org>Anil Saldhana
- * @since Apr 20, 2005
- */
-public class JBossXSStringList implements StringList
-{
- protected List<String> strList = new ArrayList<String>();
-
- public JBossXSStringList()
- {
- }
-
- public JBossXSStringList(List<String> alist)
- {
- this.strList = alist;
- }
-
- public JBossXSStringList(Collection<String> col)
- {
- this.strList.addAll(col);
- }
-
- /**
- * The number of <code>GenericString</code>s in the list. The range of
- * valid child object indices is 0 to <code>length-1</code> inclusive.
- */
- public int getLength()
- {
- return strList.size();
- }
-
- /**
- * Checks if the <code>GenericString</code> <code>item</code>
is a member
- * of this list.
- * @param item <code>GenericString</code> whose presence in this list is
- * to be tested.
- * @return True if this list contains the <code>GenericString</code>
- * <code>item</code>.
- */
- public boolean contains(String item)
- {
- return strList.contains(item);
- }
-
- /**
- * Returns the <code>index</code>th item in the collection or
- * <code>null</code> if <code>index</code> is greater than or
equal to
- * the number of objects in the list. The index starts at 0.
- * @param index index into the collection.
- * @return The <code>GenericString</code> at the
<code>index</code>th
- * position in the <code>StringList</code>, or
<code>null</code> if
- * the index specified is not valid.
- */
- public String item(int index)
- {
- return (String)strList.get(index);
- }
-
- public List<String> toList()
- {
- return strList;
- }
-
- public void addItem(String str)
- {
- strList.add(str);
- }
-
- public String toString()
- {
- return strList.toString();
- }
-}
Copied: trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSStringList.java
(from rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSStringList.java)
Deleted:
trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSTypeDefinition.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSTypeDefinition.java 2006-12-07
10:43:36 UTC (rev 1600)
+++
trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSTypeDefinition.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -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.wsdl.xmlschema;
-
-import org.apache.xerces.xs.XSTypeDefinition;
-import org.jboss.ws.WSException;
-
-/**
- * @author <mailto:Anil.Saldhana@jboss.org>Anil Saldhana
- * @since Apr 20, 2005
- */
-public class JBossXSTypeDefinition extends JBossXSObject implements XSTypeDefinition
-{
- private static final long serialVersionUID = -3317350531846406564L;
-
- protected boolean anonymous = false;
- protected JBossXSTypeDefinition baseType;
- protected boolean isFinal = false;
-
- public JBossXSTypeDefinition()
- {
- }
-
- public JBossXSTypeDefinition(String name, String namespace)
- {
- super(name, namespace);
- }
-
- /**
- * Create a new JBossXSTypeDefinition
- * while reading data from a XSTypeDefinition
- *
- * @param xt
- */
- public JBossXSTypeDefinition(XSTypeDefinition xt)
- {
- super(xt.getName(), xt.getNamespace());
- setAnonymous(xt.getAnonymous());
-
- XSTypeDefinition xbase = xt.getBaseType();
- if (xbase != null)
- {
- if (xbase instanceof JBossXSTypeDefinition == false &&
!("anyType".equals(xbase.getName())))
- baseType = new JBossXSTypeDefinition(xbase);
- }
-
- }
-
- /**
- * Return whether this type definition is a simple type or complex type.
- */
- public short getTypeCategory()
- {
- throw new WSException("Type unidentified");
- }
-
- /**
- * {base type definition}: either a simple type definition or a complex
- * type definition.
- */
- public XSTypeDefinition getBaseType()
- {
- return baseType;
- }
-
- /**
- * {final}. For a complex type definition it is a subset of {extension,
- * restriction}. For a simple type definition it is a subset of
- * {extension, list, restriction, union}.
- * @param restriction Extension, restriction, list, union constants
- * (defined in <code>XSConstants</code>).
- * @return True if <code>restriction</code> is in the final set,
- * otherwise false.
- */
- public boolean isFinal(short restriction)
- {
- return isFinal;
- }
-
- /**
- * For complex types the returned value is a bit combination of the subset
- * of {<code>DERIVATION_EXTENSION, DERIVATION_RESTRICTION</code>}
- * corresponding to <code>final</code> set of this type or
- * <code>DERIVATION_NONE</code>. For simple types the returned value is
- * a bit combination of the subset of {
- * <code>DERIVATION_RESTRICTION, DERIVATION_EXTENSION, DERIVATION_UNION,
DERIVATION_LIST</code>
- * } corresponding to <code>final</code> set of this type or
- * <code>DERIVATION_NONE</code>.
- */
- public short getFinal()
- {
- return 0;
- }
-
- /** Convenience attribute. A boolean that specifies if the type definition is
anonymous.
- */
- public boolean getAnonymous()
- {
- return anonymous;
- }
-
- public void setAnonymous(boolean anonymous)
- {
- this.anonymous = anonymous;
- }
-
- /**
- * Convenience method which checks if this type is derived from the given
- * <code>ancestorType</code>.
- * @param ancestorType An ancestor type definition.
- * @param derivationMethod A bit combination representing a subset of {
- * <code>DERIVATION_RESTRICTION, DERIVATION_EXTENSION, DERIVATION_UNION,
DERIVATION_LIST</code>
- * }.
- * @return True if this type is derived from <code>ancestorType</code>
- * using only derivation methods from the <code>derivationMethod</code>
- * .
- */
- public boolean derivedFromType(XSTypeDefinition ancestorType, short derivationMethod)
- {
- return false;
- }
-
- /**
- * Convenience method which checks if this type is derived from the given
- * ancestor type.
- * @param namespace An ancestor type namespace.
- * @param name An ancestor type name.
- * @param derivationMethod A bit combination representing a subset of {
- * <code>DERIVATION_RESTRICTION, DERIVATION_EXTENSION, DERIVATION_UNION,
DERIVATION_LIST</code>
- * }.
- * @return True if this type is derived from <code>ancestorType</code>
- * using only derivation methods from the <code>derivationMethod</code>
- * .
- */
- public boolean derivedFrom(String namespace, String name, short derivationMethod)
- {
- return false;
- }
-
- public void setBaseType(XSTypeDefinition baseT)
- {
- if (baseT instanceof JBossXSTypeDefinition)
- {
- this.baseType = (JBossXSTypeDefinition)baseT;
- }
- else
- {
- this.baseType = new JBossXSTypeDefinition(baseT);
- }
- }
-
- public void setFinal(boolean aFinal)
- {
- isFinal = aFinal;
- }
-
-}
Copied:
trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSTypeDefinition.java (from
rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSTypeDefinition.java)
Deleted: trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/WSSchemaUtils.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/WSSchemaUtils.java 2006-12-07
10:43:36 UTC (rev 1600)
+++ trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/WSSchemaUtils.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -1,775 +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.xmlschema;
-
-import java.io.IOException;
-import java.io.Writer;
-import java.util.Arrays;
-import java.util.List;
-
-import javax.xml.namespace.QName;
-
-import org.apache.xerces.xs.StringList;
-import org.apache.xerces.xs.XSAnnotation;
-import org.apache.xerces.xs.XSAttributeDeclaration;
-import org.apache.xerces.xs.XSAttributeUse;
-import org.apache.xerces.xs.XSComplexTypeDefinition;
-import org.apache.xerces.xs.XSConstants;
-import org.apache.xerces.xs.XSElementDeclaration;
-import org.apache.xerces.xs.XSModel;
-import org.apache.xerces.xs.XSModelGroup;
-import org.apache.xerces.xs.XSNamedMap;
-import org.apache.xerces.xs.XSNamespaceItem;
-import org.apache.xerces.xs.XSNamespaceItemList;
-import org.apache.xerces.xs.XSObjectList;
-import org.apache.xerces.xs.XSParticle;
-import org.apache.xerces.xs.XSSimpleTypeDefinition;
-import org.apache.xerces.xs.XSTerm;
-import org.apache.xerces.xs.XSTypeDefinition;
-import org.jboss.ws.Constants;
-import org.jboss.ws.WSException;
-import org.jboss.ws.core.utils.DOMWriter;
-import org.jboss.ws.metadata.wsdl.xsd.SchemaUtils;
-import org.jboss.xb.binding.NamespaceRegistry;
-
-/**
- * Singleton class that works on the JBoss version of XSModel
- * @author <mailto:Anil.Saldhana@jboss.org>Anil Saldhana
- * @since Jun 3, 2005
- */
-
-public class WSSchemaUtils
-{
- private static final String xsNS = Constants.NS_SCHEMA_XSD;
- private static SchemaUtils utils = SchemaUtils.getInstance();
-
- private NamespaceRegistry namespaceRegistry;
-
- private String targetNamespace = null;
-
- public static WSSchemaUtils getInstance(NamespaceRegistry namespaceRegistry, String
targetNamespace)
- {
- return new WSSchemaUtils(namespaceRegistry, targetNamespace);
- }
-
- private WSSchemaUtils(NamespaceRegistry namespaceRegistry, String targetNamespace)
- {
- this.namespaceRegistry = namespaceRegistry;
- this.targetNamespace = targetNamespace;
- }
-
-
- /**
- * Checks whether given a targetNS and other regular schema namespaces,
- * the passed "checkNS" is a custom namespace
- * @param targetNS Target Namespace of the schema
- * @param checkNS Namespace that needs to be checked if its a custom namespace
- * @return true - if checkNS is a custom namespace, false - otherwise
- */
- public boolean checkCustomNamespace(String targetNS, String checkNS)
- {
- String[] nsarr = new String[] {xsNS,Constants.NS_SCHEMA_XSI };
- List<String> knownNamespaces = Arrays.asList(nsarr);
- boolean isCustom = false;
- if(xsNS.equals(targetNS))
- throw new IllegalArgumentException("targetNamespace cannot be "+xsNS
);
- if(checkNS == null)
- throw new IllegalArgumentException("checkNS is null");
- if(knownNamespaces.contains(checkNS) == false &&
- targetNS.equals(checkNS) == false)
- isCustom = true;
- return isCustom;
- }
-
- /**
- * Create a global XSElementDeclaration object
- * @param name
- * @param xstype
- * @param targetNS
- * @return
- */
-
- public JBossXSElementDeclaration createGlobalXSElementDeclaration(String name,
XSTypeDefinition xstype,
- String targetNS)
- {
- JBossXSElementDeclaration xsel = new JBossXSElementDeclaration();
- xsel.setName(name);
- xsel.setTypeDefinition(xstype);
- xsel.setTargetNamespace(targetNS);
- xsel.setNamespace(targetNS);
- xsel.setScope(XSConstants.SCOPE_GLOBAL);
- return xsel;
- }
-
- /**
- * Generate a Schema Model for a namespace
- * @return
- */
-
- public JBossXSModel createXSModel()
- {
- return new JBossXSModel();
- }
-
- public JBossXSComplexTypeDefinition createXSComplexTypeDefinition( String name,
- XSTypeDefinition baseType, List<XSParticle> xsparts, String typens)
- {
- //No complex type if particles are null
- if(xsparts == null)
- return null;
-
- JBossXSComplexTypeDefinition ct = new JBossXSComplexTypeDefinition();
- ct.setName(name);
- ct.setNamespace(typens);
- JBossXSModelGroup group = new JBossXSModelGroup();
-
- group.setCompositor(XSModelGroup.COMPOSITOR_SEQUENCE);
- group.setParticles(xsparts);
- // Plug the particle array into the modelgroup
- JBossXSParticle xspa = new JBossXSParticle(null, typens);
- xspa.setTerm(group);
- ((JBossXSComplexTypeDefinition) ct).setParticle(xspa);
-
- if (baseType != null)
- {
- ((JBossXSComplexTypeDefinition)
ct).setDerivationMethod(XSConstants.DERIVATION_EXTENSION);
- ((JBossXSComplexTypeDefinition) ct).setBaseType(baseType);
- }
-
- return ct;
- }
-
-
- /**
- * Create a local XSElementDeclaration object
- * @param name
- * @param xstype
- * @param targetNS
- * @param isNillable
- * @return
- */
-
- public JBossXSElementDeclaration createXSElementDeclaration(String name,
XSTypeDefinition xstype,boolean isNillable)
- {
- JBossXSElementDeclaration xsel = new JBossXSElementDeclaration();
- xsel.setName(name);
- xsel.setTypeDefinition(xstype);
- xsel.setNillable(isNillable);
- return xsel;
- }
-
- public JBossXSParticle createXSParticle(String targetNS, boolean isArray, XSTerm
xsterm)
- {
- JBossXSParticle xsp = new JBossXSParticle(null, targetNS);
- if (isArray)
- xsp.setMaxOccurs(-1);
- xsp.setTerm(xsterm);
- return xsp;
- }
-
-
- /**
- * Creates a XSTypeDefinition object given a QName
- *
- * @param qname
- * @return a XSTypeDefinition
- */
- public JBossXSTypeDefinition createXSTypeDefinition(QName qname)
- {
- JBossXSTypeDefinition jbxs = new JBossXSTypeDefinition();
- jbxs.setName(qname.getLocalPart());
- jbxs.setNamespace(qname.getNamespaceURI());
- return jbxs;
- }
-
-
- /**
- * Generate a complex type for a custom exception
- * @param exname
- * @param ns
- * @return
- */
-
- public XSComplexTypeDefinition getExceptionType(String exname, String ns)
- {
- JBossXSParticle xsp = new JBossXSParticle();
- /*xsp.setType(XSConstants.ELEMENT_DECLARATION);
- xsp.setMaxOccurs(-1);
- JBossXSElementDeclaration xsel =
(JBossXSElementDeclaration)createXSElementDeclaration("name",
utils.getSchemaBasicType("string"), true);
-
- xsp.setTerm(xsel); */
- XSComplexTypeDefinition ct =
- new JBossXSComplexTypeDefinition(exname, ns);
-
- ((JBossXSComplexTypeDefinition)ct).setParticle(xsp);
- return ct;
- }
-
- /**
- * Convert the read-only Xerces implementation of XSModel
- * into JBossXSModel.
- * If the input is JBossXSModel, it will be returned back.
- * @param xsmodel XSModel object
- * @return JBossXSModel (RW Model)
- */
- public JBossXSModel getJBossXSModel(XSModel xsmodel)
- {
- if(xsmodel instanceof JBossXSModel)
- return (JBossXSModel)xsmodel;
- JBossXSModel jbxs = new JBossXSModel();
- copyXSModel(xsmodel,jbxs);
- return jbxs;
- }
-
- /**
- * Checks if the XSModel is empty given a namespace
- * @param xsmodel Schema Model to check
- * @param namespace namespace to check components for
- * @return true (if empty) and false (if not empty)
- */
- public boolean isEmptySchema(JBossXSModel xsmodel, String namespace)
- {
- if(xsmodel == null) return true;
- if(namespace == null) throw new WSException("Target Namespace of xsmodel is
null");
- XSNamedMap tmap = xsmodel.getComponentsByNamespace(XSConstants.TYPE_DEFINITION,
namespace);
- XSNamedMap emap = xsmodel.getComponentsByNamespace(XSConstants.ELEMENT_DECLARATION,
namespace);
-
- if (tmap != null && tmap.getLength() > 0) return false;
- if (emap != null && emap.getLength() > 0) return false;
-
- return true;
- }
-
-
- /**
- * Serialize the SchemaModel into a Writer
- * @param xsmodel Schema Model which needs to be serialized
- * @param writer a Writer to which serialization should happen
- * @throws IOException
- */
- public void serialize(XSModel xsmodel, Writer writer) throws IOException
- {
- StringBuilder buffer = new StringBuilder();
- if(xsmodel instanceof JBossXSModel)
- {
- String str = ((JBossXSModel)xsmodel).serialize();
- buffer.append(str);
- }
- else
- {
- buffer.append("<schema ");
- XSNamespaceItemList itemlist = xsmodel.getNamespaceItems();
- appendSchemaDefinitions(buffer, itemlist);
- appendTypes(buffer, xsmodel);
- appendGlobalElements(buffer, xsmodel);
- buffer.append("</schema>");
- }
- writer.write(buffer.toString());
- }
-
-
- /**
- * Serialize the SchemaModel (with no types and elements) into a Writer
- * @param xsmodel Schema Model which needs to be serialized
- * @param writer a Writer to which serialization should happen
- * @throws IOException
- */
-
- public void serializeEmptySchema(XSModel xsmodel, Writer writer) throws IOException
- {
- StringBuilder buffer = new StringBuilder();
- buffer.append("<schema ");
- XSNamespaceItemList itemlist = xsmodel.getNamespaceItems();
- appendSchemaDefinitions(buffer, itemlist);
- appendTypes(buffer, xsmodel);
- appendGlobalElements(buffer, xsmodel);
- buffer.append("</schema>");
- writer.write(buffer.toString());
- }
-
- /**
- * Return a string for the element declaration
- * @param xsel
- * @param xsp
- * @return
- */
-
- public String write(XSElementDeclaration xsel, XSParticle xsp)
- {
- XSTypeDefinition xst = xsel.getTypeDefinition();
- if(xst == null)
- throw new IllegalStateException("Type xst is null");
-
- boolean isGlobalRef = (xsel.getScope() == XSConstants.SCOPE_GLOBAL);
- boolean isAnonType = xst.getAnonymous();
-
- StringBuilder buf = new StringBuilder();
- String elname = xsel.getName();
- String prefix = null;
-
- if(isGlobalRef)
- {
- String namespace = xsel.getNamespace();
- prefix = getPrefix(namespace);
- buf.append("<element ref='" + prefix + ":" + elname +
"'");
- }
- else
- {
- String namespace = xst.getNamespace();
- String typename = xst.getName();
-
- if (! Constants.NS_SCHEMA_XSD.equals(namespace))
- {
- prefix = getPrefix(namespace);
- typename = prefix + ":" + typename;
- }
- buf.append("<element name='" + elname + "'");
-
- if(! isAnonType)
- buf.append(" type='" + typename + "' ");
- }
-
- if (xsel.getNillable())
- buf.append(" nillable='true' ");
-
- int minoccurs = xsp.getMinOccurs();
- int maxoccurs = xsp.getMaxOccurs();
- if (!(minoccurs == 0 && maxoccurs == 0) && !(minoccurs == 1
&& maxoccurs == 1))
- {
- if (xsp.getMaxOccursUnbounded())
- buf.append(" maxOccurs='unbounded' ");
- else
- buf.append(" maxOccurs='" + xsp.getMaxOccurs() +
"'");
-
- buf.append(" minOccurs='" + xsp.getMinOccurs() +
"'");
- }
-
- if(! isAnonType)
- buf.append("/>");
- else
-
buf.append(">").append(write(xst)).append("</element>");
-
- return buf.toString();
- }
-
- public String write(XSAttributeDeclaration decl)
- {
- XSTypeDefinition xst = decl.getTypeDefinition();
- if(xst == null)
- throw new IllegalStateException("Type xst is null");
-
- boolean isGlobalRef = (decl.getScope() == XSConstants.SCOPE_GLOBAL);
- boolean isAnonType = xst.getAnonymous();
-
- StringBuilder buf = new StringBuilder();
- String name = decl.getName();
- String prefix = null;
-
- if (isGlobalRef)
- {
- String namespace = decl.getNamespace();
- prefix = getPrefix(namespace);
- buf.append("<attribute ref='" + prefix + ":" + name +
"'");
- }
- else
- {
- String namespace = xst.getNamespace();
- String typename = xst.getName();
-
- if (! Constants.NS_SCHEMA_XSD.equals(namespace))
- {
- prefix = getPrefix(namespace);
- typename = prefix + ":" + typename;
- }
- buf.append("<attribute name='" + name + "'");
-
- if(! isAnonType)
- buf.append(" type='" + typename + "' ");
- }
-
- if(! isAnonType)
- buf.append("/>");
- else
-
buf.append(">").append(write(xst)).append("</attribute>");
-
- return buf.toString();
- }
-
- /**
- * Return a string for the global element declaration
- * @param xsel
- * @param xsp
- * @return
- */
- public String write(XSElementDeclaration xsel)
- {
- boolean isAnonType = false;
- if (XSConstants.SCOPE_GLOBAL != xsel.getScope())
- throw new IllegalArgumentException("Element is not a global
element");
-
- StringBuilder buf = new StringBuilder();
- String elname = xsel.getName();
- XSTypeDefinition xst = xsel.getTypeDefinition();
- isAnonType = xst.getAnonymous();
- String typename = xst.getName();
- String namespace = xst.getNamespace();
- String prefix = null;
-
- if (! Constants.NS_SCHEMA_XSD.equals(namespace))
- {
- prefix = getPrefix(namespace);
- typename = prefix + ":" + typename;
- }
-
- buf.append("<element name='" + elname + "'");
- if(!isAnonType)
- buf.append(" type='" + typename + "' ");
- else
- buf.append(">").append(write(xst));
-
- if (xsel.getNillable() &&
- xsel.getScope() != XSConstants.SCOPE_GLOBAL)
- buf.append(" nillable='true' ");
- if(!isAnonType)
- buf.append("/>");
- else
- buf.append("</element>");
-
- return buf.toString();
- }
-
- /**
- * Return a string for the xs model group
- * @param xstype
- * @return
- */
- public String write(XSModelGroup xsm)
- {
- StringBuilder buf = new StringBuilder();
- XSObjectList objlist = xsm.getParticles();
-
- int lenobj = objlist != null ? objlist.getLength() : 0;
-
- for (int i = 0; i < lenobj; i++)
- {
- XSParticle jxsp = (XSParticle)objlist.item(i);
- XSTerm xterm = jxsp.getTerm();
- short termType = xterm.getType();
- if(termType == XSConstants.ELEMENT_DECLARATION)
- {
- XSElementDeclaration xsel = (XSElementDeclaration)jxsp.getTerm();
- buf.append(this.write(xsel, jxsp));
- }
- else
- if ( termType == XSConstants.MODEL_GROUP)
- {
- XSObjectList olist = ((XSModelGroup)xterm).getParticles();
- int lobj = olist != null ? olist.getLength() : 0;
- for (int k = 0; k < lobj; k++)
- {
- XSParticle jxp = (XSParticle)olist.item(k);
- XSTerm xsterm = jxp.getTerm();
- termType = xsterm.getType();
- if(termType == XSConstants.ELEMENT_DECLARATION)
- buf.append(write((XSElementDeclaration)xsterm, jxsp));
- else
- if(termType == XSConstants.MODEL_GROUP && k > 0)
- buf.append(write((XSModelGroup)xsterm));
- }
- }
- }
- return buf.toString();
- }
-
-
- /**
- * Return a string for the xs type
- * @param xstype
- * @return
- */
- public String write(XSTypeDefinition xstype)
- {
- StringBuilder buf = new StringBuilder();
-
- //Handle Complex Type
- if (xstype instanceof XSComplexTypeDefinition)
- {
- XSComplexTypeDefinition jxstype = (XSComplexTypeDefinition)xstype;
- String jxsTypeName = jxstype.getName();
- boolean isSimple = jxstype.getContentType() ==
XSComplexTypeDefinition.CONTENTTYPE_SIMPLE;
-
- if(xstype.getAnonymous()) buf.append("<complexType>");
- else
- buf.append("<complexType name='" + jxsTypeName +
"'>");
-
- XSTypeDefinition xsbase = (XSTypeDefinition)jxstype.getBaseType();
- String baseType = null;
- if (xsbase != null && !("anyType".equals(xsbase.getName())))
- baseType = getPrefix(xsbase.getNamespace()) + ":" +
xsbase.getName();
-
- if (baseType != null)
- {
- buf.append((isSimple) ? "<simpleContent>" :
"<complexContent>");
- buf.append("<extension base='" + baseType +
"'>");
- }
-
- XSParticle xsp = jxstype.getParticle();
- if (xsp != null) appendComplexTypeDefinition(buf,jxstype);
-
- XSObjectList list = jxstype.getAttributeUses();
- for (int i = 0; i < list.getLength(); i++)
- {
- XSAttributeUse use = (XSAttributeUse) list.item(i);
- XSAttributeDeclaration decl = use.getAttrDeclaration();
- buf.append(write(decl));
- }
-
- if (baseType != null)
- {
- buf.append("</extension>");
- buf.append((isSimple) ? "</simpleContent>" :
"</complexContent>");
- }
-
- buf.append("</complexType>");
-
- }
- else if (xstype instanceof XSSimpleTypeDefinition)
- {
- XSTypeDefinition xsbase = (XSTypeDefinition)xstype.getBaseType();
- buf.append("<simpleType name='" + xstype.getName() +
"'>");
- if (xsbase != null && !"anyType".equals(xsbase.getName()))
- {
- String baseType = xsbase.getName();
- String ns = xsbase.getNamespace();
- if (! Constants.NS_SCHEMA_XSD.equals(ns))
- {
- String prefix = getPrefix(ns);
- baseType = prefix + ":" + baseType;
- }
-
- // currently only handle enumerations
- buf.append("<restriction base='" + baseType +
"'>");
- StringList list = ((XSSimpleTypeDefinition)xstype).getLexicalEnumeration();
- for (int i = 0; i < list.getLength(); i++)
- {
- String listItem = DOMWriter.normalize(list.item(i), false);
- buf.append("<enumeration value='" + listItem
+"'/>");
- }
- buf.append("</restriction>");
- }
- buf.append("</simpleType>");
- }
-
- return buf.toString();
- }
-
-// Private methods
-
- private void appendSchemaDefinitions(StringBuilder buffer, XSNamespaceItemList
itemlist)
- {
- int len = itemlist != null ? itemlist.getLength() : 0;
-
- for (int i = 0; i < len; i++)
- {
- XSNamespaceItem nsitem = (XSNamespaceItem)itemlist.item(i);
- String ns = nsitem.getSchemaNamespace();
- //Ignore the one for xsd
-
- if (Constants.NS_SCHEMA_XSD.equals(ns)) continue;
- buffer.append(utils.getSchemaDefinitions(ns));
-
- } //end for
- }
-
- private void appendComplexTypeDefinition(StringBuilder buf , XSComplexTypeDefinition
jxstype)
- {
- XSParticle xsp = jxstype.getParticle();
- XSTerm xsterm = xsp.getTerm();
- short deriveMethod = jxstype.getDerivationMethod();
-
- if (xsterm instanceof XSElementDeclaration)
- {
- // FIXME This is horribly wrong, but too much depends on this broken behavior
- buf.append("<sequence>");
-
- XSElementDeclaration xsel = (XSElementDeclaration)xsterm;
- buf.append(this.write(xsel, xsp));
- buf.append("</sequence>");
- }
- else if (xsterm instanceof XSModelGroup)
- {
- XSModelGroup jmg = (XSModelGroup)xsterm;
- XSObjectList objlist = jmg.getParticles();
- String end = null;
-
- switch (jmg.getCompositor())
- {
- case XSModelGroup.COMPOSITOR_ALL:
- buf.append("<all>");
- end = "</all>";
- break;
- case XSModelGroup.COMPOSITOR_CHOICE:
- buf.append("<choice>");
- end = "</choice>";
- break;
- default:
- case XSModelGroup.COMPOSITOR_SEQUENCE:
- buf.append("<sequence>");
- end = "</sequence>";
- break;
- }
-
- int lenobj = objlist != null ? objlist.getLength() : 0;
-
- for (int i = 0; i < lenobj; i++)
- {
- XSParticle jxsp = (XSParticle)objlist.item(i);
- XSTerm xterm = jxsp.getTerm();
- if (xterm instanceof XSElementDeclaration)
- {
- XSElementDeclaration xsel = (XSElementDeclaration)jxsp.getTerm();
- buf.append(this.write(xsel, jxsp));
- }
- else if (xterm instanceof XSModelGroup)
- {
- if(deriveMethod == XSConstants.DERIVATION_EXTENSION && i != lenobj
-1)
- continue;
-
- if (i == 0) continue;//Ignore as it provides the baseclass sequence of
elements
- XSObjectList olist = ((XSModelGroup)xterm).getParticles();
- int lobj = olist != null ? olist.getLength() : 0;
- for (int k = 0; k < lobj; k++)
- {
- XSParticle jxp = (XSParticle)olist.item(k);
- XSTerm jxpterm = jxp.getTerm();
- short termType = jxpterm.getType();
- if(termType == XSConstants.ELEMENT_DECLARATION)
- buf.append(write((XSElementDeclaration)jxpterm, jxsp));
- else
- if(termType == XSConstants.MODEL_GROUP)
- buf.append(write((XSModelGroup)jxpterm));
- }
- }
- }
-
- buf.append(end);
- }
- }
-
- private void appendTypes(StringBuilder buffer, XSModel xsmodel)
- {
- XSNamedMap xsmap = xsmodel.getComponents(XSConstants.TYPE_DEFINITION);
- int len = xsmap != null ? xsmap.getLength() : 0;
- for (int i = 0; i < len; i++)
- {
- XSTypeDefinition xstype = (XSTypeDefinition)xsmap.item(i);
- if (Constants.NS_SCHEMA_XSD.equals(xstype.getNamespace())) continue;
- buffer.append(this.write(xstype));
- }
- }
-
-
- private void appendGlobalElements(StringBuilder buffer, XSModel xsmodel)
- {
- XSNamedMap xsmap = xsmodel.getComponents(XSConstants.ELEMENT_DECLARATION);
- int len = xsmap != null ? xsmap.getLength() : 0;
- for (int i = 0; i < len; i++)
- {
- XSElementDeclaration xsel = (XSElementDeclaration)xsmap.item(i);
- if (Constants.NS_SCHEMA_XSD.equals(xsel.getNamespace())) continue;
- buffer.append(this.write(xsel));
- }
- }
-
- //Copy the Xerces implementation of XSModel into JBossXSModel
- public void copyXSModel(XSModel xsmodel, JBossXSModel jb)
- {
- if(xsmodel == null)
- throw new IllegalArgumentException("Illegal Null Argument:xsmodel");
- if(jb == null)
- throw new IllegalArgumentException("Illegal Null Argument:jb");
- //Copy all the Namespace Items
- jb.setXSNamespaceItemList(xsmodel.getNamespaceItems());
- //Copy all the elements
- XSNamedMap xsmp = xsmodel.getComponents(XSConstants.ELEMENT_DECLARATION);
- int len = xsmp != null ? xsmp.getLength() : 0;
-
- for (int i = 0; i < len; i++)
- {
- XSElementDeclaration xsel = (XSElementDeclaration)xsmp.item(i);
- jb.addXSElementDeclaration(xsel);
- }
- //Copy all the types
- xsmp = xsmodel.getComponents(XSConstants.TYPE_DEFINITION);
- len = xsmp != null ? xsmp.getLength() : 0;
- for (int i = 0; i < len; i++)
- {
- XSTypeDefinition xstype = (XSTypeDefinition)xsmp.item(i);
- if (!this.xsNS.equals(xstype.getNamespace())) jb.addXSTypeDefinition(xstype);
- }
-
- //Copy all the attributes
- xsmp = xsmodel.getComponents(XSConstants.ATTRIBUTE_DECLARATION);
- len = xsmp != null ? xsmp.getLength() : 0;
- for (int i = 0; i < len; i++)
- {
- XSAttributeDeclaration xsattr = (XSAttributeDeclaration)xsmp.item(i);
- jb.addXSAttributeDeclaration(xsattr);
- }
-
- //copy all the global annotations
- //xsmp = xsmodel.getComponents(XSConstants.ANNOTATION);
- XSObjectList xo = xsmodel.getAnnotations();
- len = xo != null ? xo.getLength():0;
- //len = xsmp != null ? xsmp.getLength() : 0;
- for (int i = 0; i < len; i++)
- {
- //XSAnnotation xa = (XSAnnotation)xsmp.item(i);
- XSAnnotation xa = (XSAnnotation)xo.item(i);
- jb.addXSAnnotation(xa);
- }
- }
-
- private String getPrefix(String namespace)
- {
- if (namespaceRegistry == null)
- throw new IllegalArgumentException("nameespaceRegistry can not be
null!");
-
- if (namespace == null)
- throw new IllegalArgumentException("namespace can not be null");
-
- // XML Namespace can only legally be assigned the XML prefix
- if (namespace.equals(Constants.NS_XML))
- return Constants.PREFIX_XML;
- if (namespace.equals(targetNamespace))
- return Constants.PREFIX_TNS;
- if (namespace.equals(Constants.URI_SOAP11_ENC))
- return Constants.PREFIX_SOAP11_ENC;
- if (namespace.equals(Constants.NS_SCHEMA_XSI))
- return Constants.PREFIX_XSI;
-
- String prefix = namespaceRegistry.getPrefix(namespace);
-
- // Assume target namespace
- return (prefix == null) ? Constants.PREFIX_TNS : prefix;
- }
-}
\ No newline at end of file
Copied: trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/WSSchemaUtils.java (from
rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/WSSchemaUtils.java)
Copied: trunk/src/main/java/org/jboss/ws/metadata/wsdl/xsd (from rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/xsd)
Deleted: trunk/src/main/java/org/jboss/ws/metadata/wsdl/xsd/SchemaUtils.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/xsd/SchemaUtils.java 2006-12-07
10:43:36 UTC (rev 1600)
+++ trunk/src/main/java/org/jboss/ws/metadata/wsdl/xsd/SchemaUtils.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -1,567 +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.xsd;
-
-import java.io.File;
-import java.io.IOException;
-import java.net.URL;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.xml.namespace.QName;
-
-import org.apache.xerces.impl.dv.xs.SchemaDVFactoryImpl;
-import org.apache.xerces.impl.xs.XMLSchemaLoader;
-import org.apache.xerces.xni.parser.XMLEntityResolver;
-import org.apache.xerces.xni.parser.XMLErrorHandler;
-import org.apache.xerces.xs.StringList;
-import org.apache.xerces.xs.XSComplexTypeDefinition;
-import org.apache.xerces.xs.XSConstants;
-import org.apache.xerces.xs.XSElementDeclaration;
-import org.apache.xerces.xs.XSLoader;
-import org.apache.xerces.xs.XSModel;
-import org.apache.xerces.xs.XSModelGroup;
-import org.apache.xerces.xs.XSNamedMap;
-import org.apache.xerces.xs.XSObjectList;
-import org.apache.xerces.xs.XSParticle;
-import org.apache.xerces.xs.XSSimpleTypeDefinition;
-import org.apache.xerces.xs.XSTerm;
-import org.apache.xerces.xs.XSTypeDefinition;
-import org.jboss.ws.Constants;
-import org.jboss.ws.WSException;
-import org.jboss.ws.core.server.ServerConfig;
-import org.jboss.ws.core.server.ServerConfigFactory;
-import org.jboss.ws.metadata.wsdl.xmlschema.JBossXSComplexTypeDefinition;
-import org.jboss.ws.metadata.wsdl.xmlschema.JBossXSElementDeclaration;
-import org.jboss.ws.metadata.wsdl.xmlschema.JBossXSErrorHandler;
-import org.jboss.ws.metadata.wsdl.xmlschema.JBossXSSimpleTypeDefinition;
-import org.jboss.ws.metadata.wsdl.xmlschema.JBossXSStringList;
-import org.jboss.ws.metadata.wsdl.xmlschema.JBossXSTypeDefinition;
-
-/**
- * Util class that deals with XML Schema
- * @author <mailto:Anil.Saldhana@jboss.org>Anil Saldhana
- * @since Apr 12, 2005
- */
-public class SchemaUtils
-{
- private static SchemaUtils ourInstance = new SchemaUtils();
-
- protected static String xsNS = Constants.NS_SCHEMA_XSD;
-
- private static Map<Class, QName> toolsTypeMappingOverride = new
HashMap<Class, QName>();
-
- static
- {
- toolsTypeMappingOverride.put(byte[].class, Constants.TYPE_LITERAL_BASE64BINARY);
- }
-
- public static SchemaUtils getInstance()
- {
- return ourInstance;
- }
-
- private SchemaUtils()
- {
- }
-
- /**
- * Checks if the XS Particle is of array type
- * @param xsparticle
- * @return
- */
-
- public boolean isArrayType(XSParticle xsparticle)
- {
- //Determine if it is an arrayType
- int maxOccurs = xsparticle.getMaxOccurs();
- return xsparticle.getMaxOccursUnbounded() || maxOccurs > 1;
- }
-
- public static boolean isWrapperArrayType(XSTypeDefinition xst)
- {
- return unwrapArrayType(xst) != null;
- }
-
- public static XSElementDeclaration unwrapArrayType(XSTypeDefinition xst)
- {
- if (xst instanceof XSComplexTypeDefinition == false)
- return null;
-
- XSComplexTypeDefinition xc = (XSComplexTypeDefinition)xst;
- if (xc.getContentType() == XSComplexTypeDefinition.CONTENTTYPE_EMPTY)
- return null;
-
- XSParticle xsp = xc.getParticle();
- if (xsp == null)
- return null;
-
- XSTerm xsterm = xsp.getTerm();
- if (xsterm instanceof XSModelGroup == false)
- return null;
-
- XSModelGroup xm = (XSModelGroup)xsterm;
- XSObjectList xo = xm.getParticles();
- if (xo.getLength() != 1)
- return null;
-
- XSParticle xp = (XSParticle)xo.item(0);
- XSTerm term = xp.getTerm();
- if ((xp.getMaxOccursUnbounded() || xp.getMaxOccurs() > 1) == false || term
instanceof XSElementDeclaration == false)
- return null;
-
- return (XSElementDeclaration)term;
- }
-
- /**
- * Generate a QName for a simple type
- * @param simple
- * @return
- */
- public static QName handleSimpleType(XSSimpleTypeDefinition simple)
- {
- if (simple == null)
- throw new IllegalArgumentException("XSSimpleTypeDefinition passed is
null");
-
- //Check if the type of SimpleType is a plain xsd type
- if (Constants.NS_SCHEMA_XSD.equals(simple.getNamespace()))
- return createQNameFromXSSimpleType(simple);
-
- switch (simple.getVariety())
- {
- case XSSimpleTypeDefinition.VARIETY_LIST:
- return handleSimpleType(simple.getItemType());
- case XSSimpleTypeDefinition.VARIETY_UNION:
- XSObjectList list = simple.getMemberTypes();
- if (list.getLength() > 0)
- return handleSimpleType((XSSimpleTypeDefinition)list.item(0));
- throw new WSException("Empty union type not expected");
- case XSSimpleTypeDefinition.VARIETY_ABSENT:
- throw new WSException("Absent variety is not supported in simple
types");
- }
-
- XSTypeDefinition base = simple.getBaseType();
- while (!Constants.NS_SCHEMA_XSD.equals(base.getNamespace()))
- base = base.getBaseType();
-
- if (!(base instanceof XSSimpleTypeDefinition))
- throw new WSException("Expected base type to be a simple type");
-
- return new QName(base.getNamespace(), base.getName());
- }
-
- /**
- * For the basic xsd types, patch prefix and ns uri
- * @param qname
- * @return
- */
- public QName patchXSDQName(QName qname)
- {
- if (qname == null)
- return null;
- return new QName(Constants.NS_SCHEMA_XSD, qname.getLocalPart(),
Constants.PREFIX_XSD);
- }
-
- /**
- * Given a XSTypeDefinition and the QName for the element,
- * create a XSElementDeclaration object
- * @param xmlName Name of the element
- * @param xst Type of the element
- * @return XSElementDeclaration
- */
- public XSElementDeclaration createXSElementDeclaration(QName xmlName, XSTypeDefinition
xst)
- {
- String name = xmlName.getLocalPart();
- String ns = xmlName.getNamespaceURI();
- JBossXSElementDeclaration jbel = new JBossXSElementDeclaration(name, ns);
- jbel.setTypeDefinition(xst);
- jbel.setScope(XSConstants.SCOPE_GLOBAL);
- return jbel;
- }
-
- /**
- * Create a QName given a Simple Type
- * @param xs
- * @return qname
- */
- public static QName createQNameFromXSSimpleType(XSSimpleTypeDefinition xs)
- {
- String nsuri = xs.getNamespace();
- String localpart = xs.getName();
- if (xsNS.equals(nsuri))
- return new QName(nsuri, localpart, Constants.PREFIX_XSD);
- else return new QName(nsuri, localpart);
- }
-
- /**
- * Return typemapping override for tools if any
- *
- * @param javaType
- * @return
- */
- public QName getToolsOverrideInTypeMapping(Class javaType)
- {
- return toolsTypeMappingOverride.get(javaType);
- }
-
- /**
- * Check if a global element exists
- * @param xmlName QName of the element that needs to be checked
- * @param xsmodel Schema model that is passed
- * @return
- */
- public boolean hasGlobalElement(QName xmlName, XSModel xsmodel)
- {
- if (xmlName == null)
- throw new IllegalArgumentException("xmlName is null");
- if (xsmodel == null)
- throw new IllegalArgumentException("XSModel is null");
- boolean bool = false;
- String name = xmlName.getLocalPart();
- if (name == null)
- throw new IllegalArgumentException("xmlName has a null name");
- String ns = xmlName.getNamespaceURI();
- if (ns == null)
- throw new IllegalArgumentException("xmlName has a null namespace");
- if (xsmodel.getElementDeclaration(name, ns) != null)
- bool = true;
- return bool;
- }
-
- /**
- * Check if a Complex Type exists
- * @param xmlType QName of the Complex Type that needs to be checked
- * @param xsmodel Schema model that is passed
- * @return
- */
- public boolean hasComplexTypeDefinition(QName xmlType, URL xsdLocation)
- {
- if (xsdLocation == null)
- throw new IllegalArgumentException("xsdLocation is null");
- XSModel xsmodel = parseSchema(xsdLocation);
- return this.hasComplexTypeDefinition(xmlType, xsmodel);
- }
-
- /**
- * Check if a Global Element exists
- * @param xmlType QName of the global element that needs to be checked
- * @param xsmodel Schema model that is passed
- * @return
- */
- public boolean hasGlobalElement(QName xmlName, URL xsdLocation)
- {
- if (xmlName == null)
- throw new IllegalArgumentException("xmlName is null");
- if (xsdLocation == null)
- throw new IllegalArgumentException("xsdLocation is null");
- XSModel xsmodel = parseSchema(xsdLocation);
- boolean bool = false;
- String name = xmlName.getLocalPart();
- if (name == null)
- throw new IllegalArgumentException("xmlName has a null name");
- String ns = xmlName.getNamespaceURI();
- if (ns == null)
- throw new IllegalArgumentException("xmlName has a null namespace");
- if (xsmodel.getElementDeclaration(name, ns) != null)
- bool = true;
- return bool;
- }
-
- /**
- * Check if a Complex Type exists
- * @param xmlType QName of the Complex Type that needs to be checked
- * @param xsmodel Schema model that is passed
- * @return
- */
- public boolean hasComplexTypeDefinition(QName xmlType, XSModel xsmodel)
- {
- if (xmlType == null)
- throw new IllegalArgumentException("xmlType is null");
- if (xsmodel == null)
- throw new IllegalArgumentException("XSModel is null");
- boolean bool = false;
- String name = xmlType.getLocalPart();
- if (name == null)
- throw new IllegalArgumentException("xmlName has a null name");
- String ns = xmlType.getNamespaceURI();
- if (ns == null)
- throw new IllegalArgumentException("xmlName has a null namespace");
- if (xsmodel.getTypeDefinition(name, ns) != null)
- bool = true;
- return bool;
- }
-
- /**
- * Get formatted string for the qname representing the xstype
- * @param xstype
- * @return
- */
- public String getFormattedString(XSTypeDefinition xstype)
- {
- String ns = xstype.getNamespace();
- String name = xstype.getName();
- if (!ns.equals(xsNS))
- name = getPrefix(ns) + ":" + name;
-
- return name;
- }
-
- /**
- * Get a QName for a xs type
- * @param xstype
- * @return
- */
- public QName getQName(XSTypeDefinition xstype)
- {
- String prefix = null;
- String ns = xstype.getNamespace();
- String name = xstype.getName();
- if (!ns.equals(xsNS))
- prefix = Constants.PREFIX_TNS;
- else prefix = Constants.PREFIX_XSD;
-
- return new QName(ns, name, prefix);
- }
-
- /**
- * Get a schema basic type
- * TODO: Migrate this off of the Xerces Impl
- * @param localpart
- * @return
- */
- public JBossXSTypeDefinition getSchemaBasicType(String localpart)
- {
- JBossXSTypeDefinition xt = null;
- /**
- * Special case: xs:anyType
- */
- if ("anyType".equals(localpart))
- {
- JBossXSComplexTypeDefinition ct = new JBossXSComplexTypeDefinition(localpart,
Constants.NS_SCHEMA_XSD);
- ct.setContentType(XSComplexTypeDefinition.CONTENTTYPE_EMPTY);
- xt = ct;
- }
- else
- {
- XSSimpleTypeDefinition xstype = (new
SchemaDVFactoryImpl()).getBuiltInType(localpart);
- xt = new JBossXSSimpleTypeDefinition(xstype);
-
- }
- return xt;
- }
-
- /**
- * Get an instance of XSLoader that is capable of
- * parsing schema files
- *
- * @return
- */
- public XSLoader getXSLoader()
- {
- XMLSchemaLoader xsloader = new XMLSchemaLoader();
- JBossXSErrorHandler eh = new JBossXSErrorHandler();
- xsloader.setErrorHandler(eh);
- return xsloader;
- }
-
- /**
- * Get an instance of XSLoader that is capable of
- * parsing schema files
- * @param xeh XML Error handler
- * @param xer XML Entity Resolver
- * @return
- */
- public XSLoader getXSLoader(XMLErrorHandler xeh, XMLEntityResolver xer)
- {
- XMLSchemaLoader xsloader = new XMLSchemaLoader();
- xsloader.setEntityResolver(xer);
- xsloader.setErrorHandler(xeh);
- return xsloader;
- }
-
- /**
- * Given a schema file, generate a schema model
- * @param schemaLoc java.net.URL object to the schema file
- * @return schema model
- */
- public XSModel parseSchema(URL schemaLoc)
- {
- return parseSchema(schemaLoc.toExternalForm());
- }
-
- /**
- * Given a schema file, generate a schema model
- * @param schemaLoc string representation to the location of schema
- * @return schema model
- */
- public XSModel parseSchema(String schemaLoc)
- {
- XSLoader xsloader = getXSLoader();
- XSModel xsModel = xsloader.loadURI(schemaLoc);
- if (xsModel == null)
- throw new WSException("Cannot parse schema: " + schemaLoc);
- return xsModel;
- }
-
- /**
- * Given a list of schema locations, parse and
- * provide a Xerces XSModel
- *
- * @param locations
- * @return
- */
- public XSModel parseSchema(List<String> locations)
- {
- JBossXSStringList slist = new JBossXSStringList(locations);
- XSLoader xsloader = getXSLoader();
- return xsloader.loadURIList(slist);
- }
-
- /**
- * Checks if the XSModel is empty
- * @param xsmodel
- * @return true (if empty) and false (if not empty)
- */
- public boolean isEmptySchema(XSModel xsmodel)
- {
- if (xsmodel == null)
- return true;
- String targetNS = getTargetNamespace(xsmodel);
- if (targetNS == null)
- throw new WSException("Target Namespace of xsmodel is null");
- XSNamedMap tmap = xsmodel.getComponentsByNamespace(XSConstants.TYPE_DEFINITION,
targetNS);
- XSNamedMap emap = xsmodel.getComponentsByNamespace(XSConstants.ELEMENT_DECLARATION,
targetNS);
-
- if (tmap != null && tmap.getLength() > 0)
- return false;
- if (emap != null && emap.getLength() > 0)
- return false;
-
- return true;
- }
-
- /**
- * Checks if the XSModel is empty given a namespace
- * @param xsmodel Schema Model to check
- * @param namespace namespace to check components for
- * @return true (if empty) and false (if not empty)
- */
- public boolean isEmptySchema(XSModel xsmodel, String namespace)
- {
- if (xsmodel == null)
- return true;
- if (namespace == null)
- throw new WSException("Target Namespace of xsmodel is null");
- XSNamedMap tmap = xsmodel.getComponentsByNamespace(XSConstants.TYPE_DEFINITION,
namespace);
- XSNamedMap emap = xsmodel.getComponentsByNamespace(XSConstants.ELEMENT_DECLARATION,
namespace);
-
- if (tmap != null && tmap.getLength() > 0)
- return false;
- if (emap != null && emap.getLength() > 0)
- return false;
-
- return true;
- }
-
- /**
- * Get the schema definitions as a String
- * @param targetNS The Target Namespace
- * @return
- */
- public static String getSchemaDefinitions(String targetNS)
- {
- StringBuilder buffer = new StringBuilder();
- buffer.append(" targetNamespace='" + targetNS + "'");
- buffer.append(" xmlns='" + Constants.NS_SCHEMA_XSD +
"'");
- buffer.append(" xmlns:" + Constants.PREFIX_SOAP11_ENC +
"='" + Constants.URI_SOAP11_ENC + "'");
- buffer.append(" xmlns:" + Constants.PREFIX_TNS + "='" +
targetNS + "'");
- //buffer.append(" xmlns:" + WSDLConstants.PREFIX_XSD + "='"
+ WSDLConstants.NS_SCHEMA_XSD + "'");
- buffer.append(" xmlns:" + Constants.PREFIX_XSI + "='" +
Constants.NS_SCHEMA_XSI + "'");
- buffer.append(">");
- return buffer.toString();
- }
-
- /** Get the temp file for a given namespace
- */
- public static File getSchemaTempFile(String targetNS) throws IOException
- {
- if (targetNS.length() == 0)
- throw new IllegalArgumentException("Invalid null target namespace");
-
- String fname = targetNS;
- if (fname.indexOf("://") > 0)
- fname = fname.substring(fname.indexOf("://") + 3);
-
- File tmpdir = null;
- try
- {
- ServerConfigFactory factory = ServerConfigFactory.getInstance();
- ServerConfig serverConfig = factory.getServerConfig();
- tmpdir = serverConfig.getServerTempDir();
- tmpdir = new File(tmpdir.getCanonicalPath() + "/jbossws");
- tmpdir.mkdirs();
- }
- catch (Throwable th)
- {
- // ignore if the server config cannot be found
- // this would be the case if we are on the client side
- }
-
- fname = fname.replace('/', '_');
- fname = fname.replace(':', '_');
- File file = File.createTempFile("JBossWS_" + fname, ".xsd",
tmpdir);
- return file;
- }
-
- /**
- * Get the TargetNamespace from the schema model
- */
- public static String getTargetNamespace(XSModel xsmodel)
- {
- if (xsmodel == null)
- throw new IllegalArgumentException("Illegal Null Argument: xsmodel");
- String targetNS = null;
- StringList slist = xsmodel.getNamespaces();
- int len = slist != null ? slist.getLength() : 0;
- for (int i = 0; i < len; i++)
- {
- String ns = slist.item(i);
- if (Constants.NS_SCHEMA_XSD.equals(ns))
- continue;
- targetNS = ns;
- break;
- }
- return targetNS;
- }
-
- private String getPrefix(String namespace)
- {
- if (Constants.URI_SOAP11_ENC.equals(namespace))
- return Constants.PREFIX_SOAP11_ENC;
- else if (Constants.NS_SOAP11_ENV.equals(namespace) ||
Constants.NS_SOAP12_ENV.equals(namespace))
- return Constants.PREFIX_ENV;
-
- // Fall back to target namespace even though this is incorrect
- return Constants.PREFIX_TNS;
- }
-}
Copied: trunk/src/main/java/org/jboss/ws/metadata/wsdl/xsd/SchemaUtils.java (from rev
1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/xsd/SchemaUtils.java)
Deleted: trunk/src/main/java/org/jboss/ws/metadata/wsdl/xsd/XSDWriter.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/xsd/XSDWriter.java 2006-12-07
10:43:36 UTC (rev 1600)
+++ trunk/src/main/java/org/jboss/ws/metadata/wsdl/xsd/XSDWriter.java 2006-12-07 12:05:41
UTC (rev 1603)
@@ -1,118 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
-*/
-package org.jboss.ws.metadata.wsdl.xsd;
-
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.StringWriter;
-import java.io.Writer;
-import java.net.URL;
-
-import org.apache.xerces.xs.XSModel;
-import org.jboss.logging.Logger;
-import org.jboss.ws.metadata.wsdl.WSDLDefinitions;
-import org.jboss.ws.metadata.wsdl.xmlschema.JBossXSModel;
-import org.jboss.ws.metadata.wsdl.xmlschema.WSSchemaUtils;
-
-/**
- * XML Schema File Writer
- * @author <mailto:Anil.Saldhana@jboss.org>Anil Saldhana
- */
-public class XSDWriter
-{
- // provide logging
- protected static final Logger log = Logger.getLogger(XSDWriter.class);
-
- protected WSDLDefinitions wsdl = null;
-
- protected SchemaUtils schemautils = SchemaUtils.getInstance();
-
- protected WSSchemaUtils sutils = WSSchemaUtils.getInstance(null, null);
-
- public void writeXSD(Writer writer, XSModel xsmodel, WSDLDefinitions wsdl)
- {
- if (xsmodel == null)
- throw new IllegalArgumentException("xsmodel is NULL");
-
- this.wsdl = wsdl;
-
- if (schemautils.isEmptySchema(xsmodel)) return;
- }
-
- /**
- * Serialize the schema into a temp file
- * @param xsmodel Schema model
- * @param ns Target Namespace
- * @return URL of the temp file where the schema exists
- * @throws IOException
- */
- public URL serialize( XSModel xsmodel, String ns)
- throws IOException
- {
- if(ns == null)
- throw new IllegalArgumentException("Illegal Null Argument:ns");
- String xsdString = "";
- if(xsmodel instanceof JBossXSModel)
- {
- JBossXSModel jbxs = (JBossXSModel)xsmodel;
- xsdString = jbxs.serialize();
- }
- else
- {
- // Serialize XSD model
- StringWriter strwr = new StringWriter();
- sutils.serialize(xsmodel, strwr);
- xsdString = strwr.toString();
- }
-
- log.trace("serialize:\n" + xsdString);
-
- // Write updated xsd file
- File xsdFile = SchemaUtils.getSchemaTempFile(ns);
- FileWriter writer = new FileWriter(xsdFile);
- writer.write(xsdString);
- writer.close();
-
- return xsdFile.toURL();
- }
-
- /**
- * Serialize the schema into a output stream
- * @param xsmodel Schema model
- * @param ns Target Namespace
- * @param os OutputStream to write into
- * @throws IOException
- */
- public void serialize( XSModel xsmodel, String ns, OutputStream os)
- throws IOException
- {
- // Serialize XSD model
- StringWriter strwr = new StringWriter();
- sutils.serialize(xsmodel, strwr);
- String xsdString = strwr.toString();
- log.trace("serialize:" + xsdString);
-
- os.write(xsdString.getBytes());
- }
-}
Copied: trunk/src/main/java/org/jboss/ws/metadata/wsdl/xsd/XSDWriter.java (from rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/xsd/XSDWriter.java)
Copied: trunk/src/main/java/org/jboss/ws/metadata/wsse (from rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsse)
Deleted: trunk/src/main/java/org/jboss/ws/metadata/wsse/Config.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsse/Config.java 2006-12-07
10:43:36 UTC (rev 1600)
+++ trunk/src/main/java/org/jboss/ws/metadata/wsse/Config.java 2006-12-07 12:05:41 UTC
(rev 1603)
@@ -1,95 +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.wsse;
-
-import java.io.Serializable;
-
-/**
- * <code>Config</code> represents the config tag.
- *
- * @author <a href="mailto:jason.greene@jboss.com">Jason T.
Greene</a>
- * @version $Revision$
- */
-public class Config implements Serializable
-{
- private static final long serialVersionUID = 4219543242657899910L;
-
- private Timestamp timestamp;
-
- private Username username;
-
- private Sign sign;
-
- private Encrypt encrypt;
-
- private Requires requires;
-
- public Encrypt getEncrypt()
- {
- return encrypt;
- }
-
- public void setEncrypt(Encrypt encrypt)
- {
- this.encrypt = encrypt;
- }
-
- public Sign getSign()
- {
- return sign;
- }
-
- public void setSign(Sign sign)
- {
- this.sign = sign;
- }
-
- public Timestamp getTimestamp()
- {
- return timestamp;
- }
-
- public void setTimestamp(Timestamp timestamp)
- {
- this.timestamp = timestamp;
- }
-
- public Username getUsername()
- {
- return username;
- }
-
- public void setUsername(Username username)
- {
- this.username = username;
- }
-
- public Requires getRequires()
- {
- return requires;
- }
-
- public void setRequires(Requires requires)
- {
- this.requires = requires;
- }
-}
Copied: trunk/src/main/java/org/jboss/ws/metadata/wsse/Config.java (from rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsse/Config.java)
Deleted: trunk/src/main/java/org/jboss/ws/metadata/wsse/Encrypt.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsse/Encrypt.java 2006-12-07
10:43:36 UTC (rev 1600)
+++ trunk/src/main/java/org/jboss/ws/metadata/wsse/Encrypt.java 2006-12-07 12:05:41 UTC
(rev 1603)
@@ -1,79 +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.wsse;
-
-import java.io.Serializable;
-
-/**
- * <code>Encrypt</code> represents the encrypt tag, which signifies that the
- * message should be encrypted.
- *
- * @author <a href="mailto:jason.greene@jboss.com">Jason T.
Greene</a>
- * @version $Revision$
- */
-public class Encrypt extends Targetable implements Serializable
-{
- private static final long serialVersionUID = -2802677183149218760L;
-
- private String type;
-
- private String alias;
-
- private String algorithm;
-
- public Encrypt(String type, String alias, String algorithm)
- {
- this.type = type;
- this.alias = alias;
- this.algorithm = algorithm;
- }
-
- public String getAlias()
- {
- return alias;
- }
-
- public void setAlias(String alias)
- {
- this.alias = alias;
- }
-
- public String getType()
- {
- return type;
- }
-
- public void setType(String type)
- {
- this.type = type;
- }
-
- public String getAlgorithm()
- {
- return algorithm;
- }
-
- public void setAlgorithm(String algorithm)
- {
- this.algorithm = algorithm;
- }
-}
\ No newline at end of file
Copied: trunk/src/main/java/org/jboss/ws/metadata/wsse/Encrypt.java (from rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsse/Encrypt.java)
Deleted: trunk/src/main/java/org/jboss/ws/metadata/wsse/Operation.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsse/Operation.java 2006-12-07
10:43:36 UTC (rev 1600)
+++ trunk/src/main/java/org/jboss/ws/metadata/wsse/Operation.java 2006-12-07 12:05:41 UTC
(rev 1603)
@@ -1,65 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
-*/
-package org.jboss.ws.metadata.wsse;
-
-import java.io.Serializable;
-
-/**
- * <code>Operation</code> represents a wsdl operation. Used to declare per
- * operation configurations.
- *
- * @author <a href="mailto:jason.greene@jboss.com">Jason T.
Greene</a>
- * @version $Revision$
- */
-public class Operation implements Serializable
-{
- private static final long serialVersionUID = 4223295703633326725L;
-
- private Config config;
-
- private String name;
-
- public Operation(String name)
- {
- this.name = name;
- }
-
- public Config getConfig()
- {
- return config;
- }
-
- public void setConfig(Config config)
- {
- this.config = config;
- }
-
- public String getName()
- {
- return name;
- }
-
- public void setName(String name)
- {
- this.name = name;
- }
-}
Copied: trunk/src/main/java/org/jboss/ws/metadata/wsse/Operation.java (from rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsse/Operation.java)
Deleted: trunk/src/main/java/org/jboss/ws/metadata/wsse/Port.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsse/Port.java 2006-12-07
10:43:36 UTC (rev 1600)
+++ trunk/src/main/java/org/jboss/ws/metadata/wsse/Port.java 2006-12-07 12:05:41 UTC (rev
1603)
@@ -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.wsse;
-
-import java.io.Serializable;
-import java.util.HashMap;
-
-/**
- * <code>Port</code> represents a per wsdl port configuration for a
- * security configuration.
- *
- * @author <a href="mailto:jason.greene@jboss.com">Jason T.
Greene</a>
- * @version $Revision$
- */
-public class Port implements Serializable
-{
- private static final long serialVersionUID = 8294850341855208663L;
-
- private String name;
-
- private Config defaultConfig;
-
- private HashMap<String, Operation> operations = new HashMap<String,
Operation>();
-
- public Port(String name)
- {
- this.name = name;
- }
-
- public Config getDefaultConfig()
- {
- return defaultConfig;
- }
-
- public void setDefaultConfig(Config defaultConfig)
- {
- this.defaultConfig = defaultConfig;
- }
-
- public HashMap<String, Operation> getOperations()
- {
- return operations;
- }
-
- public void setOperations(HashMap<String, Operation> operations)
- {
- this.operations = operations;
- }
-
- public String getName()
- {
- return name;
- }
-
- public void setName(String name)
- {
- this.name = name;
- }
-
- public void addOperation(Operation operation)
- {
- operations.put(operation.getName(), operation);
- }
-}
Copied: trunk/src/main/java/org/jboss/ws/metadata/wsse/Port.java (from rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsse/Port.java)
Deleted: trunk/src/main/java/org/jboss/ws/metadata/wsse/RequireEncryption.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsse/RequireEncryption.java 2006-12-07
10:43:36 UTC (rev 1600)
+++ trunk/src/main/java/org/jboss/ws/metadata/wsse/RequireEncryption.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -1,34 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
-*/
-package org.jboss.ws.metadata.wsse;
-
-/**
- * <code>Sign</code> represents the sign tag, which declares that a message
- * should be signed.
- *
- * @author <a href="mailto:jason.greene@jboss.com">Jason T.
Greene</a>
- * @version $Revision$
- */
-public class RequireEncryption extends Targetable
-{
- private static final long serialVersionUID = 3765798680988205647L;
-}
Copied: trunk/src/main/java/org/jboss/ws/metadata/wsse/RequireEncryption.java (from rev
1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsse/RequireEncryption.java)
Deleted: trunk/src/main/java/org/jboss/ws/metadata/wsse/RequireSignature.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsse/RequireSignature.java 2006-12-07
10:43:36 UTC (rev 1600)
+++ trunk/src/main/java/org/jboss/ws/metadata/wsse/RequireSignature.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -1,34 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
-*/
-package org.jboss.ws.metadata.wsse;
-
-/**
- * <code>Sign</code> represents the sign tag, which declares that a message
- * should be signed.
- *
- * @author <a href="mailto:jason.greene@jboss.com">Jason T.
Greene</a>
- * @version $Revision$
- */
-public class RequireSignature extends Targetable
-{
- private static final long serialVersionUID = -3854930944550152309L;
-}
Copied: trunk/src/main/java/org/jboss/ws/metadata/wsse/RequireSignature.java (from rev
1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsse/RequireSignature.java)
Deleted: trunk/src/main/java/org/jboss/ws/metadata/wsse/RequireTimestamp.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsse/RequireTimestamp.java 2006-12-07
10:43:36 UTC (rev 1600)
+++ trunk/src/main/java/org/jboss/ws/metadata/wsse/RequireTimestamp.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -1,47 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
-*/
-package org.jboss.ws.metadata.wsse;
-
-import java.io.Serializable;
-
-
-public class RequireTimestamp implements Serializable
-{
- private static final long serialVersionUID = 278316358447518411L;
-
- private String maxAge;
-
- public RequireTimestamp(String maxAge)
- {
- this.maxAge = maxAge;
- }
-
- public String getMaxAge()
- {
- return maxAge;
- }
-
- public void setMaxAge(String maxAge)
- {
- this.maxAge = maxAge;
- }
-}
\ No newline at end of file
Copied: trunk/src/main/java/org/jboss/ws/metadata/wsse/RequireTimestamp.java (from rev
1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsse/RequireTimestamp.java)
Deleted: trunk/src/main/java/org/jboss/ws/metadata/wsse/Requires.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsse/Requires.java 2006-12-07
10:43:36 UTC (rev 1600)
+++ trunk/src/main/java/org/jboss/ws/metadata/wsse/Requires.java 2006-12-07 12:05:41 UTC
(rev 1603)
@@ -1,71 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
-*/
-package org.jboss.ws.metadata.wsse;
-
-import java.io.Serializable;
-
-/**
- * <code>Requires</code> represents the require tag.
- *
- * @author <a href="mailto:jason.greene@jboss.com">Jason T.
Greene</a>
- * @version $Revision$
- */
-public class Requires implements Serializable
-{
- private static final long serialVersionUID = 6899913633295989845L;
-
- private RequireTimestamp requireTimestamp;
-
- private RequireSignature requireSignature;
-
- private RequireEncryption requireEncryption;
-
- public RequireEncryption getRequireEncryption()
- {
- return requireEncryption;
- }
-
- public void setRequireEncryption(RequireEncryption requireEncryption)
- {
- this.requireEncryption = requireEncryption;
- }
-
- public RequireSignature getRequireSignature()
- {
- return requireSignature;
- }
-
- public void setRequireSignature(RequireSignature requireSignature)
- {
- this.requireSignature = requireSignature;
- }
-
- public RequireTimestamp getRequireTimestamp()
- {
- return requireTimestamp;
- }
-
- public void setRequireTimestamp(RequireTimestamp requireTimestamp)
- {
- this.requireTimestamp = requireTimestamp;
- }
-}
Copied: trunk/src/main/java/org/jboss/ws/metadata/wsse/Requires.java (from rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsse/Requires.java)
Deleted: trunk/src/main/java/org/jboss/ws/metadata/wsse/Sign.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsse/Sign.java 2006-12-07
10:43:36 UTC (rev 1600)
+++ trunk/src/main/java/org/jboss/ws/metadata/wsse/Sign.java 2006-12-07 12:05:41 UTC (rev
1603)
@@ -1,77 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
-*/
-package org.jboss.ws.metadata.wsse;
-
-/**
- * <code>Sign</code> represents the sign tag, which declares that a message
- * should be signed.
- *
- * @author <a href="mailto:jason.greene@jboss.com">Jason T.
Greene</a>
- * @version $Revision$
- */
-public class Sign extends Targetable
-{
- private static final long serialVersionUID = -2645745357707804441L;
-
- private String type;
-
- private String alias;
-
- private boolean includeTimestamp;
-
- public Sign(String type, String alias, boolean includeTimestamp)
- {
- this.type = type;
- this.alias = alias;
- this.includeTimestamp = includeTimestamp;
- }
-
- public String getAlias()
- {
- return alias;
- }
-
- public void setAlias(String alias)
- {
- this.alias = alias;
- }
-
- public String getType()
- {
- return type;
- }
-
- public void setType(String type)
- {
- this.type = type;
- }
-
- public boolean isIncludeTimestamp()
- {
- return includeTimestamp;
- }
-
- public void setIncludeTimestamp(boolean includeTimestamp)
- {
- this.includeTimestamp = includeTimestamp;
- }
-}
Copied: trunk/src/main/java/org/jboss/ws/metadata/wsse/Sign.java (from rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsse/Sign.java)
Deleted: trunk/src/main/java/org/jboss/ws/metadata/wsse/Target.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsse/Target.java 2006-12-07
10:43:36 UTC (rev 1600)
+++ trunk/src/main/java/org/jboss/ws/metadata/wsse/Target.java 2006-12-07 12:05:41 UTC
(rev 1603)
@@ -1,76 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
-*/
-package org.jboss.ws.metadata.wsse;
-
-import java.io.Serializable;
-
-/**
- * <code>Target</code> represents the target tag.
- *
- * @author <a href="mailto:jason.greene@jboss.com">Jason T.
Greene</a>
- * @version $Revision$
- */
-public class Target implements Serializable
-{
- private static final long serialVersionUID = 5718485529854012480L;
-
- private String type;
-
- private String value;
-
- private boolean contentOnly;
-
- public Target(String type)
- {
- this.type = type;
- }
-
- public String getType()
- {
- return type;
- }
-
- public void setType(String type)
- {
- this.type = type;
- }
-
- public String getValue()
- {
- return value;
- }
-
- public void setValue(String value)
- {
- this.value = value;
- }
-
- public boolean isContentOnly()
- {
- return contentOnly;
- }
-
- public void setContentOnly(boolean contentOnly)
- {
- this.contentOnly = contentOnly;
- }
-}
\ No newline at end of file
Copied: trunk/src/main/java/org/jboss/ws/metadata/wsse/Target.java (from rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsse/Target.java)
Deleted: trunk/src/main/java/org/jboss/ws/metadata/wsse/Targetable.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsse/Targetable.java 2006-12-07
10:43:36 UTC (rev 1600)
+++ trunk/src/main/java/org/jboss/ws/metadata/wsse/Targetable.java 2006-12-07 12:05:41 UTC
(rev 1603)
@@ -1,57 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
-*/
-package org.jboss.ws.metadata.wsse;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-
-/**
- * <code>Targetable</code> is the base class for tags which support target
- * tags as child elements.
- *
- * @author <a href="mailto:jason.greene@jboss.com">Jason T.
Greene</a>
- * @version $Revision$
- */
-public class Targetable implements Serializable
-{
- private static final long serialVersionUID = -4034435076127402668L;
-
- private ArrayList<Target> targets;
-
- public ArrayList<Target> getTargets()
- {
- return targets;
- }
-
- public void setTargets(ArrayList<Target> targets)
- {
- this.targets = targets;
- }
-
- public void addTarget(Target target)
- {
- if (targets == null)
- targets = new ArrayList<Target>();
-
- targets.add(target);
- }
-}
Copied: trunk/src/main/java/org/jboss/ws/metadata/wsse/Targetable.java (from rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsse/Targetable.java)
Deleted: trunk/src/main/java/org/jboss/ws/metadata/wsse/Timestamp.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsse/Timestamp.java 2006-12-07
10:43:36 UTC (rev 1600)
+++ trunk/src/main/java/org/jboss/ws/metadata/wsse/Timestamp.java 2006-12-07 12:05:41 UTC
(rev 1603)
@@ -1,47 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
-*/
-package org.jboss.ws.metadata.wsse;
-
-import java.io.Serializable;
-
-
-public class Timestamp implements Serializable
-{
- private static final long serialVersionUID = 8273360977250180943L;
-
- private String ttl;
-
- public Timestamp(String ttl)
- {
- this.ttl = ttl;
- }
-
- public String getTtl()
- {
- return ttl;
- }
-
- public void setTtl(String ttl)
- {
- this.ttl = ttl;
- }
-}
Copied: trunk/src/main/java/org/jboss/ws/metadata/wsse/Timestamp.java (from rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsse/Timestamp.java)
Deleted: trunk/src/main/java/org/jboss/ws/metadata/wsse/Username.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsse/Username.java 2006-12-07
10:43:36 UTC (rev 1600)
+++ trunk/src/main/java/org/jboss/ws/metadata/wsse/Username.java 2006-12-07 12:05:41 UTC
(rev 1603)
@@ -1,30 +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.wsse;
-
-import java.io.Serializable;
-
-
-public class Username implements Serializable
-{
- private static final long serialVersionUID = 8273360977250180943L;
-}
Copied: trunk/src/main/java/org/jboss/ws/metadata/wsse/Username.java (from rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsse/Username.java)
Deleted: trunk/src/main/java/org/jboss/ws/metadata/wsse/WSSecurityConfiguration.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsse/WSSecurityConfiguration.java 2006-12-07
10:43:36 UTC (rev 1600)
+++ trunk/src/main/java/org/jboss/ws/metadata/wsse/WSSecurityConfiguration.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -1,162 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
-*/
-package org.jboss.ws.metadata.wsse;
-
-import java.io.Serializable;
-import java.net.URL;
-import java.util.HashMap;
-
-/**
- * Root configuration class, represents the "jboss-ws-security" tag.
- *
- * @author <a href="mailto:jason.greene@jboss.com">Jason T.
Greene</a>
- * @version $Revision$
- */
-public class WSSecurityConfiguration implements Serializable
-{
- private static final long serialVersionUID = 1022564645797303076L;
-
- private Config defaultConfig;
-
- private HashMap<String, Port> ports = new HashMap<String, Port>();
-
- private String keyStoreFile;
-
- private URL keyStoreURL;
-
- private String keyStoreType;
-
- private String keyStorePassword;
-
- private String trustStoreFile;
-
- private URL trustStoreURL;
-
- private String trustStoreType;
-
- private String trustStorePassword;
-
- public Config getDefaultConfig()
- {
- return defaultConfig;
- }
-
- public void setDefaultConfig(Config defaultConfig)
- {
- this.defaultConfig = defaultConfig;
- }
-
- public HashMap<String, Port> getPorts()
- {
- return ports;
- }
-
- public void setPorts(HashMap<String, Port> ports)
- {
- this.ports = ports;
- }
-
- public String getKeyStoreFile()
- {
- return keyStoreFile;
- }
-
- public void setKeyStoreFile(String keyStoreFile)
- {
- this.keyStoreFile = keyStoreFile;
- }
-
- public URL getKeyStoreURL()
- {
- return keyStoreURL;
- }
-
- public void setKeyStoreURL(URL keyStoreURL)
- {
- this.keyStoreURL = keyStoreURL;
- }
-
- public void addPort(Port port)
- {
- this.ports.put(port.getName(), port);
- }
-
- public String getKeyStorePassword()
- {
- return keyStorePassword;
- }
-
- public void setKeyStorePassword(String keyStorePassword)
- {
- this.keyStorePassword = keyStorePassword;
- }
-
- public String getKeyStoreType()
- {
- return keyStoreType;
- }
-
- public void setKeyStoreType(String keyStoreType)
- {
- this.keyStoreType = keyStoreType;
- }
-
- public String getTrustStorePassword()
- {
- return trustStorePassword;
- }
-
- public void setTrustStorePassword(String trustStorePassword)
- {
- this.trustStorePassword = trustStorePassword;
- }
-
- public String getTrustStoreType()
- {
- return trustStoreType;
- }
-
- public void setTrustStoreType(String trustStoreType)
- {
- this.trustStoreType = trustStoreType;
- }
-
- public URL getTrustStoreURL()
- {
- return trustStoreURL;
- }
-
- public void setTrustStoreURL(URL trustStoreURL)
- {
- this.trustStoreURL = trustStoreURL;
- }
-
- public String getTrustStoreFile()
- {
- return trustStoreFile;
- }
-
- public void setTrustStoreFile(String trustStoreFile)
- {
- this.trustStoreFile = trustStoreFile;
- }
-}
Copied: trunk/src/main/java/org/jboss/ws/metadata/wsse/WSSecurityConfiguration.java (from
rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsse/WSSecurityConfiguration.java)
Deleted:
trunk/src/main/java/org/jboss/ws/metadata/wsse/WSSecurityConfigurationFactory.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsse/WSSecurityConfigurationFactory.java 2006-12-07
10:43:36 UTC (rev 1600)
+++
trunk/src/main/java/org/jboss/ws/metadata/wsse/WSSecurityConfigurationFactory.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -1,460 +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.wsse;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.util.HashMap;
-
-import org.jboss.logging.Logger;
-import org.jboss.xb.binding.JBossXBException;
-import org.jboss.xb.binding.ObjectModelFactory;
-import org.jboss.xb.binding.SimpleTypeBindings;
-import org.jboss.xb.binding.Unmarshaller;
-import org.jboss.xb.binding.UnmarshallerFactory;
-import org.jboss.xb.binding.UnmarshallingContext;
-import org.xml.sax.Attributes;
-
-/**
- * A JBossXB Object Model Factory that represets a JBoss WS-Security
- * configuration. See the jboss-ws-security_1_0.xsd file for more info.
- *
- * @author <a href="mailto:jason.greene@jboss.com">Jason T.
Greene</a>
- * @version $Revision$
- */
-public class WSSecurityConfigurationFactory implements ObjectModelFactory
-{
-
- public static String SERVER_RESOURCE_NAME = "jboss-wsse-server.xml";
-
- public static String CLIENT_RESOURCE_NAME = "jboss-wsse-client.xml";
-
- private static HashMap options = new HashMap(6);
-
- static
- {
- options.put("key-store-file", "setKeyStoreFile");
- options.put("key-store-type", "setKeyStoreType");
- options.put("key-store-password", "setKeyStorePassword");
- options.put("trust-store-file", "setTrustStoreFile");
- options.put("trust-store-type", "setTrustStoreType");
- options.put("trust-store-password", "setTrustStorePassword");
- }
-
- // provide logging
- private static final Logger log =
Logger.getLogger(WSSecurityConfigurationFactory.class);
-
- // Hide constructor
- private WSSecurityConfigurationFactory()
- {
- }
-
- /**
- * Create a new instance of a jaxrpc-mapping factory
- */
- public static WSSecurityConfigurationFactory newInstance()
- {
- return new WSSecurityConfigurationFactory();
- }
-
- /**
- * Factory method for JavaWsdlMapping
- */
- public WSSecurityConfiguration parse(URL configurationFile) throws IOException
- {
- if (configurationFile == null)
- {
- throw new IllegalArgumentException("URL cannot be null");
- }
-
- // setup the XML binding Unmarshaller
- Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
- InputStream is = configurationFile.openStream();
- try
- {
- WSSecurityConfiguration configuration = (WSSecurityConfiguration)
unmarshaller.unmarshal(is, this, null);
- return configuration;
- }
- catch (JBossXBException e)
- {
- IOException ioex = new IOException("Cannot parse: " +
configurationFile);
- Throwable cause = e.getCause();
- if (cause != null)
- ioex.initCause(cause);
- throw ioex;
- }
- finally
- {
- is.close();
- }
- }
-
- /**
- * This method is called on the factory by the object model builder when the
- * parsing starts.
- */
- public Object newRoot(Object root, UnmarshallingContext navigator, String
namespaceURI, String localName, Attributes attrs)
- {
- return new WSSecurityConfiguration();
- }
-
- public Object completeRoot(Object root, UnmarshallingContext ctx, String uri, String
name)
- {
- return root;
- }
-
- public void setValue(WSSecurityConfiguration configuration, UnmarshallingContext
navigator, String namespaceURI,
- String localName, String value)
- {
- log.trace("setValue: [obj=" + configuration + ",value=" + value
+ "]");
- String method = (String) options.get(localName);
- if (method == null)
- return;
-
- // Dispatch to propper initializer
- try
- {
- WSSecurityConfiguration.class.getMethod(method, new Class[]
{String.class}).invoke(configuration, new Object[]{value});
- }
- catch (Exception e)
- {
- log.error("Could not set option: " + method + " to: " +
value, e);
- }
- }
-
- /**
- * Called when parsing of a new element started.
- */
- public Object newChild(WSSecurityConfiguration configuration, UnmarshallingContext
navigator, String namespaceURI,
- String localName, Attributes attrs)
- {
- log.trace("newChild: " + localName);
- if ("config".equals(localName))
- {
- return new Config();
- }
- if ("port".equals(localName))
- {
- return new Port(attrs.getValue("", "name"));
- }
- return null;
- }
-
- /**
- * Called when parsing character is complete.
- */
- public void addChild(WSSecurityConfiguration configuration, Config defaultConfig,
UnmarshallingContext navigator,
- String namespaceURI, String localName)
- {
- log.trace("addChild: [obj=" + configuration + ",child=" +
defaultConfig + "]");
- configuration.setDefaultConfig(defaultConfig);
- }
-
- /**
- * Called when parsing character is complete.
- */
- public void addChild(WSSecurityConfiguration configuration, Port port,
UnmarshallingContext navigator, String namespaceURI,
- String localName)
- {
- log.trace("addChild: [obj=" + configuration + ",child=" + port
+ "]");
- configuration.addPort(port);
- }
-
- /**
- * Called when parsing of a new element started.
- */
- public Object newChild(Config config, UnmarshallingContext navigator, String
namespaceURI, String localName, Attributes attrs)
- {
- log.trace("newChild: " + localName);
- if ("sign".equals(localName))
- {
- // By default, we alwyas include a timestamp
- Boolean include = new Boolean(true);
- String timestamp = attrs.getValue("", "includeTimestamp");
- if (timestamp != null)
- include = (Boolean) SimpleTypeBindings.unmarshal(timestamp,
SimpleTypeBindings.XS_BOOLEAN_NAME, null);
-
- return new Sign(attrs.getValue("", "type"),
attrs.getValue("", "alias"), include.booleanValue());
- }
- else if ("encrypt".equals(localName))
- {
- return new Encrypt(attrs.getValue("", "type"),
attrs.getValue("", "alias"), attrs.getValue("",
"algorithm"));
- }
- else if ("timestamp".equals(localName))
- {
- return new Timestamp(attrs.getValue("", "ttl"));
- }
- else if ("requires".equals(localName))
- {
- return new Requires();
- }
- else if ("username".equals(localName))
- {
- return new Username();
- }
-
- return null;
- }
-
- /**
- * Called when parsing character is complete.
- */
- public void addChild(Config config, Encrypt encrypt, UnmarshallingContext navigator,
String namespaceURI, String localName)
- {
- log.trace("addChild: [obj=" + config + ",child=" + encrypt +
"]");
- config.setEncrypt(encrypt);
- }
-
- /**
- * Called when parsing character is complete.
- */
- public void addChild(Config config, Sign sign, UnmarshallingContext navigator, String
namespaceURI, String localName)
- {
- log.trace("addChild: [obj=" + config + ",child=" + sign +
"]");
- config.setSign(sign);
- }
-
- /**
- * Called when parsing character is complete.
- */
- public void addChild(Config config, Timestamp timestamp, UnmarshallingContext
navigator, String namespaceURI, String localName)
- {
- log.trace("addChild: [obj=" + config + ",child=" + timestamp +
"]");
- config.setTimestamp(timestamp);
- }
-
- /**
- * Called when parsing character is complete.
- */
- public void addChild(Config config, Username username, UnmarshallingContext navigator,
String namespaceURI, String localName)
- {
- log.trace("addChild: [obj=" + config + ",child=" + username +
"]");
- config.setUsername(username);
- }
-
- /**
- * Called when parsing character is complete.
- */
- public void addChild(Config config, Requires requires, UnmarshallingContext navigator,
String namespaceURI, String localName)
- {
- log.trace("addChild: [obj=" + config + ",child=" + requires +
"]");
- config.setRequires(requires);
- }
-
-
- private Object handleTargets(Object object, UnmarshallingContext navigator, String
namespaceURI, String localName, Attributes attrs)
- {
- log.trace("newChild: " + localName);
- if ("target".equals(localName))
- {
- Target target = new Target(attrs.getValue("", "type"));
- if ("true".equals(attrs.getValue("",
"contentOnly")))
- target.setContentOnly(true);
-
- return target;
- }
- return null;
- }
-
- /**
- * Called when parsing of a new element started.
- */
- public Object newChild(Encrypt encrypt, UnmarshallingContext navigator, String
namespaceURI, String localName, Attributes attrs)
- {
- return handleTargets(encrypt, navigator, namespaceURI, localName, attrs);
- }
-
- /**
- * Called when parsing of a new element started.
- */
- public Object newChild(Sign sign, UnmarshallingContext navigator, String namespaceURI,
String localName, Attributes attrs)
- {
- return handleTargets(sign, navigator, namespaceURI, localName, attrs);
- }
-
- /**
- * Called when parsing of a new element started.
- */
- public Object newChild(Requires requires, UnmarshallingContext navigator, String
namespaceURI, String localName, Attributes attrs)
- {
- log.trace("newChild: " + localName);
- if ("signature".equals(localName))
- {
- return new RequireSignature();
- }
- else if ("encryption".equals(localName))
- {
- return new RequireEncryption();
- }
- else if ("timestamp".equals(localName))
- {
- return new RequireTimestamp(attrs.getValue("", "maxAge"));
- }
-
- return null;
- }
-
- /**
- * Called when parsing of a new element started.
- */
- public Object newChild(RequireSignature requireSignature, UnmarshallingContext
navigator, String namespaceURI, String localName, Attributes attrs)
- {
- return handleTargets(requireSignature, navigator, namespaceURI, localName, attrs);
- }
-
- /**
- * Called when parsing of a new element started.
- */
- public Object newChild(RequireEncryption requireEncryption, UnmarshallingContext
navigator, String namespaceURI, String localName, Attributes attrs)
- {
- return handleTargets(requireEncryption, navigator, namespaceURI, localName,
attrs);
- }
-
- public void setValue(Target target, UnmarshallingContext navigator, String
namespaceURI, String localName, String value)
- {
- log.trace("setValue: [obj=" + target + ",value=" + value +
"]");
-
- target.setValue(value);
- }
-
- /**
- * Called when parsing character is complete.
- */
- public void addChild(Encrypt encrypt, Target target, UnmarshallingContext navigator,
String namespaceURI, String localName)
- {
- log.trace("addChild: [obj=" + encrypt + ",child=" + target +
"]");
- encrypt.addTarget(target);
- }
-
- /**
- * Called when parsing character is complete.
- */
- public void addChild(Sign sign, Target target, UnmarshallingContext navigator, String
namespaceURI, String localName)
- {
- log.trace("addChild: [obj=" + sign + ",child=" + target +
"]");
- sign.addTarget(target);
- }
-
- /**
- * Called when parsing character is complete.
- */
- public void addChild(Requires requires, RequireEncryption requireEncryption,
UnmarshallingContext navigator, String namespaceURI, String localName)
- {
- log.trace("addChild: [obj=" + requires + ",child=" +
requireEncryption + "]");
- requires.setRequireEncryption(requireEncryption);
- }
-
- /**
- * Called when parsing character is complete.
- */
- public void addChild(Requires requires, RequireSignature requireSignature,
UnmarshallingContext navigator, String namespaceURI, String localName)
- {
- log.trace("addChild: [obj=" + requires + ",child=" +
requireSignature + "]");
- requires.setRequireSignature(requireSignature);
- }
-
- /**
- * Called when parsing character is complete.
- */
- public void addChild(Requires requires, RequireTimestamp requireTimestamp,
UnmarshallingContext navigator, String namespaceURI, String localName)
- {
- log.trace("addChild: [obj=" + requires + ",child=" +
requireTimestamp + "]");
- requires.setRequireTimestamp(requireTimestamp);
- }
-
- /**
- * Called when parsing character is complete.
- */
- public void addChild(RequireEncryption requireEncryption, Target target,
UnmarshallingContext navigator, String namespaceURI, String localName)
- {
- log.trace("addChild: [obj=" + requireEncryption + ",child=" +
target + "]");
- requireEncryption.addTarget(target);
- }
-
- /**
- * Called when parsing character is complete.
- */
- public void addChild(RequireSignature requireSignature, Target target,
UnmarshallingContext navigator, String namespaceURI, String localName)
- {
- log.trace("addChild: [obj=" + requireSignature + ",child=" +
target + "]");
- requireSignature.addTarget(target);
- }
-
- /**
- * Called when parsing of a new element started.
- */
- public Object newChild(Port port, UnmarshallingContext navigator, String namespaceURI,
String localName, Attributes attrs)
- {
- log.trace("newChild: " + localName);
- if ("operation".equals(localName))
- {
- return new Operation(attrs.getValue("", "name"));
- }
- else if ("config".equals(localName))
- {
- return new Config();
- }
- return null;
- }
-
- /**
- * Called when parsing character is complete.
- */
- public void addChild(Port port, Operation operation, UnmarshallingContext navigator,
String namespaceURI, String localName)
- {
- log.trace("addChild: [obj=" + port + ",child=" + operation +
"]");
- port.addOperation(operation);
- }
-
- /**
- * Called when parsing character is complete.
- */
- public void addChild(Port port, Config config, UnmarshallingContext navigator, String
namespaceURI, String localName)
- {
- log.trace("addChild: [obj=" + port + ",child=" + config +
"]");
- port.setDefaultConfig(config);
- }
-
- /**
- * Called when parsing of a new element started.
- */
- public Object newChild(Operation operation, UnmarshallingContext navigator, String
namespaceURI, String localName,
- Attributes attrs)
- {
- log.trace("newChild: " + localName);
- if ("config".equals(localName))
- {
- return new Config();
- }
- return null;
- }
-
- /**
- * Called when parsing character is complete.
- */
- public void addChild(Operation operation, Config config, UnmarshallingContext
navigator, String namespaceURI, String localName)
- {
- log.trace("addChild: [obj=" + operation + ",child=" + config +
"]");
- operation.setConfig(config);
- }
-}
Copied: trunk/src/main/java/org/jboss/ws/metadata/wsse/WSSecurityConfigurationFactory.java
(from rev 1600,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsse/WSSecurityConfigurationFactory.java)
Modified: trunk/src/test/java/org/jboss/test/ws/common/binding/SOAPBindingTestCase.java
===================================================================
---
trunk/src/test/java/org/jboss/test/ws/common/binding/SOAPBindingTestCase.java 2006-12-07
11:54:16 UTC (rev 1602)
+++
trunk/src/test/java/org/jboss/test/ws/common/binding/SOAPBindingTestCase.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -36,12 +36,12 @@
import org.jboss.test.ws.JBossWSTest;
import org.jboss.ws.Constants;
+import org.jboss.ws.core.CommonBinding;
+import org.jboss.ws.core.CommonBindingProvider;
import org.jboss.ws.core.CommonMessageContext;
+import org.jboss.ws.core.CommonSOAPBinding;
import org.jboss.ws.core.EndpointInvocation;
import org.jboss.ws.core.jaxrpc.CallImpl;
-import org.jboss.ws.core.jaxrpc.binding.CommonBinding;
-import org.jboss.ws.core.jaxrpc.binding.CommonBindingProvider;
-import org.jboss.ws.core.jaxrpc.binding.CommonSOAPBinding;
import org.jboss.ws.core.jaxrpc.handler.SOAPMessageContextJAXRPC;
import org.jboss.ws.core.soap.MessageContextAssociation;
import org.jboss.ws.core.soap.MessageFactoryImpl;
Modified:
trunk/src/test/java/org/jboss/test/ws/common/soap/attachment/GenericAttachmentTestCase.java
===================================================================
---
trunk/src/test/java/org/jboss/test/ws/common/soap/attachment/GenericAttachmentTestCase.java 2006-12-07
11:54:16 UTC (rev 1602)
+++
trunk/src/test/java/org/jboss/test/ws/common/soap/attachment/GenericAttachmentTestCase.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -41,11 +41,11 @@
import org.jboss.test.ws.JBossWSTest;
import org.jboss.ws.Constants;
+import org.jboss.ws.core.CommonBinding;
+import org.jboss.ws.core.CommonBindingProvider;
+import org.jboss.ws.core.CommonSOAPBinding;
import org.jboss.ws.core.EndpointInvocation;
import org.jboss.ws.core.jaxrpc.CallImpl;
-import org.jboss.ws.core.jaxrpc.binding.CommonBinding;
-import org.jboss.ws.core.jaxrpc.binding.CommonBindingProvider;
-import org.jboss.ws.core.jaxrpc.binding.CommonSOAPBinding;
import org.jboss.ws.core.jaxrpc.handler.SOAPMessageContextJAXRPC;
import org.jboss.ws.core.soap.MessageContextAssociation;
import org.jboss.ws.core.soap.MessageFactoryImpl;
Modified: trunk/src/test/java/org/jboss/test/ws/jaxws/xop/doclit/MTOMEndpointBean.java
===================================================================
---
trunk/src/test/java/org/jboss/test/ws/jaxws/xop/doclit/MTOMEndpointBean.java 2006-12-07
11:54:16 UTC (rev 1602)
+++
trunk/src/test/java/org/jboss/test/ws/jaxws/xop/doclit/MTOMEndpointBean.java 2006-12-07
12:05:41 UTC (rev 1603)
@@ -29,7 +29,6 @@
import org.jboss.ws.WSException;
-
@Stateless
@WebService(name="MTOMEndpoint", serviceName = "MTOMService",
endpointInterface = "org.jboss.test.ws.jaxws.xop.doclit.MTOMEndpoint")
public class MTOMEndpointBean implements MTOMEndpoint {