Author: thomas.diesler(a)jboss.com
Date: 2006-12-06 19:59:53 -0500 (Wed, 06 Dec 2006)
New Revision: 1590
Added:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/SOAPFaultHelperJAXWS.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/binding/
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/binding/BindingExt.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/binding/BindingImpl.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/binding/BindingProviderImpl.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/binding/HTTPBindingJAXWS.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/binding/MessageBinding.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/binding/PayloadBinding.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/binding/SOAP11BindingJAXWS.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/binding/SOAP12BindingJAXWS.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/binding/SOAPBindingJAXWS.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/addressing/
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/addressing/AddressingBuilderImpl.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/addressing/AddressingClientUtil.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/addressing/AddressingConstantsImpl.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/addressing/AddressingPropertiesImpl.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/addressing/AddressingTypeImpl.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/addressing/AttributeElementExtensibleImpl.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/addressing/AttributeExtensibleImpl.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/addressing/AttributedQNameImpl.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/addressing/AttributedURIImpl.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/addressing/ElementExtensibleImpl.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/addressing/EndpointReferenceImpl.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/addressing/MetadataImpl.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/addressing/ReferenceParametersImpl.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/addressing/RelationshipImpl.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/addressing/jaxrpc/
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/addressing/jaxws/
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/addressing/metadata/
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/addressing/soap/
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/eventing/
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/eventing/EventSourceEndpoint.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/eventing/EventSourceEndpointImpl.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/eventing/EventingConstants.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/eventing/EventingEndpointBase.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/eventing/EventingService.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/eventing/SubscriptionManagerEndpoint.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/eventing/SubscriptionManagerEndpointImpl.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/eventing/deployment/
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/eventing/element/
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/eventing/metadata/
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/eventing/mgmt/
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/policy/
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/BinarySecurityTokenValidator.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/Constants.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/DecodingOperation.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/DecryptionOperation.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/EncodingOperation.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/EncryptionOperation.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/FailedAuthenticationException.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/FailedCheckException.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/InvalidSecurityHeaderException.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/InvalidSecurityTokenException.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/KeyResolver.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/Operation.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/OperationDescription.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/QNameTarget.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/ReceiveUsernameOperation.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/RequireEncryptionOperation.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/RequireOperation.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/RequireSignatureOperation.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/RequireTargetableOperation.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/RequireTimestampOperation.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/STRTransform.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/SecurityAdaptor.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/SecurityAdaptorFactory.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/SecurityDecoder.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/SecurityEncoder.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/SecurityStore.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/SecurityTokenUnavailableException.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/SendUsernameOperation.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/SignatureOperation.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/SignatureVerificationOperation.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/SimplePrincipal.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/Target.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/TimestampOperation.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/TimestampVerificationOperation.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/TokenOperation.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/UnsupportedAlgorithmException.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/UnsupportedSecurityTokenException.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/Util.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/WSSecurityDispatcher.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/WSSecurityException.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/WsuIdResolver.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/WsuIdTarget.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/element/
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/jaxrpc/
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/jaxws/
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/xop/
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/xop/CreateAttachmentVisitor.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/xop/DisableMTOMHandler.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/xop/RestoreXOPElementVisitor.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/xop/XOPContext.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/xop/jaxrpc/
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/xop/jaxws/
Removed:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/binding/BindingExt.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/binding/BindingImpl.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/binding/BindingProviderImpl.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/binding/HTTPBindingJAXWS.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/binding/MessageBinding.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/binding/PayloadBinding.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/binding/SOAP11BindingJAXWS.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/binding/SOAP12BindingJAXWS.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/binding/SOAPBindingJAXWS.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/binding/SOAPFaultHelperJAXWS.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/core/
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/metadata/SomeClass.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/
Modified:
branches/tdiesler/trunk/src/main/java/javax/xml/ws/addressing/JAXWSAConstants.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/CommonClient.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/Base64Deserializer.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/Base64Serializer.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/CommonBindingProvider.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/CommonSOAPBinding.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/jbossxb/JBossXBMarshallerImpl.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/jbossxb/JBossXBUnmarshallerImpl.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/jbossxb/SchemaBindingBuilder.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/CallImpl.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/handler/HandlerDelegateJAXRPC.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/JAXBDeserializer.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/JAXBSerializer.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/client/ClientImpl.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/client/DispatchImpl.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/spi/EndpointImpl.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/metadata/builder/jaxrpc/JAXRPCMetaDataBuilder.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/metadata/builder/jaxws/JAXWSWebServiceMetaDataBuilder.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/metadata/umdm/HandlerMetaData.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/metadata/umdm/ParameterMetaData.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/AbstractServiceEndpointInvoker.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/ServiceEndpoint.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/ServiceEndpointManager.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/SOAPConnectionImpl.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/SOAPContentElement.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/SOAPMessageImpl.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/utils/ThreadLocalAssociation.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/addressing/jaxrpc/WSAddressingClientHandler.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/addressing/jaxrpc/WSAddressingServerHandler.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/addressing/jaxws/WSAddressingClientHandler.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/addressing/jaxws/WSAddressingServerHandler.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/addressing/metadata/AddressingOpMetaExt.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/addressing/soap/SOAPAddressingBuilderImpl.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/addressing/soap/SOAPAddressingPropertiesImpl.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/eventing/deployment/EventingEndpoint.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/eventing/deployment/EventingEndpointDI.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/eventing/element/DeliveryType.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/eventing/element/EndpointReference.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/eventing/element/FilterType.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/eventing/element/MetaData.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/eventing/element/ReferenceParameters.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/eventing/element/RenewRequest.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/eventing/element/RenewResponse.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/eventing/element/StatusRequest.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/eventing/element/StatusResponse.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/eventing/element/SubscribeRequest.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/eventing/element/SubscribeResponse.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/eventing/element/SubscriptionEndRequest.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/eventing/element/UnsubscribeRequest.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/eventing/metadata/EventingEpMetaExt.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/eventing/mgmt/DispatchJob.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/eventing/mgmt/DispatcherDelegate.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/eventing/mgmt/DispatcherFactory.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/eventing/mgmt/EventDispatcher.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/eventing/mgmt/EventSource.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/eventing/mgmt/EventingBuilder.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/eventing/mgmt/Filter.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/eventing/mgmt/Subscription.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/eventing/mgmt/SubscriptionError.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/eventing/mgmt/SubscriptionManager.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/eventing/mgmt/SubscriptionManagerFactory.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/eventing/mgmt/SubscriptionManagerMBean.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/eventing/mgmt/SubscriptionTicket.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/policy/Policy.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/policy/PolicyAlternative.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/policy/PolicyAssertion.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/policy/PolicyFactory.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/element/BinarySecurityToken.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/element/DirectReference.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/element/EncryptedKey.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/element/KeyIdentifier.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/element/Reference.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/element/ReferenceList.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/element/SecurityElement.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/element/SecurityHeader.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/element/SecurityProcess.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/element/SecurityTokenReference.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/element/Signature.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/element/Timestamp.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/element/Token.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/element/UsernameToken.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/element/X509IssuerSerial.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/element/X509Token.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/jaxrpc/WSSecurityHandler.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/jaxrpc/WSSecurityHandlerInbound.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/jaxrpc/WSSecurityHandlerOutbound.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/jaxws/WSSecurityHandler.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/jaxws/WSSecurityHandlerInbound.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/jaxws/WSSecurityHandlerOutbound.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/xop/jaxrpc/JBossXBContentAdapter.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/xop/jaxrpc/XOPMarshallerImpl.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/xop/jaxrpc/XOPScanner.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/xop/jaxrpc/XOPUnmarshallerImpl.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/xop/jaxws/AttachmentMarshallerImpl.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/xop/jaxws/AttachmentUnmarshallerImpl.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/xop/jaxws/ReflectiveXOPScanner.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/SecurityAdaptorFactoryImpl.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/tools/jaxws/JAXBWSDLGenerator.java
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/config/WSConfigTestCase.java
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/wsdl11/WSDL11TestCase.java
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/samples/wseventing/SysmonTestCase.java
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/samples/wseventing/SysmonUtil.java
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/samples/wssecurity/SimpleEncryptTestCase.java
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/samples/wssecurity/SimpleSignTestCase.java
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/samples/wssecurity/StorePassEncryptTestCase.java
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/wseventing/DIIClientTestCase.java
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/wseventing/EventingSupport.java
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/wseventing/EventingTestCase.java
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/wseventing/NotificationTestCase.java
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/wseventing/SubscriptionManagerTestCase.java
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/wsse/MicrosoftInteropTestCase.java
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/wsse/RoundTripTestCase.java
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/wsse/SunInteropTestCase.java
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/xop/XOPTypeDefTestCase.java
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/xop/shared/MTOMServiceBase.java
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/samples/wsaddressing/AddressingStatefulTestCase.java
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/wsaddressing/EndpointReferenceTestCase.java
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/xop/MimeDeclarationTestCase.java
Log:
Modified:
branches/tdiesler/trunk/src/main/java/javax/xml/ws/addressing/JAXWSAConstants.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/javax/xml/ws/addressing/JAXWSAConstants.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/javax/xml/ws/addressing/JAXWSAConstants.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -36,7 +36,7 @@
public static final String ADDRESSING_BUILDER_PROPERTY =
"javax.xml.ws.addressing.AddressingBuilder";
- public static final String DEFAULT_ADDRESSING_BUILDER =
"org.jboss.ws.extras.addressing.soap.SOAPAddressingBuilderImpl";
+ public static final String DEFAULT_ADDRESSING_BUILDER =
"org.jboss.ws.extentions.addressing.soap.SOAPAddressingBuilderImpl";
public static final String SOAP11_NAMESPACE_NAME =
"http://schemas.xmlsoap.org/soap/envelope/";
Modified: branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/CommonClient.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/CommonClient.java 2006-12-07
00:50:28 UTC (rev 1589)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/CommonClient.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -56,7 +56,7 @@
import org.jboss.ws.core.soap.SOAPConnectionImpl;
import org.jboss.ws.core.soap.UnboundHeader;
import org.jboss.ws.core.utils.HolderUtils;
-import org.jboss.ws.extras.addressing.AddressingConstantsImpl;
+import org.jboss.ws.extentions.addressing.AddressingConstantsImpl;
/**
* Provides support for the dynamic invocation of a service endpoint.
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/Base64Deserializer.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/Base64Deserializer.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/Base64Deserializer.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -33,8 +33,8 @@
import org.jboss.ws.core.binding.DeserializerSupport;
import org.jboss.ws.core.binding.SerializationContext;
import org.jboss.ws.core.utils.DOMUtils;
-import org.jboss.ws.extras.xop.XOPContext;
-import org.jboss.ws.extras.xop.jaxrpc.XOPUnmarshallerImpl;
+import org.jboss.ws.extentions.xop.XOPContext;
+import org.jboss.ws.extentions.xop.jaxrpc.XOPUnmarshallerImpl;
import org.jboss.xb.binding.SimpleTypeBindings;
import org.jboss.xb.binding.sunday.xop.XOPUnmarshaller;
import org.w3c.dom.Element;
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/Base64Serializer.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/Base64Serializer.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/Base64Serializer.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -30,8 +30,8 @@
import org.jboss.ws.core.binding.SerializationContext;
import org.jboss.ws.core.binding.SerializerSupport;
import org.jboss.ws.core.utils.JavaUtils;
-import org.jboss.ws.extras.xop.XOPContext;
-import org.jboss.ws.extras.xop.jaxrpc.XOPMarshallerImpl;
+import org.jboss.ws.extentions.xop.XOPContext;
+import org.jboss.ws.extentions.xop.jaxrpc.XOPMarshallerImpl;
import org.jboss.xb.binding.NamespaceRegistry;
import org.jboss.xb.binding.SimpleTypeBindings;
import org.jboss.xb.binding.sunday.xop.XOPMarshaller;
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/CommonBindingProvider.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/CommonBindingProvider.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/CommonBindingProvider.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -26,8 +26,8 @@
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.core.SOAP11BindingJAXWS;
-import org.jboss.ws.core.jaxws.core.SOAP12BindingJAXWS;
+import org.jboss.ws.core.jaxws.binding.SOAP11BindingJAXWS;
+import org.jboss.ws.core.jaxws.binding.SOAP12BindingJAXWS;
import org.jboss.ws.core.metadata.umdm.EndpointMetaData;
import org.jboss.ws.core.metadata.umdm.EndpointMetaData.Type;
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/CommonSOAPBinding.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/CommonSOAPBinding.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/CommonSOAPBinding.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -73,7 +73,7 @@
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.extras.xop.XOPContext;
+import org.jboss.ws.extentions.xop.XOPContext;
import org.jboss.xb.binding.NamespaceRegistry;
import org.w3c.dom.Element;
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/jbossxb/JBossXBMarshallerImpl.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/jbossxb/JBossXBMarshallerImpl.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/jbossxb/JBossXBMarshallerImpl.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -37,7 +37,7 @@
import org.jboss.ws.core.metadata.jaxrpcmapping.JavaXmlTypeMapping;
import org.jboss.ws.core.metadata.jaxrpcmapping.VariableMapping;
import org.jboss.ws.core.utils.JavaUtils;
-import org.jboss.ws.extras.xop.jaxrpc.XOPMarshallerImpl;
+import org.jboss.ws.extentions.xop.jaxrpc.XOPMarshallerImpl;
import org.jboss.xb.binding.Constants;
import org.jboss.xb.binding.sunday.marshalling.MarshallerImpl;
import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding;
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/jbossxb/JBossXBUnmarshallerImpl.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/jbossxb/JBossXBUnmarshallerImpl.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/jbossxb/JBossXBUnmarshallerImpl.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -27,7 +27,7 @@
import java.util.HashMap;
import org.jboss.ws.WSException;
-import org.jboss.ws.extras.xop.jaxrpc.XOPUnmarshallerImpl;
+import org.jboss.ws.extentions.xop.jaxrpc.XOPUnmarshallerImpl;
import org.jboss.xb.binding.JBossXBException;
import org.jboss.xb.binding.UnmarshallerFactory;
import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding;
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/jbossxb/SchemaBindingBuilder.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/jbossxb/SchemaBindingBuilder.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/binding/jbossxb/SchemaBindingBuilder.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -43,7 +43,7 @@
import org.jboss.ws.core.metadata.jaxrpcmapping.PackageMapping;
import org.jboss.ws.core.metadata.jaxrpcmapping.VariableMapping;
import org.jboss.ws.core.utils.JBossWSEntityResolver;
-import org.jboss.ws.extras.xop.jaxrpc.JBossXBContentAdapter;
+import org.jboss.ws.extentions.xop.jaxrpc.JBossXBContentAdapter;
import org.jboss.xb.binding.metadata.ClassMetaData;
import org.jboss.xb.binding.metadata.PackageMetaData;
import org.jboss.xb.binding.metadata.PropertyMetaData;
Modified: branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/CallImpl.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/CallImpl.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/CallImpl.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -61,7 +61,7 @@
import org.jboss.ws.core.soap.MessageContextAssociation;
import org.jboss.ws.core.soap.UnboundHeader;
import org.jboss.ws.core.utils.JavaUtils;
-import org.jboss.ws.extras.xop.XOPContext;
+import org.jboss.ws.extentions.xop.XOPContext;
/** Provides support for the dynamic invocation of a service endpoint.
* The javax.xml.rpc.Service interface acts as a factory for the creation of Call
instances.
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/handler/HandlerDelegateJAXRPC.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/handler/HandlerDelegateJAXRPC.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxrpc/handler/HandlerDelegateJAXRPC.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -42,7 +42,7 @@
import org.jboss.ws.core.server.HandlerDelegate;
import org.jboss.ws.core.server.ServiceEndpointInfo;
import org.jboss.ws.core.soap.MessageContextAssociation;
-import org.jboss.ws.extras.xop.XOPContext;
+import org.jboss.ws.extentions.xop.XOPContext;
/** Delegates to JAXRPC handlers
*
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/JAXBDeserializer.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/JAXBDeserializer.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/JAXBDeserializer.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -37,7 +37,7 @@
import org.jboss.ws.core.binding.ComplexTypeDeserializer;
import org.jboss.ws.core.binding.SerializationContext;
import org.jboss.ws.core.jaxrpc.TypeMappingImpl;
-import org.jboss.ws.extras.xop.jaxws.AttachmentUnmarshallerImpl;
+import org.jboss.ws.extentions.xop.jaxws.AttachmentUnmarshallerImpl;
/**
* A Deserializer that can handle complex types by delegating to JAXB.
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/JAXBSerializer.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/JAXBSerializer.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/JAXBSerializer.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -36,7 +36,7 @@
import org.jboss.ws.core.binding.ComplexTypeSerializer;
import org.jboss.ws.core.binding.SerializationContext;
import org.jboss.ws.core.jaxrpc.TypeMappingImpl;
-import org.jboss.ws.extras.xop.jaxws.AttachmentMarshallerImpl;
+import org.jboss.ws.extentions.xop.jaxws.AttachmentMarshallerImpl;
import org.w3c.dom.NamedNodeMap;
/**
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/SOAPFaultHelperJAXWS.java
(from rev 1587,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/core/SOAPFaultHelperJAXWS.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/core/SOAPFaultHelperJAXWS.java 2006-12-07
00:41:57 UTC (rev 1587)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/SOAPFaultHelperJAXWS.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -0,0 +1,503 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the JBPM BPEL PUBLIC LICENSE AGREEMENT as
+ * published by JBoss Inc.; either version 1.0 of the License, or
+ * (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ */
+package org.jboss.ws.core.jaxws;
+
+import java.io.IOException;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Iterator;
+
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.namespace.QName;
+import javax.xml.rpc.encoding.TypeMapping;
+import javax.xml.soap.Detail;
+import javax.xml.soap.DetailEntry;
+import javax.xml.soap.MessageFactory;
+import javax.xml.soap.Name;
+import javax.xml.soap.SOAPBody;
+import javax.xml.soap.SOAPElement;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPFault;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.ws.WebServiceException;
+import javax.xml.ws.soap.SOAPFaultException;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.Constants;
+import org.jboss.ws.core.CommonMessageContext;
+import org.jboss.ws.core.binding.BindingException;
+import org.jboss.ws.core.binding.DeserializerFactoryBase;
+import org.jboss.ws.core.binding.DeserializerSupport;
+import org.jboss.ws.core.binding.SerializationContext;
+import org.jboss.ws.core.binding.SerializerFactoryBase;
+import org.jboss.ws.core.binding.SerializerSupport;
+import org.jboss.ws.core.jaxrpc.SOAPFaultHelperJAXRPC;
+import org.jboss.ws.core.metadata.umdm.FaultMetaData;
+import org.jboss.ws.core.metadata.umdm.OperationMetaData;
+import org.jboss.ws.core.soap.MessageContextAssociation;
+import org.jboss.ws.core.soap.NameImpl;
+import org.jboss.ws.core.soap.SOAPFactoryImpl;
+import org.jboss.ws.core.utils.DOMUtils;
+import org.jboss.ws.core.utils.DOMWriter;
+import org.w3c.dom.Element;
+
+/**
+ * @author <a href="mailto:alex.guizar@jboss.com">Alejandro
Guizar</a>
+ * @version $Revision$
+ */
+public class SOAPFaultHelperJAXWS
+{
+ // provide logging
+ private static Logger log = Logger.getLogger(SOAPFaultHelperJAXWS.class);
+
+ private static final Collection<String> excludedGetters = Arrays.asList(new
String[] { "getCause", "getLocalizedMessage",
"getStackTrace", "getClass" });
+
+ /** Factory method for FaultException for a given SOAPFault */
+ public static SOAPFaultException getSOAPFaultException(SOAPFault soapFault)
+ {
+ SOAPFaultException faultEx = new SOAPFaultException(soapFault);
+ Detail detail = soapFault.getDetail();
+
+ CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
+ if (detail != null && msgContext != null)
+ {
+ SerializationContext serContext = msgContext.getSerializationContext();
+ TypeMapping typeMapping = serContext.getTypeMapping();
+
+ Iterator it = detail.getDetailEntries();
+ while (it.hasNext())
+ {
+ DetailEntry deElement = (DetailEntry)it.next();
+ QName xmlName = new QName(deElement.getNamespaceURI(),
deElement.getLocalName());
+
+ OperationMetaData opMetaData = msgContext.getOperationMetaData();
+ FaultMetaData faultMetaData = opMetaData.getFault(xmlName);
+ if (faultMetaData != null)
+ {
+ log.debug("Deserialize fault: " + faultMetaData);
+ QName xmlType = faultMetaData.getXmlType();
+ Class<?> faultBeanClass = faultMetaData.getFaultBean();
+
+ // Get the deserializer from the type mapping
+ DeserializerFactoryBase desFactory =
(DeserializerFactoryBase)typeMapping.getDeserializer(faultBeanClass, xmlType);
+ if (desFactory == null)
+ throw new WebServiceException("Cannot obtain deserializer factory:
xmlType=" + xmlType + ", javaType=" + faultBeanClass);
+
+ //
http://jira.jboss.org/jira/browse/JBWS-955
+ // Cannot deserialize fault detail
+ String prefix = deElement.getPrefix();
+ if (prefix.length() > 0)
+ {
+ String nsURI = deElement.getNamespaceURI();
+ String attrValue = deElement.getAttribute("xmlns:" +
prefix);
+ if (nsURI.length() > 0 && attrValue.length() == 0)
+ {
+ try
+ {
+ deElement.addNamespaceDeclaration(prefix, nsURI);
+ }
+ catch (SOAPException e)
+ {
+ log.warn("Declaration of detail entry namespace
failed", e);
+ }
+ }
+ }
+
+ // Try jaxb deserialization
+ try
+ {
+ String xmlFragment = DOMWriter.printNode(deElement, false);
+ DeserializerSupport des =
(DeserializerSupport)desFactory.getDeserializer();
+ Object faultBean = des.deserialize(xmlName, xmlType, xmlFragment,
serContext);
+
+ /* JAX-WS 2.5: A wsdl:fault element refers to a wsdl:message that
contains
+ * a single part. The global element declaration referred to by that
part
+ * is mapped to a Java bean. A wrapper exception class contains the
+ * following methods:
+ * - WrapperException(String message, FaultBean faultInfo)
+ * - WrapperException(String message, FaultBean faultInfo, Throwable
cause)
+ * - FaultBean getFaultInfo() */
+ Class<?> serviceExGenericClass = faultMetaData.getJavaType();
+ Class<? extends Exception> serviceExClass =
serviceExGenericClass.asSubclass(Exception.class);
+
+ Exception serviceEx;
+ try
+ {
+ Constructor<? extends Exception> serviceExCtor =
serviceExClass.getConstructor(String.class, faultBeanClass);
+ serviceEx = serviceExCtor.newInstance(soapFault.getFaultString(),
faultBean);
+ }
+ catch (NoSuchMethodException e)
+ {
+ serviceEx = toServiceException(faultBean, serviceExClass);
+ }
+ catch (InstantiationException e)
+ {
+ throw new WebServiceException("Service specific exception class
is not instantiable", e);
+ }
+
+ faultEx.initCause(serviceEx);
+ }
+ catch (BindingException e)
+ {
+ throw new WebServiceException(e);
+ }
+ catch (IllegalAccessException e)
+ {
+ throw new WebServiceException(e);
+ }
+ catch (InvocationTargetException e)
+ {
+ throw new WebServiceException(e.getTargetException());
+ }
+ }
+ else
+ {
+ log.debug("Cannot find fault meta data for: " + xmlName);
+ }
+ }
+ }
+
+ return faultEx;
+ }
+
+ private static Exception toServiceException(Object faultBean, Class<? extends
Exception> serviceExClass) throws IllegalAccessException, InvocationTargetException
+ {
+ Class<?> faultBeanClass = faultBean.getClass();
+ XmlType xmlType = faultBeanClass.getAnnotation(XmlType.class);
+
+ if (xmlType == null)
+ throw new WebServiceException("@XmlType annotation missing from fault bean
class: " + faultBeanClass.getName());
+
+ String[] propertyNames = xmlType.propOrder();
+ Class<?>[] propertyTypes = new Class<?>[propertyNames.length];
+ Object[] propertyValues = new Object[propertyNames.length];
+
+ for (int i = 0; i < propertyNames.length; i++)
+ {
+ String propertyName = propertyNames[i];
+ propertyName = Character.toUpperCase(propertyName.charAt(0)) +
propertyName.substring(1);
+
+ Method propertyGetter;
+ try
+ {
+ propertyGetter = faultBeanClass.getMethod("get" + propertyName);
+ }
+ catch (NoSuchMethodException e)
+ {
+ try
+ {
+ propertyGetter = faultBeanClass.getMethod("is" + propertyName);
+ }
+ catch (NoSuchMethodException ee)
+ {
+ throw new WebServiceException("Fault bean has no getter for property:
" + propertyName, ee);
+ }
+ }
+ propertyValues[i] = propertyGetter.invoke(faultBean);
+ propertyTypes[i] = propertyGetter.getReturnType();
+ }
+
+ try
+ {
+ Constructor<? extends Exception> serviceExCtor =
serviceExClass.getConstructor(propertyTypes);
+ return serviceExCtor.newInstance(propertyValues);
+ }
+ catch (NoSuchMethodException e)
+ {
+ throw new WebServiceException("Service exception has no constructor for
parameter types: " + Arrays.toString(propertyTypes));
+ }
+ catch (InstantiationException e)
+ {
+ throw new WebServiceException("Service exception is not instantiable",
e);
+ }
+ }
+
+ /** Translate the request exception into a SOAPFault message. */
+ public static SOAPMessage exceptionToFaultMessage(Exception reqEx)
+ {
+ log.error("SOAP request exception", reqEx);
+
+ try
+ {
+ SOAPMessage faultMessage;
+ if (reqEx instanceof SOAPFaultException)
+ {
+ faultMessage = toSOAPMessage((SOAPFaultException)reqEx);
+ }
+ else if (reqEx instanceof javax.xml.rpc.soap.SOAPFaultException)
+ {
+ /* this exception should not occur in JAX-WS endpoints, but JBossWS
+ * throws it to signal internal error conditions */
+ faultMessage = SOAPFaultHelperJAXRPC.exceptionToFaultMessage(reqEx);
+ }
+ else
+ {
+ faultMessage = toSOAPMessage(reqEx);
+ }
+
+ return faultMessage;
+ }
+ catch (SOAPException ex)
+ {
+ log.error("Error creating SOAPFault message", ex);
+ throw new WebServiceException("Cannot create SOAPFault message for: "
+ reqEx);
+ }
+ }
+
+ private static SOAPMessage toSOAPMessage(SOAPFaultException faultEx) throws
SOAPException
+ {
+ MessageFactory factory = MessageFactory.newInstance();
+ SOAPMessage soapMessage = factory.createMessage();
+
+ SOAPBody soapBody = soapMessage.getSOAPBody();
+ populateSOAPFault(soapBody, faultEx);
+
+ /* detail
+ * X. Serialized service specific exception
+ * 2. SOAPFaultException.getFault().getDetail() */
+ Detail detail = faultEx.getFault().getDetail();
+ if (detail != null)
+ soapBody.getFault().addChildElement(detail);
+
+ return soapMessage;
+ }
+
+ private static void populateSOAPFault(SOAPBody soapBody, SOAPFaultException faultEx)
throws SOAPException
+ {
+ SOAPFault sourceFault = faultEx.getFault();
+
+ /* JAX-WS 10.2.2.3: the fields of the fault message are populated according to the
+ * following rules of precedence: */
+
+ /* faultcode
+ * 1. SOAPFaultException.getFault().getFaultCodeAsQName()
+ * X. env:Server (Subcode omitted for SOAP 1.2) */
+ Name faultCode = sourceFault.getFaultCodeAsName();
+ if (faultCode != null)
+ {
+ faultCode = new NameImpl(faultCode.getLocalName(), "codeNS",
faultCode.getURI());
+ }
+ else
+ {
+ faultCode = getFallbackFaultCode();
+ }
+
+ /* faultstring
+ * 1. SOAPFaultException.getFault().getFaultString()
+ * X. Exception.getMessage()
+ * X. Exception.toString() */
+ String faultString = sourceFault.getFaultString();
+ if (faultString == null)
+ faultString = getFallbackFaultString(faultEx);
+
+ SOAPFault targetFault = soapBody.addFault(faultCode, faultString);
+
+ /* faultactor
+ * 1. SOAPFaultException.getFault().getFaultActor()
+ * 2. Empty */
+ String faultActor = sourceFault.getFaultActor();
+ if (faultActor != null)
+ targetFault.setFaultActor(faultActor);
+ }
+
+ private static SOAPMessage toSOAPMessage(Exception ex) throws SOAPException
+ {
+ MessageFactory factory = MessageFactory.newInstance();
+ SOAPMessage soapMessage = factory.createMessage();
+
+ SOAPBody soapBody = soapMessage.getSOAPBody();
+ SOAPFault soapFault;
+
+ /* JAX-WS 6.4.1: When an implementation catches an exception thrown by a
+ * service endpoint implementation and the cause of that exception is an
+ * instance of the appropriate ProtocolException subclass for the protocol
+ * in use, an implementation MUST reflect the information contained in the
+ * ProtocolException subclass within the generated protocol level fault. */
+ Throwable cause = ex.getCause();
+ if (cause instanceof SOAPFaultException)
+ {
+ populateSOAPFault(soapBody, (SOAPFaultException)cause);
+ soapFault = soapBody.getFault();
+ }
+ else
+ {
+ soapFault = soapBody.addFault(getFallbackFaultCode(),
getFallbackFaultString(ex));
+ }
+
+ CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
+ SerializationContext serContext = msgContext.getSerializationContext();
+
+ NameImpl faultCode = (NameImpl)soapFault.getFaultCodeAsName();
+ if (faultCode.getURI().length() > 0)
+ serContext.getNamespaceRegistry().registerQName(faultCode.toQName());
+
+ OperationMetaData opMetaData = msgContext.getOperationMetaData();
+ Class<? extends Exception> exClass = ex.getClass();
+ if (opMetaData != null && opMetaData.getFault(exClass) != null)
+ {
+ FaultMetaData faultMetaData = opMetaData.getFault(exClass);
+ Class faultBeanClass = faultMetaData.getFaultBean();
+ Object faultBean;
+ try
+ {
+ try
+ {
+ /* JAX-WS 3.7: For exceptions that match the pattern described in section
+ * 2.5 (i.e. exceptions that have a getFaultInfo method), the FaultBean
+ * is used as input to JAXB */
+ Method getFaultInfo = exClass.getMethod("getFaultInfo");
+ faultBean = getFaultInfo.invoke(ex);
+ }
+ catch (NoSuchMethodException e)
+ {
+ /* JAX-WS 3.7: For exceptions that do not match the pattern described in
+ * section 2.5, JAX-WS maps those exceptions to Java beans and then uses
+ * those Java beans as input to the JAXB mapping. */
+ faultBean = toFaultBean(ex, faultBeanClass);
+ }
+ }
+ catch (IllegalAccessException e)
+ {
+ throw new WebServiceException(e);
+ }
+ catch (InvocationTargetException e)
+ {
+ throw new WebServiceException(e.getTargetException());
+ }
+
+ Detail detail = soapFault.addDetail();
+ SOAPElement detailEntry = toDetailEntry(faultBean, serContext, faultMetaData);
+ detail.addChildElement(detailEntry);
+ }
+ else
+ {
+ log.debug("Cannot obtain fault meta data for: " + exClass);
+ }
+
+ return soapMessage;
+ }
+
+ private static Name getFallbackFaultCode()
+ {
+ /* faultcode
+ * X. SOAPFaultException.getFault().getFaultCodeAsQName()
+ * 2. env:Server (Subcode omitted for SOAP 1.2) */
+ return new NameImpl(Constants.SOAP11_FAULT_CODE_SERVER);
+ }
+
+ private static String getFallbackFaultString(Exception ex)
+ {
+ /* faultstring
+ * X. SOAPFaultException.getFault().getFaultString()
+ * 2. Exception.getMessage()
+ * 3. Exception.toString() */
+ String faultString = ex.getMessage();
+
+ if (faultString == null)
+ faultString = ex.toString();
+
+ return faultString;
+ }
+
+ private static Object toFaultBean(Exception userEx, Class faultBeanClass) throws
IllegalAccessException, InvocationTargetException
+ {
+ Object faultBean;
+ try
+ {
+ faultBean = faultBeanClass.newInstance();
+ }
+ catch (InstantiationException e)
+ {
+ throw new WebServiceException("Fault bean class is not instantiable",
e);
+ }
+
+ /* For each getter in the exception and its superclasses, a property of
+ * the same type and name is added to the bean. The getCause, getLocalizedMessage
+ * and getStackTrace getters from java.lang.Throwable and the getClass getter
+ * from java.lang.Object are excluded from the list of getters to be mapped. */
+ for (Method exMethod : userEx.getClass().getMethods())
+ {
+ if (exMethod.getParameterTypes().length > 0)
+ continue;
+
+ String exMethodName = exMethod.getName();
+
+ if (excludedGetters.contains(exMethodName))
+ continue;
+
+ String propertyName;
+ if (exMethodName.startsWith("get"))
+ {
+ propertyName = exMethodName.substring(3);
+ }
+ else if (exMethodName.startsWith("is"))
+ {
+ propertyName = exMethodName.substring(2);
+ }
+ else continue;
+
+ // get the property value from the exception
+ Object propertyValue = exMethod.invoke(userEx);
+ Class propertyClass = exMethod.getReturnType();
+
+ try
+ {
+ // set the value to the bean
+ Method beanSetter = faultBeanClass.getMethod("set" + propertyName,
propertyClass);
+ beanSetter.invoke(faultBean, propertyValue);
+ }
+ catch (NoSuchMethodException e)
+ {
+ throw new WebServiceException("Fault bean has no setter for property:
" + propertyName, e);
+ }
+ }
+
+ return faultBean;
+ }
+
+ private static SOAPElement toDetailEntry(Object faultObject, SerializationContext
serContext, FaultMetaData faultMetaData) throws SOAPException
+ {
+ QName xmlName = faultMetaData.getXmlName();
+ xmlName = serContext.getNamespaceRegistry().registerQName(xmlName);
+
+ // Get the serializer from the type mapping
+ QName xmlType = faultMetaData.getXmlType();
+ Class javaType = faultMetaData.getFaultBean() != null ?
faultMetaData.getFaultBean() : faultMetaData.getJavaType();
+ SerializerFactoryBase serFactory =
(SerializerFactoryBase)serContext.getTypeMapping().getSerializer(javaType, xmlType);
+ if (serFactory == null)
+ throw new WebServiceException("Cannot obtain serializer factory:
xmlType=" + xmlType + ", javaType=" + javaType);
+
+ try
+ {
+ SerializerSupport ser = serFactory.getSerializer();
+ String xmlFragment = ser.serialize(xmlName, xmlType, faultObject, serContext,
null);
+
+ SOAPFactoryImpl soapFactory = new SOAPFactoryImpl();
+ Element domElement = DOMUtils.parse(xmlFragment);
+ return soapFactory.createElement(domElement, true);
+ }
+ catch (BindingException e)
+ {
+ throw new WebServiceException(e);
+ }
+ catch (IOException e)
+ {
+ throw new WebServiceException(e);
+ }
+ }
+}
Copied: branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/binding (from rev
1586, branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/core)
Deleted:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/binding/BindingExt.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/core/BindingExt.java 2006-12-07
00:31:03 UTC (rev 1586)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/binding/BindingExt.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -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.core.jaxws.core;
-
-import java.util.List;
-
-import javax.xml.ws.Binding;
-import javax.xml.ws.handler.Handler;
-
-import org.jboss.ws.common.metadata.umdm.HandlerMetaData.HandlerType;
-
-// $Id$
-
-/**
- * Extension to JAXWS protocol bindings.
- *
- * @author Thomas.Diesler(a)jboss.com
- * @since 04-Jul-2006
- */
-public interface BindingExt extends Binding
-{
- public List<Handler> getHandlerChain(HandlerType handlerType);
-}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/binding/BindingExt.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/core/BindingExt.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/core/BindingExt.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/binding/BindingExt.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -0,0 +1,42 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ws.core.jaxws.binding;
+
+import java.util.List;
+
+import javax.xml.ws.Binding;
+import javax.xml.ws.handler.Handler;
+
+import org.jboss.ws.core.metadata.umdm.HandlerMetaData.HandlerType;
+
+// $Id$
+
+/**
+ * Extension to JAXWS protocol bindings.
+ *
+ * @author Thomas.Diesler(a)jboss.com
+ * @since 04-Jul-2006
+ */
+public interface BindingExt extends Binding
+{
+ public List<Handler> getHandlerChain(HandlerType handlerType);
+}
Deleted:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/binding/BindingImpl.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/core/BindingImpl.java 2006-12-07
00:31:03 UTC (rev 1586)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/binding/BindingImpl.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -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.core.jaxws.core;
-
-// $Id: $
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import javax.xml.ws.handler.Handler;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.common.metadata.umdm.HandlerMetaData.HandlerType;
-
-/**
- * The Binding interface is the base interface for JAXWS protocol bindings.
- *
- * @author Thomas.Diesler(a)jboss.com
- * @since 04-Jul-2006
- */
-public class BindingImpl implements BindingExt
-{
- // provide logging
- private static Logger log = Logger.getLogger(BindingImpl.class);
-
- private List<Handler> preHandlerChain = new ArrayList<Handler>();
- private List<Handler> jaxwsHandlerChain = new ArrayList<Handler>();
- private List<Handler> postHandlerChain = new ArrayList<Handler>();
-
- public List<Handler> getHandlerChain(HandlerType handlerType)
- {
- List<Handler> handlerChain = new ArrayList<Handler>();
-
- if (handlerType == HandlerType.PRE || handlerType == HandlerType.ALL)
- handlerChain.addAll(preHandlerChain);
-
- if (handlerType == HandlerType.ENDPOINT || handlerType == HandlerType.ALL)
- handlerChain.addAll(jaxwsHandlerChain);
-
- if (handlerType == HandlerType.POST || handlerType == HandlerType.ALL)
- handlerChain.addAll(postHandlerChain);
-
- return Collections.unmodifiableList(handlerChain);
- }
-
- public List<Handler> getHandlerChain()
- {
- log.debug("getHandlerChain: " + jaxwsHandlerChain);
- return jaxwsHandlerChain;
- }
-
- public void setHandlerChain(List<Handler> handlerChain)
- {
- log.debug("setHandlerChain: " + handlerChain);
- this.jaxwsHandlerChain = handlerChain;
- }
-}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/binding/BindingImpl.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/core/BindingImpl.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/core/BindingImpl.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/binding/BindingImpl.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -0,0 +1,77 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ws.core.jaxws.binding;
+
+// $Id: $
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import javax.xml.ws.handler.Handler;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.core.metadata.umdm.HandlerMetaData.HandlerType;
+
+/**
+ * The Binding interface is the base interface for JAXWS protocol bindings.
+ *
+ * @author Thomas.Diesler(a)jboss.com
+ * @since 04-Jul-2006
+ */
+public class BindingImpl implements BindingExt
+{
+ // provide logging
+ private static Logger log = Logger.getLogger(BindingImpl.class);
+
+ private List<Handler> preHandlerChain = new ArrayList<Handler>();
+ private List<Handler> jaxwsHandlerChain = new ArrayList<Handler>();
+ private List<Handler> postHandlerChain = new ArrayList<Handler>();
+
+ public List<Handler> getHandlerChain(HandlerType handlerType)
+ {
+ List<Handler> handlerChain = new ArrayList<Handler>();
+
+ if (handlerType == HandlerType.PRE || handlerType == HandlerType.ALL)
+ handlerChain.addAll(preHandlerChain);
+
+ if (handlerType == HandlerType.ENDPOINT || handlerType == HandlerType.ALL)
+ handlerChain.addAll(jaxwsHandlerChain);
+
+ if (handlerType == HandlerType.POST || handlerType == HandlerType.ALL)
+ handlerChain.addAll(postHandlerChain);
+
+ return Collections.unmodifiableList(handlerChain);
+ }
+
+ public List<Handler> getHandlerChain()
+ {
+ log.debug("getHandlerChain: " + jaxwsHandlerChain);
+ return jaxwsHandlerChain;
+ }
+
+ public void setHandlerChain(List<Handler> handlerChain)
+ {
+ log.debug("setHandlerChain: " + handlerChain);
+ this.jaxwsHandlerChain = handlerChain;
+ }
+}
Deleted:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/binding/BindingProviderImpl.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/core/BindingProviderImpl.java 2006-12-07
00:31:03 UTC (rev 1586)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/binding/BindingProviderImpl.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -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.core.jaxws.core;
-
-// $Id$
-
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.xml.ws.Binding;
-import javax.xml.ws.BindingProvider;
-import javax.xml.ws.WebServiceException;
-import javax.xml.ws.Service.Mode;
-import javax.xml.ws.http.HTTPBinding;
-import javax.xml.ws.soap.SOAPBinding;
-
-import org.jboss.ws.common.metadata.umdm.EndpointMetaData;
-import org.jboss.ws.common.metadata.umdm.EndpointMetaData.Type;
-import org.jboss.ws.core.CommonBindingProvider;
-
-/**
- * The BindingProvider interface provides access to the protocol binding and associated
context objects
- * for request and response message processing.
- *
- * @author Thomas.Diesler(a)jboss.com
- * @since 04-Jul-2006
- */
-public class BindingProviderImpl extends CommonBindingProvider implements
BindingProvider
-{
- private Map<String, Object> requestContext = new HashMap<String,
Object>();
- private Map<String, Object> responseContext = new HashMap<String,
Object>();
-
- public BindingProviderImpl(EndpointMetaData epMetaData)
- {
- super(epMetaData);
- }
-
- public BindingProviderImpl(String bindingId)
- {
- super(bindingId, Type.JAXWS);
- }
-
- @Override
- protected void initBinding(String bindingId, Type type)
- {
- if (epMetaData != null && epMetaData.getServiceMode() == Mode.MESSAGE)
- {
- binding = new MessageBinding();
- }
- else if (epMetaData != null && epMetaData.getServiceMode() ==
Mode.PAYLOAD)
- {
- binding = new PayloadBinding();
- }
- else if (SOAPBinding.SOAP11HTTP_BINDING.equals(bindingId))
- {
- binding = new SOAP11BindingJAXWS();
- }
- else if (SOAPBinding.SOAP12HTTP_BINDING.equals(bindingId))
- {
- binding = new SOAP12BindingJAXWS();
- }
- else if (HTTPBinding.HTTP_BINDING.equals(bindingId))
- {
- binding = new HTTPBindingJAXWS();
- }
- else
- {
- throw new WebServiceException("Unsupported binding: " + bindingId);
- }
- }
-
- public Map<String, Object> getRequestContext()
- {
- return requestContext;
- }
-
- public Map<String, Object> getResponseContext()
- {
- return responseContext;
- }
-
- public Binding getBinding()
- {
- return (Binding)binding;
- }
-}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/binding/BindingProviderImpl.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/core/BindingProviderImpl.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/core/BindingProviderImpl.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/binding/BindingProviderImpl.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -0,0 +1,105 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, 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.jaxws.binding;
+
+// $Id$
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.xml.ws.Binding;
+import javax.xml.ws.BindingProvider;
+import javax.xml.ws.WebServiceException;
+import javax.xml.ws.Service.Mode;
+import javax.xml.ws.http.HTTPBinding;
+import javax.xml.ws.soap.SOAPBinding;
+
+import org.jboss.ws.core.binding.CommonBindingProvider;
+import org.jboss.ws.core.metadata.umdm.EndpointMetaData;
+import org.jboss.ws.core.metadata.umdm.EndpointMetaData.Type;
+
+/**
+ * The BindingProvider interface provides access to the protocol binding and associated
context objects
+ * for request and response message processing.
+ *
+ * @author Thomas.Diesler(a)jboss.com
+ * @since 04-Jul-2006
+ */
+public class BindingProviderImpl extends CommonBindingProvider implements
BindingProvider
+{
+ private Map<String, Object> requestContext = new HashMap<String,
Object>();
+ private Map<String, Object> responseContext = new HashMap<String,
Object>();
+
+ public BindingProviderImpl(EndpointMetaData epMetaData)
+ {
+ super(epMetaData);
+ }
+
+ public BindingProviderImpl(String bindingId)
+ {
+ super(bindingId, Type.JAXWS);
+ }
+
+ @Override
+ protected void initBinding(String bindingId, Type type)
+ {
+ if (epMetaData != null && epMetaData.getServiceMode() == Mode.MESSAGE)
+ {
+ binding = new MessageBinding();
+ }
+ else if (epMetaData != null && epMetaData.getServiceMode() ==
Mode.PAYLOAD)
+ {
+ binding = new PayloadBinding();
+ }
+ else if (SOAPBinding.SOAP11HTTP_BINDING.equals(bindingId))
+ {
+ binding = new SOAP11BindingJAXWS();
+ }
+ else if (SOAPBinding.SOAP12HTTP_BINDING.equals(bindingId))
+ {
+ binding = new SOAP12BindingJAXWS();
+ }
+ else if (HTTPBinding.HTTP_BINDING.equals(bindingId))
+ {
+ binding = new HTTPBindingJAXWS();
+ }
+ else
+ {
+ throw new WebServiceException("Unsupported binding: " + bindingId);
+ }
+ }
+
+ public Map<String, Object> getRequestContext()
+ {
+ return requestContext;
+ }
+
+ public Map<String, Object> getResponseContext()
+ {
+ return responseContext;
+ }
+
+ public Binding getBinding()
+ {
+ return (Binding)binding;
+ }
+}
Deleted:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/binding/HTTPBindingJAXWS.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/core/HTTPBindingJAXWS.java 2006-12-07
00:31:03 UTC (rev 1586)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/binding/HTTPBindingJAXWS.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -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.core.jaxws.core;
-
-// $Id$
-
-import java.util.List;
-import java.util.Map;
-
-import javax.xml.namespace.QName;
-import javax.xml.ws.handler.Handler;
-import javax.xml.ws.http.HTTPBinding;
-
-import org.jboss.util.NotImplementedException;
-import org.jboss.ws.common.metadata.umdm.OperationMetaData;
-import org.jboss.ws.common.metadata.umdm.HandlerMetaData.HandlerType;
-import org.jboss.ws.core.CommonBinding;
-import org.jboss.ws.core.EndpointInvocation;
-import org.jboss.ws.core.binding.BindingException;
-import org.jboss.ws.core.soap.UnboundHeader;
-
-/**
- * The HTTPBinding interface is an abstraction for the XML/HTTP binding.
- *
- * @author Thomas.Diesler(a)jboss.com
- * @since 04-Jul-2006
- */
-public class HTTPBindingJAXWS implements CommonBinding, BindingExt, HTTPBinding
-{
- private BindingImpl delegate = new BindingImpl();
-
- public Object bindRequestMessage(OperationMetaData opMetaData, EndpointInvocation
epInv, Map<QName, UnboundHeader> unboundHeaders) throws BindingException
- {
- throw new NotImplementedException();
- }
-
- public Object bindResponseMessage(OperationMetaData opMetaData, EndpointInvocation
epInv) throws BindingException
- {
- throw new NotImplementedException();
- }
-
- public EndpointInvocation unbindRequestMessage(OperationMetaData opMetaData, Object
reqMessage) throws BindingException
- {
- throw new NotImplementedException();
- }
-
- public void unbindResponseMessage(OperationMetaData opMetaData, Object resMessage,
EndpointInvocation epInv, Map<QName, UnboundHeader> unboundHeaders) throws
BindingException
- {
- throw new NotImplementedException();
- }
-
- public List<Handler> getHandlerChain()
- {
- return delegate.getHandlerChain();
- }
-
- public List<Handler> getHandlerChain(HandlerType handlerType)
- {
- return delegate.getHandlerChain(handlerType);
- }
-
- public void setHandlerChain(List<Handler> handlerChain)
- {
- delegate.setHandlerChain(handlerChain);
- }
-}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/binding/HTTPBindingJAXWS.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/core/HTTPBindingJAXWS.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/core/HTTPBindingJAXWS.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/binding/HTTPBindingJAXWS.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -0,0 +1,85 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ws.core.jaxws.binding;
+
+// $Id$
+
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.handler.Handler;
+import javax.xml.ws.http.HTTPBinding;
+
+import org.jboss.util.NotImplementedException;
+import org.jboss.ws.core.EndpointInvocation;
+import org.jboss.ws.core.binding.BindingException;
+import org.jboss.ws.core.binding.CommonBinding;
+import org.jboss.ws.core.metadata.umdm.OperationMetaData;
+import org.jboss.ws.core.metadata.umdm.HandlerMetaData.HandlerType;
+import org.jboss.ws.core.soap.UnboundHeader;
+
+/**
+ * The HTTPBinding interface is an abstraction for the XML/HTTP binding.
+ *
+ * @author Thomas.Diesler(a)jboss.com
+ * @since 04-Jul-2006
+ */
+public class HTTPBindingJAXWS implements CommonBinding, BindingExt, HTTPBinding
+{
+ private BindingImpl delegate = new BindingImpl();
+
+ public Object bindRequestMessage(OperationMetaData opMetaData, EndpointInvocation
epInv, Map<QName, UnboundHeader> unboundHeaders) throws BindingException
+ {
+ throw new NotImplementedException();
+ }
+
+ public Object bindResponseMessage(OperationMetaData opMetaData, EndpointInvocation
epInv) throws BindingException
+ {
+ throw new NotImplementedException();
+ }
+
+ public EndpointInvocation unbindRequestMessage(OperationMetaData opMetaData, Object
reqMessage) throws BindingException
+ {
+ throw new NotImplementedException();
+ }
+
+ public void unbindResponseMessage(OperationMetaData opMetaData, Object resMessage,
EndpointInvocation epInv, Map<QName, UnboundHeader> unboundHeaders) throws
BindingException
+ {
+ throw new NotImplementedException();
+ }
+
+ public List<Handler> getHandlerChain()
+ {
+ return delegate.getHandlerChain();
+ }
+
+ public List<Handler> getHandlerChain(HandlerType handlerType)
+ {
+ return delegate.getHandlerChain(handlerType);
+ }
+
+ public void setHandlerChain(List<Handler> handlerChain)
+ {
+ delegate.setHandlerChain(handlerChain);
+ }
+}
Deleted:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/binding/MessageBinding.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/core/MessageBinding.java 2006-12-07
00:31:03 UTC (rev 1586)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/binding/MessageBinding.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -1,149 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.ws.core.jaxws.core;
-
-// $Id$
-
-import java.util.List;
-import java.util.Map;
-
-import javax.xml.namespace.QName;
-import javax.xml.soap.SOAPMessage;
-import javax.xml.ws.handler.Handler;
-
-import org.jboss.logging.Logger;
-import org.jboss.util.NotImplementedException;
-import org.jboss.ws.common.WSException;
-import org.jboss.ws.common.metadata.umdm.OperationMetaData;
-import org.jboss.ws.common.metadata.umdm.ParameterMetaData;
-import org.jboss.ws.common.metadata.umdm.HandlerMetaData.HandlerType;
-import org.jboss.ws.core.CommonBinding;
-import org.jboss.ws.core.EndpointInvocation;
-import org.jboss.ws.core.binding.BindingException;
-import org.jboss.ws.core.jaxws.handler.SOAPMessageContextJAXWS;
-import org.jboss.ws.core.soap.MessageContextAssociation;
-import org.jboss.ws.core.soap.UnboundHeader;
-
-/** A binding for unprocessed SOAP Messages
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 27-Jun-2006
- */
-public class MessageBinding implements CommonBinding, BindingExt
-{
- // provide logging
- private static final Logger log = Logger.getLogger(MessageBinding.class);
-
- // Delegate to JAXWS binding
- private BindingImpl delegate = new BindingImpl();
-
- /** On the client side, generate the payload from IN parameters. */
- public SOAPMessage bindRequestMessage(OperationMetaData opMetaData, EndpointInvocation
epInv, Map<QName, UnboundHeader> unboundHeaders) throws BindingException
- {
- throw new NotImplementedException();
- }
-
- /** On the server side, extract the IN parameters from the payload and populate an
Invocation object */
- public EndpointInvocation unbindRequestMessage(OperationMetaData opMetaData, Object
reqMessage) throws BindingException
- {
- log.debug("unbindRequestMessage: " + opMetaData.getQName());
-
- try
- {
- // Construct the endpoint invocation object
- EndpointInvocation epInv = new EndpointInvocation(opMetaData);
-
- SOAPMessageContextJAXWS msgContext =
(SOAPMessageContextJAXWS)MessageContextAssociation.peekMessageContext();
- if (msgContext == null)
- throw new WSException("MessageContext not available");
-
- ParameterMetaData paramMetaData = opMetaData.getParameters().get(0);
- QName xmlName = paramMetaData.getXmlName();
- epInv.setRequestParamValue(xmlName, reqMessage);
-
- 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
- {
- SOAPMessageContextJAXWS msgContext =
(SOAPMessageContextJAXWS)MessageContextAssociation.peekMessageContext();
- if (msgContext == null)
- throw new WSException("MessageContext not available");
-
- // Associate current message with message context
- SOAPMessage resMessage = (SOAPMessage)epInv.getReturnValue();
- msgContext.setMessage(resMessage);
-
- 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 resMessage,
EndpointInvocation epInv, Map<QName, UnboundHeader> unboundHeaders)
- throws BindingException
- {
- throw new NotImplementedException();
- }
-
- public List<Handler> getHandlerChain()
- {
- return delegate.getHandlerChain();
- }
-
- public List<Handler> getHandlerChain(HandlerType handlerType)
- {
- return delegate.getHandlerChain(handlerType);
- }
-
- public void setHandlerChain(List<Handler> handlerChain)
- {
- delegate.setHandlerChain(handlerChain);
- }
-
- private void handleException(Exception ex) throws BindingException
- {
- if (ex instanceof RuntimeException)
- throw (RuntimeException)ex;
-
- if (ex instanceof BindingException)
- throw (BindingException)ex;
-
- throw new BindingException(ex);
- }
-
-}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/binding/MessageBinding.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/core/MessageBinding.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/core/MessageBinding.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/binding/MessageBinding.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -0,0 +1,149 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ws.core.jaxws.binding;
+
+// $Id$
+
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.ws.handler.Handler;
+
+import org.jboss.logging.Logger;
+import org.jboss.util.NotImplementedException;
+import org.jboss.ws.WSException;
+import org.jboss.ws.core.EndpointInvocation;
+import org.jboss.ws.core.binding.BindingException;
+import org.jboss.ws.core.binding.CommonBinding;
+import org.jboss.ws.core.jaxws.handler.SOAPMessageContextJAXWS;
+import org.jboss.ws.core.metadata.umdm.OperationMetaData;
+import org.jboss.ws.core.metadata.umdm.ParameterMetaData;
+import org.jboss.ws.core.metadata.umdm.HandlerMetaData.HandlerType;
+import org.jboss.ws.core.soap.MessageContextAssociation;
+import org.jboss.ws.core.soap.UnboundHeader;
+
+/** A binding for unprocessed SOAP Messages
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 27-Jun-2006
+ */
+public class MessageBinding implements CommonBinding, BindingExt
+{
+ // provide logging
+ private static final Logger log = Logger.getLogger(MessageBinding.class);
+
+ // Delegate to JAXWS binding
+ private BindingImpl delegate = new BindingImpl();
+
+ /** On the client side, generate the payload from IN parameters. */
+ public SOAPMessage bindRequestMessage(OperationMetaData opMetaData, EndpointInvocation
epInv, Map<QName, UnboundHeader> unboundHeaders) throws BindingException
+ {
+ throw new NotImplementedException();
+ }
+
+ /** On the server side, extract the IN parameters from the payload and populate an
Invocation object */
+ public EndpointInvocation unbindRequestMessage(OperationMetaData opMetaData, Object
reqMessage) throws BindingException
+ {
+ log.debug("unbindRequestMessage: " + opMetaData.getQName());
+
+ try
+ {
+ // Construct the endpoint invocation object
+ EndpointInvocation epInv = new EndpointInvocation(opMetaData);
+
+ SOAPMessageContextJAXWS msgContext =
(SOAPMessageContextJAXWS)MessageContextAssociation.peekMessageContext();
+ if (msgContext == null)
+ throw new WSException("MessageContext not available");
+
+ ParameterMetaData paramMetaData = opMetaData.getParameters().get(0);
+ QName xmlName = paramMetaData.getXmlName();
+ epInv.setRequestParamValue(xmlName, reqMessage);
+
+ 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
+ {
+ SOAPMessageContextJAXWS msgContext =
(SOAPMessageContextJAXWS)MessageContextAssociation.peekMessageContext();
+ if (msgContext == null)
+ throw new WSException("MessageContext not available");
+
+ // Associate current message with message context
+ SOAPMessage resMessage = (SOAPMessage)epInv.getReturnValue();
+ msgContext.setMessage(resMessage);
+
+ 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 resMessage,
EndpointInvocation epInv, Map<QName, UnboundHeader> unboundHeaders)
+ throws BindingException
+ {
+ throw new NotImplementedException();
+ }
+
+ public List<Handler> getHandlerChain()
+ {
+ return delegate.getHandlerChain();
+ }
+
+ public List<Handler> getHandlerChain(HandlerType handlerType)
+ {
+ return delegate.getHandlerChain(handlerType);
+ }
+
+ public void setHandlerChain(List<Handler> handlerChain)
+ {
+ delegate.setHandlerChain(handlerChain);
+ }
+
+ 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);
+ }
+
+}
Deleted:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/binding/PayloadBinding.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/core/PayloadBinding.java 2006-12-07
00:31:03 UTC (rev 1586)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/binding/PayloadBinding.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -1,163 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, 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.jaxws.core;
-
-// $Id$
-
-import java.util.List;
-import java.util.Map;
-
-import javax.xml.namespace.QName;
-import javax.xml.soap.SOAPMessage;
-import javax.xml.transform.Source;
-import javax.xml.ws.handler.Handler;
-
-import org.jboss.logging.Logger;
-import org.jboss.util.NotImplementedException;
-import org.jboss.ws.common.Constants;
-import org.jboss.ws.common.WSException;
-import org.jboss.ws.common.metadata.umdm.OperationMetaData;
-import org.jboss.ws.common.metadata.umdm.ParameterMetaData;
-import org.jboss.ws.common.metadata.umdm.HandlerMetaData.HandlerType;
-import org.jboss.ws.core.CommonBinding;
-import org.jboss.ws.core.EndpointInvocation;
-import org.jboss.ws.core.binding.BindingException;
-import org.jboss.ws.core.jaxws.handler.SOAPMessageContextJAXWS;
-import org.jboss.ws.core.soap.MessageContextAssociation;
-import org.jboss.ws.core.soap.MessageFactoryImpl;
-import org.jboss.ws.core.soap.SOAPBodyImpl;
-import org.jboss.ws.core.soap.SOAPMessageImpl;
-import org.jboss.ws.core.soap.UnboundHeader;
-
-/** A BindingProvider for a JAXWS payload
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 27-Jun-2006
- */
-public class PayloadBinding implements CommonBinding, BindingExt
-{
- // provide logging
- private static final Logger log = Logger.getLogger(PayloadBinding.class);
-
- // Delegate to JAXWS binding
- private BindingImpl delegate = new BindingImpl();
-
- /** On the client side, generate the payload from IN parameters. */
- public Object bindRequestMessage(OperationMetaData opMetaData, EndpointInvocation
epInv, Map<QName, UnboundHeader> unboundHeaders) throws BindingException
- {
- throw new NotImplementedException();
- }
-
- /** 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
- {
- // Construct the endpoint invocation object
- EndpointInvocation epInv = new EndpointInvocation(opMetaData);
-
- SOAPMessageContextJAXWS msgContext =
(SOAPMessageContextJAXWS)MessageContextAssociation.peekMessageContext();
- if (msgContext == null)
- throw new WSException("MessageContext not available");
-
- ParameterMetaData paramMetaData = opMetaData.getParameters().get(0);
- QName xmlName = paramMetaData.getXmlName();
-
- SOAPMessage reqMessage = (SOAPMessage)payload;
- SOAPBodyImpl soapBody = (SOAPBodyImpl)reqMessage.getSOAPBody();
- Source source = soapBody.getPayload();
- epInv.setRequestParamValue(xmlName, source);
-
- 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
- {
- SOAPMessageContextJAXWS msgContext =
(SOAPMessageContextJAXWS)MessageContextAssociation.peekMessageContext();
- if (msgContext == null)
- throw new WSException("MessageContext not available");
-
- // Associate current message with message context
- MessageFactoryImpl factory = new MessageFactoryImpl();
- factory.setEnvelopeURI(Constants.NS_SOAP11_ENV);
- SOAPMessageImpl resMessage = (SOAPMessageImpl)factory.createMessage();
- msgContext.setMessage(resMessage);
-
- Source payload = (Source)epInv.getReturnValue();
- SOAPBodyImpl soapBody = (SOAPBodyImpl)resMessage.getSOAPBody();
- soapBody.setPayload(payload);
-
- 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 resMessage,
EndpointInvocation epInv, Map<QName, UnboundHeader> unboundHeaders)
- throws BindingException
- {
- throw new NotImplementedException();
- }
-
- public List<Handler> getHandlerChain()
- {
- return delegate.getHandlerChain();
- }
-
- public List<Handler> getHandlerChain(HandlerType handlerType)
- {
- return delegate.getHandlerChain(handlerType);
- }
-
- public void setHandlerChain(List<Handler> handlerChain)
- {
- delegate.setHandlerChain(handlerChain);
- }
-
- private void handleException(Exception ex) throws BindingException
- {
- if (ex instanceof RuntimeException)
- throw (RuntimeException)ex;
-
- if (ex instanceof BindingException)
- throw (BindingException)ex;
-
- throw new BindingException(ex);
- }
-}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/binding/PayloadBinding.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/core/PayloadBinding.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/core/PayloadBinding.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/binding/PayloadBinding.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -0,0 +1,163 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ws.core.jaxws.binding;
+
+// $Id$
+
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.transform.Source;
+import javax.xml.ws.handler.Handler;
+
+import org.jboss.logging.Logger;
+import org.jboss.util.NotImplementedException;
+import org.jboss.ws.Constants;
+import org.jboss.ws.WSException;
+import org.jboss.ws.core.EndpointInvocation;
+import org.jboss.ws.core.binding.BindingException;
+import org.jboss.ws.core.binding.CommonBinding;
+import org.jboss.ws.core.jaxws.handler.SOAPMessageContextJAXWS;
+import org.jboss.ws.core.metadata.umdm.OperationMetaData;
+import org.jboss.ws.core.metadata.umdm.ParameterMetaData;
+import org.jboss.ws.core.metadata.umdm.HandlerMetaData.HandlerType;
+import org.jboss.ws.core.soap.MessageContextAssociation;
+import org.jboss.ws.core.soap.MessageFactoryImpl;
+import org.jboss.ws.core.soap.SOAPBodyImpl;
+import org.jboss.ws.core.soap.SOAPMessageImpl;
+import org.jboss.ws.core.soap.UnboundHeader;
+
+/** A BindingProvider for a JAXWS payload
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 27-Jun-2006
+ */
+public class PayloadBinding implements CommonBinding, BindingExt
+{
+ // provide logging
+ private static final Logger log = Logger.getLogger(PayloadBinding.class);
+
+ // Delegate to JAXWS binding
+ private BindingImpl delegate = new BindingImpl();
+
+ /** On the client side, generate the payload from IN parameters. */
+ public Object bindRequestMessage(OperationMetaData opMetaData, EndpointInvocation
epInv, Map<QName, UnboundHeader> unboundHeaders) throws BindingException
+ {
+ throw new NotImplementedException();
+ }
+
+ /** 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
+ {
+ // Construct the endpoint invocation object
+ EndpointInvocation epInv = new EndpointInvocation(opMetaData);
+
+ SOAPMessageContextJAXWS msgContext =
(SOAPMessageContextJAXWS)MessageContextAssociation.peekMessageContext();
+ if (msgContext == null)
+ throw new WSException("MessageContext not available");
+
+ ParameterMetaData paramMetaData = opMetaData.getParameters().get(0);
+ QName xmlName = paramMetaData.getXmlName();
+
+ SOAPMessage reqMessage = (SOAPMessage)payload;
+ SOAPBodyImpl soapBody = (SOAPBodyImpl)reqMessage.getSOAPBody();
+ Source source = soapBody.getPayload();
+ epInv.setRequestParamValue(xmlName, source);
+
+ 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
+ {
+ SOAPMessageContextJAXWS msgContext =
(SOAPMessageContextJAXWS)MessageContextAssociation.peekMessageContext();
+ if (msgContext == null)
+ throw new WSException("MessageContext not available");
+
+ // Associate current message with message context
+ MessageFactoryImpl factory = new MessageFactoryImpl();
+ factory.setEnvelopeURI(Constants.NS_SOAP11_ENV);
+ SOAPMessageImpl resMessage = (SOAPMessageImpl)factory.createMessage();
+ msgContext.setMessage(resMessage);
+
+ Source payload = (Source)epInv.getReturnValue();
+ SOAPBodyImpl soapBody = (SOAPBodyImpl)resMessage.getSOAPBody();
+ soapBody.setPayload(payload);
+
+ 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 resMessage,
EndpointInvocation epInv, Map<QName, UnboundHeader> unboundHeaders)
+ throws BindingException
+ {
+ throw new NotImplementedException();
+ }
+
+ public List<Handler> getHandlerChain()
+ {
+ return delegate.getHandlerChain();
+ }
+
+ public List<Handler> getHandlerChain(HandlerType handlerType)
+ {
+ return delegate.getHandlerChain(handlerType);
+ }
+
+ public void setHandlerChain(List<Handler> handlerChain)
+ {
+ delegate.setHandlerChain(handlerChain);
+ }
+
+ 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);
+ }
+}
Deleted:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/binding/SOAP11BindingJAXWS.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/core/SOAP11BindingJAXWS.java 2006-12-07
00:31:03 UTC (rev 1586)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/binding/SOAP11BindingJAXWS.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -1,102 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.ws.core.jaxws.core;
-
-// $Id: SOAPBindingImpl.java 716 2006-08-09 16:42:10Z thomas.diesler(a)jboss.com $
-
-import java.net.URI;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import javax.xml.soap.SOAPMessage;
-import javax.xml.ws.handler.Handler;
-import javax.xml.ws.soap.SOAPBinding;
-
-import org.jboss.ws.common.Constants;
-import org.jboss.ws.common.metadata.umdm.OperationMetaData;
-import org.jboss.ws.common.metadata.umdm.HandlerMetaData.HandlerType;
-import org.jboss.ws.core.CommonSOAP11Binding;
-import org.jboss.ws.core.soap.SOAPFaultImpl;
-
-/**
- * The JAXWS SOAP11Binding
- *
- * @author Thomas.Diesler(a)jboss.com
- * @since 04-Jul-2006
- */
-public class SOAP11BindingJAXWS extends CommonSOAP11Binding implements BindingExt,
SOAPBinding
-{
- // Delegate to JAXWS SOAP binding
- private SOAPBindingJAXWS delegate = new SOAPBindingJAXWS();
-
- public SOAP11BindingJAXWS()
- {
- }
-
- public void setSOAPActionHeader(OperationMetaData opMetaData, SOAPMessage reqMessage)
- {
- delegate.setSOAPActionHeader(opMetaData, reqMessage);
- }
-
- public Set<URI> getRoles()
- {
- // 10.3 Conformance (Default role visibility): An implementation MUST include the
required next and ultimate
- // receiver roles in the Set returned from SOAPBinding.getRoles.
- // In SOAP 1.1 the ultimate receiver role is identified by omission of the actor
attribute from a SOAP header.
- Set<URI> soap11Roles = new HashSet<URI>(delegate.getRoles());
- soap11Roles.add(URI.create(Constants.URI_SOAP11_NEXT_ACTOR));
- return soap11Roles;
- }
-
- public void setRoles(Set<URI> roles)
- {
- delegate.setRoles(roles);
- }
-
- public List<Handler> getHandlerChain()
- {
- return delegate.getHandlerChain();
- }
-
- public List<Handler> getHandlerChain(HandlerType handlerType)
- {
- return delegate.getHandlerChain(handlerType);
- }
-
- public void setHandlerChain(List<Handler> handlerChain)
- {
- delegate.setHandlerChain(handlerChain);
- }
-
- @Override
- protected void throwFaultException(SOAPFaultImpl fault) throws Exception
- {
- throw SOAPFaultHelperJAXWS.getSOAPFaultException(fault);
- }
-
- @Override
- public SOAPMessage exceptionToFaultMessage(Exception ex)
- {
- return SOAPFaultHelperJAXWS.exceptionToFaultMessage(ex);
- }
-}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/binding/SOAP11BindingJAXWS.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/core/SOAP11BindingJAXWS.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/core/SOAP11BindingJAXWS.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/binding/SOAP11BindingJAXWS.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -0,0 +1,103 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, 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.jaxws.binding;
+
+// $Id: SOAPBindingImpl.java 716 2006-08-09 16:42:10Z thomas.diesler(a)jboss.com $
+
+import java.net.URI;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import javax.xml.soap.SOAPMessage;
+import javax.xml.ws.handler.Handler;
+import javax.xml.ws.soap.SOAPBinding;
+
+import org.jboss.ws.Constants;
+import org.jboss.ws.core.binding.CommonSOAP11Binding;
+import org.jboss.ws.core.jaxws.SOAPFaultHelperJAXWS;
+import org.jboss.ws.core.metadata.umdm.OperationMetaData;
+import org.jboss.ws.core.metadata.umdm.HandlerMetaData.HandlerType;
+import org.jboss.ws.core.soap.SOAPFaultImpl;
+
+/**
+ * The JAXWS SOAP11Binding
+ *
+ * @author Thomas.Diesler(a)jboss.com
+ * @since 04-Jul-2006
+ */
+public class SOAP11BindingJAXWS extends CommonSOAP11Binding implements BindingExt,
SOAPBinding
+{
+ // Delegate to JAXWS SOAP binding
+ private SOAPBindingJAXWS delegate = new SOAPBindingJAXWS();
+
+ public SOAP11BindingJAXWS()
+ {
+ }
+
+ public void setSOAPActionHeader(OperationMetaData opMetaData, SOAPMessage reqMessage)
+ {
+ delegate.setSOAPActionHeader(opMetaData, reqMessage);
+ }
+
+ public Set<URI> getRoles()
+ {
+ // 10.3 Conformance (Default role visibility): An implementation MUST include the
required next and ultimate
+ // receiver roles in the Set returned from SOAPBinding.getRoles.
+ // In SOAP 1.1 the ultimate receiver role is identified by omission of the actor
attribute from a SOAP header.
+ Set<URI> soap11Roles = new HashSet<URI>(delegate.getRoles());
+ soap11Roles.add(URI.create(Constants.URI_SOAP11_NEXT_ACTOR));
+ return soap11Roles;
+ }
+
+ public void setRoles(Set<URI> roles)
+ {
+ delegate.setRoles(roles);
+ }
+
+ public List<Handler> getHandlerChain()
+ {
+ return delegate.getHandlerChain();
+ }
+
+ public List<Handler> getHandlerChain(HandlerType handlerType)
+ {
+ return delegate.getHandlerChain(handlerType);
+ }
+
+ public void setHandlerChain(List<Handler> handlerChain)
+ {
+ delegate.setHandlerChain(handlerChain);
+ }
+
+ @Override
+ protected void throwFaultException(SOAPFaultImpl fault) throws Exception
+ {
+ throw SOAPFaultHelperJAXWS.getSOAPFaultException(fault);
+ }
+
+ @Override
+ public SOAPMessage exceptionToFaultMessage(Exception ex)
+ {
+ return SOAPFaultHelperJAXWS.exceptionToFaultMessage(ex);
+ }
+}
Deleted:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/binding/SOAP12BindingJAXWS.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/core/SOAP12BindingJAXWS.java 2006-12-07
00:31:03 UTC (rev 1586)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/binding/SOAP12BindingJAXWS.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -1,110 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.ws.core.jaxws.core;
-
-// $Id: SOAPBindingImpl.java 716 2006-08-09 16:42:10Z thomas.diesler(a)jboss.com $
-
-import java.net.URI;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import javax.xml.soap.SOAPMessage;
-import javax.xml.ws.WebServiceException;
-import javax.xml.ws.handler.Handler;
-import javax.xml.ws.soap.SOAPBinding;
-
-import org.jboss.ws.common.Constants;
-import org.jboss.ws.common.metadata.umdm.OperationMetaData;
-import org.jboss.ws.common.metadata.umdm.HandlerMetaData.HandlerType;
-import org.jboss.ws.core.CommonSOAP12Binding;
-import org.jboss.ws.core.soap.SOAPFaultImpl;
-
-/**
- * The SOAP11Binding
- *
- * @author Thomas.Diesler(a)jboss.com
- * @since 04-Jul-2006
- */
-public class SOAP12BindingJAXWS extends CommonSOAP12Binding implements BindingExt,
SOAPBinding
-{
- // Delegate to JAXWS SOAP binding
- private SOAPBindingJAXWS delegate = new SOAPBindingJAXWS();
-
- public SOAP12BindingJAXWS()
- {
- }
-
- public void setSOAPActionHeader(OperationMetaData opMetaData, SOAPMessage reqMessage)
- {
- delegate.setSOAPActionHeader(opMetaData, reqMessage);
- }
-
- public Set<URI> getRoles()
- {
- // 10.3 Conformance (Default role visibility): An implementation MUST include the
required next and ultimate
- // receiver roles in the Set returned from SOAPBinding.getRoles.
- Set<URI> soap12Roles = new HashSet<URI>(delegate.getRoles());
- soap12Roles.add(URI.create(Constants.URI_SOAP12_ROLE_NEXT));
- soap12Roles.add(URI.create(Constants.URI_SOAP12_ROLE_ULTIMATE_RECEIVER));
- return soap12Roles;
- }
-
- public void setRoles(Set<URI> roles)
- {
- // 10.5 Conformance (None role error): An implementation MUST throw
WebServiceException if a client
- // attempts to configure the binding to play the none role via
SOAPBinding.setRoles.
- for (URI role : roles)
- {
- if (role.equals(Constants.URI_SOAP12_ROLE_NONE))
- throw new WebServiceException("Attempt to configure the binding to play
the none role");
- }
- delegate.setRoles(roles);
- }
-
- public List<Handler> getHandlerChain()
- {
- return delegate.getHandlerChain();
- }
-
- public List<Handler> getHandlerChain(HandlerType handlerType)
- {
- return delegate.getHandlerChain(handlerType);
- }
-
- public void setHandlerChain(List<Handler> handlerChain)
- {
- delegate.setHandlerChain(handlerChain);
- }
-
- @Override
- protected void throwFaultException(SOAPFaultImpl fault) throws Exception
- {
- throw SOAPFaultHelperJAXWS.getSOAPFaultException(fault);
- }
-
- @Override
- public SOAPMessage exceptionToFaultMessage(Exception ex)
- {
- return SOAPFaultHelperJAXWS.exceptionToFaultMessage(ex);
- }
-}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/binding/SOAP12BindingJAXWS.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/core/SOAP12BindingJAXWS.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/core/SOAP12BindingJAXWS.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/binding/SOAP12BindingJAXWS.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -0,0 +1,111 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, 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.jaxws.binding;
+
+// $Id: SOAPBindingImpl.java 716 2006-08-09 16:42:10Z thomas.diesler(a)jboss.com $
+
+import java.net.URI;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import javax.xml.soap.SOAPMessage;
+import javax.xml.ws.WebServiceException;
+import javax.xml.ws.handler.Handler;
+import javax.xml.ws.soap.SOAPBinding;
+
+import org.jboss.ws.Constants;
+import org.jboss.ws.core.binding.CommonSOAP12Binding;
+import org.jboss.ws.core.jaxws.SOAPFaultHelperJAXWS;
+import org.jboss.ws.core.metadata.umdm.OperationMetaData;
+import org.jboss.ws.core.metadata.umdm.HandlerMetaData.HandlerType;
+import org.jboss.ws.core.soap.SOAPFaultImpl;
+
+/**
+ * The SOAP11Binding
+ *
+ * @author Thomas.Diesler(a)jboss.com
+ * @since 04-Jul-2006
+ */
+public class SOAP12BindingJAXWS extends CommonSOAP12Binding implements BindingExt,
SOAPBinding
+{
+ // Delegate to JAXWS SOAP binding
+ private SOAPBindingJAXWS delegate = new SOAPBindingJAXWS();
+
+ public SOAP12BindingJAXWS()
+ {
+ }
+
+ public void setSOAPActionHeader(OperationMetaData opMetaData, SOAPMessage reqMessage)
+ {
+ delegate.setSOAPActionHeader(opMetaData, reqMessage);
+ }
+
+ public Set<URI> getRoles()
+ {
+ // 10.3 Conformance (Default role visibility): An implementation MUST include the
required next and ultimate
+ // receiver roles in the Set returned from SOAPBinding.getRoles.
+ Set<URI> soap12Roles = new HashSet<URI>(delegate.getRoles());
+ soap12Roles.add(URI.create(Constants.URI_SOAP12_ROLE_NEXT));
+ soap12Roles.add(URI.create(Constants.URI_SOAP12_ROLE_ULTIMATE_RECEIVER));
+ return soap12Roles;
+ }
+
+ public void setRoles(Set<URI> roles)
+ {
+ // 10.5 Conformance (None role error): An implementation MUST throw
WebServiceException if a client
+ // attempts to configure the binding to play the none role via
SOAPBinding.setRoles.
+ for (URI role : roles)
+ {
+ if (role.equals(Constants.URI_SOAP12_ROLE_NONE))
+ throw new WebServiceException("Attempt to configure the binding to play
the none role");
+ }
+ delegate.setRoles(roles);
+ }
+
+ public List<Handler> getHandlerChain()
+ {
+ return delegate.getHandlerChain();
+ }
+
+ public List<Handler> getHandlerChain(HandlerType handlerType)
+ {
+ return delegate.getHandlerChain(handlerType);
+ }
+
+ public void setHandlerChain(List<Handler> handlerChain)
+ {
+ delegate.setHandlerChain(handlerChain);
+ }
+
+ @Override
+ protected void throwFaultException(SOAPFaultImpl fault) throws Exception
+ {
+ throw SOAPFaultHelperJAXWS.getSOAPFaultException(fault);
+ }
+
+ @Override
+ public SOAPMessage exceptionToFaultMessage(Exception ex)
+ {
+ return SOAPFaultHelperJAXWS.exceptionToFaultMessage(ex);
+ }
+}
Deleted:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/binding/SOAPBindingJAXWS.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/core/SOAPBindingJAXWS.java 2006-12-07
00:31:03 UTC (rev 1586)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/binding/SOAPBindingJAXWS.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -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.core.jaxws.core;
-
-// $Id$
-
-import java.net.URI;
-import java.util.HashSet;
-import java.util.Set;
-
-import javax.xml.soap.MimeHeaders;
-import javax.xml.soap.SOAPMessage;
-import javax.xml.ws.BindingProvider;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.common.metadata.umdm.OperationMetaData;
-import org.jboss.ws.core.CommonMessageContext;
-import org.jboss.ws.core.soap.MessageContextAssociation;
-
-/**
- * The SOAPBinding interface is an abstraction for the SOAP binding.
- *
- * @author Thomas.Diesler(a)jboss.com
- * @since 04-Jul-2006
- */
-class SOAPBindingJAXWS extends BindingImpl
-{
- // provide logging
- private static Logger log = Logger.getLogger(SOAPBindingJAXWS.class);
-
- private Set<URI> roles = new HashSet<URI>();
-
- public Set<URI> getRoles()
- {
- return roles;
- }
-
- public void setRoles(Set<URI> roles)
- {
- this.roles = roles;
- }
-
- public void setSOAPActionHeader(OperationMetaData opMetaData, SOAPMessage reqMessage)
- {
- CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
- MimeHeaders mimeHeaders = reqMessage.getMimeHeaders();
- String soapAction = opMetaData.getSOAPAction();
-
- // R2744 A HTTP request MESSAGE MUST contain a SOAPAction HTTP header field
- // with a quoted value equal to the value of the soapAction attribute of
- // soapbind:operation, if present in the corresponding WSDL description.
-
- // R2745 A HTTP request MESSAGE MUST contain a SOAPAction HTTP header field
- // with a quoted empty string value, if in the corresponding WSDL description,
- // the soapAction attribute of soapbind:operation is either not present, or
- // present with an empty string as its value.
-
- if (msgContext.getProperty(BindingProvider.SOAPACTION_USE_PROPERTY) != null)
- log.info("Ignore BindingProvider.SOAPACTION_USE_PROPERTY because of BP-1.0
R2745, R2745");
-
- String soapActionProperty =
(String)msgContext.getProperty(BindingProvider.SOAPACTION_URI_PROPERTY);
- if (soapActionProperty != null)
- soapAction = soapActionProperty;
-
- mimeHeaders.addHeader("SOAPAction", soapAction != null ? soapAction :
"");
- }
-}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/binding/SOAPBindingJAXWS.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/core/SOAPBindingJAXWS.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/core/SOAPBindingJAXWS.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/binding/SOAPBindingJAXWS.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -0,0 +1,86 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ws.core.jaxws.binding;
+
+// $Id$
+
+import java.net.URI;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.xml.soap.MimeHeaders;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.ws.BindingProvider;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.core.CommonMessageContext;
+import org.jboss.ws.core.metadata.umdm.OperationMetaData;
+import org.jboss.ws.core.soap.MessageContextAssociation;
+
+/**
+ * The SOAPBinding interface is an abstraction for the SOAP binding.
+ *
+ * @author Thomas.Diesler(a)jboss.com
+ * @since 04-Jul-2006
+ */
+class SOAPBindingJAXWS extends BindingImpl
+{
+ // provide logging
+ private static Logger log = Logger.getLogger(SOAPBindingJAXWS.class);
+
+ private Set<URI> roles = new HashSet<URI>();
+
+ public Set<URI> getRoles()
+ {
+ return roles;
+ }
+
+ public void setRoles(Set<URI> roles)
+ {
+ this.roles = roles;
+ }
+
+ public void setSOAPActionHeader(OperationMetaData opMetaData, SOAPMessage reqMessage)
+ {
+ CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
+ MimeHeaders mimeHeaders = reqMessage.getMimeHeaders();
+ String soapAction = opMetaData.getSOAPAction();
+
+ // R2744 A HTTP request MESSAGE MUST contain a SOAPAction HTTP header field
+ // with a quoted value equal to the value of the soapAction attribute of
+ // soapbind:operation, if present in the corresponding WSDL description.
+
+ // R2745 A HTTP request MESSAGE MUST contain a SOAPAction HTTP header field
+ // with a quoted empty string value, if in the corresponding WSDL description,
+ // the soapAction attribute of soapbind:operation is either not present, or
+ // present with an empty string as its value.
+
+ if (msgContext.getProperty(BindingProvider.SOAPACTION_USE_PROPERTY) != null)
+ log.info("Ignore BindingProvider.SOAPACTION_USE_PROPERTY because of BP-1.0
R2745, R2745");
+
+ String soapActionProperty =
(String)msgContext.getProperty(BindingProvider.SOAPACTION_URI_PROPERTY);
+ if (soapActionProperty != null)
+ soapAction = soapActionProperty;
+
+ mimeHeaders.addHeader("SOAPAction", soapAction != null ? soapAction :
"");
+ }
+}
Deleted:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/binding/SOAPFaultHelperJAXWS.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/core/SOAPFaultHelperJAXWS.java 2006-12-07
00:31:03 UTC (rev 1586)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/binding/SOAPFaultHelperJAXWS.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -1,503 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the JBPM BPEL PUBLIC LICENSE AGREEMENT as
- * published by JBoss Inc.; either version 1.0 of the License, or
- * (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- */
-package org.jboss.ws.core.jaxws.core;
-
-import java.io.IOException;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Iterator;
-
-import javax.xml.bind.annotation.XmlType;
-import javax.xml.namespace.QName;
-import javax.xml.rpc.encoding.TypeMapping;
-import javax.xml.soap.Detail;
-import javax.xml.soap.DetailEntry;
-import javax.xml.soap.MessageFactory;
-import javax.xml.soap.Name;
-import javax.xml.soap.SOAPBody;
-import javax.xml.soap.SOAPElement;
-import javax.xml.soap.SOAPException;
-import javax.xml.soap.SOAPFault;
-import javax.xml.soap.SOAPMessage;
-import javax.xml.ws.WebServiceException;
-import javax.xml.ws.soap.SOAPFaultException;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.common.Constants;
-import org.jboss.ws.common.NameImpl;
-import org.jboss.ws.common.metadata.umdm.FaultMetaData;
-import org.jboss.ws.common.metadata.umdm.OperationMetaData;
-import org.jboss.ws.common.utils.DOMUtils;
-import org.jboss.ws.common.utils.DOMWriter;
-import org.jboss.ws.core.CommonMessageContext;
-import org.jboss.ws.core.binding.BindingException;
-import org.jboss.ws.core.binding.DeserializerFactoryBase;
-import org.jboss.ws.core.binding.DeserializerSupport;
-import org.jboss.ws.core.binding.SerializationContext;
-import org.jboss.ws.core.binding.SerializerFactoryBase;
-import org.jboss.ws.core.binding.SerializerSupport;
-import org.jboss.ws.core.jaxrpc.SOAPFaultHelperJAXRPC;
-import org.jboss.ws.core.soap.MessageContextAssociation;
-import org.jboss.ws.core.soap.SOAPFactoryImpl;
-import org.w3c.dom.Element;
-
-/**
- * @author <a href="mailto:alex.guizar@jboss.com">Alejandro
Guizar</a>
- * @version $Revision$
- */
-public class SOAPFaultHelperJAXWS
-{
- // provide logging
- private static Logger log = Logger.getLogger(SOAPFaultHelperJAXWS.class);
-
- private static final Collection<String> excludedGetters = Arrays.asList(new
String[] { "getCause", "getLocalizedMessage",
"getStackTrace", "getClass" });
-
- /** Factory method for FaultException for a given SOAPFault */
- public static SOAPFaultException getSOAPFaultException(SOAPFault soapFault)
- {
- SOAPFaultException faultEx = new SOAPFaultException(soapFault);
- Detail detail = soapFault.getDetail();
-
- CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
- if (detail != null && msgContext != null)
- {
- SerializationContext serContext = msgContext.getSerializationContext();
- TypeMapping typeMapping = serContext.getTypeMapping();
-
- Iterator it = detail.getDetailEntries();
- while (it.hasNext())
- {
- DetailEntry deElement = (DetailEntry)it.next();
- QName xmlName = new QName(deElement.getNamespaceURI(),
deElement.getLocalName());
-
- OperationMetaData opMetaData = msgContext.getOperationMetaData();
- FaultMetaData faultMetaData = opMetaData.getFault(xmlName);
- if (faultMetaData != null)
- {
- log.debug("Deserialize fault: " + faultMetaData);
- QName xmlType = faultMetaData.getXmlType();
- Class<?> faultBeanClass = faultMetaData.getFaultBean();
-
- // Get the deserializer from the type mapping
- DeserializerFactoryBase desFactory =
(DeserializerFactoryBase)typeMapping.getDeserializer(faultBeanClass, xmlType);
- if (desFactory == null)
- throw new WebServiceException("Cannot obtain deserializer factory:
xmlType=" + xmlType + ", javaType=" + faultBeanClass);
-
- //
http://jira.jboss.org/jira/browse/JBWS-955
- // Cannot deserialize fault detail
- String prefix = deElement.getPrefix();
- if (prefix.length() > 0)
- {
- String nsURI = deElement.getNamespaceURI();
- String attrValue = deElement.getAttribute("xmlns:" +
prefix);
- if (nsURI.length() > 0 && attrValue.length() == 0)
- {
- try
- {
- deElement.addNamespaceDeclaration(prefix, nsURI);
- }
- catch (SOAPException e)
- {
- log.warn("Declaration of detail entry namespace
failed", e);
- }
- }
- }
-
- // Try jaxb deserialization
- try
- {
- String xmlFragment = DOMWriter.printNode(deElement, false);
- DeserializerSupport des =
(DeserializerSupport)desFactory.getDeserializer();
- Object faultBean = des.deserialize(xmlName, xmlType, xmlFragment,
serContext);
-
- /* JAX-WS 2.5: A wsdl:fault element refers to a wsdl:message that
contains
- * a single part. The global element declaration referred to by that
part
- * is mapped to a Java bean. A wrapper exception class contains the
- * following methods:
- * - WrapperException(String message, FaultBean faultInfo)
- * - WrapperException(String message, FaultBean faultInfo, Throwable
cause)
- * - FaultBean getFaultInfo() */
- Class<?> serviceExGenericClass = faultMetaData.getJavaType();
- Class<? extends Exception> serviceExClass =
serviceExGenericClass.asSubclass(Exception.class);
-
- Exception serviceEx;
- try
- {
- Constructor<? extends Exception> serviceExCtor =
serviceExClass.getConstructor(String.class, faultBeanClass);
- serviceEx = serviceExCtor.newInstance(soapFault.getFaultString(),
faultBean);
- }
- catch (NoSuchMethodException e)
- {
- serviceEx = toServiceException(faultBean, serviceExClass);
- }
- catch (InstantiationException e)
- {
- throw new WebServiceException("Service specific exception class
is not instantiable", e);
- }
-
- faultEx.initCause(serviceEx);
- }
- catch (BindingException e)
- {
- throw new WebServiceException(e);
- }
- catch (IllegalAccessException e)
- {
- throw new WebServiceException(e);
- }
- catch (InvocationTargetException e)
- {
- throw new WebServiceException(e.getTargetException());
- }
- }
- else
- {
- log.debug("Cannot find fault meta data for: " + xmlName);
- }
- }
- }
-
- return faultEx;
- }
-
- private static Exception toServiceException(Object faultBean, Class<? extends
Exception> serviceExClass) throws IllegalAccessException, InvocationTargetException
- {
- Class<?> faultBeanClass = faultBean.getClass();
- XmlType xmlType = faultBeanClass.getAnnotation(XmlType.class);
-
- if (xmlType == null)
- throw new WebServiceException("@XmlType annotation missing from fault bean
class: " + faultBeanClass.getName());
-
- String[] propertyNames = xmlType.propOrder();
- Class<?>[] propertyTypes = new Class<?>[propertyNames.length];
- Object[] propertyValues = new Object[propertyNames.length];
-
- for (int i = 0; i < propertyNames.length; i++)
- {
- String propertyName = propertyNames[i];
- propertyName = Character.toUpperCase(propertyName.charAt(0)) +
propertyName.substring(1);
-
- Method propertyGetter;
- try
- {
- propertyGetter = faultBeanClass.getMethod("get" + propertyName);
- }
- catch (NoSuchMethodException e)
- {
- try
- {
- propertyGetter = faultBeanClass.getMethod("is" + propertyName);
- }
- catch (NoSuchMethodException ee)
- {
- throw new WebServiceException("Fault bean has no getter for property:
" + propertyName, ee);
- }
- }
- propertyValues[i] = propertyGetter.invoke(faultBean);
- propertyTypes[i] = propertyGetter.getReturnType();
- }
-
- try
- {
- Constructor<? extends Exception> serviceExCtor =
serviceExClass.getConstructor(propertyTypes);
- return serviceExCtor.newInstance(propertyValues);
- }
- catch (NoSuchMethodException e)
- {
- throw new WebServiceException("Service exception has no constructor for
parameter types: " + Arrays.toString(propertyTypes));
- }
- catch (InstantiationException e)
- {
- throw new WebServiceException("Service exception is not instantiable",
e);
- }
- }
-
- /** Translate the request exception into a SOAPFault message. */
- public static SOAPMessage exceptionToFaultMessage(Exception reqEx)
- {
- log.error("SOAP request exception", reqEx);
-
- try
- {
- SOAPMessage faultMessage;
- if (reqEx instanceof SOAPFaultException)
- {
- faultMessage = toSOAPMessage((SOAPFaultException)reqEx);
- }
- else if (reqEx instanceof javax.xml.rpc.soap.SOAPFaultException)
- {
- /* this exception should not occur in JAX-WS endpoints, but JBossWS
- * throws it to signal internal error conditions */
- faultMessage = SOAPFaultHelperJAXRPC.exceptionToFaultMessage(reqEx);
- }
- else
- {
- faultMessage = toSOAPMessage(reqEx);
- }
-
- return faultMessage;
- }
- catch (SOAPException ex)
- {
- log.error("Error creating SOAPFault message", ex);
- throw new WebServiceException("Cannot create SOAPFault message for: "
+ reqEx);
- }
- }
-
- private static SOAPMessage toSOAPMessage(SOAPFaultException faultEx) throws
SOAPException
- {
- MessageFactory factory = MessageFactory.newInstance();
- SOAPMessage soapMessage = factory.createMessage();
-
- SOAPBody soapBody = soapMessage.getSOAPBody();
- populateSOAPFault(soapBody, faultEx);
-
- /* detail
- * X. Serialized service specific exception
- * 2. SOAPFaultException.getFault().getDetail() */
- Detail detail = faultEx.getFault().getDetail();
- if (detail != null)
- soapBody.getFault().addChildElement(detail);
-
- return soapMessage;
- }
-
- private static void populateSOAPFault(SOAPBody soapBody, SOAPFaultException faultEx)
throws SOAPException
- {
- SOAPFault sourceFault = faultEx.getFault();
-
- /* JAX-WS 10.2.2.3: the fields of the fault message are populated according to the
- * following rules of precedence: */
-
- /* faultcode
- * 1. SOAPFaultException.getFault().getFaultCodeAsQName()
- * X. env:Server (Subcode omitted for SOAP 1.2) */
- Name faultCode = sourceFault.getFaultCodeAsName();
- if (faultCode != null)
- {
- faultCode = new NameImpl(faultCode.getLocalName(), "codeNS",
faultCode.getURI());
- }
- else
- {
- faultCode = getFallbackFaultCode();
- }
-
- /* faultstring
- * 1. SOAPFaultException.getFault().getFaultString()
- * X. Exception.getMessage()
- * X. Exception.toString() */
- String faultString = sourceFault.getFaultString();
- if (faultString == null)
- faultString = getFallbackFaultString(faultEx);
-
- SOAPFault targetFault = soapBody.addFault(faultCode, faultString);
-
- /* faultactor
- * 1. SOAPFaultException.getFault().getFaultActor()
- * 2. Empty */
- String faultActor = sourceFault.getFaultActor();
- if (faultActor != null)
- targetFault.setFaultActor(faultActor);
- }
-
- private static SOAPMessage toSOAPMessage(Exception ex) throws SOAPException
- {
- MessageFactory factory = MessageFactory.newInstance();
- SOAPMessage soapMessage = factory.createMessage();
-
- SOAPBody soapBody = soapMessage.getSOAPBody();
- SOAPFault soapFault;
-
- /* JAX-WS 6.4.1: When an implementation catches an exception thrown by a
- * service endpoint implementation and the cause of that exception is an
- * instance of the appropriate ProtocolException subclass for the protocol
- * in use, an implementation MUST reflect the information contained in the
- * ProtocolException subclass within the generated protocol level fault. */
- Throwable cause = ex.getCause();
- if (cause instanceof SOAPFaultException)
- {
- populateSOAPFault(soapBody, (SOAPFaultException)cause);
- soapFault = soapBody.getFault();
- }
- else
- {
- soapFault = soapBody.addFault(getFallbackFaultCode(),
getFallbackFaultString(ex));
- }
-
- CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
- SerializationContext serContext = msgContext.getSerializationContext();
-
- NameImpl faultCode = (NameImpl)soapFault.getFaultCodeAsName();
- if (faultCode.getURI().length() > 0)
- serContext.getNamespaceRegistry().registerQName(faultCode.toQName());
-
- OperationMetaData opMetaData = msgContext.getOperationMetaData();
- Class<? extends Exception> exClass = ex.getClass();
- if (opMetaData != null && opMetaData.getFault(exClass) != null)
- {
- FaultMetaData faultMetaData = opMetaData.getFault(exClass);
- Class faultBeanClass = faultMetaData.getFaultBean();
- Object faultBean;
- try
- {
- try
- {
- /* JAX-WS 3.7: For exceptions that match the pattern described in section
- * 2.5 (i.e. exceptions that have a getFaultInfo method), the FaultBean
- * is used as input to JAXB */
- Method getFaultInfo = exClass.getMethod("getFaultInfo");
- faultBean = getFaultInfo.invoke(ex);
- }
- catch (NoSuchMethodException e)
- {
- /* JAX-WS 3.7: For exceptions that do not match the pattern described in
- * section 2.5, JAX-WS maps those exceptions to Java beans and then uses
- * those Java beans as input to the JAXB mapping. */
- faultBean = toFaultBean(ex, faultBeanClass);
- }
- }
- catch (IllegalAccessException e)
- {
- throw new WebServiceException(e);
- }
- catch (InvocationTargetException e)
- {
- throw new WebServiceException(e.getTargetException());
- }
-
- Detail detail = soapFault.addDetail();
- SOAPElement detailEntry = toDetailEntry(faultBean, serContext, faultMetaData);
- detail.addChildElement(detailEntry);
- }
- else
- {
- log.debug("Cannot obtain fault meta data for: " + exClass);
- }
-
- return soapMessage;
- }
-
- private static Name getFallbackFaultCode()
- {
- /* faultcode
- * X. SOAPFaultException.getFault().getFaultCodeAsQName()
- * 2. env:Server (Subcode omitted for SOAP 1.2) */
- return new NameImpl(Constants.SOAP11_FAULT_CODE_SERVER);
- }
-
- private static String getFallbackFaultString(Exception ex)
- {
- /* faultstring
- * X. SOAPFaultException.getFault().getFaultString()
- * 2. Exception.getMessage()
- * 3. Exception.toString() */
- String faultString = ex.getMessage();
-
- if (faultString == null)
- faultString = ex.toString();
-
- return faultString;
- }
-
- private static Object toFaultBean(Exception userEx, Class faultBeanClass) throws
IllegalAccessException, InvocationTargetException
- {
- Object faultBean;
- try
- {
- faultBean = faultBeanClass.newInstance();
- }
- catch (InstantiationException e)
- {
- throw new WebServiceException("Fault bean class is not instantiable",
e);
- }
-
- /* For each getter in the exception and its superclasses, a property of
- * the same type and name is added to the bean. The getCause, getLocalizedMessage
- * and getStackTrace getters from java.lang.Throwable and the getClass getter
- * from java.lang.Object are excluded from the list of getters to be mapped. */
- for (Method exMethod : userEx.getClass().getMethods())
- {
- if (exMethod.getParameterTypes().length > 0)
- continue;
-
- String exMethodName = exMethod.getName();
-
- if (excludedGetters.contains(exMethodName))
- continue;
-
- String propertyName;
- if (exMethodName.startsWith("get"))
- {
- propertyName = exMethodName.substring(3);
- }
- else if (exMethodName.startsWith("is"))
- {
- propertyName = exMethodName.substring(2);
- }
- else continue;
-
- // get the property value from the exception
- Object propertyValue = exMethod.invoke(userEx);
- Class propertyClass = exMethod.getReturnType();
-
- try
- {
- // set the value to the bean
- Method beanSetter = faultBeanClass.getMethod("set" + propertyName,
propertyClass);
- beanSetter.invoke(faultBean, propertyValue);
- }
- catch (NoSuchMethodException e)
- {
- throw new WebServiceException("Fault bean has no setter for property:
" + propertyName, e);
- }
- }
-
- return faultBean;
- }
-
- private static SOAPElement toDetailEntry(Object faultObject, SerializationContext
serContext, FaultMetaData faultMetaData) throws SOAPException
- {
- QName xmlName = faultMetaData.getXmlName();
- xmlName = serContext.getNamespaceRegistry().registerQName(xmlName);
-
- // Get the serializer from the type mapping
- QName xmlType = faultMetaData.getXmlType();
- Class javaType = faultMetaData.getFaultBean() != null ?
faultMetaData.getFaultBean() : faultMetaData.getJavaType();
- SerializerFactoryBase serFactory =
(SerializerFactoryBase)serContext.getTypeMapping().getSerializer(javaType, xmlType);
- if (serFactory == null)
- throw new WebServiceException("Cannot obtain serializer factory:
xmlType=" + xmlType + ", javaType=" + javaType);
-
- try
- {
- SerializerSupport ser = serFactory.getSerializer();
- String xmlFragment = ser.serialize(xmlName, xmlType, faultObject, serContext,
null);
-
- SOAPFactoryImpl soapFactory = new SOAPFactoryImpl();
- Element domElement = DOMUtils.parse(xmlFragment);
- return soapFactory.createElement(domElement, true);
- }
- catch (BindingException e)
- {
- throw new WebServiceException(e);
- }
- catch (IOException e)
- {
- throw new WebServiceException(e);
- }
- }
-}
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/client/ClientImpl.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/client/ClientImpl.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/client/ClientImpl.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -43,8 +43,8 @@
import org.jboss.ws.core.CommonClient;
import org.jboss.ws.core.CommonMessageContext;
import org.jboss.ws.core.binding.CommonBindingProvider;
-import org.jboss.ws.core.jaxws.core.BindingExt;
-import org.jboss.ws.core.jaxws.core.BindingProviderImpl;
+import org.jboss.ws.core.jaxws.binding.BindingExt;
+import org.jboss.ws.core.jaxws.binding.BindingProviderImpl;
import org.jboss.ws.core.jaxws.handler.HandlerChainExecutor;
import org.jboss.ws.core.jaxws.handler.MessageContextJAXWS;
import org.jboss.ws.core.jaxws.handler.PortInfoImpl;
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/client/DispatchImpl.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/client/DispatchImpl.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/client/DispatchImpl.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -51,7 +51,7 @@
import javax.xml.ws.Service.Mode;
import org.jboss.logging.Logger;
-import org.jboss.ws.core.jaxws.core.BindingProviderImpl;
+import org.jboss.ws.core.jaxws.binding.BindingProviderImpl;
import org.jboss.ws.core.metadata.umdm.EndpointMetaData;
import org.jboss.ws.core.soap.SOAPBodyImpl;
import org.jboss.ws.core.soap.SOAPConnectionImpl;
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/spi/EndpointImpl.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/spi/EndpointImpl.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/spi/EndpointImpl.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -40,7 +40,7 @@
import org.jboss.logging.Logger;
import org.jboss.util.NotImplementedException;
-import org.jboss.ws.core.jaxws.core.BindingProviderImpl;
+import org.jboss.ws.core.jaxws.binding.BindingProviderImpl;
import org.jboss.ws.core.server.HttpContext;
import org.jboss.ws.core.server.HttpServer;
Deleted: branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/metadata/SomeClass.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/metadata/SomeClass.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/metadata/SomeClass.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -1,5 +0,0 @@
-package org.jboss.ws.core.metadata;
-
-public class SomeClass {
-
-}
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/metadata/builder/jaxrpc/JAXRPCMetaDataBuilder.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/metadata/builder/jaxrpc/JAXRPCMetaDataBuilder.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/metadata/builder/jaxrpc/JAXRPCMetaDataBuilder.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -86,12 +86,12 @@
import org.jboss.ws.core.metadata.wsdl.WSDLRPCSignatureItem.Direction;
import org.jboss.ws.core.metadata.wsdl.xmlschema.JBossXSModel;
import org.jboss.ws.core.utils.JavaUtils;
-import org.jboss.ws.extras.addressing.AddressingPropertiesImpl;
-import org.jboss.ws.extras.addressing.metadata.AddressingOpMetaExt;
-import org.jboss.ws.extras.eventing.EventingConstants;
-import org.jboss.ws.extras.eventing.deployment.EventingEndpoint;
-import org.jboss.ws.extras.eventing.metadata.EventingEpMetaExt;
-import org.jboss.ws.extras.xop.jaxrpc.XOPScanner;
+import org.jboss.ws.extentions.addressing.AddressingPropertiesImpl;
+import org.jboss.ws.extentions.addressing.metadata.AddressingOpMetaExt;
+import org.jboss.ws.extentions.eventing.EventingConstants;
+import org.jboss.ws.extentions.eventing.deployment.EventingEndpoint;
+import org.jboss.ws.extentions.eventing.metadata.EventingEpMetaExt;
+import org.jboss.ws.extentions.xop.jaxrpc.XOPScanner;
/**
* A meta data builder that is based on webservices.xml.
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/metadata/builder/jaxws/JAXWSWebServiceMetaDataBuilder.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/metadata/builder/jaxws/JAXWSWebServiceMetaDataBuilder.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/metadata/builder/jaxws/JAXWSWebServiceMetaDataBuilder.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -92,8 +92,8 @@
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.extras.addressing.AddressingPropertiesImpl;
-import org.jboss.ws.extras.addressing.metadata.AddressingOpMetaExt;
+import org.jboss.ws.extentions.addressing.AddressingPropertiesImpl;
+import org.jboss.ws.extentions.addressing.metadata.AddressingOpMetaExt;
import org.jboss.ws.tools.jaxws.JAXBWSDLGenerator;
import org.jboss.ws.tools.jaxws.WSDLGenerator;
import org.jboss.ws.tools.wsdl.WSDLWriter;
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/metadata/umdm/HandlerMetaData.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/metadata/umdm/HandlerMetaData.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/metadata/umdm/HandlerMetaData.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -150,10 +150,10 @@
public void validate()
{
List<String> securityHandlers = new ArrayList<String>();
-
securityHandlers.add(org.jboss.ws.extras.security.jaxrpc.WSSecurityHandlerInbound.class.getName());
-
securityHandlers.add(org.jboss.ws.extras.security.jaxrpc.WSSecurityHandlerOutbound.class.getName());
-
securityHandlers.add(org.jboss.ws.extras.security.jaxws.WSSecurityHandlerInbound.class.getName());
-
securityHandlers.add(org.jboss.ws.extras.security.jaxws.WSSecurityHandlerOutbound.class.getName());
+
securityHandlers.add(org.jboss.ws.extentions.security.jaxrpc.WSSecurityHandlerInbound.class.getName());
+
securityHandlers.add(org.jboss.ws.extentions.security.jaxrpc.WSSecurityHandlerOutbound.class.getName());
+
securityHandlers.add(org.jboss.ws.extentions.security.jaxws.WSSecurityHandlerInbound.class.getName());
+
securityHandlers.add(org.jboss.ws.extentions.security.jaxws.WSSecurityHandlerOutbound.class.getName());
if (securityHandlers.contains(handlerClassName))
{
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/metadata/umdm/ParameterMetaData.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/metadata/umdm/ParameterMetaData.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/metadata/umdm/ParameterMetaData.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -43,7 +43,7 @@
import org.jboss.ws.core.metadata.umdm.WrappedParameter.AccessorFactory;
import org.jboss.ws.core.utils.HolderUtils;
import org.jboss.ws.core.utils.JavaUtils;
-import org.jboss.ws.extras.xop.jaxws.ReflectiveXOPScanner;
+import org.jboss.ws.extentions.xop.jaxws.ReflectiveXOPScanner;
/**
* A request/response parameter that a given operation supports.
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/AbstractServiceEndpointInvoker.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/AbstractServiceEndpointInvoker.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/AbstractServiceEndpointInvoker.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -48,7 +48,7 @@
import org.jboss.ws.core.binding.CommonBindingProvider;
import org.jboss.ws.core.binding.CommonSOAPBinding;
import org.jboss.ws.core.jaxrpc.handler.HandlerDelegateJAXRPC;
-import org.jboss.ws.core.jaxws.core.BindingProviderImpl;
+import org.jboss.ws.core.jaxws.binding.BindingProviderImpl;
import org.jboss.ws.core.jaxws.handler.HandlerDelegateJAXWS;
import org.jboss.ws.core.metadata.umdm.EndpointMetaData;
import org.jboss.ws.core.metadata.umdm.OperationMetaData;
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/ServiceEndpoint.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/ServiceEndpoint.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/ServiceEndpoint.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -51,7 +51,7 @@
import org.jboss.ws.core.soap.SOAPElementWriter;
import org.jboss.ws.core.soap.SOAPMessageImpl;
import org.jboss.ws.core.utils.DOMWriter;
-import org.jboss.ws.extras.xop.XOPContext;
+import org.jboss.ws.extentions.xop.XOPContext;
import org.w3c.dom.Document;
/**
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/ServiceEndpointManager.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/ServiceEndpointManager.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/ServiceEndpointManager.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -71,7 +71,7 @@
import org.jboss.ws.core.soap.MessageContextAssociation;
import org.jboss.ws.core.soap.SOAPConnectionImpl;
import org.jboss.ws.core.utils.ThreadLocalAssociation;
-import org.jboss.ws.extras.addressing.AddressingConstantsImpl;
+import org.jboss.ws.extentions.addressing.AddressingConstantsImpl;
/**
* A service that manages JBossWS endpoints.
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/SOAPConnectionImpl.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/SOAPConnectionImpl.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/SOAPConnectionImpl.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -45,7 +45,7 @@
import org.jboss.remoting.security.SSLSocketBuilder;
import org.jboss.remoting.transport.http.HTTPMetadataConstants;
import org.jboss.ws.core.jaxrpc.StubExt;
-import org.jboss.ws.extras.xop.XOPContext;
+import org.jboss.ws.extentions.xop.XOPContext;
/**
* SOAPConnection implementation
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/SOAPContentElement.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/SOAPContentElement.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/SOAPContentElement.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -57,7 +57,7 @@
import org.jboss.ws.core.utils.DOMWriter;
import org.jboss.ws.core.utils.JavaUtils;
import org.jboss.ws.core.utils.MimeUtils;
-import org.jboss.ws.extras.xop.XOPContext;
+import org.jboss.ws.extentions.xop.XOPContext;
import org.w3c.dom.Attr;
import org.w3c.dom.DOMException;
import org.w3c.dom.Element;
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/SOAPMessageImpl.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/SOAPMessageImpl.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/soap/SOAPMessageImpl.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -49,7 +49,7 @@
import org.jboss.ws.core.soap.attachment.MultipartRelatedEncoder;
import org.jboss.ws.core.soap.attachment.MultipartRelatedSwAEncoder;
import org.jboss.ws.core.soap.attachment.MultipartRelatedXOPEncoder;
-import org.jboss.ws.extras.xop.XOPContext;
+import org.jboss.ws.extentions.xop.XOPContext;
/**
* The root class for all SOAP messages. As transmitted on the "wire", a SOAP
message is an XML document or a
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/utils/ThreadLocalAssociation.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/utils/ThreadLocalAssociation.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/utils/ThreadLocalAssociation.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -26,7 +26,7 @@
import java.util.Stack;
import org.jboss.ws.core.CommonMessageContext;
-import org.jboss.ws.extras.security.SecurityStore;
+import org.jboss.ws.extentions.security.SecurityStore;
/**
* Maintain thread locals at a single point.
@@ -50,7 +50,7 @@
private static ThreadLocal<Stack<CommonMessageContext>> msgContextAssoc =
new ThreadLocal<Stack<CommonMessageContext>>();
/**
- * @see org.jboss.ws.extras.security.STRTransform
+ * @see org.jboss.ws.extentions.security.STRTransform
*/
private static ThreadLocal<SecurityStore> strTransformAssoc = new
ThreadLocal<SecurityStore>();
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/addressing/AddressingBuilderImpl.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/addressing/AddressingBuilderImpl.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/addressing/AddressingBuilderImpl.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/addressing/AddressingBuilderImpl.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -0,0 +1,85 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+package org.jboss.ws.extentions.addressing;
+
+//$Id$
+
+import java.net.URI;
+import java.net.URISyntaxException;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.addressing.AddressingBuilder;
+import javax.xml.ws.addressing.AddressingConstants;
+import javax.xml.ws.addressing.AddressingProperties;
+import javax.xml.ws.addressing.AttributedQName;
+import javax.xml.ws.addressing.AttributedURI;
+import javax.xml.ws.addressing.EndpointReference;
+import javax.xml.ws.addressing.Relationship;
+
+/**
+ * Factory for <code>AddressingElements</code>.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 14-Nov-2005
+ */
+public class AddressingBuilderImpl extends AddressingBuilder
+{
+ public AttributedURI newURI(URI uri)
+ {
+ return new AttributedURIImpl(uri);
+ }
+
+ public AttributedURI newURI(String uri) throws URISyntaxException
+ {
+ return newURI(new URI(uri));
+ }
+
+ public AttributedQName newQName(QName name)
+ {
+ return new AttributedQNameImpl(name);
+ }
+
+ public Relationship newRelationship(URI uri)
+ {
+ return new RelationshipImpl(uri);
+ }
+
+ public EndpointReference newEndpointReference(URI uri)
+ {
+ return new EndpointReferenceImpl(uri);
+ }
+
+ public AddressingProperties newAddressingProperties()
+ {
+ return new AddressingPropertiesImpl();
+ }
+
+ public AddressingConstants newAddressingConstants()
+ {
+ return new AddressingConstantsImpl();
+ }
+
+ public String getNamespaceURI()
+ {
+ return new AddressingTypeImpl().getNamespaceURI();
+ }
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/addressing/AddressingClientUtil.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/addressing/AddressingClientUtil.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/addressing/AddressingClientUtil.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/addressing/AddressingClientUtil.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -0,0 +1,121 @@
+package org.jboss.ws.extentions.addressing;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+
+import javax.xml.rpc.Stub;
+import javax.xml.ws.addressing.AddressingBuilder;
+import javax.xml.ws.addressing.AddressingConstants;
+import javax.xml.ws.addressing.AddressingProperties;
+import javax.xml.ws.addressing.AttributedURI;
+
+import org.jboss.ws.core.utils.UUIDGenerator;
+
+/**
+ * @author Heiko Braun, <heiko(a)openj.net>
+ * @since 04-Mar-2006
+ */
+public class AddressingClientUtil
+{
+ private static AddressingBuilder BUILDER;
+ private static AddressingConstants CONSTANTS;
+ static
+ {
+ BUILDER = AddressingBuilder.getAddressingBuilder();
+ CONSTANTS = BUILDER.newAddressingConstants();
+ }
+
+ /* creates outbound addressing properties */
+ public static AddressingProperties createRequestProperties()
+ {
+ AddressingProperties addrProps = BUILDER.newAddressingProperties();
+ return addrProps;
+ }
+
+ /**
+ * create default outbound addressing properties.
+ */
+ public static AddressingProperties createDefaultProps(String wsaAction, String wsaTo)
+ {
+ try
+ {
+ AddressingProperties addrProps = createRequestProperties();
+ addrProps.setAction(BUILDER.newURI(wsaAction));
+ addrProps.setTo(BUILDER.newURI(wsaTo));
+ return addrProps;
+ }
+ catch (URISyntaxException e)
+ {
+ throw new IllegalArgumentException(e.getMessage());
+ }
+ }
+
+ /**
+ * create anonymous request properties.
+ * wsa:ReplyTo is set to anonymous and a messageID is supplied.
+ */
+ public static AddressingProperties createAnonymousProps(String wsaAction, String
wsaTo)
+ {
+ try
+ {
+ AddressingProperties addrProps = createDefaultProps(wsaAction, wsaTo);
+ addrProps.setMessageID(BUILDER.newURI(generateMessageID()));
+ addrProps.setReplyTo(BUILDER.newEndpointReference(new
URI(CONSTANTS.getAnonymousURI())));
+ return addrProps;
+ }
+ catch (URISyntaxException e)
+ {
+ throw new IllegalArgumentException(e.getMessage());
+ }
+ }
+
+ /**
+ * one-way properties cary a wsa:ReplyTo of none
+ * upon which no response is expected.
+ */
+ public static AddressingProperties createOneWayProps(String wsaAction, String wsaTo)
+ {
+ try
+ {
+ AddressingProperties addrProps = createDefaultProps(wsaAction, wsaTo);
+ addrProps.setMessageID(BUILDER.newURI(generateMessageID()));
+ addrProps.setReplyTo(BUILDER.newEndpointReference(new
URI(CONSTANTS.getNoneURI())));
+ return addrProps;
+ }
+ catch (URISyntaxException e)
+ {
+ throw new IllegalArgumentException(e.getMessage());
+ }
+ }
+
+ /**
+ * customize a stubs endpooint url
+ */
+ public static void setTargetAddress(Stub stub, String url)
+ {
+ stub._setProperty(Stub.ENDPOINT_ADDRESS_PROPERTY, url);
+ }
+
+ /**
+ * generate a UUID based message id.
+ */
+ public static URI generateMessageID() throws URISyntaxException
+ {
+ URI messageId = new URI("urn:uuid:" +
UUIDGenerator.generateRandomUUIDString());
+ return messageId;
+ }
+
+ public static AttributedURI createMessageID()
+ {
+ AttributedURI msgId = null;
+ try
+ {
+ msgId = BUILDER.newURI(generateMessageID());
+ }
+ catch (URISyntaxException e)
+ {
+ //
+ }
+ return msgId;
+ }
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/addressing/AddressingConstantsImpl.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/addressing/AddressingConstantsImpl.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/addressing/AddressingConstantsImpl.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/addressing/AddressingConstantsImpl.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -0,0 +1,207 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+package org.jboss.ws.extentions.addressing;
+
+//$Id$
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.addressing.AddressingConstants;
+
+import org.jboss.util.NotImplementedException;
+import org.jboss.ws.Constants;
+
+/**
+ * Encapsulation for version-specific WS-Addressing constants.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 14-Nov-2005
+ */
+public class AddressingConstantsImpl implements AddressingConstants
+{
+ static final String URI_ADDRESSING =
"http://www.w3.org/2005/08/addressing";
+ static final String PREFIX_ADDRESSING = "wsa";
+
+ public String getNamespaceURI()
+ {
+ return URI_ADDRESSING;
+ }
+
+ public String getNamespacePrefix()
+ {
+ return PREFIX_ADDRESSING;
+ }
+
+ public String getWSDLNamespaceURI()
+ {
+ return Constants.NS_WSDL11;
+ }
+
+ public String getWSDLNamespacePrefix()
+ {
+ return Constants.PREFIX_WSDL;
+ }
+
+ public QName getWSDLExtensibilityQName()
+ {
+ return null;
+ }
+
+ public QName getWSDLActionQName()
+ {
+ return new QName(URI_ADDRESSING, "Action", "wsa");
+ }
+
+ public String getAnonymousURI()
+ {
+ return "http://www.w3.org/2005/08/addressing/anonymous";
+ }
+
+ public String getNoneURI()
+ {
+ return "http://www.w3.org/2005/08/addressing/none";
+ }
+
+ public QName getFromQName()
+ {
+ return new QName(URI_ADDRESSING, "From", PREFIX_ADDRESSING);
+ }
+
+ public QName getToQName()
+ {
+ return new QName(URI_ADDRESSING, "To", PREFIX_ADDRESSING);
+ }
+
+ public QName getReplyToQName()
+ {
+ return new QName(URI_ADDRESSING, "ReplyTo", PREFIX_ADDRESSING);
+ }
+
+ public QName getFaultToQName()
+ {
+ return new QName(URI_ADDRESSING, "FaultTo", PREFIX_ADDRESSING);
+ }
+
+ public QName getActionQName()
+ {
+ return new QName(URI_ADDRESSING, "Action", PREFIX_ADDRESSING);
+ }
+
+ public QName getMessageIDQName()
+ {
+ return new QName(URI_ADDRESSING, "MessageID", PREFIX_ADDRESSING);
+ }
+
+ public QName getRelationshipReplyQName()
+ {
+ return new QName(URI_ADDRESSING, "Reply", PREFIX_ADDRESSING);
+ }
+
+ public QName getRelatesToQName()
+ {
+ return new QName(URI_ADDRESSING, "RelatesTo", PREFIX_ADDRESSING);
+ }
+
+ public String getRelationshipTypeName()
+ {
+ return "RelationshipType";
+ }
+
+ public QName getMetadataQName()
+ {
+ return new QName(URI_ADDRESSING, "Metadata", PREFIX_ADDRESSING);
+ }
+
+ public QName getAddressQName()
+ {
+ return new QName(URI_ADDRESSING, "Address", PREFIX_ADDRESSING);
+ }
+
+ public QName getReferenceParametersQName()
+ {
+ return new QName(URI_ADDRESSING, "ReferenceParameters",
PREFIX_ADDRESSING);
+ }
+
+ public String getPackageName()
+ {
+ return getClass().getPackage().getName();
+ }
+
+ public String getIsReferenceParameterName()
+ {
+ throw new NotImplementedException();
+ }
+
+ public QName getInvalidMapQName()
+ {
+ return new QName(URI_ADDRESSING, "InvalidMessageInformationHeader",
PREFIX_ADDRESSING);
+ }
+
+ public QName getMapRequiredQName()
+ {
+ return new QName(URI_ADDRESSING, "MessageInformationHeaderRequired",
PREFIX_ADDRESSING);
+ }
+
+ public QName getDestinationUnreachableQName()
+ {
+ return new QName(URI_ADDRESSING, "DestinationUnreachable",
PREFIX_ADDRESSING);
+ }
+
+ public QName getActioNotSupportedQName()
+ {
+ return new QName(URI_ADDRESSING, "ActionNotSupported",
PREFIX_ADDRESSING);
+ }
+
+ public QName getEndpointUnavailableQName()
+ {
+ return new QName(URI_ADDRESSING, "EndpointUnavailable",
PREFIX_ADDRESSING);
+ }
+
+ public String getDefaultFaultAction()
+ {
+ return "http://www.w3.org/2005/08/addressing/fault";
+ }
+
+ public String getActionNotSupportedText()
+ {
+ return "Action not supported";
+ }
+
+ public String getDestinationUnreachableText()
+ {
+ return "Destination unreachable";
+ }
+
+ public String getEndpointUnavailableText()
+ {
+ return "Endpoint unavailable";
+ }
+
+ public String getInvalidMapText()
+ {
+ return "Invalid Map";
+ }
+
+ public String getMapRequiredText()
+ {
+ return "Map Required";
+ }
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/addressing/AddressingPropertiesImpl.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/addressing/AddressingPropertiesImpl.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/addressing/AddressingPropertiesImpl.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/addressing/AddressingPropertiesImpl.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -0,0 +1,282 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ws.extentions.addressing;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+import javax.xml.namespace.QName;
+import javax.xml.soap.SOAPElement;
+import javax.xml.ws.addressing.AddressingBuilder;
+import javax.xml.ws.addressing.AddressingConstants;
+import javax.xml.ws.addressing.AddressingProperties;
+import javax.xml.ws.addressing.AddressingType;
+import javax.xml.ws.addressing.AttributedURI;
+import javax.xml.ws.addressing.EndpointReference;
+import javax.xml.ws.addressing.ReferenceParameters;
+import javax.xml.ws.addressing.Relationship;
+
+// $Id$
+
+/**
+ * Each instance is associated with a particular WS-Addressing schema whose
+ * namespace URI is returned by its <code>getAddressingVersion</code>
method.
+ *
+ * The namespace of each key in the underlying map must match this URI and the
+ * local names of all the keys must be exactly the names of the Message Addressing
Properties
+ * defined in that version of the WS-Addressing specification.
+ *
+ * Each value in the underlying type must be an instance of
<code>AddressingType</code> whose
+ * WS-Addressing version (determined by its
<code>getAddressingVersion</code>) method must
+ * match the WS-Addressing version associated with the
<code>AddressingProperties</code>.
+ *
+ * TODO: verify that AddressingPropertiesImpl can extend ElementExtensibleImpl.
+ * See
http://jira.jboss.com/jira/browse/JBWS-728
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 14-Nov-2005
+ */
+public class AddressingPropertiesImpl extends ElementExtensibleImpl implements
AddressingProperties
+{
+ private static AddressingConstants ADDR = new AddressingConstantsImpl();
+
+ // A REQUIRED absolute URI representing the address of the intended receiver of this
message.
+ private AttributedURI to;
+ // A REQUIRED absolute URI that uniquely identifies the semantics implied by this
message.
+ private AttributedURI action;
+ // An OPTIONAL absolute URI that uniquely identifies the message.
+ private AttributedURI messageId;
+ // An OPTIONAL pair of values that indicate how this message relates to another
message.
+ private Relationship[] relatesTo;
+ // An OPTIONAL endpoint reference for the intended receiver for replies to this
message.
+ private EndpointReference replyTo;
+ // An OPTIONAL endpoint reference for the intended receiver for faults related to this
message.
+ private EndpointReference faultTo;
+ // An OPTIONAL reference to the endpoint from which the message originated.
+ private EndpointReference from;
+ // Corresponds to the value of the [reference parameters] property of the endpoint
reference to which the message is addressed.
+ private ReferenceParameters refParams = new ReferenceParametersImpl();
+
+ private Map<QName, AddressingType> addrTypes = new HashMap<QName,
AddressingType>();
+
+ public AttributedURI getTo()
+ {
+ return to;
+ }
+
+ public void setTo(AttributedURI to)
+ {
+ this.to = to;
+ }
+
+ public AttributedURI getAction()
+ {
+ return action;
+ }
+
+ public void setAction(AttributedURI action)
+ {
+ this.action = action;
+ }
+
+ public AttributedURI getMessageID()
+ {
+ return messageId;
+ }
+
+ public void setMessageID(AttributedURI iri)
+ {
+ this.messageId = iri;
+ }
+
+ public Relationship[] getRelatesTo()
+ {
+ return relatesTo;
+ }
+
+ public void setRelatesTo(Relationship[] relatesTo)
+ {
+ this.relatesTo = relatesTo;
+ }
+
+ public EndpointReference getReplyTo()
+ {
+ return replyTo;
+ }
+
+ public void setReplyTo(EndpointReference replyTo)
+ {
+ this.replyTo = replyTo;
+ }
+
+ public EndpointReference getFaultTo()
+ {
+ return faultTo;
+ }
+
+ public void setFaultTo(EndpointReference faultTo)
+ {
+ this.faultTo = faultTo;
+ }
+
+ public EndpointReference getFrom()
+ {
+ return from;
+ }
+
+ public void setFrom(EndpointReference from)
+ {
+ this.from = from;
+ }
+
+ public ReferenceParameters getReferenceParameters()
+ {
+ return refParams;
+ }
+
+ /**
+ * Initializes the properties as a destination using the given
+ * <code>EndpointReference</code>. The <bold>To</bold>
property is initialized
+ * using the <bold>Address</bold> property of the
<code>EndpointReference</code>
+ * and the <bold>ReferenceParameters</bold> property is initialized using
the
+ * <bold>ReferenceParameters</bold> property of the
<code>EndpointReference</code>.
+ *
+ * @param epr The <code>EndpointReference</code> representing the
destination.
+ */
+ public void initializeAsDestination(EndpointReference epr)
+ {
+ if (epr == null)
+ throw new IllegalArgumentException("Invalid null endpoint
reference");
+
+ this.to = epr.getAddress();
+
+ ReferenceParameters srcParams = epr.getReferenceParameters();
+ for (Object obj : srcParams.getElements())
+ {
+ SOAPElement soapElement = (SOAPElement)obj;
+ soapElement.setAttributeNS(getNamespaceURI(),
"wsa:IsReferenceParameter", "true");
+ addElement(soapElement);
+ }
+ }
+
+ /**
+ * Initialize this <code>AddressingProperties</code> as a reply to the
+ * given message. As described in the WS-Addressing Core specification.
+ * The <bold>ReplyTo</bold> property is using the
<bold>Address</bold>
+ * property of the source <code>AddressingProperties</code> and the
+ * <bold>ReferenceParameters</bold> property is initialized using the
+ * <bold>ReferenceParameters</bold> property of the source message.
+ *
+ * @param props The source <code>AddressingProperties</code>
+ * @param isFault <code>true</code> if the reply is a Fault message.
+ */
+ public void initializeAsReply(AddressingProperties props, boolean isFault)
+ {
+ EndpointReference epr = (isFault ? props.getFaultTo() : null);
+ if (epr == null)
+ {
+ epr = props.getReplyTo();
+ }
+ this.to = (epr != null ? epr.getAddress() : new
AttributedURIImpl(ADDR.getAnonymousURI()));
+
+ if (epr != null)
+ {
+ ReferenceParameters srcParams = epr.getReferenceParameters();
+ for (Object obj : srcParams.getElements())
+ {
+ SOAPElement soapElement = (SOAPElement)obj;
+ soapElement.setAttributeNS(getNamespaceURI(),
"wsa:IsReferenceParameter", "true");
+ addElement(soapElement);
+ }
+ }
+ if (props.getMessageID() != null)
+ {
+ AddressingBuilder builder = AddressingBuilder.getAddressingBuilder();
+ Relationship rel = builder.newRelationship(props.getMessageID().getURI());
+ this.relatesTo = new Relationship[] { rel };
+ }
+ }
+
+ // Map interface ****************************************************************
+
+ public int size()
+ {
+ return addrTypes.size();
+ }
+
+ public boolean isEmpty()
+ {
+ return addrTypes.isEmpty();
+ }
+
+ public boolean containsKey(Object arg0)
+ {
+ return addrTypes.containsKey(arg0);
+ }
+
+ public boolean containsValue(Object arg0)
+ {
+ return addrTypes.containsValue(arg0);
+ }
+
+ public AddressingType get(Object arg0)
+ {
+ return addrTypes.get(arg0);
+ }
+
+ public AddressingType put(QName arg0, AddressingType arg1)
+ {
+ return addrTypes.put(arg0, arg1);
+ }
+
+ public AddressingType remove(Object arg0)
+ {
+ return addrTypes.remove(arg0);
+ }
+
+ public void putAll(Map<? extends QName, ? extends AddressingType> arg0)
+ {
+ addrTypes.putAll(arg0);
+ }
+
+ public void clear()
+ {
+ addrTypes.clear();
+ }
+
+ public Set<QName> keySet()
+ {
+ return addrTypes.keySet();
+ }
+
+ public Collection<AddressingType> values()
+ {
+ return addrTypes.values();
+ }
+
+ public Set<Entry<QName, AddressingType>> entrySet()
+ {
+ return addrTypes.entrySet();
+ }
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/addressing/AddressingTypeImpl.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/addressing/AddressingTypeImpl.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/addressing/AddressingTypeImpl.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/addressing/AddressingTypeImpl.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -0,0 +1,40 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+package org.jboss.ws.extentions.addressing;
+
+//$Id$
+
+import javax.xml.ws.addressing.AddressingType;
+
+/**
+ * Implemented by wrappers for types defined by <b>WS-Addressing</b>.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 14-Nov-2005
+ */
+public class AddressingTypeImpl implements AddressingType
+{
+ public String getNamespaceURI()
+ {
+ return AddressingConstantsImpl.URI_ADDRESSING;
+ }
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/addressing/AttributeElementExtensibleImpl.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/addressing/AttributeElementExtensibleImpl.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/addressing/AttributeElementExtensibleImpl.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/addressing/AttributeElementExtensibleImpl.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -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.extentions.addressing;
+
+//$Id$
+
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.addressing.AddressingException;
+import javax.xml.ws.addressing.AddressingType;
+import javax.xml.ws.addressing.AttributeExtensible;
+import javax.xml.ws.addressing.ElementExtensible;
+
+/**
+ * Used to represent Addressing classes that support collections of arbitrary XML
Elements.
+ * Used to represent Addressing classes that support extensibility attributes.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 14-Nov-2005
+ */
+public class AttributeElementExtensibleImpl implements AttributeExtensible,
ElementExtensible, AddressingType
+{
+ private AttributeExtensible attrExt = new AttributeExtensibleImpl();
+ private ElementExtensible elmtExt = new ElementExtensibleImpl();
+
+ public Map<QName, String> getAttributes()
+ {
+ return attrExt.getAttributes();
+ }
+
+ public void addAttribute(QName name, String value) throws AddressingException
+ {
+ attrExt.addAttribute(name, value);
+ }
+
+ public List<Object> getElements()
+ {
+ return elmtExt.getElements();
+ }
+
+ public void addElement(Object element)
+ {
+ elmtExt.addElement(element);
+ }
+
+ public boolean removeElement(Object element)
+ {
+ return elmtExt.removeElement(element);
+ }
+
+ public String getNamespaceURI()
+ {
+ return new AddressingTypeImpl().getNamespaceURI();
+ }
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/addressing/AttributeExtensibleImpl.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/addressing/AttributeExtensibleImpl.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/addressing/AttributeExtensibleImpl.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/addressing/AttributeExtensibleImpl.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -0,0 +1,52 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+package org.jboss.ws.extentions.addressing;
+
+//$Id$
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.addressing.AddressingException;
+import javax.xml.ws.addressing.AttributeExtensible;
+
+/**
+ * Used to represent Addressing classes that support extensibility attributes.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 14-Nov-2005
+ */
+public class AttributeExtensibleImpl extends AddressingTypeImpl implements
AttributeExtensible
+{
+ private Map<QName, String> extMap = new HashMap<QName, String>();
+
+ public Map<QName, String> getAttributes()
+ {
+ return extMap;
+ }
+
+ public void addAttribute(QName name, String value) throws AddressingException
+ {
+ extMap.put(name, value);
+ }
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/addressing/AttributedQNameImpl.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/addressing/AttributedQNameImpl.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/addressing/AttributedQNameImpl.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/addressing/AttributedQNameImpl.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -0,0 +1,49 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+package org.jboss.ws.extentions.addressing;
+
+//$Id$
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.addressing.AttributedQName;
+
+/**
+ * Abstraction of <code>AttributedQNameType</code> defined in the normative
+ * WS-Addressing core schema.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 14-Nov-2005
+ */
+public class AttributedQNameImpl extends AttributeExtensibleImpl implements
AttributedQName
+{
+ private QName qname;
+
+ public AttributedQNameImpl(QName qname)
+ {
+ this.qname = qname;
+ }
+
+ public QName getQName()
+ {
+ return qname;
+ }
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/addressing/AttributedURIImpl.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/addressing/AttributedURIImpl.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/addressing/AttributedURIImpl.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/addressing/AttributedURIImpl.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -0,0 +1,62 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+package org.jboss.ws.extentions.addressing;
+
+//$Id$
+
+import java.net.URI;
+import java.net.URISyntaxException;
+
+import javax.xml.ws.addressing.AttributedURI;
+
+/**
+ * Abstraction <code>AttributedURIType</code> defined in the normative
WS-Addressing core schema.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 14-Nov-2005
+ */
+public class AttributedURIImpl extends AttributeExtensibleImpl implements AttributedURI
+{
+ private URI uri;
+
+ public AttributedURIImpl(URI uri)
+ {
+ this.uri = uri;
+ }
+
+ public AttributedURIImpl(String uri)
+ {
+ try
+ {
+ this.uri = new URI(uri);
+ }
+ catch (URISyntaxException ex)
+ {
+ throw new IllegalArgumentException(ex.toString());
+ }
+ }
+
+ public URI getURI()
+ {
+ return uri;
+ }
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/addressing/ElementExtensibleImpl.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/addressing/ElementExtensibleImpl.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/addressing/ElementExtensibleImpl.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/addressing/ElementExtensibleImpl.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -0,0 +1,58 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+package org.jboss.ws.extentions.addressing;
+
+//$Id$
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.ws.addressing.ElementExtensible;
+
+/**
+ * Implemented by classes exposing a <code>List</code> of
+ * <code>SOAPElements</code>. Used to represent addressing classes that
+ * support collections of arbitrary XML Elements.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 14-Nov-2005
+ */
+public class ElementExtensibleImpl extends AddressingTypeImpl implements
ElementExtensible
+{
+ private List<Object> elements = new ArrayList<Object>();
+
+ public List<Object> getElements()
+ {
+ return elements;
+ }
+
+ public void addElement(Object element)
+ {
+ elements.add(element);
+ }
+
+ public boolean removeElement(Object element)
+ {
+ return elements.remove(element);
+ }
+
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/addressing/EndpointReferenceImpl.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/addressing/EndpointReferenceImpl.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/addressing/EndpointReferenceImpl.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/addressing/EndpointReferenceImpl.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -0,0 +1,300 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ws.extentions.addressing;
+
+//$Id$
+
+import java.io.IOException;
+import java.io.StringWriter;
+import java.net.URI;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.addressing.AddressingConstants;
+import javax.xml.ws.addressing.AddressingException;
+import javax.xml.ws.addressing.AttributedURI;
+import javax.xml.ws.addressing.EndpointReference;
+import javax.xml.ws.addressing.Metadata;
+import javax.xml.ws.addressing.ReferenceParameters;
+import javax.xml.ws.addressing.soap.SOAPAddressingBuilder;
+
+import org.jboss.ws.WSException;
+import org.jboss.ws.core.utils.DOMUtils;
+import org.jboss.ws.core.utils.DOMWriter;
+import org.jboss.ws.extentions.addressing.soap.SOAPAddressingBuilderImpl;
+import org.w3c.dom.Element;
+
+/**
+ * Abstraction of EndpointReference.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 14-Nov-2005
+ */
+public class EndpointReferenceImpl extends AttributeElementExtensibleImpl implements
EndpointReference
+{
+ private static AddressingConstants ADDR = new AddressingConstantsImpl();
+
+ // The REQUIRED root element name
+ private QName rootQName = new QName(ADDR.getNamespaceURI(),
"EndpointReference", ADDR.getNamespacePrefix());
+ // This REQUIRED element (whose content is of type xs:anyURI) specifies the [address]
property of the endpoint reference.
+ private AttributedURIImpl address = new AttributedURIImpl(ADDR.getAnonymousURI());
+ // This OPTIONAL element may contain elements from any namespace. Such elements form
the [reference parameters] of the reference.
+ private ReferenceParametersImpl refParams = new ReferenceParametersImpl();
+ // This OPTIONAL element may contain elements from any namespace.
+ private MetadataImpl metadata = new MetadataImpl();
+
+ public EndpointReferenceImpl(URI uri)
+ {
+ this.address = new AttributedURIImpl(uri);
+ }
+
+ public EndpointReferenceImpl(Element elRoot)
+ {
+ initFromElement(elRoot);
+ }
+
+ public QName getRootQName()
+ {
+ return rootQName;
+ }
+
+ public void setRootQName(QName rootElementName)
+ {
+ this.rootQName = rootElementName;
+ }
+
+ public AttributedURI getAddress()
+ {
+ return address;
+ }
+
+ public ReferenceParameters getReferenceParameters()
+ {
+ return refParams;
+ }
+
+ public Metadata getMetadata()
+ {
+ return metadata;
+ }
+
+ private void initFromElement(Element elRoot)
+ {
+ if (elRoot == null)
+ throw new IllegalArgumentException("Cannot initialize from null
element");
+
+ try
+ {
+ Map<QName, String> attributes = DOMUtils.getAttributes(elRoot);
+ for (QName attqname : attributes.keySet())
+ {
+ String value = attributes.get(attqname);
+ addAttribute(attqname, value);
+ }
+
+ Iterator it = DOMUtils.getChildElements(elRoot);
+ while (it.hasNext())
+ {
+ Element el = (Element)it.next();
+ QName qname = DOMUtils.getElementQName(el);
+
+ // Parse Address
+ if (qname.equals(ADDR.getAddressQName()))
+ {
+ address = new AttributedURIImpl(DOMUtils.getTextContent(el));
+
+ attributes = DOMUtils.getAttributes(el);
+ for (QName attqname : attributes.keySet())
+ {
+ String value = attributes.get(attqname);
+ address.addAttribute(attqname, value);
+ }
+ }
+ // Parse ReferenceParameters
+ else if (qname.equals(ADDR.getReferenceParametersQName()))
+ {
+ attributes = DOMUtils.getAttributes(el);
+ for (QName attqname : attributes.keySet())
+ {
+ String value = attributes.get(attqname);
+ refParams.addAttribute(attqname, value);
+ }
+ Iterator itel = DOMUtils.getChildElements(el);
+ while (itel.hasNext())
+ {
+ Element child = (Element)itel.next();
+ refParams.addElement(child);
+ }
+ }
+ // Parse Metadata
+ else if (qname.equals(ADDR.getMetadataQName()))
+ {
+ attributes = DOMUtils.getAttributes(el);
+ for (QName attqname : attributes.keySet())
+ {
+ String value = attributes.get(attqname);
+ metadata.addAttribute(attqname, value);
+ }
+ Iterator itel = DOMUtils.getChildElements(el);
+ while (itel.hasNext())
+ {
+ Element child = (Element)itel.next();
+ metadata.addElement(child);
+ }
+ }
+ else
+ {
+ addElement(el);
+ }
+ }
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (Exception ex)
+ {
+ throw new AddressingException("Cannot init EPR from element", ex);
+ }
+ }
+
+ public Element toElement()
+ {
+ String xmlString = toXMLString(false);
+ try
+ {
+ return DOMUtils.parse(xmlString);
+ }
+ catch (IOException ex)
+ {
+ throw new WSException("Cannot parse: " + xmlString, ex);
+ }
+ }
+
+ public String toXMLString(boolean pretty)
+ {
+ if (pretty)
+ {
+ Element epRef = toElement();
+ return DOMWriter.printNode(epRef, true);
+ }
+
+ SOAPAddressingBuilder builder = new SOAPAddressingBuilderImpl();
+ AddressingConstants ADDR = builder.newAddressingConstants();
+
+ String rootname = getPrefixedName(rootQName);
+ StringBuilder xmlBuffer = new StringBuilder("<" + rootname);
+ appendAttributes(xmlBuffer, getAttributes());
+ xmlBuffer.append(">");
+
+ // insert xmlns:wsa
+ String wsaURI = ADDR.getNamespaceURI();
+ String wsaPrefix = ADDR.getNamespacePrefix();
+ String wsaDeclaration = " xmlns:" + wsaPrefix + "='" +
wsaURI + "'";
+ if (xmlBuffer.indexOf(wsaDeclaration) < 0)
+ {
+ xmlBuffer.insert(rootname.length() + 1, wsaDeclaration);
+ }
+
+ // append address
+ xmlBuffer.append("<" + getPrefixedName(ADDR.getAddressQName()));
+ appendAttributes(xmlBuffer, address.getAttributes());
+ xmlBuffer.append(">");
+ xmlBuffer.append(address.getURI() + "</" +
getPrefixedName(ADDR.getAddressQName()) + ">");
+
+ // append parameters
+ if (refParams.getElements().size() > 0 || refParams.getAttributes().size() >
0)
+ {
+ xmlBuffer.append("<" +
getPrefixedName(ADDR.getReferenceParametersQName()));
+ appendAttributes(xmlBuffer, refParams.getAttributes());
+ xmlBuffer.append(">");
+ appendElements(xmlBuffer, refParams.getElements());
+ xmlBuffer.append("</" +
getPrefixedName(ADDR.getReferenceParametersQName()) + ">");
+ }
+
+ // append metadata
+ if (metadata.getElements().size() > 0 || metadata.getAttributes().size() >
0)
+ {
+ xmlBuffer.append("<" + getPrefixedName(ADDR.getMetadataQName()));
+ appendAttributes(xmlBuffer, metadata.getAttributes());
+ xmlBuffer.append(">");
+ appendElements(xmlBuffer, metadata.getElements());
+ xmlBuffer.append("</" + getPrefixedName(ADDR.getMetadataQName()) +
">");
+ }
+
+ // append custom elements
+ appendElements(xmlBuffer, getElements());
+
+ xmlBuffer.append("</" + rootname + ">");
+
+ String xmlString = xmlBuffer.toString();
+ return xmlString;
+ }
+
+ private void appendAttributes(StringBuilder xmlBuffer, Map<QName, String>
attributes)
+ {
+ for (QName qname : attributes.keySet())
+ {
+ String qualname = getPrefixedName(qname);
+ String value = attributes.get(qname);
+ xmlBuffer.append(" " + qualname + "='" + value +
"'");
+ }
+ }
+
+ private void appendElements(StringBuilder xmlBuffer, List<Object> elements)
+ {
+ for (Object obj : elements)
+ {
+ if (obj instanceof Element)
+ {
+ StringWriter strwr = new StringWriter();
+ DOMWriter domWriter = new DOMWriter(strwr).setCompleteNamespaces(false);
+ domWriter.print((Element)obj);
+ String xmlFragment = strwr.toString();
+ xmlBuffer.append(xmlFragment);
+ }
+ else if (obj instanceof String)
+ {
+ xmlBuffer.append(obj);
+ }
+ else
+ {
+ throw new AddressingException("Unsupported element: " +
obj.getClass().getName());
+ }
+ }
+ }
+
+ private String getPrefixedName(QName qname)
+ {
+ String prefix = qname.getPrefix();
+ String localPart = qname.getLocalPart();
+ String qualname = (prefix != null && prefix.length() > 0 ? prefix +
":" + localPart : localPart);
+ return qualname;
+ }
+
+ public String toString()
+ {
+ return toXMLString(true);
+ }
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/addressing/MetadataImpl.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/addressing/MetadataImpl.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/addressing/MetadataImpl.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/addressing/MetadataImpl.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -0,0 +1,36 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+package org.jboss.ws.extentions.addressing;
+
+//$Id$
+
+import javax.xml.ws.addressing.Metadata;
+
+/**
+ * Abstraction of Metadata bucket in an <code>EndpointReference</code>.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 14-Nov-2005
+ */
+public class MetadataImpl extends AttributeElementExtensibleImpl implements Metadata
+{
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/addressing/ReferenceParametersImpl.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/addressing/ReferenceParametersImpl.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/addressing/ReferenceParametersImpl.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/addressing/ReferenceParametersImpl.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -0,0 +1,41 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ws.extentions.addressing;
+
+import javax.xml.ws.addressing.ReferenceParameters;
+
+// $Id$
+
+/**
+ * Abstraction of ReferenceParameters bucket in an
+ * <code>EndpointReference</code>.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 14-Nov-2005
+ */
+public class ReferenceParametersImpl extends AttributeElementExtensibleImpl implements
ReferenceParameters
+{
+ public ReferenceParametersImpl()
+ {
+ super();
+ }
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/addressing/RelationshipImpl.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/addressing/RelationshipImpl.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/addressing/RelationshipImpl.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/addressing/RelationshipImpl.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -0,0 +1,67 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ws.extentions.addressing;
+
+import java.net.URI;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.addressing.Relationship;
+
+// $Id$
+
+/**
+ * Abstraction of the RelatesToType defined by WS-Addressing. Includes an ID
+ * property that references the MessageID of the related message and a Type
+ * property corresponding to the RelationshipType attribute of the
+ * RelatesToType. Implementing classes must supply a single argument constructor
+ * with parameter type <code>java.net.URI</code>, which is used to
initialize
+ * the <b>ID</b> property.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 14-Nov-2005
+ */
+public class RelationshipImpl extends AttributeExtensibleImpl implements Relationship
+{
+ private URI uri;
+ private QName type;
+
+ public RelationshipImpl(URI uri)
+ {
+ this.uri = uri;
+ }
+
+ public URI getID()
+ {
+ return uri;
+ }
+
+ public QName getType()
+ {
+ return type;
+ }
+
+ public void setType(QName type)
+ {
+ this.type = type;
+ }
+
+}
Copied: branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/addressing/jaxrpc
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/addressing/jaxrpc)
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/addressing/jaxrpc/WSAddressingClientHandler.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/addressing/jaxrpc/WSAddressingClientHandler.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/addressing/jaxrpc/WSAddressingClientHandler.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
*/
-package org.jboss.ws.extras.addressing.jaxrpc;
+package org.jboss.ws.extentions.addressing.jaxrpc;
import javax.xml.namespace.QName;
import javax.xml.rpc.handler.GenericHandler;
@@ -35,7 +35,7 @@
import javax.xml.ws.addressing.soap.SOAPAddressingProperties;
import org.jboss.logging.Logger;
-import org.jboss.ws.extras.addressing.soap.SOAPAddressingPropertiesImpl;
+import org.jboss.ws.extentions.addressing.soap.SOAPAddressingPropertiesImpl;
/**
* A client side handler that reads/writes the addressing properties
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/addressing/jaxrpc/WSAddressingServerHandler.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/addressing/jaxrpc/WSAddressingServerHandler.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/addressing/jaxrpc/WSAddressingServerHandler.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
*/
-package org.jboss.ws.extras.addressing.jaxrpc;
+package org.jboss.ws.extentions.addressing.jaxrpc;
import java.net.URISyntaxException;
@@ -37,8 +37,8 @@
import org.jboss.logging.Logger;
import org.jboss.ws.core.jaxrpc.handler.SOAPMessageContextJAXRPC;
import org.jboss.ws.core.metadata.umdm.OperationMetaData;
-import org.jboss.ws.extras.addressing.AddressingConstantsImpl;
-import org.jboss.ws.extras.addressing.metadata.AddressingOpMetaExt;
+import org.jboss.ws.extentions.addressing.AddressingConstantsImpl;
+import org.jboss.ws.extentions.addressing.metadata.AddressingOpMetaExt;
/**
* A server side handler that reads/writes the addressing properties
Copied: branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/addressing/jaxws
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/addressing/jaxws)
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/addressing/jaxws/WSAddressingClientHandler.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/addressing/jaxws/WSAddressingClientHandler.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/addressing/jaxws/WSAddressingClientHandler.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
*/
-package org.jboss.ws.extras.addressing.jaxws;
+package org.jboss.ws.extentions.addressing.jaxws;
import javax.xml.soap.SOAPException;
import javax.xml.soap.SOAPMessage;
@@ -33,7 +33,7 @@
import org.jboss.logging.Logger;
import org.jboss.ws.core.jaxws.handler.GenericSOAPHandler;
-import org.jboss.ws.extras.addressing.soap.SOAPAddressingPropertiesImpl;
+import org.jboss.ws.extentions.addressing.soap.SOAPAddressingPropertiesImpl;
/**
* A client side handler that reads/writes the addressing properties
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/addressing/jaxws/WSAddressingServerHandler.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/addressing/jaxws/WSAddressingServerHandler.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/addressing/jaxws/WSAddressingServerHandler.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
*/
-package org.jboss.ws.extras.addressing.jaxws;
+package org.jboss.ws.extentions.addressing.jaxws;
import java.net.URISyntaxException;
@@ -35,8 +35,8 @@
import org.jboss.ws.core.CommonMessageContext;
import org.jboss.ws.core.jaxws.handler.GenericSOAPHandler;
import org.jboss.ws.core.metadata.umdm.OperationMetaData;
-import org.jboss.ws.extras.addressing.AddressingConstantsImpl;
-import org.jboss.ws.extras.addressing.metadata.AddressingOpMetaExt;
+import org.jboss.ws.extentions.addressing.AddressingConstantsImpl;
+import org.jboss.ws.extentions.addressing.metadata.AddressingOpMetaExt;
/**
* A server side handler that reads/writes the addressing properties
Copied: branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/addressing/metadata
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/addressing/metadata)
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/addressing/metadata/AddressingOpMetaExt.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/addressing/metadata/AddressingOpMetaExt.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/addressing/metadata/AddressingOpMetaExt.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
*/
-package org.jboss.ws.extras.addressing.metadata;
+package org.jboss.ws.extentions.addressing.metadata;
// $Id$
Copied: branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/addressing/soap
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/addressing/soap)
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/addressing/soap/SOAPAddressingBuilderImpl.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/addressing/soap/SOAPAddressingBuilderImpl.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/addressing/soap/SOAPAddressingBuilderImpl.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
*/
-package org.jboss.ws.extras.addressing.soap;
+package org.jboss.ws.extentions.addressing.soap;
//$Id$
@@ -35,12 +35,12 @@
import javax.xml.ws.addressing.Relationship;
import javax.xml.ws.addressing.soap.SOAPAddressingBuilder;
-import org.jboss.ws.extras.addressing.AddressingConstantsImpl;
-import org.jboss.ws.extras.addressing.AddressingTypeImpl;
-import org.jboss.ws.extras.addressing.AttributedQNameImpl;
-import org.jboss.ws.extras.addressing.AttributedURIImpl;
-import org.jboss.ws.extras.addressing.EndpointReferenceImpl;
-import org.jboss.ws.extras.addressing.RelationshipImpl;
+import org.jboss.ws.extentions.addressing.AddressingConstantsImpl;
+import org.jboss.ws.extentions.addressing.AddressingTypeImpl;
+import org.jboss.ws.extentions.addressing.AttributedQNameImpl;
+import org.jboss.ws.extentions.addressing.AttributedURIImpl;
+import org.jboss.ws.extentions.addressing.EndpointReferenceImpl;
+import org.jboss.ws.extentions.addressing.RelationshipImpl;
/**
* Factory for <code>AddressingElements</code>.
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/addressing/soap/SOAPAddressingPropertiesImpl.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/addressing/soap/SOAPAddressingPropertiesImpl.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/addressing/soap/SOAPAddressingPropertiesImpl.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
*/
-package org.jboss.ws.extras.addressing.soap;
+package org.jboss.ws.extentions.addressing.soap;
//$Id$
@@ -50,9 +50,9 @@
import org.jboss.ws.core.soap.SOAPElementImpl;
import org.jboss.ws.core.soap.SOAPFactoryImpl;
import org.jboss.ws.core.utils.DOMUtils;
-import org.jboss.ws.extras.addressing.AddressingConstantsImpl;
-import org.jboss.ws.extras.addressing.AddressingPropertiesImpl;
-import org.jboss.ws.extras.addressing.EndpointReferenceImpl;
+import org.jboss.ws.extentions.addressing.AddressingConstantsImpl;
+import org.jboss.ws.extentions.addressing.AddressingPropertiesImpl;
+import org.jboss.ws.extentions.addressing.EndpointReferenceImpl;
import org.jboss.xb.binding.NamespaceRegistry;
import org.w3c.dom.Attr;
import org.w3c.dom.Element;
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/eventing/EventSourceEndpoint.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/eventing/EventSourceEndpoint.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/eventing/EventSourceEndpoint.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/eventing/EventSourceEndpoint.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -0,0 +1,45 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ws.extentions.eventing;
+
+// $Id$
+
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+
+import org.jboss.ws.extentions.eventing.element.SubscribeRequest;
+import org.jboss.ws.extentions.eventing.element.SubscribeResponse;
+import org.jboss.ws.extentions.eventing.element.SubscriptionEndRequest;
+
+/**
+ * Event source endpoint interface.
+ *
+ * @author Heiko Braun, <heiko(a)openj.net>
+ * @since 24-Nov-2005
+ */
+public interface EventSourceEndpoint extends Remote
+{
+
+ SubscribeResponse subscribe(SubscribeRequest subscribeRequest) throws
RemoteException;
+
+ SubscriptionEndRequest subscriptionEnd() throws RemoteException;
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/eventing/EventSourceEndpointImpl.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/eventing/EventSourceEndpointImpl.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/eventing/EventSourceEndpointImpl.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/eventing/EventSourceEndpointImpl.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -0,0 +1,109 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ws.extentions.eventing;
+
+// $Id$
+
+import java.rmi.RemoteException;
+
+import javax.xml.rpc.soap.SOAPFaultException;
+import javax.xml.ws.addressing.AddressingProperties;
+import javax.xml.ws.addressing.AttributedURI;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.extentions.eventing.element.EndpointReference;
+import org.jboss.ws.extentions.eventing.element.SubscribeRequest;
+import org.jboss.ws.extentions.eventing.element.SubscribeResponse;
+import org.jboss.ws.extentions.eventing.element.SubscriptionEndRequest;
+import org.jboss.ws.extentions.eventing.mgmt.Filter;
+import org.jboss.ws.extentions.eventing.mgmt.SubscriptionError;
+import org.jboss.ws.extentions.eventing.mgmt.SubscriptionManagerMBean;
+import org.jboss.ws.extentions.eventing.mgmt.SubscriptionTicket;
+
+/**
+ * Event source endpoint implementation.<br>
+ * Delegates to {@link org.jboss.ws.extentions.eventing.mgmt.SubscriptionManager}
+ *
+ * @author Heiko Braun, <heiko(a)openj.net>
+ * @since 25-Nov-2005
+ */
+public class EventSourceEndpointImpl extends EventingEndpointBase
+ implements EventSourceEndpoint
+{
+ private static Logger log = Logger.getLogger(EventSourceEndpointImpl.class);
+
+ public SubscribeResponse subscribe(SubscribeRequest request) throws RemoteException
+ {
+ try
+ {
+ // retrieve addressing headers
+ AddressingProperties inProps = getAddrProperties();
+ AttributedURI eventSourceURI = inProps.getTo();
+ log.debug("Subscribe request for event source: " +
eventSourceURI.getURI());
+
+ assertSubscriberEndpoints(request);
+ EndpointReference notifyTo = request.getDelivery().getNotifyTo();
+ EndpointReference endTo = request.getEndTo();
+
+ // adapt filter elements
+ Filter filter = null;
+ if (request.getFilter() != null)
+ {
+ filter = new Filter(request.getFilter().getDialect(),
request.getFilter().get_value());
+ }
+
+ // invoke subscription manager
+ SubscriptionManagerMBean subscriptionManager = getSubscriptionManager();
+ SubscriptionTicket ticket =
subscriptionManager.subscribe(eventSourceURI.getURI(), notifyTo, endTo,
request.getExpires(), filter);
+
+ // create the response element
+ SubscribeResponse res = new SubscribeResponse();
+ res.setExpires(ticket.getExpires());
+ res.setSubscriptionManager(ticket.getSubscriptionManager());
+
+ return res;
+
+ }
+ catch (SubscriptionError e)
+ {
+ throw new SOAPFaultException(buildFaultQName(e.getSubcode()), e.getReason(),
null, null);
+ }
+ }
+
+ public SubscriptionEndRequest subscriptionEnd() throws RemoteException
+ {
+ return new SubscriptionEndRequest();
+ }
+
+ /**
+ * Ensure that the subscriber endpoint information is supplied in request.
+ * Namely NotifyTo and EndTo need to be set.
+ * @param request
+ */
+ private void assertSubscriberEndpoints(SubscribeRequest request) {
+ if(null == request.getDelivery().getNotifyTo() || null == request.getEndTo() )
+ throw new SOAPFaultException(
buildFaultQName(EventingConstants.CODE_INVALID_MESSAGE) ,
+ "Subcriber endpoint information missing from request",
+ null, null
+ );
+ }
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/eventing/EventingConstants.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/eventing/EventingConstants.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/eventing/EventingConstants.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/eventing/EventingConstants.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -0,0 +1,161 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ws.extentions.eventing;
+
+// $Id$
+
+import java.net.URI;
+import java.net.URISyntaxException;
+
+import javax.xml.ws.addressing.AddressingBuilder;
+import javax.xml.ws.addressing.AddressingConstants;
+
+import org.jboss.ws.WSException;
+
+/**
+ * @author Heiko Braun, <heiko(a)openj.net>
+ * @since 19-Dec-2005
+ */
+public class EventingConstants
+{
+ private static AddressingBuilder WSA_BUILDER =
AddressingBuilder.getAddressingBuilder();
+ private static AddressingConstants WSA_CONSTANTS =
WSA_BUILDER.newAddressingConstants();
+
+ // common namespaces
+
+ public final static String NS_EVENTING =
"http://schemas.xmlsoap.org/ws/2004/08/eventing";
+ public final static String PREFIX_EVENTING = "wse";
+ public final static String NS_ADDRESSING = WSA_CONSTANTS.getNamespaceURI();
+
+ // request /response action from specification
+
+ public final static String SUBSCRIBE_ACTION =
"http://schemas.xmlsoap.org/ws/2004/08/eventing/Subscribe";
+ public final static String SUBSCRIBE_RESPONSE_ACTION =
"http://schemas.xmlsoap.org/ws/2004/08/eventing/SubscribeResponse";
+ public final static String UNSUBSCRIBE_ACTION =
"http://schemas.xmlsoap.org/ws/2004/08/eventing/Unsubscribe";
+ public final static String UNSUBSCRIBE_RESPONSE_ACTION =
"http://schemas.xmlsoap.org/ws/2004/08/eventing/UnsubscribeResponse";
+ public final static String GET_STATUS_ACTION =
"http://schemas.xmlsoap.org/ws/2004/08/eventing/GetStatus";
+ public final static String GET_STATUS_RESPONSE_ACTION =
"http://schemas.xmlsoap.org/ws/2004/08/eventing/GetStatusResponse";
+ public final static String RENEW_ACTION =
"http://schemas.xmlsoap.org/ws/2004/08/eventing/Renew";
+ public final static String RENEW_RESPONSE_ACTION =
"http://schemas.xmlsoap.org/ws/2004/08/eventing/RenewResponse";
+ public final static String SUBSCRIPTION_END_ACTION =
"http://schemas.xmlsoap.org/ws/2004/08/eventing/SubscriptionEnd";
+
+ public final static String WSA_FAULT_ACTION =
"http://schemas.xmlsoap.org/ws/2004/08/addressing/fault";
+ public final static String WSA_ANONYMOUS_URI = WSA_CONSTANTS.getAnonymousURI();
+
+ // failures
+
+ public final static String DELIVERY_FAILURE =
"http://schemas.xmlsoap.org/ws/2004/08/eventing/DeliveryFailure";
+ public final static String SOURCE_SHUTTING_DOWN =
"http://schemas.xmlsoap.org/ws/2004/08/eventing/SourceShuttingDown";
+ public final static String SOURCE_CANCELING =
"http://schemas.xmlsoap.org/ws/2004/08/eventing/SourceCanceling";
+
+ public final static String CODE_UNABLE_TO_PROCESS =
"EventSourceUnableToProcess";
+ public final static String CODE_FILTER_NOT_SUPPORTED =
"FilteringNotSupported";
+ public final static String CODE_REQUESTED_FILTER_UNAVAILABLE =
"FilteringRequestedUnavailable";
+ public final static String CODE_INVALID_EXPIRATION_TIME =
"InvalidExpirationTime";
+ public final static String CODE_UNABLE_TO_RENEW = "UnableToRenew";
+ public final static String CODE_INVALID_MESSAGE = "InvalidMessage";
+
+ // default config
+
+ public final static String DISPATCHER_JNDI_NAME = "EventDispatcher";
+ public final static long MAX_LEASE_TIME = 1000 * 60 * 10L;
+ public final static long DEFAULT_LEASE = 1000 * 60 * 5L;
+
+ private static URI DELIVERY_PUSH_URI = null;
+ private static URI DIALECT_XPATH_URI = null;
+
+ private static URI SUBSCRIBE_ACTION_URI = null;
+
+ public final static URI buildURI(String uri)
+ {
+ try
+ {
+ return new URI(uri);
+ }
+ catch (URISyntaxException e)
+ {
+ throw new IllegalArgumentException(e.getMessage());
+ }
+ }
+
+ public static final URI getDefaultFilterDialect()
+ {
+ try
+ {
+ return new
URI("http://www.w3.org/TR/1999/REC-xpath-19991116");
+ }
+ catch (URISyntaxException e)
+ {
+ throw new WSException(e.getMessage());
+ }
+ }
+
+ public static final URI getDeliveryPush()
+ {
+ if (null == DELIVERY_PUSH_URI)
+ {
+ try
+ {
+ DELIVERY_PUSH_URI = new
URI("http://schemas.xmlsoap.org/ws/2004/08/eventing/DeliveryModes/Pu...;
+ }
+ catch (URISyntaxException e)
+ {
+ //
+ }
+ }
+ return DELIVERY_PUSH_URI;
+ }
+
+ public static URI getDialectXPath()
+ {
+ if (null == DIALECT_XPATH_URI)
+ {
+ try
+ {
+ DIALECT_XPATH_URI = new
URI("http://www.w3.org/TR/1999/REC-xpath-19991116");
+ }
+ catch (URISyntaxException e)
+ {
+ //
+ }
+ }
+
+ return DIALECT_XPATH_URI;
+ }
+
+ public static URI getSubscribeAction()
+ {
+ if (null == SUBSCRIBE_ACTION_URI)
+ {
+ try
+ {
+ SUBSCRIBE_ACTION_URI = new URI(SUBSCRIBE_ACTION);
+ }
+ catch (URISyntaxException e)
+ {
+ //
+ }
+ }
+
+ return SUBSCRIBE_ACTION_URI;
+ }
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/eventing/EventingEndpointBase.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/eventing/EventingEndpointBase.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/eventing/EventingEndpointBase.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/eventing/EventingEndpointBase.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -0,0 +1,99 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ws.extentions.eventing;
+
+
+// $Id$
+
+import java.net.URI;
+
+import javax.xml.namespace.QName;
+import javax.xml.rpc.soap.SOAPFaultException;
+import javax.xml.ws.addressing.AddressingBuilder;
+import javax.xml.ws.addressing.AddressingProperties;
+import javax.xml.ws.addressing.JAXWSAConstants;
+
+import org.jboss.ws.Constants;
+import org.jboss.ws.core.CommonMessageContext;
+import org.jboss.ws.core.soap.MessageContextAssociation;
+import org.jboss.ws.extentions.eventing.mgmt.SubscriptionManagerFactory;
+import org.jboss.ws.extentions.eventing.mgmt.SubscriptionManagerMBean;
+
+/**
+ * @author Heiko Braun, <heiko(a)openj.net>
+ * @since 13-Jan-2006
+ */
+public abstract class EventingEndpointBase
+{
+
+ private AddressingBuilder addrBuilder;
+
+ /**
+ * Retrieve the addressing properties associated with the request
+ * and verify them.
+ */
+ protected static AddressingProperties getAddrProperties()
+ {
+ CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
+ AddressingProperties inProps =
(AddressingProperties)msgContext.getProperty(JAXWSAConstants.SERVER_ADDRESSING_PROPERTIES_INBOUND);
+ assertAddrProperties(inProps);
+ return inProps;
+ }
+
+ protected void setReplyAction(URI replyAction)
+ {
+
+ }
+
+ /**
+ * Access local subscription manager service.
+ */
+ protected SubscriptionManagerMBean getSubscriptionManager()
+ {
+ SubscriptionManagerFactory factory = SubscriptionManagerFactory.getInstance();
+ SubscriptionManagerMBean subscriptionManager = factory.getSubscriptionManager();
+ return subscriptionManager;
+ }
+
+ protected AddressingBuilder getAddrBuilder()
+ {
+ if (null == addrBuilder)
+ addrBuilder = AddressingBuilder.getAddressingBuilder();
+ return addrBuilder;
+ }
+
+ /**
+ * Ensure that all required inbound properties are supplied in request.
+ * @param inProps
+ * @throws javax.xml.rpc.soap.SOAPFaultException
+ */
+ protected static void assertAddrProperties(AddressingProperties inProps) throws
SOAPFaultException
+ {
+ if (null == inProps)
+ throw new SOAPFaultException(Constants.SOAP11_FAULT_CODE_CLIENT,
"Addressing headers missing from request", "wse:InvalidMessage",
null);
+ }
+
+ public QName buildFaultQName(String elementName)
+ {
+ return new QName(EventingConstants.NS_EVENTING, elementName,
EventingConstants.PREFIX_EVENTING);
+ }
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/eventing/EventingService.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/eventing/EventingService.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/eventing/EventingService.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/eventing/EventingService.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -0,0 +1,34 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ws.extentions.eventing;
+
+// $Id$
+
+import javax.xml.rpc.Service;
+
+/**
+ * @author Heiko Braun, <heiko(a)openj.net>
+ * @since 24-Nov-2005
+ */
+public interface EventingService extends Service
+{
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/eventing/SubscriptionManagerEndpoint.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/eventing/SubscriptionManagerEndpoint.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/eventing/SubscriptionManagerEndpoint.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/eventing/SubscriptionManagerEndpoint.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -0,0 +1,49 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ws.extentions.eventing;
+
+// $Id$
+
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+
+import org.jboss.ws.extentions.eventing.element.RenewRequest;
+import org.jboss.ws.extentions.eventing.element.RenewResponse;
+import org.jboss.ws.extentions.eventing.element.StatusRequest;
+import org.jboss.ws.extentions.eventing.element.StatusResponse;
+import org.jboss.ws.extentions.eventing.element.UnsubscribeRequest;
+
+/**
+ * Subscription manager endpoint interface.
+ *
+ * @author Heiko Braun, <heiko(a)openj.net>
+ * @since 16-Dec-2005
+ */
+public interface SubscriptionManagerEndpoint extends Remote
+{
+
+ StatusResponse getStatus(StatusRequest request) throws RemoteException;
+
+ RenewResponse renew(RenewRequest request) throws RemoteException;
+
+ void unsubscribe(UnsubscribeRequest request) throws RemoteException;
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/eventing/SubscriptionManagerEndpointImpl.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/eventing/SubscriptionManagerEndpointImpl.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/eventing/SubscriptionManagerEndpointImpl.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/eventing/SubscriptionManagerEndpointImpl.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -0,0 +1,194 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ws.extentions.eventing;
+
+// $Id$
+
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.rmi.RemoteException;
+import java.util.Date;
+
+import javax.xml.namespace.QName;
+import javax.xml.rpc.soap.SOAPFaultException;
+import javax.xml.ws.addressing.AddressingProperties;
+import javax.xml.ws.addressing.JAXWSAConstants;
+import javax.xml.ws.addressing.ReferenceParameters;
+
+import org.jboss.ws.Constants;
+import org.jboss.ws.core.CommonMessageContext;
+import org.jboss.ws.core.soap.MessageContextAssociation;
+import org.jboss.ws.core.utils.DOMUtils;
+import org.jboss.ws.extentions.eventing.element.RenewRequest;
+import org.jboss.ws.extentions.eventing.element.RenewResponse;
+import org.jboss.ws.extentions.eventing.element.StatusRequest;
+import org.jboss.ws.extentions.eventing.element.StatusResponse;
+import org.jboss.ws.extentions.eventing.element.UnsubscribeRequest;
+import org.jboss.ws.extentions.eventing.mgmt.SubscriptionError;
+import org.w3c.dom.Element;
+
+/**
+ * SubscriptionManager endpoint implementation.<br>
+ * Delegates to {@link org.jboss.ws.extentions.eventing.mgmt.SubscriptionManager}
+ *
+ * @author Heiko Braun, <heiko(a)openj.net>
+ * @since 16-Dec-2005
+ */
+public class SubscriptionManagerEndpointImpl extends EventingEndpointBase
+ implements SubscriptionManagerEndpoint
+{
+
+ public static final QName IDQN = new
QName("http://schemas.xmlsoap.org/ws/2004/08/eventing", "Identifier",
"ns1");
+
+ /**
+ * Get the status of a subscription.
+ *
+ * @param request
+ * @return response including the lease time.
+ * @throws RemoteException
+ */
+ public StatusResponse getStatus(StatusRequest request) throws RemoteException
+ {
+ URI identifier = retrieveSubscriptionId();
+
+ try
+ {
+ Date leaseTime = getSubscriptionManager().getStatus(identifier);
+ StatusResponse response = new StatusResponse();
+ response.setExpires(leaseTime);
+
+ return response;
+ }
+ catch (SubscriptionError e)
+ {
+ throw new SOAPFaultException(buildFaultQName(e.getSubcode()), e.getReason(),
null, null);
+ }
+ }
+
+ /**
+ * Update the expiration for a subscription.
+ *
+ * @param request
+ * @return response inclduing the new lease time.
+ * @throws RemoteException
+ */
+ public RenewResponse renew(RenewRequest request) throws RemoteException
+ {
+
setReplyAction(EventingConstants.buildURI(EventingConstants.RENEW_RESPONSE_ACTION));
+ URI identifier = retrieveSubscriptionId();
+
+ try
+ {
+ Date newLeaseTime = getSubscriptionManager().renew(identifier,
request.getExpires());
+ RenewResponse response = new RenewResponse();
+ response.setExpires(newLeaseTime);
+
+ return response;
+ }
+ catch (SubscriptionError e)
+ {
+ throw new SOAPFaultException(buildFaultQName(e.getSubcode()), e.getReason(),
null, null);
+ }
+
+ }
+
+ /**
+ * Explicitly delete a subscription.
+ *
+ * @param request
+ * @throws RemoteException
+ */
+ public void unsubscribe(UnsubscribeRequest request) throws RemoteException
+ {
+
setReplyAction(EventingConstants.buildURI(EventingConstants.UNSUBSCRIBE_RESPONSE_ACTION));
+ URI identifier = retrieveSubscriptionId();
+
+ try
+ {
+ getSubscriptionManager().unsubscribe(identifier);
+ }
+ catch (SubscriptionError e)
+ {
+ throw new SOAPFaultException(buildFaultQName(e.getSubcode()), e.getReason(),
null, null);
+ }
+
+ }
+
+ private URI retrieveSubscriptionId()
+ {
+ URI subscriptionId = null;
+ CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
+ AddressingProperties addrProps =
(AddressingProperties)msgContext.getProperty(JAXWSAConstants.SERVER_ADDRESSING_PROPERTIES_INBOUND);
+
+ if (null == addrProps)
+ {
+ throw new SOAPFaultException(
+ Constants.SOAP11_FAULT_CODE_CLIENT,
+ "The message is not valid and cannot be processed:" +
+ "Cannot obtain addressing properties.",
+ null, null
+ );
+ }
+
+ ReferenceParameters refParams = addrProps.getReferenceParameters();
+ if (refParams != null)
+ {
+ for (Object obj : refParams.getElements())
+ {
+ if (obj instanceof Element)
+ {
+ Element el = (Element)obj;
+ QName qname = DOMUtils.getElementQName(el);
+ if (qname.equals(IDQN))
+ {
+ try
+ {
+ subscriptionId = new URI(DOMUtils.getTextContent(el));
+ break;
+ }
+ catch (URISyntaxException e)
+ {
+ throw new SOAPFaultException(
+ Constants.SOAP11_FAULT_CODE_CLIENT,
+ "The message is not valid and cannot be processed:"
+
+ "Invalid subscription id.",
+ null, null
+ );
+ }
+ }
+ }
+ }
+ }
+
+ if (null == subscriptionId)
+ {
+ throw new SOAPFaultException(
+ buildFaultQName(EventingConstants.CODE_INVALID_MESSAGE),
+ "The message is not valid and cannot be processed."
+ + "Cannot obtain subscription id.",
+ null, null
+ );
+ }
+
+ return subscriptionId;
+ }
+}
Copied: branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/eventing/deployment
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/eventing/deployment)
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/eventing/deployment/EventingEndpoint.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/eventing/deployment/EventingEndpoint.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/eventing/deployment/EventingEndpoint.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -1,13 +1,13 @@
-package org.jboss.ws.extras.eventing.deployment;
+package org.jboss.ws.extentions.eventing.deployment;
import org.jboss.ws.WSException;
import org.jboss.ws.core.metadata.umdm.ServerEndpointMetaData;
import org.jboss.ws.core.server.ServiceEndpoint;
import org.jboss.ws.core.server.ServiceEndpointInfo;
-import org.jboss.ws.extras.eventing.EventingConstants;
-import org.jboss.ws.extras.eventing.metadata.EventingEpMetaExt;
-import org.jboss.ws.extras.eventing.mgmt.SubscriptionManagerFactory;
-import org.jboss.ws.extras.eventing.mgmt.SubscriptionManagerMBean;
+import org.jboss.ws.extentions.eventing.EventingConstants;
+import org.jboss.ws.extentions.eventing.metadata.EventingEpMetaExt;
+import org.jboss.ws.extentions.eventing.mgmt.SubscriptionManagerFactory;
+import org.jboss.ws.extentions.eventing.mgmt.SubscriptionManagerMBean;
/**
* EventingEndpointLifecycle is responsible to create event sources
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/eventing/deployment/EventingEndpointDI.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/eventing/deployment/EventingEndpointDI.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/eventing/deployment/EventingEndpointDI.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -1,4 +1,4 @@
-package org.jboss.ws.extras.eventing.deployment;
+package org.jboss.ws.extentions.eventing.deployment;
import java.io.IOException;
Copied: branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/eventing/element
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/eventing/element)
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/eventing/element/DeliveryType.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/eventing/element/DeliveryType.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/eventing/element/DeliveryType.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
*/
-package org.jboss.ws.extras.eventing.element;
+package org.jboss.ws.extentions.eventing.element;
// $Id$
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/eventing/element/EndpointReference.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/eventing/element/EndpointReference.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/eventing/element/EndpointReference.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
*/
-package org.jboss.ws.extras.eventing.element;
+package org.jboss.ws.extentions.eventing.element;
// $Id$
@@ -30,8 +30,8 @@
import javax.xml.soap.SOAPFactory;
import org.jboss.ws.core.soap.SOAPFactoryImpl;
-import org.jboss.ws.extras.addressing.EndpointReferenceImpl;
-import org.jboss.ws.extras.eventing.EventingConstants;
+import org.jboss.ws.extentions.addressing.EndpointReferenceImpl;
+import org.jboss.ws.extentions.eventing.EventingConstants;
/**
* Simplified endpoint representation.
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/eventing/element/FilterType.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/eventing/element/FilterType.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/eventing/element/FilterType.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
*/
-package org.jboss.ws.extras.eventing.element;
+package org.jboss.ws.extentions.eventing.element;
// $Id$
@@ -37,7 +37,7 @@
* <br>
* For further information see
<
code>http://www.w3.org/TR/xpath#predicates</code>.
*
- * @see org.jboss.ws.extras.eventing.mgmt.Filter
+ * @see org.jboss.ws.extentions.eventing.mgmt.Filter
*
* @author Heiko Braun, <heiko(a)openj.net>
* @since 24-Nov-2005
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/eventing/element/MetaData.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/eventing/element/MetaData.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/eventing/element/MetaData.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
*/
-package org.jboss.ws.extras.eventing.element;
+package org.jboss.ws.extentions.eventing.element;
// $Id$
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/eventing/element/ReferenceParameters.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/eventing/element/ReferenceParameters.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/eventing/element/ReferenceParameters.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
*/
-package org.jboss.ws.extras.eventing.element;
+package org.jboss.ws.extentions.eventing.element;
// $Id$
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/eventing/element/RenewRequest.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/eventing/element/RenewRequest.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/eventing/element/RenewRequest.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
*/
-package org.jboss.ws.extras.eventing.element;
+package org.jboss.ws.extentions.eventing.element;
// $Id$
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/eventing/element/RenewResponse.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/eventing/element/RenewResponse.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/eventing/element/RenewResponse.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
*/
-package org.jboss.ws.extras.eventing.element;
+package org.jboss.ws.extentions.eventing.element;
// $Id$
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/eventing/element/StatusRequest.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/eventing/element/StatusRequest.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/eventing/element/StatusRequest.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
*/
-package org.jboss.ws.extras.eventing.element;
+package org.jboss.ws.extentions.eventing.element;
import javax.xml.soap.SOAPElement;
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/eventing/element/StatusResponse.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/eventing/element/StatusResponse.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/eventing/element/StatusResponse.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
*/
-package org.jboss.ws.extras.eventing.element;
+package org.jboss.ws.extentions.eventing.element;
// $Id$
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/eventing/element/SubscribeRequest.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/eventing/element/SubscribeRequest.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/eventing/element/SubscribeRequest.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
*/
-package org.jboss.ws.extras.eventing.element;
+package org.jboss.ws.extentions.eventing.element;
// $Id$
@@ -50,7 +50,7 @@
this.endTo = endTo;
}
- public org.jboss.ws.extras.eventing.element.DeliveryType getDelivery()
+ public org.jboss.ws.extentions.eventing.element.DeliveryType getDelivery()
{
return delivery;
}
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/eventing/element/SubscribeResponse.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/eventing/element/SubscribeResponse.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/eventing/element/SubscribeResponse.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
*/
-package org.jboss.ws.extras.eventing.element;
+package org.jboss.ws.extentions.eventing.element;
// $Id$
@@ -31,7 +31,7 @@
*/
public class SubscribeResponse
{
- private org.jboss.ws.extras.eventing.element.EndpointReference subscriptionManager;
+ private org.jboss.ws.extentions.eventing.element.EndpointReference
subscriptionManager;
private Date expires;
public EndpointReference getSubscriptionManager()
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/eventing/element/SubscriptionEndRequest.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/eventing/element/SubscriptionEndRequest.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/eventing/element/SubscriptionEndRequest.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -19,13 +19,13 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
*/
-package org.jboss.ws.extras.eventing.element;
+package org.jboss.ws.extentions.eventing.element;
// $Id$
import java.net.URI;
-import org.jboss.ws.extras.addressing.EndpointReferenceImpl;
+import org.jboss.ws.extentions.addressing.EndpointReferenceImpl;
/**
* @author Heiko Braun, <heiko(a)openj.net>
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/eventing/element/UnsubscribeRequest.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/eventing/element/UnsubscribeRequest.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/eventing/element/UnsubscribeRequest.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
*/
-package org.jboss.ws.extras.eventing.element;
+package org.jboss.ws.extentions.eventing.element;
// $Id$
Copied: branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/eventing/metadata
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/eventing/metadata)
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/eventing/metadata/EventingEpMetaExt.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/eventing/metadata/EventingEpMetaExt.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/eventing/metadata/EventingEpMetaExt.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -1,4 +1,4 @@
-package org.jboss.ws.extras.eventing.metadata;
+package org.jboss.ws.extentions.eventing.metadata;
import java.net.URI;
import java.net.URISyntaxException;
Copied: branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/eventing/mgmt (from
rev 1589, branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/eventing/mgmt)
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/eventing/mgmt/DispatchJob.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/eventing/mgmt/DispatchJob.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/eventing/mgmt/DispatchJob.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
*/
-package org.jboss.ws.extras.eventing.mgmt;
+package org.jboss.ws.extentions.eventing.mgmt;
// $Id$
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/eventing/mgmt/DispatcherDelegate.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/eventing/mgmt/DispatcherDelegate.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/eventing/mgmt/DispatcherDelegate.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -1,4 +1,4 @@
-package org.jboss.ws.extras.eventing.mgmt;
+package org.jboss.ws.extentions.eventing.mgmt;
import java.net.URI;
import java.util.Properties;
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/eventing/mgmt/DispatcherFactory.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/eventing/mgmt/DispatcherFactory.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/eventing/mgmt/DispatcherFactory.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -1,4 +1,4 @@
-package org.jboss.ws.extras.eventing.mgmt;
+package org.jboss.ws.extentions.eventing.mgmt;
import java.util.Hashtable;
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/eventing/mgmt/EventDispatcher.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/eventing/mgmt/EventDispatcher.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/eventing/mgmt/EventDispatcher.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
*/
-package org.jboss.ws.extras.eventing.mgmt;
+package org.jboss.ws.extentions.eventing.mgmt;
// $Id$
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/eventing/mgmt/EventSource.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/eventing/mgmt/EventSource.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/eventing/mgmt/EventSource.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
*/
-package org.jboss.ws.extras.eventing.mgmt;
+package org.jboss.ws.extentions.eventing.mgmt;
// $Id$
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/eventing/mgmt/EventingBuilder.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/eventing/mgmt/EventingBuilder.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/eventing/mgmt/EventingBuilder.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -1,11 +1,11 @@
-package org.jboss.ws.extras.eventing.mgmt;
+package org.jboss.ws.extentions.eventing.mgmt;
import java.net.URI;
import java.net.URISyntaxException;
import org.jboss.ws.WSException;
-import org.jboss.ws.extras.eventing.EventingConstants;
-import org.jboss.ws.extras.eventing.deployment.EventingEndpointDI;
+import org.jboss.ws.extentions.eventing.EventingConstants;
+import org.jboss.ws.extentions.eventing.deployment.EventingEndpointDI;
/**
* @author Heiko Braun, <heiko(a)openj.net>
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/eventing/mgmt/Filter.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/eventing/mgmt/Filter.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/eventing/mgmt/Filter.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
*/
-package org.jboss.ws.extras.eventing.mgmt;
+package org.jboss.ws.extentions.eventing.mgmt;
// $Id$
@@ -28,7 +28,7 @@
/**
* A local filter representation.
*
- * @see org.jboss.ws.extras.eventing.element.FilterType
+ * @see org.jboss.ws.extentions.eventing.element.FilterType
*
* @author Heiko Braun, <heiko(a)openj.net>
* @since 08-Dec-2005
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/eventing/mgmt/Subscription.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/eventing/mgmt/Subscription.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/eventing/mgmt/Subscription.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
*/
-package org.jboss.ws.extras.eventing.mgmt;
+package org.jboss.ws.extentions.eventing.mgmt;
// $Id$
@@ -37,8 +37,8 @@
import org.jboss.logging.Logger;
import org.jboss.ws.core.soap.SOAPConnectionImpl;
import org.jboss.ws.core.utils.DOMWriter;
-import org.jboss.ws.extras.eventing.EventingConstants;
-import org.jboss.ws.extras.eventing.element.EndpointReference;
+import org.jboss.ws.extentions.eventing.EventingConstants;
+import org.jboss.ws.extentions.eventing.element.EndpointReference;
import org.w3c.dom.Element;
/**
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/eventing/mgmt/SubscriptionError.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/eventing/mgmt/SubscriptionError.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/eventing/mgmt/SubscriptionError.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -1,4 +1,4 @@
-package org.jboss.ws.extras.eventing.mgmt;
+package org.jboss.ws.extentions.eventing.mgmt;
/**
* @author Heiko Braun, <heiko(a)openj.net>
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/eventing/mgmt/SubscriptionManager.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/eventing/mgmt/SubscriptionManager.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/eventing/mgmt/SubscriptionManager.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
*/
-package org.jboss.ws.extras.eventing.mgmt;
+package org.jboss.ws.extentions.eventing.mgmt;
// $Id$
@@ -49,10 +49,10 @@
import org.jboss.ws.WSException;
import org.jboss.ws.core.utils.ObjectNameFactory;
import org.jboss.ws.core.utils.UUIDGenerator;
-import org.jboss.ws.extras.eventing.EventingConstants;
-import org.jboss.ws.extras.eventing.deployment.EventingEndpointDI;
-import org.jboss.ws.extras.eventing.element.EndpointReference;
-import org.jboss.ws.extras.eventing.element.ReferenceParameters;
+import org.jboss.ws.extentions.eventing.EventingConstants;
+import org.jboss.ws.extentions.eventing.deployment.EventingEndpointDI;
+import org.jboss.ws.extentions.eventing.element.EndpointReference;
+import org.jboss.ws.extentions.eventing.element.ReferenceParameters;
import org.w3c.dom.Element;
/**
@@ -73,9 +73,9 @@
* <p>
* Currently only event push is supported.
*
- * @see org.jboss.ws.extras.eventing.EventSourceEndpoint
- * @see org.jboss.ws.extras.eventing.SubscriptionManagerEndpoint
- * @see org.jboss.ws.extras.eventing.element.FilterType
+ * @see org.jboss.ws.extentions.eventing.EventSourceEndpoint
+ * @see org.jboss.ws.extentions.eventing.SubscriptionManagerEndpoint
+ * @see org.jboss.ws.extentions.eventing.element.FilterType
*
* @author Heiko Braun, <heiko(a)openj.net>
* @since 02-Dec-2005
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/eventing/mgmt/SubscriptionManagerFactory.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/eventing/mgmt/SubscriptionManagerFactory.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/eventing/mgmt/SubscriptionManagerFactory.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -1,4 +1,4 @@
-package org.jboss.ws.extras.eventing.mgmt;
+package org.jboss.ws.extentions.eventing.mgmt;
import org.jboss.kernel.spi.registry.KernelRegistry;
import org.jboss.kernel.spi.registry.KernelRegistryEntry;
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/eventing/mgmt/SubscriptionManagerMBean.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/eventing/mgmt/SubscriptionManagerMBean.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/eventing/mgmt/SubscriptionManagerMBean.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -19,15 +19,15 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
*/
-package org.jboss.ws.extras.eventing.mgmt;
+package org.jboss.ws.extentions.eventing.mgmt;
// $Id$
import java.net.URI;
import java.util.Date;
-import org.jboss.ws.extras.eventing.deployment.EventingEndpointDI;
-import org.jboss.ws.extras.eventing.element.EndpointReference;
+import org.jboss.ws.extentions.eventing.deployment.EventingEndpointDI;
+import org.jboss.ws.extentions.eventing.element.EndpointReference;
import org.w3c.dom.Element;
/**
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/eventing/mgmt/SubscriptionTicket.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/eventing/mgmt/SubscriptionTicket.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/eventing/mgmt/SubscriptionTicket.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -19,14 +19,14 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
*/
-package org.jboss.ws.extras.eventing.mgmt;
+package org.jboss.ws.extentions.eventing.mgmt;
// $Id$
import java.net.URI;
import java.util.Date;
-import org.jboss.ws.extras.eventing.element.EndpointReference;
+import org.jboss.ws.extentions.eventing.element.EndpointReference;
/**
* @author Heiko Braun, <heiko(a)openj.net>
@@ -51,7 +51,7 @@
return identifier;
}
- public org.jboss.ws.extras.eventing.element.EndpointReference
getSubscriptionManager()
+ public org.jboss.ws.extentions.eventing.element.EndpointReference
getSubscriptionManager()
{
return subscriptionManager;
}
Copied: branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/policy (from rev
1589, branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/policy)
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/policy/Policy.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/policy/Policy.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/policy/Policy.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
*/
-package org.jboss.ws.extras.policy;
+package org.jboss.ws.extentions.policy;
// $Id$
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/policy/PolicyAlternative.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/policy/PolicyAlternative.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/policy/PolicyAlternative.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
*/
-package org.jboss.ws.extras.policy;
+package org.jboss.ws.extentions.policy;
//$Id$
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/policy/PolicyAssertion.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/policy/PolicyAssertion.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/policy/PolicyAssertion.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
*/
-package org.jboss.ws.extras.policy;
+package org.jboss.ws.extentions.policy;
//$Id$
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/policy/PolicyFactory.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/policy/PolicyFactory.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/policy/PolicyFactory.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
*/
-package org.jboss.ws.extras.policy;
+package org.jboss.ws.extentions.policy;
// $Id$
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/BinarySecurityTokenValidator.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/security/BinarySecurityTokenValidator.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/security/BinarySecurityTokenValidator.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/BinarySecurityTokenValidator.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -0,0 +1,48 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+package org.jboss.ws.extentions.security;
+
+import org.jboss.ws.extentions.security.element.BinarySecurityToken;
+import org.jboss.ws.extentions.security.element.X509Token;
+
+
+/**
+ * <code>BinarySecurityTokenValidator</code> is responsible for validating
BSTs
+ *
+ * @author <a href="mailto:jason.greene@jboss.com">Jason T.
Greene</a>
+ * @version $Revision$
+ */
+public class BinarySecurityTokenValidator
+{
+ private SecurityStore store;
+
+ public BinarySecurityTokenValidator(SecurityStore store)
+ {
+ this.store = store;
+ }
+
+ public void validateToken(BinarySecurityToken token) throws WSSecurityException
+ {
+ if (token instanceof X509Token)
+ store.validateCertificate(((X509Token)token).getCert());
+ }
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/Constants.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/security/Constants.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/security/Constants.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/Constants.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -0,0 +1,70 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+package org.jboss.ws.extentions.security;
+
+import org.apache.xml.security.utils.EncryptionConstants;
+
+
+/**
+ * @author Jason T. Greene
+ * @version $Id$
+ */
+public class Constants
+{
+ public static final String WSS_SOAP_NS =
"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0";
+
+ public static final String JBOSS_WSSE_NS =
"http://www.jboss.com/jbossws/ws-security";
+
+ public static final String JBOSS_WSSE_PREFIX = "jboss-wsse";
+
+ public static final String WSSE_PREFIX = "wsse";
+
+ public static final String WSSE_NS =
"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd";
+
+ public static final String WSU_PREFIX = "wsu";
+
+ public static final String WSU_NS =
"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd";
+
+ public static final String XML_SIGNATURE_NS =
org.apache.xml.security.utils.Constants.SignatureSpecNS;
+
+ public static final String XML_ENCRYPTION_NS = EncryptionConstants.EncryptionSpecNS;
+
+ public static final String XML_ENCRYPTION_PREFIX = "xenc";
+
+ public static final String ID = "Id";
+
+ public static final String WSU_ID = WSU_PREFIX + ":" + ID;
+
+ public static final String BASE64_ENCODING_TYPE = WSS_SOAP_NS +
"#Base64Binary";
+
+ public static final String WSSE_HEADER = WSSE_PREFIX + ":Security";
+
+ public static final String XMLNS_NS = "http://www.w3.org/2000/xmlns/";
+
+ public static final String XENC_DATAREFERENCE = "DataReference";
+
+ public static final String XENC_REFERENCELIST = "ReferenceList";
+
+ public static final String XENC_ELEMENT_TYPE = EncryptionConstants.TYPE_ELEMENT;
+
+ public static final String XENC_CONTENT_TYPE = EncryptionConstants.TYPE_CONTENT;
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/DecodingOperation.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/security/DecodingOperation.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/security/DecodingOperation.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/DecodingOperation.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -0,0 +1,40 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+package org.jboss.ws.extentions.security;
+
+import java.util.Collection;
+
+import org.jboss.ws.extentions.security.element.SecurityProcess;
+import org.w3c.dom.Document;
+
+/**
+ * <code>DecodingOperation</code> represents an operation that is applied to
a
+ * WS-Security encoded message to both convert and verify the contents of the
+ * message.
+ *
+ * @author <a href="mailto:jason.greene@jboss.com">Jason T.
Greene</a>
+ * @version $Revision$
+ */
+public interface DecodingOperation extends Operation
+{
+ public Collection<String> process(Document message, SecurityProcess process)
throws WSSecurityException;
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/DecryptionOperation.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/security/DecryptionOperation.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/security/DecryptionOperation.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/DecryptionOperation.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -0,0 +1,145 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+package org.jboss.ws.extentions.security;
+
+import java.util.Collection;
+import java.util.HashSet;
+
+import javax.crypto.SecretKey;
+
+import org.apache.xml.security.encryption.XMLCipher;
+import org.apache.xml.security.encryption.XMLEncryptionException;
+import org.jboss.ws.extentions.security.element.EncryptedKey;
+import org.jboss.ws.extentions.security.element.ReferenceList;
+import org.jboss.ws.extentions.security.element.SecurityHeader;
+import org.jboss.ws.extentions.security.element.SecurityProcess;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+public class DecryptionOperation implements DecodingOperation
+{
+
+ private SecurityHeader header;
+
+ private SecurityStore store;
+
+ public DecryptionOperation(SecurityHeader header, SecurityStore store) throws
WSSecurityException
+ {
+ this.header = header;
+ this.store = store;
+ }
+
+ private boolean isContent(Element element)
+ {
+ return Constants.XENC_CONTENT_TYPE.equals(element.getAttribute("Type"));
+ }
+
+ private String getEncryptionAlgorithm(Element element) throws WSSecurityException
+ {
+ element = Util.findElement(element, "EncryptionMethod",
Constants.XML_ENCRYPTION_NS);
+ if (element == null)
+ throw new InvalidSecurityHeaderException("Encrypted element corrupted, no
encryption method");
+
+ String alg = element.getAttribute("Algorithm");
+ if (alg == null || alg.length() == 0)
+ throw new InvalidSecurityHeaderException("Encrypted element corrupted, no
algorithm specified");
+
+ return alg;
+ }
+
+ private String decryptElement(Element element, SecretKey key) throws
WSSecurityException
+ {
+ Element previous;
+ boolean parent;
+ boolean isContent;
+
+ // We find the decrypted element by traversing to the element before the
+ // encrypted data. If there is no sibling before the encrypted data, then
+ // we traverse to the parent.
+ // "Now take a step back . . . and then a step forward . . . and then a
+ // step back . . . and then we're cha-chaing." -Chris Knight
+ parent = isContent = isContent(element);
+ if (parent)
+ {
+ previous = (Element) element.getParentNode();
+ }
+ else
+ {
+ previous = Util.getPreviousSiblingElement(element);
+ if (previous == null)
+ {
+ parent = true;
+ previous = (Element) element.getParentNode();
+ }
+ }
+
+ String alg = getEncryptionAlgorithm(element);
+ try
+ {
+ XMLCipher cipher = XMLCipher.getInstance(alg);
+ cipher.init(XMLCipher.DECRYPT_MODE, key);
+ cipher.doFinal(element.getOwnerDocument(), element);
+ }
+ catch (XMLEncryptionException e)
+ {
+ throw new FailedCheckException("Decryption was invalid.");
+ }
+ catch (Exception e)
+ {
+ throw new WSSecurityException("Could not decrypt element: " +
e.getMessage(), e);
+ }
+
+ if (isContent)
+ return Util.getWsuId(previous);
+
+ Element decrypted = (parent) ? Util.getFirstChildElement(previous) :
Util.getNextSiblingElement(previous);
+ if (decrypted == null)
+ return null;
+
+ return Util.getWsuId(decrypted);
+ }
+
+ private boolean isEncryptedData(Element element)
+ {
+ return "EncryptedData".equals(element.getLocalName()) &&
Constants.XML_ENCRYPTION_NS.equals(element.getNamespaceURI());
+ }
+
+ public Collection<String> process(Document message, SecurityProcess process)
throws WSSecurityException
+ {
+ Collection<String> ids = new HashSet<String>();
+ EncryptedKey key = (EncryptedKey) process;
+ ReferenceList list = key.getReferenceList();
+ for (String uri : list.getAllReferences())
+ {
+ Element element = Util.findElementByWsuId(message.getDocumentElement(), uri);
+ if (element == null)
+ throw new WSSecurityException("A reference list refered to an element
that was not found: " + uri);
+
+ if (!isEncryptedData(element))
+ throw new WSSecurityException("Malformed reference list, a non encrypted
data element was referenced: " + uri);
+
+ ids.add(decryptElement(element, key.getSecretKey()));
+ }
+
+ return ids;
+ }
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/EncodingOperation.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/security/EncodingOperation.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/security/EncodingOperation.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/EncodingOperation.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -0,0 +1,39 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+package org.jboss.ws.extentions.security;
+
+import java.util.List;
+
+import org.w3c.dom.Document;
+
+/**
+ * <code>EncodingOperation</code> represents an encoding operation that is
+ * applied to a standard SOAP message, transforming it into a WS-Security
+ * encoded message.
+ *
+ * @author <a href="mailto:jason.greene@jboss.com">Jason T.
Greene</a>
+ * @version $Revision$
+ */
+public interface EncodingOperation extends Operation
+{
+ public void process(Document message, List<Target> targets, String alias, String
credential, String algorithm) throws WSSecurityException;
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/EncryptionOperation.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/security/EncryptionOperation.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/security/EncryptionOperation.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/EncryptionOperation.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -0,0 +1,172 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+package org.jboss.ws.extentions.security;
+
+import java.security.NoSuchAlgorithmException;
+import java.security.cert.X509Certificate;
+import java.util.HashMap;
+import java.util.List;
+
+import javax.crypto.KeyGenerator;
+import javax.crypto.SecretKey;
+import javax.xml.namespace.QName;
+
+import org.apache.xml.security.encryption.EncryptedData;
+import org.apache.xml.security.encryption.XMLCipher;
+import org.apache.xml.security.exceptions.XMLSecurityException;
+import org.jboss.util.NotImplementedException;
+import org.jboss.ws.extentions.security.element.EncryptedKey;
+import org.jboss.ws.extentions.security.element.ReferenceList;
+import org.jboss.ws.extentions.security.element.SecurityHeader;
+import org.jboss.ws.extentions.security.element.X509Token;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+public class EncryptionOperation implements EncodingOperation
+{
+ private SecurityHeader header;
+
+ private SecurityStore store;
+
+ private static class Algorithm
+ {
+ Algorithm(String jceName, String xmlName, int size)
+ {
+ this.jceName = jceName;
+ this.xmlName = xmlName;
+ this.size = size;
+ }
+
+ public String jceName;
+ public String xmlName;
+ public int size;
+ }
+
+ private static HashMap<String, Algorithm> algorithms;
+
+ private static final String DEFAULT_ALGORITHM = "aes-128";
+
+ static
+ {
+ algorithms = new HashMap<String, Algorithm>(4);
+ algorithms.put("aes-128", new Algorithm("AES",
XMLCipher.AES_128, 128));
+ algorithms.put("aes-192", new Algorithm("AES",
XMLCipher.AES_192, 192));
+ algorithms.put("aes-256", new Algorithm("AES",
XMLCipher.AES_256, 256));
+ algorithms.put("tripledes", new Algorithm("TripleDes",
XMLCipher.TRIPLEDES, 168));
+ }
+
+ public EncryptionOperation(SecurityHeader header, SecurityStore store) throws
WSSecurityException
+ {
+ this.header = header;
+ this.store = store;
+ }
+
+ private void processTarget(XMLCipher cipher, Document message, Target target,
ReferenceList list, SecretKey key) throws WSSecurityException
+ {
+ if (!(target instanceof QNameTarget))
+ throw new NotImplementedException();
+
+ QName name = ((QNameTarget)target).getName();
+
+ Element element = Util.findElement(message.getDocumentElement(), name);
+ if (element == null)
+ throw new RuntimeException("Could not find element");
+
+ // Ensure that the element has an id, so that encryption verification can be
performed
+ Util.assignWsuId(element);
+
+ try
+ {
+ cipher.init(XMLCipher.ENCRYPT_MODE, key);
+ EncryptedData encrypted = cipher.getEncryptedData();
+ String id = Util.generateId("encrypted");
+ encrypted.setId(id);
+ list.add(id);
+ cipher.doFinal(message, element, target.isContent());
+ }
+ catch (Exception e)
+ {
+ throw new WSSecurityException("Error encrypting target: " + name, e);
+ }
+ }
+
+ public SecretKey getSecretKey(String algorithm) throws WSSecurityException
+ {
+ Algorithm alg = algorithms.get(algorithm);
+
+ try
+ {
+ KeyGenerator kgen = KeyGenerator.getInstance(alg.jceName);
+ kgen.init(alg.size);
+ return kgen.generateKey();
+ }
+ catch (NoSuchAlgorithmException e)
+ {
+ throw new WSSecurityException(e.getMessage());
+ }
+ }
+
+ public void process(Document message, List<Target> targets, String alias, String
credential, String algorithm) throws WSSecurityException
+ {
+ if (! algorithms.containsKey(algorithm))
+ algorithm = DEFAULT_ALGORITHM;
+
+ SecretKey secretKey = getSecretKey(algorithm);
+ XMLCipher cipher;
+ try
+ {
+ cipher = XMLCipher.getInstance(algorithms.get(algorithm).xmlName);
+ cipher.init(XMLCipher.ENCRYPT_MODE, secretKey);
+ }
+ catch (XMLSecurityException e)
+ {
+ throw new WSSecurityException("Error initializing xml cipher" +
e.getMessage(), e);
+ }
+
+ ReferenceList list = new ReferenceList();
+
+ if (targets == null || targets.size() == 0)
+ {
+ // By default we encrypt the content of the body element
+ String namespace = message.getDocumentElement().getNamespaceURI();
+ processTarget(cipher, message, new QNameTarget(new QName(namespace,
"Body"), true), list, secretKey);
+ }
+ else
+ {
+ for (Target target : targets)
+ processTarget(cipher, message, target, list, secretKey);
+ }
+
+ X509Certificate cert = store.getCertificate(alias);
+ X509Token token = (X509Token) header.getSharedToken(cert);
+
+ // Can we reuse an existing token?
+ if (token == null)
+ {
+ token = new X509Token(cert, message);
+ header.addToken(token);
+ }
+
+ EncryptedKey eKey = new EncryptedKey(message, secretKey, token, list);
+ header.addSecurityProcess(eKey);
+ }
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/FailedAuthenticationException.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/security/FailedAuthenticationException.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/security/FailedAuthenticationException.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/FailedAuthenticationException.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -0,0 +1,64 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+package org.jboss.ws.extentions.security;
+
+import javax.xml.namespace.QName;
+
+
+/**
+ * @author <a href="mailto:jason.greene@jboss.com">Jason T.
Greene</a>
+ * @version $Revision$
+ */
+public class FailedAuthenticationException extends WSSecurityException
+{
+ public static final QName faultCode = new QName(Constants.WSSE_NS,
"FailedAuthentication", Constants.WSSE_PREFIX);
+
+ public static final String faultString = "The security token could not be
authenticated or authorized.";
+
+ public FailedAuthenticationException()
+ {
+ super(faultString);
+ setFaultCode(faultCode);
+ setFaultString(faultString);
+ }
+
+ public FailedAuthenticationException(Throwable cause)
+ {
+ super(faultString);
+ setFaultCode(faultCode);
+ setFaultString(faultString);
+ }
+
+ public FailedAuthenticationException(String message)
+ {
+ super(message);
+ setFaultCode(faultCode);
+ setFaultString(message);
+ }
+
+ public FailedAuthenticationException(String message, Throwable cause)
+ {
+ super(message, cause);
+ setFaultCode(faultCode);
+ setFaultString(message);
+ }
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/FailedCheckException.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/security/FailedCheckException.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/security/FailedCheckException.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/FailedCheckException.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -0,0 +1,64 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+package org.jboss.ws.extentions.security;
+
+import javax.xml.namespace.QName;
+
+
+/**
+ * @author <a href="mailto:jason.greene@jboss.com">Jason T.
Greene</a>
+ * @version $Revision$
+ */
+public class FailedCheckException extends WSSecurityException
+{
+ public static final QName faultCode = new QName(Constants.WSSE_NS,
"FailedCheck", Constants.WSSE_PREFIX);
+
+ public static final String faultString = "The signature or decryption was
invlaid.";
+
+ public FailedCheckException()
+ {
+ super(faultString);
+ setFaultCode(faultCode);
+ setFaultString(faultString);
+ }
+
+ public FailedCheckException(Throwable cause)
+ {
+ super(faultString);
+ setFaultCode(faultCode);
+ setFaultString(faultString);
+ }
+
+ public FailedCheckException(String message)
+ {
+ super(message);
+ setFaultCode(faultCode);
+ setFaultString(message);
+ }
+
+ public FailedCheckException(String message, Throwable cause)
+ {
+ super(message, cause);
+ setFaultCode(faultCode);
+ setFaultString(message);
+ }
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/InvalidSecurityHeaderException.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/security/InvalidSecurityHeaderException.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/security/InvalidSecurityHeaderException.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/InvalidSecurityHeaderException.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -0,0 +1,64 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+package org.jboss.ws.extentions.security;
+
+import javax.xml.namespace.QName;
+
+
+/**
+ * @author <a href="mailto:jason.greene@jboss.com">Jason T.
Greene</a>
+ * @version $Revision$
+ */
+public class InvalidSecurityHeaderException extends WSSecurityException
+{
+ public static final QName faultCode = new QName(Constants.WSSE_NS,
"InvalidSecurity", Constants.WSSE_PREFIX);
+
+ public static final String faultString = "An error was dicovered processing the
<wsse:Security> header.";
+
+ public InvalidSecurityHeaderException()
+ {
+ super(faultString);
+ setFaultCode(faultCode);
+ setFaultString(faultString);
+ }
+
+ public InvalidSecurityHeaderException(Throwable cause)
+ {
+ super(faultString);
+ setFaultCode(faultCode);
+ setFaultString(faultString);
+ }
+
+ public InvalidSecurityHeaderException(String message)
+ {
+ super(message);
+ setFaultCode(faultCode);
+ setFaultString(message);
+ }
+
+ public InvalidSecurityHeaderException(String message, Throwable cause)
+ {
+ super(message, cause);
+ setFaultCode(faultCode);
+ setFaultString(message);
+ }
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/InvalidSecurityTokenException.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/security/InvalidSecurityTokenException.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/security/InvalidSecurityTokenException.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/InvalidSecurityTokenException.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -0,0 +1,64 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+package org.jboss.ws.extentions.security;
+
+import javax.xml.namespace.QName;
+
+
+/**
+ * @author <a href="mailto:jason.greene@jboss.com">Jason T.
Greene</a>
+ * @version $Revision$
+ */
+public class InvalidSecurityTokenException extends WSSecurityException
+{
+ public static final QName faultCode = new QName(Constants.WSSE_NS,
"InvlalidSecurityToken", Constants.WSSE_PREFIX);
+
+ public static final String faultString = "An invlaid security token was
provided.";
+
+ public InvalidSecurityTokenException()
+ {
+ super(faultString);
+ setFaultCode(faultCode);
+ setFaultString(faultString);
+ }
+
+ public InvalidSecurityTokenException(Throwable cause)
+ {
+ super(faultString);
+ setFaultCode(faultCode);
+ setFaultString(faultString);
+ }
+
+ public InvalidSecurityTokenException(String message)
+ {
+ super(message);
+ setFaultCode(faultCode);
+ setFaultString(message);
+ }
+
+ public InvalidSecurityTokenException(String message, Throwable cause)
+ {
+ super(message, cause);
+ setFaultCode(faultCode);
+ setFaultString(message);
+ }
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/KeyResolver.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/security/KeyResolver.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/security/KeyResolver.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/KeyResolver.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -0,0 +1,166 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+package org.jboss.ws.extentions.security;
+
+import java.security.PrivateKey;
+import java.security.PublicKey;
+import java.security.cert.X509Certificate;
+import java.util.HashMap;
+
+import org.apache.xml.security.keys.KeyInfo;
+import org.jboss.util.NotImplementedException;
+import org.jboss.ws.extentions.security.element.BinarySecurityToken;
+import org.jboss.ws.extentions.security.element.DirectReference;
+import org.jboss.ws.extentions.security.element.KeyIdentifier;
+import org.jboss.ws.extentions.security.element.Reference;
+import org.jboss.ws.extentions.security.element.SecurityTokenReference;
+import org.jboss.ws.extentions.security.element.X509IssuerSerial;
+import org.jboss.ws.extentions.security.element.X509Token;
+import org.w3c.dom.Element;
+
+
+/**
+ * <code>KeyResolver</code> is responsible for locating security tokens
+ * within a WS-Security message.
+ *
+ * @author <a href="mailto:jason.greene@jboss.com">Jason T.
Greene</a>
+ * @version $Revision$
+ */
+public class KeyResolver
+{
+ private HashMap<String, BinarySecurityToken> tokenCache = new HashMap<String,
BinarySecurityToken>();
+
+ private SecurityStore store;
+
+ public KeyResolver(SecurityStore store)
+ {
+ this.store = store;
+ }
+
+ private SecurityTokenReference extractSecurityTokenReference(KeyInfo info) throws
WSSecurityException
+ {
+ Element child = Util.getFirstChildElement(info.getElement());
+ if (child == null)
+ throw new WSSecurityException("Empty KeyInfo");
+
+ if (! child.getLocalName().equals("SecurityTokenReference"))
+ throw new WSSecurityException("KeyInfo did not contain expected
SecurityTokenReference, instead got: " + child.getLocalName());
+
+ return new SecurityTokenReference(child);
+ }
+
+ public void cacheToken(BinarySecurityToken token)
+ {
+ tokenCache.put(token.getId(), token);
+ }
+
+ public BinarySecurityToken resolve(SecurityTokenReference reference) throws
WSSecurityException
+ {
+ Reference ref = reference.getReference();
+ if (ref instanceof DirectReference)
+ {
+ DirectReference direct = (DirectReference) ref;
+ return resolveDirectReference(direct);
+ }
+ else if (ref instanceof KeyIdentifier)
+ {
+ KeyIdentifier identifier = (KeyIdentifier) ref;
+ return resolveKeyIdentifier(identifier);
+ }
+ else if (ref instanceof X509IssuerSerial)
+ {
+ X509IssuerSerial issuerSerial = (X509IssuerSerial) ref;
+ return resolveX509IssuerSerial(issuerSerial);
+ }
+
+ throw new NotImplementedException("Currently only DirectReference is
supported!");
+ }
+
+ private BinarySecurityToken resolveDirectReference(DirectReference direct) throws
WSSecurityException
+ {
+ String id = direct.getUri().substring(1);
+
+ BinarySecurityToken token = tokenCache.get(id);
+ if (token == null)
+ throw new SecurityTokenUnavailableException("Could not resolve token id:
" + id);
+
+ return token;
+ }
+
+ private BinarySecurityToken resolveKeyIdentifier(KeyIdentifier identifier) throws
WSSecurityException
+ {
+ // Support only SKI at the moment
+ X509Certificate cert =
store.getCertificateBySubjectKeyIdentifier(identifier.getIdentifier());
+ if (cert == null)
+ throw new SecurityTokenUnavailableException("Could not locate certificate
by key identifier");
+ return new X509Token(cert, identifier.getDocument());
+ }
+
+ private BinarySecurityToken resolveX509IssuerSerial(X509IssuerSerial issuerSerial)
throws WSSecurityException
+ {
+ X509Certificate cert = store.getCertificateByIssuerSerial(issuerSerial.getIssuer(),
issuerSerial.getSerial());
+ if (cert == null)
+ throw new SecurityTokenUnavailableException("Could not locate certificate by
issuer and serial number");
+
+ return new X509Token(cert, issuerSerial.getDocument());
+ }
+
+ public X509Certificate resolveCertificate(SecurityTokenReference reference) throws
WSSecurityException
+ {
+ BinarySecurityToken token = resolve(reference);
+
+ if (! (token instanceof X509Token))
+ throw new WSSecurityException("Expected X509Token, cache contained: "
+ token.getClass().getName());
+
+ return ((X509Token)token).getCert();
+ }
+
+ public PublicKey resolvePublicKey(SecurityTokenReference reference) throws
WSSecurityException
+ {
+ return resolveCertificate(reference).getPublicKey();
+ }
+
+ public PrivateKey resolvePrivateKey(SecurityTokenReference reference) throws
WSSecurityException
+ {
+ return store.getPrivateKey(resolveCertificate(reference));
+ }
+
+ public BinarySecurityToken resolve(KeyInfo info) throws WSSecurityException
+ {
+ return resolve(extractSecurityTokenReference(info));
+ }
+
+ public X509Certificate resolveCertificate(KeyInfo info) throws WSSecurityException
+ {
+ return resolveCertificate(extractSecurityTokenReference(info));
+ }
+
+ public PublicKey resolvePublicKey(KeyInfo info) throws WSSecurityException
+ {
+ return resolvePublicKey(extractSecurityTokenReference(info));
+ }
+
+ public PrivateKey resolvePrivateKey(KeyInfo info) throws WSSecurityException
+ {
+ return resolvePrivateKey(extractSecurityTokenReference(info));
+ }
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/Operation.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/security/Operation.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/security/Operation.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/Operation.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -0,0 +1,33 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+package org.jboss.ws.extentions.security;
+
+/**
+ * Marker interface for all WS-Security operations
+ *
+ * @author <a href="mailto:jason.greene@jboss.com">Jason T.
Greene</a>
+ * @version $Revision$
+ */
+public interface Operation
+{
+
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/OperationDescription.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/security/OperationDescription.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/security/OperationDescription.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/OperationDescription.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -0,0 +1,105 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+package org.jboss.ws.extentions.security;
+
+import java.util.List;
+
+
+/**
+ * @author <a href="mailto:jason.greene@jboss.com">Jason T.
Greene</a>
+ * @version $Revision$
+ */
+public class OperationDescription<T extends Operation>
+{
+ private Class<? extends T> operation;
+
+ private List<Target> targets;
+
+ private String certificateAlias;
+
+ private String credential;
+
+ private String algorithm;
+
+ public OperationDescription(Class<? extends T> operation, List<Target>
targets, String certicateAlias, String credential, String algorithm)
+ {
+ this.operation = operation;
+ this.targets = targets;
+ this.certificateAlias = certicateAlias;
+ this.credential = credential;
+ this.algorithm = algorithm;
+ }
+
+ public Class<? extends T> getOperation()
+ {
+ return operation;
+ }
+
+ public void setOperation(Class<? extends T> operation)
+ {
+ this.operation = operation;
+ }
+
+ public List<Target> getTargets()
+ {
+ return targets;
+ }
+
+ public void setTargets(List<Target> targets)
+ {
+ this.targets = targets;
+ }
+
+
+ public String getCertificateAlias()
+ {
+ return certificateAlias;
+ }
+
+
+ public void setCertificateAlias(String certificateAlias)
+ {
+ this.certificateAlias = certificateAlias;
+ }
+
+
+ public String getCredential()
+ {
+ return credential;
+ }
+
+ public void setCredential(String credential)
+ {
+ this.credential = credential;
+ }
+
+ public String getAlgorithm()
+ {
+ return algorithm;
+ }
+
+ public void setAlgorithm(String algorithm)
+ {
+ this.algorithm = algorithm;
+ }
+
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/QNameTarget.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/security/QNameTarget.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/security/QNameTarget.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/QNameTarget.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -0,0 +1,59 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+package org.jboss.ws.extentions.security;
+
+import javax.xml.namespace.QName;
+
+
+
+/**
+ * @author <a href="mailto:jason.greene@jboss.com">Jason T.
Greene</a>
+ * @version $Revision$
+ */
+public class QNameTarget extends Target
+{
+ private QName name;
+
+ private boolean content;
+
+ public QNameTarget(QName name)
+ {
+ this.name = name;
+ this.content = false;
+ }
+
+ public QNameTarget(QName name, boolean content)
+ {
+ this(name);
+ this.content = content;
+ }
+
+ public QName getName()
+ {
+ return name;
+ }
+
+ public boolean isContent()
+ {
+ return content;
+ }
+}
\ No newline at end of file
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/ReceiveUsernameOperation.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/security/ReceiveUsernameOperation.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/security/ReceiveUsernameOperation.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/ReceiveUsernameOperation.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -0,0 +1,50 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ws.extentions.security;
+
+import org.jboss.ws.extentions.security.element.SecurityHeader;
+import org.jboss.ws.extentions.security.element.Token;
+import org.jboss.ws.extentions.security.element.UsernameToken;
+import org.w3c.dom.Document;
+
+public class ReceiveUsernameOperation implements TokenOperation
+{
+ private SecurityHeader header;
+
+ private SecurityStore store;
+
+ public ReceiveUsernameOperation(SecurityHeader header, SecurityStore store)
+ {
+ this.header = header;
+ this.store = store;
+ }
+
+ public void process(Document message, Token token) throws WSSecurityException
+ {
+ UsernameToken user = (UsernameToken)token;
+
+ SecurityAdaptorFactory factory = SecurityAdaptorFactory.getInstance();
+ SecurityAdaptor securityAdaptor = factory.getSecurityAdaptor();
+ securityAdaptor.setPrincipal(new SimplePrincipal(user.getUsername()));
+ securityAdaptor.setCredential(user.getPassword());
+ }
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/RequireEncryptionOperation.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/security/RequireEncryptionOperation.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/security/RequireEncryptionOperation.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/RequireEncryptionOperation.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -0,0 +1,33 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+package org.jboss.ws.extentions.security;
+
+import org.jboss.ws.extentions.security.element.SecurityHeader;
+
+
+public class RequireEncryptionOperation extends RequireTargetableOperation
+{
+ public RequireEncryptionOperation(SecurityHeader header, SecurityStore store) throws
WSSecurityException
+ {
+ super(header, store);
+ }
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/RequireOperation.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/security/RequireOperation.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/security/RequireOperation.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/RequireOperation.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -0,0 +1,38 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+package org.jboss.ws.extentions.security;
+
+import java.util.Collection;
+import java.util.List;
+
+import org.w3c.dom.Document;
+
+/**
+ * Marker interface for all requirement based WS-Security operations.
+ *
+ * @author <a href="mailto:jason.greene@jboss.com">Jason T.
Greene</a>
+ * @version $Revision$
+ */
+public interface RequireOperation extends Operation
+{
+ public void process(Document message, List<Target> targets, String alias, String
credential, Collection<String> processedIds) throws WSSecurityException;
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/RequireSignatureOperation.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/security/RequireSignatureOperation.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/security/RequireSignatureOperation.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/RequireSignatureOperation.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -0,0 +1,33 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+package org.jboss.ws.extentions.security;
+
+import org.jboss.ws.extentions.security.element.SecurityHeader;
+
+
+public class RequireSignatureOperation extends RequireTargetableOperation
+{
+ public RequireSignatureOperation(SecurityHeader header, SecurityStore store) throws
WSSecurityException
+ {
+ super(header, store);
+ }
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/RequireTargetableOperation.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/security/RequireTargetableOperation.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/security/RequireTargetableOperation.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/RequireTargetableOperation.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -0,0 +1,90 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+package org.jboss.ws.extentions.security;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.ws.extentions.security.element.SecurityHeader;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+public class RequireTargetableOperation implements RequireOperation
+{
+ public RequireTargetableOperation(SecurityHeader header, SecurityStore store) throws
WSSecurityException
+ {
+ }
+
+ private Collection<String> resolveTarget(Document message, Target target) throws
WSSecurityException
+ {
+ if (target instanceof QNameTarget)
+ return resolveQNameTarget(message, (QNameTarget) target);
+ else if (target instanceof WsuIdTarget)
+ {
+ Collection<String> result = new ArrayList<String>(1);
+ result.add(((WsuIdTarget)target).getId());
+ return result;
+ }
+
+ throw new WSSecurityException("Unknown target");
+ }
+
+ private Collection<String> resolveQNameTarget(Document message, QNameTarget
target) throws WSSecurityException
+ {
+ QName name = target.getName();
+
+ Element element = Util.findElement(message.getDocumentElement(), name);
+ if (element == null)
+ throw new FailedCheckException("Required QName was not present: " +
name);
+
+ String id = Util.getWsuId(element);
+
+ if (id == null)
+ throw new FailedCheckException("Required element did not contain a
wsu:id.");
+
+ Collection<String> result = new ArrayList<String>(1);
+ result.add(id);
+
+ return result;
+ }
+
+ public void process(Document message, List<Target> targets, String alias, String
credential, Collection<String> processedIds) throws WSSecurityException
+ {
+ if (targets == null || targets.size() == 0)
+ {
+ // By default we require just the body element
+ String namespace = message.getDocumentElement().getNamespaceURI();
+ targets = new ArrayList<Target>(1);
+ targets.add(new QNameTarget(new QName(namespace, "Body"), true));
+ }
+
+ for (Target target : targets)
+ {
+ Collection<String> ids = resolveTarget(message, target);
+ if (! processedIds.containsAll(ids))
+ throw new FailedCheckException("Required elements for encryption and or
signing are not all present.");
+ }
+ }
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/RequireTimestampOperation.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/security/RequireTimestampOperation.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/security/RequireTimestampOperation.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/RequireTimestampOperation.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -0,0 +1,60 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+package org.jboss.ws.extentions.security;
+
+import java.util.Calendar;
+import java.util.Collection;
+import java.util.List;
+
+import org.jboss.ws.extentions.security.element.SecurityHeader;
+import org.jboss.ws.extentions.security.element.Timestamp;
+import org.w3c.dom.Document;
+
+
+public class RequireTimestampOperation implements RequireOperation
+{
+ private SecurityHeader header;
+
+ public RequireTimestampOperation(SecurityHeader header, SecurityStore store) throws
WSSecurityException
+ {
+ this.header = header;
+ }
+
+ public void process(Document message, List<Target> targets, String maxAge,
String credential, Collection<String> processedIds) throws WSSecurityException
+ {
+ Timestamp stamp = header.getTimestamp();
+ if (stamp == null)
+ throw new FailedCheckException("Required timestamp not present.");
+
+ // If there is no maxAge specified then we are done
+ if (maxAge == null)
+ return;
+
+ int max = Integer.parseInt(maxAge);
+
+ Calendar expired = (Calendar)stamp.getCreated().clone();
+ expired.add(Calendar.SECOND, max);
+
+ if (! Calendar.getInstance().before(expired))
+ throw new FailedCheckException("Timestamp of message is too old.");
+ }
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/STRTransform.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/security/STRTransform.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/security/STRTransform.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/STRTransform.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -0,0 +1,173 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+package org.jboss.ws.extentions.security;
+
+import java.io.IOException;
+
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.apache.xml.security.c14n.CanonicalizationException;
+import org.apache.xml.security.c14n.Canonicalizer;
+import org.apache.xml.security.c14n.InvalidCanonicalizerException;
+import org.apache.xml.security.signature.XMLSignatureInput;
+import org.apache.xml.security.transforms.Transform;
+import org.apache.xml.security.transforms.TransformSpi;
+import org.apache.xml.security.transforms.TransformationException;
+import org.apache.xml.security.utils.XMLUtils;
+import org.jboss.util.NotImplementedException;
+import org.jboss.ws.WSException;
+import org.jboss.ws.core.utils.ThreadLocalAssociation;
+import org.jboss.ws.extentions.security.element.BinarySecurityToken;
+import org.jboss.ws.extentions.security.element.SecurityTokenReference;
+import org.w3c.dom.Element;
+import org.xml.sax.SAXException;
+
+
+/**
+ * <code>STRTransform</code> implements the STR-Transform specified in the
+ * WS-Security specification. This class dynamically registers itself with
+ * XML Security on its first load (using a static initializer).
+ *
+ * You must call the static yet thread safe setSecurityStore() before use of
+ * this class.
+ *
+ * @author <a href="mailto:jason.greene@jboss.com">Jason T.
Greene</a>
+ * @version $Revision$
+ */
+public class STRTransform extends TransformSpi
+{
+ public static final String STR_URI =
"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#STR-Transform";
+
+ static
+ {
+ try
+ {
+ Transform.register(STR_URI, STRTransform.class.getName());
+ }
+ catch (Exception e)
+ {
+ // Eat
+ }
+ }
+
+ private String canonicalize(Element element, Element method) throws
TransformationException, InvalidCanonicalizerException, CanonicalizationException
+ {
+ if (method == null || !
method.getLocalName().equals("CanonicalizationMethod"))
+ throw new TransformationException("CanonicalizationMethod
expected!");
+
+ String algorithm = method.getAttribute("Algorithm");
+ if (algorithm == null || algorithm.length() == 0)
+ throw new TransformationException("CanonicalizationMethod missing
algorithm!");
+
+ Canonicalizer canon = Canonicalizer.getInstance(algorithm);
+
+ return new String(canon.canonicalizeSubtree(element, "#default"));
+ }
+
+ @Override
+ protected String engineGetURI()
+ {
+ return STR_URI;
+ }
+
+
+ @Override
+ protected XMLSignatureInput enginePerformTransform(XMLSignatureInput input) throws
IOException, CanonicalizationException,
+ InvalidCanonicalizerException, TransformationException,
ParserConfigurationException, SAXException
+ {
+
+ SecurityStore store = ThreadLocalAssociation.localStrTransformAssoc().get();
+
+ if (store == null)
+ throw new WSException("SecurityStore Thread Local not initialized before
call!");
+
+ try
+ {
+ if (! input.isElement())
+ throw new NotImplementedException("Only element input is
supported");
+
+ // Resolve the BinarySecurityToken associated with this SecurityTokenReference
+ Element element = (Element)input.getSubNode();
+ SecurityTokenReference ref = new SecurityTokenReference(element);
+ KeyResolver resolver = new KeyResolver(store);
+ BinarySecurityToken token = resolver.resolve(ref);
+
+ // Get the specially formated dom element for this element
+ element = token.getSTRTransformElement();
+
+ // Obtain the canonicalizer specified in the transformation parameters
+ Element parameters =
XMLUtils.selectNode(this._transformObject.getElement().getFirstChild(),
Constants.WSSE_NS,
+ "TransformationParameters", 0);
+ if (parameters == null)
+ throw new TransformationException("wsse:TransformationParameters
expected!");
+
+ Element method = Util.getFirstChildElement(parameters);
+ String transformed = canonicalize(element, method);
+
+ // Now WS-Security says we must augment the transformed output to ensure that
there is
+ // a default namespace
+ int startTag = transformed.indexOf('<');
+ int endTag = transformed.indexOf('>', startTag + 1);
+ String within = transformed.substring(startTag + 1, endTag);
+ if (! within.contains("xmlns="))
+ {
+ int insPos = within.indexOf(" ") + startTag + 1;
+ transformed = new StringBuilder(transformed).insert(insPos, "
xmlns=\"\"").toString();
+ }
+
+ return new XMLSignatureInput(transformed.getBytes());
+ }
+ catch (WSSecurityException e)
+ {
+ throw new TransformationException(e.getMessage(), e);
+ }
+ finally
+ {
+ ThreadLocalAssociation.localStrTransformAssoc().set(null);
+ }
+ }
+
+ public static void setSecurityStore(SecurityStore store)
+ {
+ ThreadLocalAssociation.localStrTransformAssoc().set(store);
+ }
+
+ public boolean wantsOctetStream()
+ {
+ return false;
+ }
+
+ public boolean wantsNodeSet()
+ {
+ return false;
+ }
+
+ public boolean returnsOctetStream()
+ {
+ return false;
+ }
+
+ public boolean returnsNodeSet()
+ {
+ return false;
+ }
+}
\ No newline at end of file
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/SecurityAdaptor.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/security/SecurityAdaptor.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/security/SecurityAdaptor.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/SecurityAdaptor.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -0,0 +1,38 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+package org.jboss.ws.extentions.security;
+
+// $Id$
+
+import java.security.Principal;
+
+/**
+ * A container idependent security adaptor
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 10-May-2005
+ */
+public interface SecurityAdaptor
+{
+ void setPrincipal(Principal pricipal);
+ void setCredential(Object credential);
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/SecurityAdaptorFactory.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/security/SecurityAdaptorFactory.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/security/SecurityAdaptorFactory.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/SecurityAdaptorFactory.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -0,0 +1,70 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ws.extentions.security;
+
+//$Id$
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.WSException;
+
+/**
+ * A container idependent security adaptor factory
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 10-May-2005
+ */
+public class SecurityAdaptorFactory
+{
+ // provide logging
+ private static final Logger log = Logger.getLogger(SecurityAdaptorFactory.class);
+
+ public static final String DEFAULT_FACTORY =
"org.jboss.ws.integration.SecurityAdaptorFactoryImpl";
+
+ private static SecurityAdaptorFactory delegate;
+
+ public static SecurityAdaptorFactory getInstance()
+ {
+ if (delegate == null)
+ {
+ ClassLoader ctxLoader = Thread.currentThread().getContextClassLoader();
+ try
+ {
+ Class factoryClass = ctxLoader.loadClass(DEFAULT_FACTORY);
+ delegate = (SecurityAdaptorFactory)factoryClass.newInstance();
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (Exception e)
+ {
+ throw new WSException("Cannot load: " + DEFAULT_FACTORY, e);
+ }
+ }
+ return delegate;
+ }
+
+ public SecurityAdaptor getSecurityAdaptor()
+ {
+ return delegate.getSecurityAdaptor();
+ }
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/SecurityDecoder.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/security/SecurityDecoder.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/security/SecurityDecoder.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/SecurityDecoder.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -0,0 +1,194 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+package org.jboss.ws.extentions.security;
+
+import java.lang.reflect.Constructor;
+import java.util.Calendar;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+
+import org.jboss.ws.extentions.security.element.EncryptedKey;
+import org.jboss.ws.extentions.security.element.SecurityHeader;
+import org.jboss.ws.extentions.security.element.SecurityProcess;
+import org.jboss.ws.extentions.security.element.Signature;
+import org.jboss.ws.extentions.security.element.Timestamp;
+import org.jboss.ws.extentions.security.element.Token;
+import org.jboss.ws.extentions.security.element.UsernameToken;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+/**
+ * @author <a href="mailto:jason.greene@jboss.com">Jason T.
Greene</a>
+ * @version $Revision$
+ */
+public class SecurityDecoder
+{
+ private Element headerElement;
+
+ private Calendar now = null;
+
+ private SecurityHeader header;
+
+ private Document message;
+
+ private SecurityStore store;
+
+ private HashSet<String> signedIds = new HashSet<String>();
+
+ private HashSet<String> encryptedIds = new HashSet<String>();
+
+ public SecurityDecoder(SecurityStore store)
+ {
+ org.apache.xml.security.Init.init();
+ this.store = store;
+ }
+
+ /**
+ * A special constructor that allows you to use a different value when validating the
message.
+ * DO NOT USE THIS UNLESS YOU REALLY KNOW WHAT YOU ARE DOING!.
+ *
+ * @param SecurityStore the security store that contains key and trust information
+ * @param now The timestamp to use as the current time when validating a message
expiration
+ */
+ public SecurityDecoder(SecurityStore store, Calendar now)
+ {
+ this(store);
+ this.now = now;
+ }
+
+ private Element getHeader(Document message) throws WSSecurityException
+ {
+ Element header = Util.findElement(message.getDocumentElement(),
"Security", Constants.WSSE_NS);
+ if (header == null)
+ throw new WSSecurityException("Expected security header was not
found");
+
+ return header;
+ }
+
+ private void detachHeader()
+ {
+ headerElement.getParentNode().removeChild(headerElement);
+ }
+
+
+ private void decode() throws WSSecurityException
+ {
+ // Validate a timestamp if it is present
+ Timestamp timestamp = header.getTimestamp();
+
+ if (timestamp != null)
+ {
+ TimestampVerificationOperation operation =
+ (now == null) ? new TimestampVerificationOperation() : new
TimestampVerificationOperation(now);
+ operation.process(message, timestamp);
+ }
+
+ for (Token token : header.getTokens())
+ {
+ if (token instanceof UsernameToken)
+ new ReceiveUsernameOperation(header, store).process(message, token);
+ }
+
+ signedIds.clear();
+ encryptedIds.clear();
+
+ SignatureVerificationOperation signatureVerifier = new
SignatureVerificationOperation(header, store);
+ DecryptionOperation decrypter = new DecryptionOperation(header, store);
+
+ for (SecurityProcess process : header.getSecurityProcesses())
+ {
+ // If this list gets much larger it should probably be a hash lookup
+ if (process instanceof Signature)
+ {
+ Collection<String> ids = signatureVerifier.process(message, process);
+ if (ids != null)
+ signedIds.addAll(ids);
+ }
+ else if (process instanceof EncryptedKey)
+ {
+ Collection<String> ids = decrypter.process(message, process);
+ if (ids != null)
+ encryptedIds.addAll(ids);
+ }
+ }
+ }
+
+ public void verify(List<OperationDescription<RequireOperation>>
requireOperations) throws WSSecurityException
+ {
+ if (requireOperations == null)
+ return;
+
+ for (OperationDescription<RequireOperation> o : requireOperations)
+ {
+ Class<? extends RequireOperation> operation = o.getOperation();
+ RequireOperation op;
+ Collection<String> processedIds = null;
+
+ if (operation.equals(RequireSignatureOperation.class))
+ {
+ op = new RequireSignatureOperation(header, store);
+ processedIds = signedIds;
+ }
+ else if (operation.equals(RequireEncryptionOperation.class))
+ {
+ op = new RequireEncryptionOperation(header, store);
+ processedIds = encryptedIds;
+ }
+ else
+ {
+ try
+ {
+ Constructor<? extends RequireOperation> c =
operation.getConstructor(SecurityHeader.class, SecurityStore.class);
+ op = c.newInstance(header, store);
+ }
+ catch (Exception e)
+ {
+ throw new WSSecurityException("Error constructing operation: " +
operation);
+ }
+ }
+
+ op.process(message, o.getTargets(), o.getCertificateAlias(), o.getCredential(),
processedIds);
+ }
+ }
+
+ public void decode(Document message) throws WSSecurityException
+ {
+ decode(message, getHeader(message));
+ }
+
+ public void decode(Document message, Element headerElement) throws
WSSecurityException
+ {
+ this.headerElement = headerElement;
+ this.header = new SecurityHeader(this.headerElement, store);
+ this.message = message;
+
+ decode();
+ }
+
+ public void complete()
+ {
+ // On completion we must remove the header so that no one else can process this
+ // message (required by the specification)
+ detachHeader();
+ }
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/SecurityEncoder.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/security/SecurityEncoder.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/security/SecurityEncoder.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/SecurityEncoder.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -0,0 +1,86 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+package org.jboss.ws.extentions.security;
+
+import java.lang.reflect.Constructor;
+import java.util.List;
+
+import org.jboss.ws.extentions.security.element.SecurityHeader;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+
+/**
+ * <code>SecurityEncoder</code> is responsible for transforming a SOAP
message
+ * into a WS-Security encoded message.
+ *
+ * @author <a href="mailto:jason.greene@jboss.com">Jason T.
Greene</a>
+ * @version $Revision$
+ */
+public class SecurityEncoder
+{
+ private List<OperationDescription<EncodingOperation>> operations;
+
+ private SecurityStore store;
+
+ public SecurityEncoder(List<OperationDescription<EncodingOperation>>
operations, SecurityStore store)
+ {
+ org.apache.xml.security.Init.init();
+ this.operations = operations;
+ this.store = store;
+ }
+
+ private void attachHeader(SecurityHeader header, Document message)
+ {
+ Element soapHeader = Util.findOrCreateSoapHeader(message.getDocumentElement());
+ try
+ {
+ Element wsse = header.getElement();
+ wsse.setAttributeNS(soapHeader.getNamespaceURI(), soapHeader.getPrefix() +
":mustUnderstand", "1");
+ soapHeader.insertBefore(wsse, soapHeader.getFirstChild());
+ }
+ catch (Exception e) {}
+
+ }
+
+ public void encode(Document message) throws WSSecurityException
+ {
+ SecurityHeader header = new SecurityHeader(message);
+ for (OperationDescription<EncodingOperation> o : operations)
+ {
+ EncodingOperation operation;
+
+ try
+ {
+ Constructor<? extends EncodingOperation> constructor =
o.getOperation().getConstructor(SecurityHeader.class, SecurityStore.class);
+ operation = constructor.newInstance(header, store);
+ }
+ catch (Exception e)
+ {
+ throw new WSSecurityException("Error constructing operation: " +
o.getOperation());
+ }
+
+ operation.process(message, o.getTargets(), o.getCertificateAlias(),
o.getCredential(), o.getAlgorithm());
+ }
+ attachHeader(header, message);
+ }
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/SecurityStore.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/security/SecurityStore.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/security/SecurityStore.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/SecurityStore.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -0,0 +1,488 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ws.extentions.security;
+
+// $Id$
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Method;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.security.InvalidAlgorithmParameterException;
+import java.security.KeyStore;
+import java.security.KeyStoreException;
+import java.security.PrivateKey;
+import java.security.cert.CertPath;
+import java.security.cert.CertPathValidator;
+import java.security.cert.CertPathValidatorException;
+import java.security.cert.Certificate;
+import java.security.cert.CertificateFactory;
+import java.security.cert.PKIXParameters;
+import java.security.cert.X509Certificate;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Enumeration;
+import java.util.List;
+import java.util.StringTokenizer;
+
+import org.jboss.logging.Logger;
+
+/**
+ * <code>SecurityStore</code> holds and loads the keystore and truststore
required for encyption and signing.
+ *
+ * @author <a href="mailto:jason.greene@jboss.com">Jason T.
Greene</a>
+ * @author <a href="mailto:jason.greene@jboss.com">Magesh Kumar
B</a>
+ * @version $Revision$
+ */
+public class SecurityStore
+{
+ private static Logger log = Logger.getLogger(SecurityStore.class);
+
+ private KeyStore keyStore;
+
+ private String keyStorePassword;
+
+ private KeyStore trustStore;
+
+ private String trustStorePassword;
+
+ public SecurityStore() throws WSSecurityException
+ {
+ this(null, null, null, null, null, null);
+ }
+
+ public SecurityStore(URL keyStoreURL, String keyStoreType, String keyStorePassword)
throws WSSecurityException
+ {
+ loadKeyStore(keyStoreURL, keyStoreType, keyStorePassword);
+ loadTrustStore(keyStoreURL, keyStoreType, keyStorePassword);
+ }
+
+ public SecurityStore(URL keyStoreURL, String keyStoreType, String keyStorePassword,
URL trustStoreURL, String trustStoreType, String trustStorePassword)
+ throws WSSecurityException
+ {
+ loadKeyStore(keyStoreURL, keyStoreType, keyStorePassword);
+ loadTrustStore(trustStoreURL, trustStoreType, trustStorePassword);
+ }
+
+ private void loadKeyStore(URL keyStoreURL, String keyStoreType, String
keyStorePassword) throws WSSecurityException
+ {
+ if (keyStorePassword == null)
+ keyStorePassword =
System.getProperty("org.jboss.ws.wsse.keyStorePassword");
+
+ keyStore = loadStore("org.jboss.ws.wsse.keyStore", "Keystore",
keyStoreURL, keyStoreType, keyStorePassword);
+ this.keyStorePassword = keyStorePassword;
+ }
+
+ private void loadTrustStore(URL trustStoreURL, String trustStoreType, String
trustStorePassword) throws WSSecurityException
+ {
+ if (trustStorePassword == null)
+ trustStorePassword =
System.getProperty("org.jboss.ws.wsse.trustStorePassword");
+
+ trustStore = loadStore("org.jboss.ws.wsse.trustStore",
"Truststore", trustStoreURL, trustStoreType, trustStorePassword);
+ this.trustStorePassword = trustStorePassword;
+ }
+
+ private KeyStore loadStore(String property, String type, URL storeURL, String
storeType, String storePassword) throws WSSecurityException
+ {
+ if (storeURL == null)
+ {
+ String defaultStore = System.getProperty(property);
+ if (defaultStore == null)
+ {
+ return null;
+ }
+
+ File storeFile = new File(defaultStore);
+ try
+ {
+ storeURL = storeFile.toURL();
+ }
+ catch (MalformedURLException e)
+ {
+ throw new WSSecurityException("Problems loading " + type + ":
" + e.getMessage(), e);
+ }
+ }
+
+ if (storeType == null)
+ storeType = System.getProperty(property + "Type");
+ if (storeType == null)
+ storeType = "jks";
+
+ KeyStore keyStore = null;
+ try
+ {
+ log.debug("loadStore: " + storeURL);
+ InputStream stream = storeURL.openStream();
+ if (stream == null)
+ throw new WSSecurityException("Cannot load store from: " +
storeURL);
+
+ keyStore = KeyStore.getInstance(storeType);
+ if (keyStore == null)
+ throw new WSSecurityException("Cannot get keystore for type: " +
storeType);
+
+ String decryptedPassword = decryptPassword(storePassword);
+ if (decryptedPassword == null)
+ throw new WSSecurityException("Cannot decrypt store password");
+
+ keyStore.load(stream, decryptedPassword.toCharArray());
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (WSSecurityException ex)
+ {
+ throw ex;
+ }
+ catch (Exception ex)
+ {
+ throw new WSSecurityException("Problems loading " + type + ":
" + ex.getMessage(), ex);
+ }
+
+ return keyStore;
+ }
+
+ /**
+ * This method examines the password for the presence of a encryption algorithm, if
found
+ * decrypts and returns the password, else returns the password as is.
+ */
+ private String decryptPassword(String password) throws WSSecurityException
+ {
+ log.trace("decrypt password: " + password);
+
+ if (password == null)
+ throw new WSSecurityException("Invalid null password for security
store");
+
+ if (password.charAt(0) == '{')
+ {
+ StringTokenizer tokenizer = new StringTokenizer(password, "{}");
+ String keyStorePasswordCmdType = tokenizer.nextToken();
+ String keyStorePasswordCmd = tokenizer.nextToken();
+ if (keyStorePasswordCmdType.equals("EXT"))
+ {
+ password = execPasswordCmd(keyStorePasswordCmd);
+ }
+ else if (keyStorePasswordCmdType.equals("CLASS"))
+ {
+ password = invokePasswordClass(keyStorePasswordCmd);
+ }
+ else
+ {
+ throw new WSSecurityException("Unknown keyStorePasswordCmdType: " +
keyStorePasswordCmdType);
+ }
+ }
+ if (password == null)
+ throw new WSSecurityException("Cannot decrypt password, result is
null");
+
+ log.trace("decrypted password: " + password);
+ return password;
+ }
+
+ private String execPasswordCmd(String keyStorePasswordCmd) throws WSSecurityException
+ {
+ log.debug("Executing command: " + keyStorePasswordCmd);
+ try
+ {
+ Runtime rt = Runtime.getRuntime();
+ Process p = rt.exec(keyStorePasswordCmd);
+ InputStream stdin = p.getInputStream();
+ BufferedReader reader = new BufferedReader(new InputStreamReader(stdin));
+ String password = reader.readLine();
+ stdin.close();
+ int exitCode = p.waitFor();
+ log.debug("Command exited with: " + exitCode);
+ return password;
+ }
+ catch (Exception e)
+ {
+ throw new WSSecurityException("Problems executing password command: "
+ keyStorePasswordCmd, e);
+ }
+ }
+
+ private String invokePasswordClass(String keyStorePasswordCmd) throws
WSSecurityException
+ {
+ String password = null;
+ String classname = keyStorePasswordCmd;
+ String ctorArg = null;
+ int colon = keyStorePasswordCmd.indexOf(':');
+ if (colon > 0)
+ {
+ classname = keyStorePasswordCmd.substring(0, colon);
+ ctorArg = keyStorePasswordCmd.substring(colon + 1);
+ }
+ log.debug("Loading class: " + classname + ", ctorArg=" +
ctorArg);
+ try
+ {
+ ClassLoader loader = Thread.currentThread().getContextClassLoader();
+ Class c = loader.loadClass(classname);
+ Object instance = null;
+ if (ctorArg != null)
+ {
+ Class[] sig = { String.class };
+ Constructor ctor = c.getConstructor(sig);
+ Object[] args = { ctorArg };
+ instance = ctor.newInstance(args);
+ }
+ else
+ {
+ instance = c.newInstance();
+ }
+ try
+ {
+ log.debug("Checking for toCharArray");
+ Class[] sig = {};
+ Method toCharArray = c.getMethod("toCharArray", sig);
+ Object[] args = {};
+ log.debug("Invoking toCharArray");
+ password = new String((char[])toCharArray.invoke(instance, args));
+ }
+ catch (NoSuchMethodException e)
+ {
+ log.debug("No toCharArray found, invoking toString");
+ password = instance.toString();
+ }
+ }
+ catch (Exception e)
+ {
+ throw new WSSecurityException("Problems loading or invoking Password class
: " + classname, e);
+ }
+ return password;
+ }
+
+ public static byte[] getSubjectKeyIdentifier(X509Certificate cert)
+ {
+ // Maybee we should make one ourselves if it isn't there?
+ byte[] encoded = cert.getExtensionValue("2.5.29.14");
+ if (encoded == null)
+ return null;
+
+ // We need to skip 4 bytes [(OCTET STRING) (LENGTH)[(OCTET STRING) (LENGTH) (Actual
data)]]
+ int trunc = encoded.length - 4;
+
+ byte[] identifier = new byte[trunc];
+ System.arraycopy(encoded, 4, identifier, 0, trunc);
+
+ return identifier;
+ }
+
+ public X509Certificate getCertificate(String alias) throws WSSecurityException
+ {
+ if (keyStore == null)
+ {
+ throw new WSSecurityException("KeyStore not set.");
+ }
+
+ X509Certificate cert;
+ try
+ {
+ cert = (X509Certificate)keyStore.getCertificate(alias);
+ }
+ catch (Exception e)
+ {
+ throw new WSSecurityException("Problems retrieving cert: " +
e.getMessage(), e);
+ }
+
+ if (cert == null)
+ throw new WSSecurityException("Certificate (" + alias + ") not in
keystore");
+
+ return cert;
+ }
+
+ public X509Certificate getCertificateBySubjectKeyIdentifier(byte[] identifier) throws
WSSecurityException
+ {
+ if (identifier == null)
+ return null;
+
+ if (keyStore == null)
+ {
+ throw new WSSecurityException("KeyStore not set.");
+ }
+
+ try
+ {
+ Enumeration i = keyStore.aliases();
+
+ while (i.hasMoreElements())
+ {
+ String alias = (String)i.nextElement();
+ Certificate cert = keyStore.getCertificate(alias);
+ if (!(cert instanceof X509Certificate))
+ continue;
+
+ byte[] subjectKeyIdentifier =
getSubjectKeyIdentifier((X509Certificate)cert);
+ if (subjectKeyIdentifier == null)
+ continue;
+
+ if (Arrays.equals(identifier, subjectKeyIdentifier))
+ return (X509Certificate)cert;
+ }
+ }
+ catch (KeyStoreException e)
+ {
+ throw new WSSecurityException("Problems retrieving cert: " +
e.getMessage(), e);
+ }
+
+ return null;
+ }
+
+ public X509Certificate getCertificateByIssuerSerial(String issuer, String serial)
throws WSSecurityException
+ {
+ if (keyStore == null)
+ {
+ throw new WSSecurityException("KeyStore not set.");
+ }
+
+ try
+ {
+ Enumeration i = keyStore.aliases();
+
+ while (i.hasMoreElements())
+ {
+ String alias = (String)i.nextElement();
+ Certificate cert = keyStore.getCertificate(alias);
+ if (!(cert instanceof X509Certificate))
+ continue;
+
+ X509Certificate x509 = (X509Certificate)cert;
+ if (issuer.equals(x509.getIssuerDN().toString()) &&
serial.equals(x509.getSerialNumber().toString()))
+ return x509;
+ }
+ }
+ catch (KeyStoreException e)
+ {
+ throw new WSSecurityException("Problems retrieving cert: " +
e.getMessage(), e);
+ }
+
+ return null;
+ }
+
+ public PrivateKey getPrivateKey(String alias) throws WSSecurityException
+ {
+ if (keyStore == null)
+ {
+ throw new WSSecurityException("KeyStore not set.");
+ }
+
+ PrivateKey key;
+ try
+ {
+ key = (PrivateKey)keyStore.getKey(alias,
decryptPassword(keyStorePassword).toCharArray());
+ }
+ catch (Exception e)
+ {
+ throw new WSSecurityException("Problems retrieving private key: " +
e.getMessage(), e);
+ }
+
+ if (key == null)
+ throw new WSSecurityException("Private key (" + alias + ") not in
keystore");
+
+ return key;
+ }
+
+ public PrivateKey getPrivateKey(X509Certificate cert) throws WSSecurityException
+ {
+ if (keyStore == null)
+ {
+ throw new WSSecurityException("KeyStore not set.");
+ }
+
+ try
+ {
+ String alias = keyStore.getCertificateAlias(cert);
+ return getPrivateKey(alias);
+ }
+ catch (Exception e)
+ {
+ throw new WSSecurityException("Problems retrieving private key: " +
e.getMessage(), e);
+ }
+ }
+
+ public void validateCertificate(X509Certificate cert) throws WSSecurityException
+ {
+ try
+ {
+ cert.checkValidity();
+ }
+ catch (Exception e)
+ {
+ log.debug("Certificate is invalid", e);
+ throw new FailedAuthenticationException();
+ }
+
+ if (keyStore == null)
+ {
+ throw new WSSecurityException("TrustStore not set.");
+ }
+
+ // Check for the exact entry in the truststore first, then fallback to a CA check
+ try
+ {
+ if (trustStore.getCertificateAlias(cert) != null)
+ {
+ return;
+ }
+ }
+ catch (KeyStoreException e)
+ {
+ throw new WSSecurityException("Problems searching truststore", e);
+ }
+
+ List list = new ArrayList(1);
+ list.add(cert);
+
+ CertPath cp;
+ CertPathValidator cpv;
+ PKIXParameters parameters;
+
+ try
+ {
+ cp = CertificateFactory.getInstance("X.509").generateCertPath(list);
+ cpv = CertPathValidator.getInstance("PKIX");
+ parameters = new PKIXParameters(trustStore);
+
+ // We currently don't support CRLs
+ parameters.setRevocationEnabled(false);
+ }
+ catch (Exception e)
+ {
+ throw new WSSecurityException("Problems setting up certificate
validation", e);
+ }
+
+ try
+ {
+ cpv.validate(cp, parameters);
+ }
+ catch (CertPathValidatorException cpve)
+ {
+ log.debug("Certificate is invalid:", cpve);
+ throw new FailedAuthenticationException();
+ }
+ catch (InvalidAlgorithmParameterException e)
+ {
+ throw new WSSecurityException("Problems setting up certificate
validation", e);
+ }
+ }
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/SecurityTokenUnavailableException.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/security/SecurityTokenUnavailableException.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/security/SecurityTokenUnavailableException.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/SecurityTokenUnavailableException.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -0,0 +1,64 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+package org.jboss.ws.extentions.security;
+
+import javax.xml.namespace.QName;
+
+
+/**
+ * @author <a href="mailto:jason.greene@jboss.com">Jason T.
Greene</a>
+ * @version $Revision$
+ */
+public class SecurityTokenUnavailableException extends WSSecurityException
+{
+ public static final QName faultCode = new QName(Constants.WSSE_NS,
"SecurityTokenUnavailable", Constants.WSSE_PREFIX);
+
+ public static final String faultString = "Referenced security token could not be
retrieved.";
+
+ public SecurityTokenUnavailableException()
+ {
+ super(faultString);
+ setFaultCode(faultCode);
+ setFaultString(faultString);
+ }
+
+ public SecurityTokenUnavailableException(Throwable cause)
+ {
+ super(faultString);
+ setFaultCode(faultCode);
+ setFaultString(faultString);
+ }
+
+ public SecurityTokenUnavailableException(String message)
+ {
+ super(message);
+ setFaultCode(faultCode);
+ setFaultString(message);
+ }
+
+ public SecurityTokenUnavailableException(String message, Throwable cause)
+ {
+ super(message, cause);
+ setFaultCode(faultCode);
+ setFaultString(message);
+ }
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/SendUsernameOperation.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/security/SendUsernameOperation.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/security/SendUsernameOperation.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/SendUsernameOperation.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -0,0 +1,46 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+package org.jboss.ws.extentions.security;
+
+import java.util.List;
+
+import org.jboss.ws.extentions.security.element.SecurityHeader;
+import org.jboss.ws.extentions.security.element.UsernameToken;
+import org.w3c.dom.Document;
+
+public class SendUsernameOperation implements EncodingOperation
+{
+ private SecurityHeader header;
+
+ private SecurityStore store;
+
+ public SendUsernameOperation(SecurityHeader header, SecurityStore store)
+ {
+ this.header = header;
+ this.store = store;
+ }
+
+ public void process(Document message, List<Target> targets, String alias, String
credential, String algorithm) throws WSSecurityException
+ {
+ header.addToken(new UsernameToken(alias, credential, message));
+ }
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/SignatureOperation.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/security/SignatureOperation.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/security/SignatureOperation.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/SignatureOperation.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -0,0 +1,178 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+package org.jboss.ws.extentions.security;
+
+import java.security.PrivateKey;
+import java.security.cert.X509Certificate;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.apache.xml.security.c14n.Canonicalizer;
+import org.apache.xml.security.exceptions.XMLSecurityException;
+import org.apache.xml.security.signature.XMLSignature;
+import org.apache.xml.security.signature.XMLSignatureException;
+import org.apache.xml.security.transforms.TransformationException;
+import org.apache.xml.security.transforms.Transforms;
+import org.jboss.util.NotImplementedException;
+import org.jboss.ws.extentions.security.element.DirectReference;
+import org.jboss.ws.extentions.security.element.SecurityHeader;
+import org.jboss.ws.extentions.security.element.SecurityTokenReference;
+import org.jboss.ws.extentions.security.element.Signature;
+import org.jboss.ws.extentions.security.element.X509Token;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+
+public class SignatureOperation implements EncodingOperation
+{
+ private SecurityHeader header;
+
+ private SecurityStore store;
+
+ public SignatureOperation(SecurityHeader header, SecurityStore store) throws
WSSecurityException
+ {
+ this.header = header;
+ this.store = store;
+ }
+
+ private void processTarget(XMLSignature sig, Document message, Target target)
+ {
+ if (target instanceof QNameTarget)
+ processQNameTarget(sig, message, (QNameTarget) target);
+ else if (target instanceof WsuIdTarget)
+ processWsuIdTarget(sig, message, (WsuIdTarget) target);
+ else
+ throw new NotImplementedException();
+ }
+
+ private void processQNameTarget(XMLSignature sig, Document message, QNameTarget
target)
+ {
+ QName name = target.getName();
+
+ Transforms transforms = new Transforms(message);
+ try
+ {
+ transforms.addTransform(Transforms.TRANSFORM_C14N_EXCL_OMIT_COMMENTS);
+ }
+ catch (TransformationException e)
+ {
+ throw new RuntimeException(e);
+ }
+
+ Element element = Util.findElement(message.getDocumentElement(), name);
+ if (element == null)
+ throw new RuntimeException("Could not find element");
+
+ String id = Util.assignWsuId(element);
+
+ try
+ {
+ sig.addDocument("#" + id, transforms);
+ }
+ catch (XMLSignatureException e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ private void processWsuIdTarget(XMLSignature sig, Document message, WsuIdTarget
target)
+ {
+ String id = target.getId();
+
+ Transforms transforms = new Transforms(message);
+ try
+ {
+ transforms.addTransform(Transforms.TRANSFORM_C14N_EXCL_OMIT_COMMENTS);
+ }
+ catch (TransformationException e)
+ {
+ throw new RuntimeException(e);
+ }
+
+ try
+ {
+ sig.addDocument("#" + id, transforms);
+ }
+ catch (XMLSignatureException e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public void process(Document message, List<Target> targets, String alias, String
credential, String algorithm) throws WSSecurityException
+ {
+ Element envelope = message.getDocumentElement();
+ XMLSignature sig;
+ try
+ {
+ sig = new XMLSignature(message, null, XMLSignature.ALGO_ID_SIGNATURE_RSA,
Canonicalizer.ALGO_ID_C14N_EXCL_OMIT_COMMENTS);
+ }
+ catch (XMLSecurityException e)
+ {
+ throw new WSSecurityException("Error building signature", e);
+ }
+
+ // For now we pass our resolver the root document because the signature element
isn't attached
+ // to the evelope yet (no wsse header). Perhaps we should do this differently
+ sig.addResourceResolver(new WsuIdResolver(message, header.getElement()));
+ PrivateKey key = store.getPrivateKey(alias);
+
+ if (targets == null || targets.size() == 0)
+ {
+ // By default we sign the body element, and a timestamp if it is available
+ String namespace = envelope.getNamespaceURI();
+ processTarget(sig, message, new QNameTarget(new QName(namespace,
"Body")));
+ if (header.getTimestamp() != null)
+ processTarget(sig, message, new WsuIdTarget("timestamp"));
+ }
+ else
+ {
+ for (Target target : targets)
+ processTarget(sig, message, target);
+ }
+
+ try
+ {
+ sig.sign(key);
+ }
+ catch (XMLSignatureException e)
+ {
+ throw new WSSecurityException("Error signing message: " +
e.getMessage(), e);
+ }
+
+ X509Certificate cert = store.getCertificate(alias);
+ X509Token token = (X509Token) header.getSharedToken(cert);
+
+ // Can we reuse an existing token?
+ if (token == null)
+ {
+ token = new X509Token(cert, message);
+ header.addToken(token);
+ }
+
+ SecurityTokenReference reference = new SecurityTokenReference(new
DirectReference(message, token));
+ sig.getKeyInfo().addUnknownElement(reference.getElement());
+
+ header.addSecurityProcess(new Signature(sig));
+ }
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/SignatureVerificationOperation.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/security/SignatureVerificationOperation.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/security/SignatureVerificationOperation.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/SignatureVerificationOperation.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -0,0 +1,89 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+package org.jboss.ws.extentions.security;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.apache.xml.security.exceptions.XMLSecurityException;
+import org.apache.xml.security.signature.SignedInfo;
+import org.apache.xml.security.signature.XMLSignature;
+import org.apache.xml.security.signature.XMLSignatureException;
+import org.jboss.ws.extentions.security.element.SecurityHeader;
+import org.jboss.ws.extentions.security.element.SecurityProcess;
+import org.jboss.ws.extentions.security.element.Signature;
+import org.w3c.dom.Document;
+
+public class SignatureVerificationOperation implements DecodingOperation
+{
+ private SecurityHeader header;
+
+ private SecurityStore store;
+
+ public SignatureVerificationOperation(SecurityHeader header, SecurityStore store)
throws WSSecurityException
+ {
+ this.header = header;
+ this.store = store;
+ }
+
+ public Collection<String> process(Document message, SecurityProcess process)
throws WSSecurityException
+ {
+ Signature signature = (Signature) process;
+ XMLSignature xmlSig = signature.getSignature();
+
+ xmlSig.addResourceResolver(new WsuIdResolver(message));
+ STRTransform.setSecurityStore(store);
+
+ try
+ {
+ if (! xmlSig.checkSignatureValue(signature.getPublicKey()))
+ throw new FailedCheckException("Signature is invalid.");
+ }
+ catch (XMLSignatureException e)
+ {
+ throw new WSSecurityException("An unexpected error occured while verifying
signature", e);
+ }
+ finally
+ {
+ STRTransform.setSecurityStore(null);
+ }
+
+ SignedInfo info = xmlSig.getSignedInfo();
+ int length = info.getLength();
+ Collection<String> processed = new ArrayList<String>(length);
+ try
+ {
+ for (int i = 0; i < length; i++)
+ {
+ String uri = info.item(i).getURI();
+ if (uri != null && uri.length() > 1 &&
uri.charAt(0)=='#')
+ processed.add(uri.substring(1));
+ }
+ }
+ catch (XMLSecurityException e)
+ {
+ throw new WSSecurityException("Could not extract references", e);
+ }
+
+ return processed;
+ }
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/SimplePrincipal.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/security/SimplePrincipal.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/security/SimplePrincipal.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/SimplePrincipal.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -0,0 +1,65 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ws.extentions.security;
+
+import java.io.Serializable;
+import java.security.Principal;
+
+/** A simple String based implementation of Principal.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 05-May-2006
+ */
+public class SimplePrincipal implements Principal, Serializable
+{
+ private static final long serialVersionUID = 136345402844480211L;
+
+ private String name;
+
+ public SimplePrincipal(String name)
+ {
+ this.name = name;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public boolean equals(Object obj)
+ {
+ if (!(obj instanceof Principal))
+ return false;
+
+ return toString().equals(((Principal)obj).getName());
+ }
+
+ public int hashCode()
+ {
+ return (name == null ? 0 : name.hashCode());
+ }
+
+ public String toString()
+ {
+ return "" + name;
+ }
+}
Copied: branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/Target.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/security/Target.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/security/Target.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/Target.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -0,0 +1,33 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+package org.jboss.ws.extentions.security;
+
+
+/**
+ * @author <a href="mailto:jason.greene@jboss.com">Jason T.
Greene</a>
+ * @version $Revision$
+ */
+abstract public class Target
+{
+ // Applies only to encryption
+ abstract public boolean isContent();
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/TimestampOperation.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/security/TimestampOperation.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/security/TimestampOperation.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/TimestampOperation.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -0,0 +1,58 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+package org.jboss.ws.extentions.security;
+
+import java.util.List;
+
+import org.jboss.ws.extentions.security.element.SecurityHeader;
+import org.jboss.ws.extentions.security.element.Timestamp;
+import org.w3c.dom.Document;
+
+public class TimestampOperation implements EncodingOperation
+{
+ private SecurityHeader header;
+
+ private SecurityStore store;
+
+ public TimestampOperation(SecurityHeader header, SecurityStore store)
+ {
+ this.header = header;
+ this.store = store;
+ }
+
+ public void process(Document message, List<Target> targets, String alias, String
credential, String algorithm) throws WSSecurityException
+ {
+ Integer ttl = null;
+
+ try
+ {
+ // Time to live is stuffed in the credential field
+ ttl = Integer.valueOf(credential);
+ }
+ catch (NumberFormatException e)
+ {
+ // Eat
+ }
+
+ header.setTimestamp(new Timestamp(ttl, message));
+ }
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/TimestampVerificationOperation.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/security/TimestampVerificationOperation.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/security/TimestampVerificationOperation.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/TimestampVerificationOperation.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -0,0 +1,61 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+package org.jboss.ws.extentions.security;
+
+import java.util.Calendar;
+
+import org.jboss.ws.extentions.security.element.Timestamp;
+import org.w3c.dom.Document;
+
+
+public class TimestampVerificationOperation
+{
+ private Calendar now = null;
+
+ public TimestampVerificationOperation()
+ {
+ }
+
+ /**
+ * A special constructor that allows you to use a different value when validating the
message.
+ * DO NOT USE THIS UNLESS YOU REALLY KNOW WHAT YOU ARE DOING!.
+ *
+ * @param now The timestamp to use as the current time when validating a message
expiration
+ */
+ public TimestampVerificationOperation(Calendar now)
+ {
+ this.now = now;
+ }
+
+ public void process(Document message, Timestamp timestamp) throws WSSecurityException
+ {
+ Calendar expired = timestamp.getExpires();
+ Calendar created = timestamp.getCreated();
+ Calendar now = (this.now == null) ? Calendar.getInstance() : this.now;
+
+ if (created.after(now))
+ throw new WSSecurityException("Invalid timestamp, message claimed to be
created after now");
+
+ if (expired != null && ! now.before(expired))
+ throw new FailedCheckException("Expired message.");
+ }
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/TokenOperation.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/security/TokenOperation.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/security/TokenOperation.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/TokenOperation.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -0,0 +1,38 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+package org.jboss.ws.extentions.security;
+
+import org.jboss.ws.extentions.security.element.Token;
+import org.w3c.dom.Document;
+
+/**
+ * <code>DecodingOperation</code> represents an operation that is applied to
a
+ * WS-Security encoded message to both convert and verify the contents of the
+ * message.
+ *
+ * @author <a href="mailto:jason.greene@jboss.com">Jason T.
Greene</a>
+ * @version $Revision$
+ */
+public interface TokenOperation
+{
+ public void process(Document message, Token token) throws WSSecurityException;
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/UnsupportedAlgorithmException.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/security/UnsupportedAlgorithmException.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/security/UnsupportedAlgorithmException.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/UnsupportedAlgorithmException.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -0,0 +1,65 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+package org.jboss.ws.extentions.security;
+
+import javax.xml.namespace.QName;
+
+
+/**
+ * @author <a href="mailto:jason.greene@jboss.com">Jason T.
Greene</a>
+ * @version $Revision$
+ */
+
+public class UnsupportedAlgorithmException extends WSSecurityException
+{
+ public static final QName faultCode = new QName("UnsupportedAlgorithm",
Constants.WSSE_PREFIX, Constants.WSSE_NS);
+
+ public static final String faultString = "An unsupported signature or encryption
algorithm was used.";
+
+ public UnsupportedAlgorithmException()
+ {
+ super(faultString);
+ setFaultCode(faultCode);
+ setFaultString(faultString);
+ }
+
+ public UnsupportedAlgorithmException(Throwable cause)
+ {
+ super(faultString);
+ setFaultCode(faultCode);
+ setFaultString(faultString);
+ }
+
+ public UnsupportedAlgorithmException(String message)
+ {
+ super(message);
+ setFaultCode(faultCode);
+ setFaultString(message);
+ }
+
+ public UnsupportedAlgorithmException(String message, Throwable cause)
+ {
+ super(message, cause);
+ setFaultCode(faultCode);
+ setFaultString(message);
+ }
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/UnsupportedSecurityTokenException.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/security/UnsupportedSecurityTokenException.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/security/UnsupportedSecurityTokenException.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/UnsupportedSecurityTokenException.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -0,0 +1,64 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+package org.jboss.ws.extentions.security;
+
+import javax.xml.namespace.QName;
+
+
+/**
+ * @author <a href="mailto:jason.greene@jboss.com">Jason T.
Greene</a>
+ * @version $Revision$
+ */
+public class UnsupportedSecurityTokenException extends WSSecurityException
+{
+ public static final QName faultCode = new QName("UnsupportedSecurityToken",
Constants.WSSE_PREFIX, Constants.WSSE_NS);
+
+ public static final String faultString = "An unsupported token was
provided.";
+
+ public UnsupportedSecurityTokenException()
+ {
+ super(faultString);
+ setFaultCode(faultCode);
+ setFaultString(faultString);
+ }
+
+ public UnsupportedSecurityTokenException(Throwable cause)
+ {
+ super(faultString);
+ setFaultCode(faultCode);
+ setFaultString(faultString);
+ }
+
+ public UnsupportedSecurityTokenException(String message)
+ {
+ super(message);
+ setFaultCode(faultCode);
+ setFaultString(message);
+ }
+
+ public UnsupportedSecurityTokenException(String message, Throwable cause)
+ {
+ super(message, cause);
+ setFaultCode(faultCode);
+ setFaultString(message);
+ }
+}
Copied: branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/Util.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/security/Util.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/security/Util.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/Util.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -0,0 +1,217 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+package org.jboss.ws.extentions.security;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+/**
+ * @author Jason T. Greene
+ * @version $Id$
+ */
+public class Util
+{
+ public static int count = 0;
+
+ public static String assignWsuId(Element element)
+ {
+ String id = element.getAttributeNS(Constants.WSU_NS, Constants.ID);
+
+ if (id == null || id.length() < 1)
+ {
+ id = generateId();
+ element.setAttributeNS(Constants.WSU_NS, Constants.WSU_ID, id);
+ addNamespace(element, Constants.WSU_PREFIX, Constants.WSU_NS);
+ }
+
+ return id;
+ }
+
+ public static Element getFirstChildElement(Node node)
+ {
+ Node child = node.getFirstChild();
+ while (child != null && child.getNodeType() != Node.ELEMENT_NODE)
+ child = child.getNextSibling();
+
+ return (Element)child;
+ }
+
+ public static Element getNextSiblingElement(Element element)
+ {
+ Node sibling = element.getNextSibling();
+ while (sibling != null && sibling.getNodeType() != Node.ELEMENT_NODE)
+ sibling = sibling.getNextSibling();
+
+ return (Element)sibling;
+ }
+
+ public static Element getPreviousSiblingElement(Element element)
+ {
+ Node sibling = element.getPreviousSibling();
+ while (sibling != null && sibling.getNodeType() != Node.ELEMENT_NODE)
+ sibling = sibling.getPreviousSibling();
+
+ return (Element)sibling;
+ }
+
+ public static Element findElement(Element root, String localName, String namespace)
+ {
+ return findElement(root, new QName(namespace, localName));
+ }
+
+ public static Element findElement(Element root, QName name)
+ {
+ // Here lies your standard recusive DFS.....
+ if (matchNode(root, name))
+ return root;
+
+ // Search children
+ for (Node child = root.getFirstChild(); child != null; child =
child.getNextSibling())
+ {
+ if (child.getNodeType() != Node.ELEMENT_NODE)
+ continue;
+
+ Node possibleMatch = findElement((Element)child, name);
+ if (possibleMatch != null)
+ return (Element)possibleMatch;
+ }
+
+ return null;
+ }
+
+ public static List<Node> findAllElements(Element root, QName name, boolean
local)
+ {
+ List<Node> list = new ArrayList<Node>();
+ if (matchNode(root, name, local))
+ list.add(root);
+
+ for (Node child = root.getFirstChild(); child != null; child =
child.getNextSibling())
+ {
+ if (child.getNodeType() != Node.ELEMENT_NODE)
+ continue;
+
+ list.addAll(findAllElements((Element) child, name, local));
+ }
+
+ return list;
+ }
+
+ public static Element findElementByWsuId(Element root, String id)
+ {
+ // Here lies another standard recusive DFS.....
+ if (id.equals(getWsuId(root)))
+ return root;
+
+ // Search children
+ for (Node child = root.getFirstChild(); child != null; child =
child.getNextSibling())
+ {
+ if (child.getNodeType() != Node.ELEMENT_NODE)
+ continue;
+
+ Node possibleMatch = findElementByWsuId((Element)child, id);
+ if (possibleMatch != null)
+ return (Element)possibleMatch;
+ }
+
+ return null;
+ }
+
+ public static Element findOrCreateSoapHeader(Element envelope)
+ {
+ String prefix = envelope.getPrefix();
+ String uri = envelope.getNamespaceURI();
+ QName name = new QName(uri, "Header");
+ Element header = findElement(envelope, name);
+ if (header == null)
+ {
+ header = envelope.getOwnerDocument().createElementNS(uri, prefix +
":Header");
+ envelope.insertBefore(header, envelope.getFirstChild());
+ }
+
+ return header;
+ }
+
+ public static String getWsuId(Element element)
+ {
+ if (element.hasAttributeNS(Constants.WSU_NS, Constants.ID))
+ return element.getAttributeNS(Constants.WSU_NS, Constants.ID);
+
+ if (element.hasAttribute(Constants.ID))
+ {
+ String ns = element.getNamespaceURI();
+ if (Constants.XML_SIGNATURE_NS.equals(ns) ||
Constants.XML_ENCRYPTION_NS.equals(ns))
+ return element.getAttribute(Constants.ID);
+ }
+
+ return null;
+ }
+
+ public static boolean equalStrings(String string1, String string2)
+ {
+ if (string1 == null && string2 == null)
+ return true;
+
+ return string1 != null && string1.equals(string2);
+ }
+
+ public static boolean matchNode(Node node, QName name)
+ {
+ return matchNode(node, name, false);
+ }
+
+ public static boolean matchNode(Node node, QName name, boolean local)
+ {
+ return equalStrings(node.getLocalName(), name.getLocalPart())
+ && (local || equalStrings(node.getNamespaceURI(),
name.getNamespaceURI()));
+ }
+
+ public static String generateId()
+ {
+ return generateId("element");
+ }
+
+ public static void addNamespace(Element element, String prefix, String uri)
+ {
+ element.setAttributeNS(Constants.XMLNS_NS, "xmlns:" + prefix, uri);
+ }
+
+ public static String generateId(String prefix)
+ {
+ StringBuilder id = new StringBuilder();
+ long time = System.currentTimeMillis();
+
+ // reasonably gaurantee uniqueness
+ synchronized (Util.class)
+ {
+ count++;
+ }
+
+
id.append(prefix).append("-").append(count).append("-").append(time).append("-").append(id.hashCode());
+
+ return id.toString();
+ }
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/WSSecurityDispatcher.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/security/WSSecurityDispatcher.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/security/WSSecurityDispatcher.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/WSSecurityDispatcher.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -0,0 +1,303 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ws.extentions.security;
+
+// $Id$
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+import javax.xml.rpc.Stub;
+import javax.xml.rpc.soap.SOAPFaultException;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPHeader;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.WSException;
+import org.jboss.ws.core.CommonMessageContext;
+import org.jboss.ws.core.jaxrpc.StubExt;
+import org.jboss.ws.core.metadata.umdm.EndpointMetaData;
+import org.jboss.ws.core.metadata.umdm.OperationMetaData;
+import org.jboss.ws.core.metadata.wsse.Config;
+import org.jboss.ws.core.metadata.wsse.Encrypt;
+import org.jboss.ws.core.metadata.wsse.Operation;
+import org.jboss.ws.core.metadata.wsse.Port;
+import org.jboss.ws.core.metadata.wsse.RequireEncryption;
+import org.jboss.ws.core.metadata.wsse.RequireSignature;
+import org.jboss.ws.core.metadata.wsse.RequireTimestamp;
+import org.jboss.ws.core.metadata.wsse.Requires;
+import org.jboss.ws.core.metadata.wsse.Sign;
+import org.jboss.ws.core.metadata.wsse.Timestamp;
+import org.jboss.ws.core.metadata.wsse.WSSecurityConfiguration;
+import org.jboss.ws.core.soap.SOAPMessageImpl;
+import org.jboss.ws.core.utils.DOMWriter;
+import org.w3c.dom.Element;
+
+public class WSSecurityDispatcher
+{
+ // provide logging
+ private static Logger log = Logger.getLogger(WSSecurityDispatcher.class);
+
+ private static List<Target>
convertTargets(List<org.jboss.ws.core.metadata.wsse.Target> targets)
+ {
+ if (targets == null)
+ return null;
+
+ ArrayList<Target> newList = new ArrayList<Target>(targets.size());
+
+ for (org.jboss.ws.core.metadata.wsse.Target target : targets)
+ {
+ if ("qname".equals(target.getType()))
+ {
+ QNameTarget qnameTarget = new QNameTarget(QName.valueOf(target.getValue()),
target.isContentOnly());
+ newList.add(qnameTarget);
+ }
+ else if ("wsuid".equals(target.getType()))
+ {
+ newList.add(new WsuIdTarget(target.getValue()));
+ }
+ }
+
+ return newList;
+ }
+
+ private static Config getConfig(WSSecurityConfiguration config, String portName,
String operationName)
+ {
+ Port port = config.getPorts().get(portName);
+ if (port == null)
+ return config.getDefaultConfig();
+
+ Operation operation = port.getOperations().get(operationName);
+ if (operation == null)
+ {
+ Config portConfig = port.getDefaultConfig();
+ return (portConfig == null) ? config.getDefaultConfig() : portConfig;
+
+ }
+
+ return operation.getConfig();
+ }
+
+ private static SOAPFaultException convertToFault(WSSecurityException e)
+ {
+ return new SOAPFaultException(e.getFaultCode(), e.getFaultString(), null, null);
+ }
+
+ public static void handleInbound(CommonMessageContext ctx) throws SOAPException,
SOAPFaultException
+ {
+ WSSecurityConfiguration config = getSecurityConfig(ctx);
+ SOAPMessageImpl soapMessage = (SOAPMessageImpl)ctx.getSOAPMessage();
+
+ SOAPHeader soapHeader = soapMessage.getSOAPHeader();
+ QName secQName = new QName(Constants.WSSE_NS, "Security");
+ Element secHeaderElement = Util.findElement(soapHeader, secQName);
+
+ if (secHeaderElement == null)
+ {
+ // This is ok, we always allow faults to be received because WS-Security does
not encrypt faults
+ if (soapMessage.getSOAPBody().getFault() != null)
+ return;
+
+ OperationMetaData opMetaData = ctx.getOperationMetaData();
+ if (opMetaData == null)
+ {
+ // Get the operation meta data from the soap message
+ // for the server side inbound message.
+ EndpointMetaData epMetaData = ctx.getEndpointMetaData();
+ opMetaData = soapMessage.getOperationMetaData(epMetaData);
+ }
+
+ String operation = opMetaData.getQName().toString();
+ String port = opMetaData.getEndpointMetaData().getQName().getLocalPart();
+
+ if (hasRequirements(config, operation, port))
+ throw convertToFault(new InvalidSecurityHeaderException("This service
requires <wsse:Security>, which is missing."));
+
+ return;
+ }
+
+ try
+ {
+ SecurityStore securityStore = new SecurityStore(config.getKeyStoreURL(),
config.getKeyStoreType(), config.getKeyStorePassword(), config.getTrustStoreURL(),
+ config.getTrustStoreType(), config.getTrustStorePassword());
+ SecurityDecoder decoder = new SecurityDecoder(securityStore);
+
+ decoder.decode(soapMessage.getSOAPPart(), secHeaderElement);
+ log.debug("Decoded Message:\n" +
DOMWriter.printNode(soapMessage.getSOAPPart(), true));
+
+ OperationMetaData opMetaData = ctx.getOperationMetaData();
+ if (opMetaData == null)
+ {
+ // Get the operation meta data from the soap message
+ // for the server side inbound message.
+ EndpointMetaData epMetaData = ctx.getEndpointMetaData();
+ opMetaData = soapMessage.getOperationMetaData(epMetaData);
+ }
+
+ String operation = opMetaData.getQName().toString();
+ String port = opMetaData.getEndpointMetaData().getQName().getLocalPart();
+
+ List<OperationDescription<RequireOperation>> operations =
buildRequireOperations(config, operation, port);
+
+ decoder.verify(operations);
+ log.debug("Verification is successful");
+
+ decoder.complete();
+ }
+ catch (WSSecurityException e)
+ {
+ if (e.isInternalError())
+ log.error("Internal error occured handling inbound message:", e);
+ else log.debug("Returning error to sender: " + e.getMessage());
+
+ throw convertToFault(e);
+ }
+ }
+
+ private static WSSecurityConfiguration getSecurityConfig(CommonMessageContext ctx)
+ {
+ WSSecurityConfiguration config =
ctx.getEndpointMetaData().getServiceMetaData().getSecurityConfiguration();
+ if (config == null)
+ throw new WSException("Cannot obtatin security configuration from message
context");
+
+ return config;
+ }
+
+ private static boolean hasRequirements(WSSecurityConfiguration config, String
operation, String port)
+ {
+ Config operationConfig = getConfig(config, port, operation);
+ return (operationConfig != null && operationConfig.getRequires() != null);
+ }
+
+ private static List<OperationDescription<RequireOperation>>
buildRequireOperations(WSSecurityConfiguration config, String operation, String port)
+ {
+ Config operationConfig = getConfig(config, port, operation);
+ if (operationConfig == null)
+ return null;
+
+ Requires requires = operationConfig.getRequires();
+ if (requires == null)
+ return null;
+
+ ArrayList<OperationDescription<RequireOperation>> operations = new
ArrayList<OperationDescription<RequireOperation>>();
+ RequireTimestamp requireTimestamp = requires.getRequireTimestamp();
+ if (requireTimestamp != null)
+ operations.add(new
OperationDescription<RequireOperation>(RequireTimestampOperation.class, null,
requireTimestamp.getMaxAge(), null, null));
+
+ RequireSignature requireSignature = requires.getRequireSignature();
+ if (requireSignature != null)
+ {
+ List<Target> targets = convertTargets(requireSignature.getTargets());
+ operations.add(new
OperationDescription<RequireOperation>(RequireSignatureOperation.class, targets,
null, null, null));
+ }
+
+ RequireEncryption requireEncryption = requires.getRequireEncryption();
+ if (requireEncryption != null)
+ {
+ List<Target> targets = convertTargets(requireEncryption.getTargets());
+ operations.add(new
OperationDescription<RequireOperation>(RequireEncryptionOperation.class, targets,
null, null, null));
+ }
+
+ return operations;
+ }
+
+ public static void handleOutbound(CommonMessageContext ctx) throws SOAPException,
SOAPFaultException
+ {
+ WSSecurityConfiguration config = getSecurityConfig(ctx);
+ SOAPMessageImpl soapMessage = (SOAPMessageImpl)ctx.getSOAPMessage();
+
+ OperationMetaData opMetaData = ctx.getOperationMetaData();
+ String operation = opMetaData.getQName().toString();
+ String port = opMetaData.getEndpointMetaData().getQName().getLocalPart();
+
+ Config operationConfig = getConfig(config, port, operation);
+
+ log.debug("WS-Security config:" + operationConfig);
+ // Nothing to process
+ if (operationConfig == null)
+ return;
+
+ ArrayList<OperationDescription<EncodingOperation>> operations = new
ArrayList<OperationDescription<EncodingOperation>>();
+ Timestamp timestamp = operationConfig.getTimestamp();
+ if (timestamp != null)
+ {
+ operations.add(new
OperationDescription<EncodingOperation>(TimestampOperation.class, null, null,
timestamp.getTtl(), null));
+ }
+
+ if (operationConfig.getUsername() != null)
+ {
+ Object user = ctx.getProperty(Stub.USERNAME_PROPERTY);
+ Object pass = ctx.getProperty(Stub.PASSWORD_PROPERTY);
+
+ if (user != null && pass != null)
+ {
+ operations.add(new
OperationDescription<EncodingOperation>(SendUsernameOperation.class, null,
user.toString(), pass.toString(), null));
+ ctx.setProperty(StubExt.PROPERTY_AUTH_TYPE,
StubExt.PROPERTY_AUTH_TYPE_WSSE);
+ }
+ }
+
+ Sign sign = operationConfig.getSign();
+ if (sign != null)
+ {
+ List<Target> targets = convertTargets(sign.getTargets());
+ if (sign.isIncludeTimestamp())
+ {
+ if (timestamp == null)
+ operations.add(new
OperationDescription<EncodingOperation>(TimestampOperation.class, null, null, null,
null));
+
+ if (targets != null && targets.size() > 0)
+ targets.add(new WsuIdTarget("timestamp"));
+ }
+
+ operations.add(new
OperationDescription<EncodingOperation>(SignatureOperation.class, targets,
sign.getAlias(), null, null));
+ }
+
+ Encrypt encrypt = operationConfig.getEncrypt();
+ if (encrypt != null)
+ {
+ List<Target> targets = convertTargets(encrypt.getTargets());
+ operations.add(new
OperationDescription<EncodingOperation>(EncryptionOperation.class, targets,
encrypt.getAlias(), null, encrypt.getAlgorithm()));
+ }
+
+ if (operations.size() == 0)
+ return;
+
+ log.debug("Encoding Message:\n" +
DOMWriter.printNode(soapMessage.getSOAPPart(), true));
+
+ try
+ {
+ SecurityStore securityStore = new SecurityStore(config.getKeyStoreURL(),
config.getKeyStoreType(), config.getKeyStorePassword(), config.getTrustStoreURL(),
+ config.getTrustStoreType(), config.getTrustStorePassword());
+ SecurityEncoder encoder = new SecurityEncoder(operations, securityStore);
+ encoder.encode(soapMessage.getSOAPPart());
+ }
+ catch (WSSecurityException e)
+ {
+ if (e.isInternalError())
+ log.error("Internal error occured handling outbound message:", e);
+ else log.debug("Returning error to sender: " + e.getMessage());
+
+ throw convertToFault(e);
+ }
+ }
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/WSSecurityException.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/security/WSSecurityException.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/security/WSSecurityException.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/WSSecurityException.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -0,0 +1,74 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+package org.jboss.ws.extentions.security;
+
+import javax.xml.namespace.QName;
+
+/**
+ * @author <a href="mailto:jason.greene@jboss.com">Jason T.
Greene</a>
+ * @version $Revision$
+ */
+public class WSSecurityException extends Exception
+{
+ private boolean internal = false;
+
+ private QName faultCode = new QName(Constants.JBOSS_WSSE_NS,
"InternalError", Constants.JBOSS_WSSE_PREFIX);
+
+ private String faultString = "An internal WS-Security error occurred. See log for
details";
+
+ public WSSecurityException(String message)
+ {
+ super(message);
+ this.internal = true;
+ }
+
+ public WSSecurityException(String message, Throwable cause)
+ {
+ super(message, cause);
+ this.internal = true;
+ }
+
+ protected void setFaultCode(QName faultCode)
+ {
+ this.faultCode = faultCode;
+ }
+
+ protected void setFaultString(String faultMessage)
+ {
+ this.faultString = faultMessage;
+ }
+
+ public boolean isInternalError()
+ {
+ return internal;
+ }
+
+ public QName getFaultCode()
+ {
+ return faultCode;
+ }
+
+ public String getFaultString()
+ {
+ return faultString;
+ }
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/WsuIdResolver.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/security/WsuIdResolver.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/security/WsuIdResolver.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/WsuIdResolver.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -0,0 +1,89 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+package org.jboss.ws.extentions.security;
+
+import org.apache.xml.security.signature.XMLSignatureInput;
+import org.apache.xml.security.utils.resolver.ResourceResolverException;
+import org.apache.xml.security.utils.resolver.ResourceResolverSpi;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+
+/**
+ * @author Jason T. Greene
+ * @version $Id$
+ */
+public class WsuIdResolver extends ResourceResolverSpi
+{
+ Document doc;
+ Element header;
+
+ public WsuIdResolver(Document doc)
+ {
+ this.doc = doc;
+ }
+
+ public WsuIdResolver(Document doc, Element header)
+ {
+ this.doc = doc;
+ this.header = header;
+ }
+
+ /**
+ * @see
org.apache.xml.security.utils.resolver.ResourceResolverSpi#engineCanResolve(org.w3c.dom.Attr,
java.lang.String)
+ */
+ public boolean engineCanResolve(Attr uri, String baseURI)
+ {
+ if (uri == null)
+ return false;
+
+ String nodeValue = uri.getNodeValue();
+ return nodeValue != null && nodeValue.startsWith("#");
+ }
+
+ /**
+ * @see
org.apache.xml.security.utils.resolver.ResourceResolverSpi#engineResolve(org.w3c.dom.Attr,
java.lang.String)
+ */
+ public XMLSignatureInput engineResolve(Attr uri, String BaseURI) throws
ResourceResolverException
+ {
+ //Document doc = uri.getOwnerDocument();
+ String id = uri.getValue().substring(1);
+
+ Element element = doc.getDocumentElement();
+ element = Util.findElementByWsuId(element, id);
+
+ // If its not in the document, try the header
+ if (element == null && header != null)
+ element = Util.findElementByWsuId(header, id);
+
+ if (element == null)
+ throw new ResourceResolverException(id, uri, BaseURI);
+
+ XMLSignatureInput input = new XMLSignatureInput(element);
+ input.setMIMEType("text/xml");
+
+ input.setSourceURI(BaseURI + uri);
+
+ return input;
+ }
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/WsuIdTarget.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/security/WsuIdTarget.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/security/WsuIdTarget.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/WsuIdTarget.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -0,0 +1,56 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+package org.jboss.ws.extentions.security;
+
+
+/**
+ * @author <a href="mailto:jason.greene@jboss.com">Jason T.
Greene</a>
+ * @version $Revision$
+ */
+public class WsuIdTarget extends Target
+{
+ private String id;
+
+ private boolean content;
+
+ public WsuIdTarget(String url)
+ {
+ this.id = url;
+ this.content = false;
+ }
+
+ public WsuIdTarget(String url, boolean content)
+ {
+ this(url);
+ this.content = content;
+ }
+
+ public String getId()
+ {
+ return id;
+ }
+
+ public boolean isContent()
+ {
+ return content;
+ }
+}
\ No newline at end of file
Copied: branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/element
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/security/element)
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/element/BinarySecurityToken.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/security/element/BinarySecurityToken.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/element/BinarySecurityToken.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -19,11 +19,11 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
*/
-package org.jboss.ws.extras.security.element;
+package org.jboss.ws.extentions.security.element;
-import org.jboss.ws.extras.security.Constants;
-import org.jboss.ws.extras.security.Util;
-import org.jboss.ws.extras.security.WSSecurityException;
+import org.jboss.ws.extentions.security.Constants;
+import org.jboss.ws.extentions.security.Util;
+import org.jboss.ws.extentions.security.WSSecurityException;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/element/DirectReference.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/security/element/DirectReference.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/element/DirectReference.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -19,10 +19,10 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
*/
-package org.jboss.ws.extras.security.element;
+package org.jboss.ws.extentions.security.element;
-import org.jboss.ws.extras.security.Constants;
-import org.jboss.ws.extras.security.WSSecurityException;
+import org.jboss.ws.extentions.security.Constants;
+import org.jboss.ws.extentions.security.WSSecurityException;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -32,8 +32,8 @@
* retrievable via a URL. This is typically used for refering to a
* <code>BinarySecurityToken</code> that is within the same message.
*
- * @see org.jboss.ws.extras.security.element.SecurityTokenReference
- * @see org.jboss.ws.extras.security.element.BinarySecurityToken
+ * @see org.jboss.ws.extentions.security.element.SecurityTokenReference
+ * @see org.jboss.ws.extentions.security.element.BinarySecurityToken
*
* @author Jason T. Greene
* @version $Id$
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/element/EncryptedKey.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/security/element/EncryptedKey.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/element/EncryptedKey.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
*/
-package org.jboss.ws.extras.security.element;
+package org.jboss.ws.extentions.security.element;
import java.security.PrivateKey;
@@ -28,11 +28,11 @@
import org.apache.xml.security.encryption.XMLCipher;
import org.apache.xml.security.exceptions.XMLSecurityException;
import org.apache.xml.security.keys.KeyInfo;
-import org.jboss.ws.extras.security.Constants;
-import org.jboss.ws.extras.security.InvalidSecurityHeaderException;
-import org.jboss.ws.extras.security.KeyResolver;
-import org.jboss.ws.extras.security.Util;
-import org.jboss.ws.extras.security.WSSecurityException;
+import org.jboss.ws.extentions.security.Constants;
+import org.jboss.ws.extentions.security.InvalidSecurityHeaderException;
+import org.jboss.ws.extentions.security.KeyResolver;
+import org.jboss.ws.extentions.security.Util;
+import org.jboss.ws.extentions.security.WSSecurityException;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/element/KeyIdentifier.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/security/element/KeyIdentifier.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/element/KeyIdentifier.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -19,15 +19,15 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
*/
-package org.jboss.ws.extras.security.element;
+package org.jboss.ws.extentions.security.element;
import java.security.cert.X509Certificate;
import org.apache.xml.security.exceptions.Base64DecodingException;
import org.apache.xml.security.utils.Base64;
import org.apache.xml.security.utils.XMLUtils;
-import org.jboss.ws.extras.security.Constants;
-import org.jboss.ws.extras.security.WSSecurityException;
+import org.jboss.ws.extentions.security.Constants;
+import org.jboss.ws.extentions.security.WSSecurityException;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -38,8 +38,8 @@
* X.509v3 Subject Key Identifier, which is the only currently
* supported key identifier by this class.
*
- * @see org.jboss.ws.extras.security.element.SecurityTokenReference
- * @see org.jboss.ws.extras.security.element.BinarySecurityToken
+ * @see org.jboss.ws.extentions.security.element.SecurityTokenReference
+ * @see org.jboss.ws.extentions.security.element.BinarySecurityToken
*
* @author Jason T. Greene
* @version $Id$
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/element/Reference.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/security/element/Reference.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/element/Reference.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -19,9 +19,9 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
*/
-package org.jboss.ws.extras.security.element;
+package org.jboss.ws.extentions.security.element;
-import org.jboss.ws.extras.security.WSSecurityException;
+import org.jboss.ws.extentions.security.WSSecurityException;
import org.w3c.dom.Element;
abstract public class Reference implements SecurityElement
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/element/ReferenceList.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/security/element/ReferenceList.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/element/ReferenceList.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -19,15 +19,15 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
*/
-package org.jboss.ws.extras.security.element;
+package org.jboss.ws.extentions.security.element;
import java.util.Collection;
import java.util.Iterator;
import java.util.LinkedList;
import org.apache.xml.security.encryption.Reference;
-import org.jboss.ws.extras.security.Constants;
-import org.jboss.ws.extras.security.Util;
+import org.jboss.ws.extentions.security.Constants;
+import org.jboss.ws.extentions.security.Util;
import org.w3c.dom.Element;
/**
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/element/SecurityElement.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/security/element/SecurityElement.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/element/SecurityElement.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -19,9 +19,9 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
*/
-package org.jboss.ws.extras.security.element;
+package org.jboss.ws.extentions.security.element;
-import org.jboss.ws.extras.security.WSSecurityException;
+import org.jboss.ws.extentions.security.WSSecurityException;
import org.w3c.dom.Element;
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/element/SecurityHeader.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/security/element/SecurityHeader.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/element/SecurityHeader.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -19,18 +19,18 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
*/
-package org.jboss.ws.extras.security.element;
+package org.jboss.ws.extentions.security.element;
import java.util.HashMap;
import java.util.LinkedList;
-import org.jboss.ws.extras.security.BinarySecurityTokenValidator;
-import org.jboss.ws.extras.security.Constants;
-import org.jboss.ws.extras.security.KeyResolver;
-import org.jboss.ws.extras.security.SecurityStore;
-import org.jboss.ws.extras.security.UnsupportedSecurityTokenException;
-import org.jboss.ws.extras.security.Util;
-import org.jboss.ws.extras.security.WSSecurityException;
+import org.jboss.ws.extentions.security.BinarySecurityTokenValidator;
+import org.jboss.ws.extentions.security.Constants;
+import org.jboss.ws.extentions.security.KeyResolver;
+import org.jboss.ws.extentions.security.SecurityStore;
+import org.jboss.ws.extentions.security.UnsupportedSecurityTokenException;
+import org.jboss.ws.extentions.security.Util;
+import org.jboss.ws.extentions.security.WSSecurityException;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/element/SecurityProcess.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/security/element/SecurityProcess.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/element/SecurityProcess.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
*/
-package org.jboss.ws.extras.security.element;
+package org.jboss.ws.extentions.security.element;
/**
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/element/SecurityTokenReference.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/security/element/SecurityTokenReference.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/element/SecurityTokenReference.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -19,11 +19,11 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
*/
-package org.jboss.ws.extras.security.element;
+package org.jboss.ws.extentions.security.element;
-import org.jboss.ws.extras.security.Constants;
-import org.jboss.ws.extras.security.Util;
-import org.jboss.ws.extras.security.WSSecurityException;
+import org.jboss.ws.extentions.security.Constants;
+import org.jboss.ws.extentions.security.Util;
+import org.jboss.ws.extentions.security.WSSecurityException;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/element/Signature.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/security/element/Signature.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/element/Signature.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -19,14 +19,14 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
*/
-package org.jboss.ws.extras.security.element;
+package org.jboss.ws.extentions.security.element;
import java.security.PublicKey;
import org.apache.xml.security.exceptions.XMLSecurityException;
import org.apache.xml.security.signature.XMLSignature;
-import org.jboss.ws.extras.security.KeyResolver;
-import org.jboss.ws.extras.security.WSSecurityException;
+import org.jboss.ws.extentions.security.KeyResolver;
+import org.jboss.ws.extentions.security.WSSecurityException;
import org.w3c.dom.Element;
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/element/Timestamp.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/security/element/Timestamp.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/element/Timestamp.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -19,16 +19,16 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
*/
-package org.jboss.ws.extras.security.element;
+package org.jboss.ws.extentions.security.element;
import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.TimeZone;
import org.apache.xml.security.utils.XMLUtils;
-import org.jboss.ws.extras.security.Constants;
-import org.jboss.ws.extras.security.Util;
-import org.jboss.ws.extras.security.WSSecurityException;
+import org.jboss.ws.extentions.security.Constants;
+import org.jboss.ws.extentions.security.Util;
+import org.jboss.ws.extentions.security.WSSecurityException;
import org.jboss.xb.binding.SimpleTypeBindings;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/element/Token.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/security/element/Token.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/element/Token.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
*/
-package org.jboss.ws.extras.security.element;
+package org.jboss.ws.extentions.security.element;
/**
* <code>Token</code> represnts an authenticated identifier contained in a
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/element/UsernameToken.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/security/element/UsernameToken.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/element/UsernameToken.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -19,12 +19,12 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
*/
-package org.jboss.ws.extras.security.element;
+package org.jboss.ws.extentions.security.element;
import org.apache.xml.security.utils.XMLUtils;
-import org.jboss.ws.extras.security.Constants;
-import org.jboss.ws.extras.security.Util;
-import org.jboss.ws.extras.security.WSSecurityException;
+import org.jboss.ws.extentions.security.Constants;
+import org.jboss.ws.extentions.security.Util;
+import org.jboss.ws.extentions.security.WSSecurityException;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/element/X509IssuerSerial.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/security/element/X509IssuerSerial.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/element/X509IssuerSerial.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -19,15 +19,15 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
*/
-package org.jboss.ws.extras.security.element;
+package org.jboss.ws.extentions.security.element;
import java.security.cert.X509Certificate;
import org.apache.xml.security.utils.XMLUtils;
-import org.jboss.ws.extras.security.Constants;
-import org.jboss.ws.extras.security.InvalidSecurityHeaderException;
-import org.jboss.ws.extras.security.Util;
-import org.jboss.ws.extras.security.WSSecurityException;
+import org.jboss.ws.extentions.security.Constants;
+import org.jboss.ws.extentions.security.InvalidSecurityHeaderException;
+import org.jboss.ws.extentions.security.Util;
+import org.jboss.ws.extentions.security.WSSecurityException;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -36,8 +36,8 @@
* <code>SecurityTokenReference</code> that referes to a token that
* using the Issuer's DN, and certificate serial number.
*
- * @see org.jboss.ws.extras.security.element.SecurityTokenReference
- * @see org.jboss.ws.extras.security.element.BinarySecurityToken
+ * @see org.jboss.ws.extentions.security.element.SecurityTokenReference
+ * @see org.jboss.ws.extentions.security.element.BinarySecurityToken
*
* @author Jason T. Greene
* @version $Id$
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/element/X509Token.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/security/element/X509Token.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/element/X509Token.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
*/
-package org.jboss.ws.extras.security.element;
+package org.jboss.ws.extentions.security.element;
import java.io.ByteArrayInputStream;
import java.security.cert.CertificateEncodingException;
@@ -28,8 +28,8 @@
import org.apache.xml.security.utils.XMLUtils;
import org.jboss.util.Base64;
-import org.jboss.ws.extras.security.Constants;
-import org.jboss.ws.extras.security.WSSecurityException;
+import org.jboss.ws.extentions.security.Constants;
+import org.jboss.ws.extentions.security.WSSecurityException;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
Copied: branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/jaxrpc
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/security/jaxrpc)
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/jaxrpc/WSSecurityHandler.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/security/jaxrpc/WSSecurityHandler.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/jaxrpc/WSSecurityHandler.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
*/
-package org.jboss.ws.extras.security.jaxrpc;
+package org.jboss.ws.extentions.security.jaxrpc;
// $Id$
@@ -32,7 +32,7 @@
import org.jboss.ws.core.jaxrpc.handler.SOAPMessageContextJAXRPC;
import org.jboss.ws.core.metadata.umdm.EndpointMetaData;
import org.jboss.ws.core.metadata.wsse.WSSecurityConfiguration;
-import org.jboss.ws.extras.security.WSSecurityDispatcher;
+import org.jboss.ws.extentions.security.WSSecurityDispatcher;
/**
* An abstract JAXRPC handler that delegates to the WSSecurityDispatcher
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/jaxrpc/WSSecurityHandlerInbound.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/security/jaxrpc/WSSecurityHandlerInbound.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/jaxrpc/WSSecurityHandlerInbound.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
*/
-package org.jboss.ws.extras.security.jaxrpc;
+package org.jboss.ws.extentions.security.jaxrpc;
// $Id$
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/jaxrpc/WSSecurityHandlerOutbound.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/security/jaxrpc/WSSecurityHandlerOutbound.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/jaxrpc/WSSecurityHandlerOutbound.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
*/
-package org.jboss.ws.extras.security.jaxrpc;
+package org.jboss.ws.extentions.security.jaxrpc;
// $Id$
Copied: branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/jaxws (from
rev 1589, branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/security/jaxws)
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/jaxws/WSSecurityHandler.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/security/jaxws/WSSecurityHandler.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/jaxws/WSSecurityHandler.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
*/
-package org.jboss.ws.extras.security.jaxws;
+package org.jboss.ws.extentions.security.jaxws;
// $Id$
@@ -31,7 +31,7 @@
import org.jboss.ws.core.jaxws.handler.GenericSOAPHandler;
import org.jboss.ws.core.metadata.umdm.EndpointMetaData;
import org.jboss.ws.core.metadata.wsse.WSSecurityConfiguration;
-import org.jboss.ws.extras.security.WSSecurityDispatcher;
+import org.jboss.ws.extentions.security.WSSecurityDispatcher;
/**
* An abstract JAXWS handler that delegates to the WSSecurityDispatcher
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/jaxws/WSSecurityHandlerInbound.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/security/jaxws/WSSecurityHandlerInbound.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/jaxws/WSSecurityHandlerInbound.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
*/
-package org.jboss.ws.extras.security.jaxws;
+package org.jboss.ws.extentions.security.jaxws;
import javax.xml.ws.handler.MessageContext;
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/jaxws/WSSecurityHandlerOutbound.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/security/jaxws/WSSecurityHandlerOutbound.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/security/jaxws/WSSecurityHandlerOutbound.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
*/
-package org.jboss.ws.extras.security.jaxws;
+package org.jboss.ws.extentions.security.jaxws;
import javax.xml.ws.handler.MessageContext;
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/xop/CreateAttachmentVisitor.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/xop/CreateAttachmentVisitor.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/xop/CreateAttachmentVisitor.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/xop/CreateAttachmentVisitor.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -0,0 +1,89 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+package org.jboss.ws.extentions.xop;
+
+import java.io.IOException;
+import java.io.Writer;
+import java.util.Iterator;
+
+import org.jboss.ws.core.soap.SAAJVisitor;
+import org.jboss.ws.core.soap.SOAPContentElement;
+import org.jboss.ws.core.soap.SOAPElementImpl;
+
+/**
+ * @author Heiko Braun <heiko.braun(a)jboss.com>
+ * @version $Id: CreateAttachmentVisitor.java 1408 2006-11-07 13:42:25Z
heiko.braun(a)jboss.com $
+ * @since Nov 7, 2006
+ */
+public class CreateAttachmentVisitor implements SAAJVisitor {
+ public void visitXOPElements(SOAPElementImpl root)
+ {
+ boolean isSCE = (root instanceof SOAPContentElement);
+
+ // don't expand SOAPContentElements
+ if(isSCE)
+ {
+ root.accept(this);
+ }
+ else
+ {
+ Iterator it = root.getChildElements();
+ while(it.hasNext())
+ {
+ final Object o = it.next();
+ if(o instanceof SOAPElementImpl)
+ visitXOPElements((SOAPElementImpl)o);
+ }
+ }
+ }
+
+ public void visitSOAPElement(SOAPElementImpl soapElement) {
+ // nada
+ }
+
+ public void visitSOAPContentElement(SOAPContentElement scElement) {
+ // Calling writeElement will enforce marshalling of this object
+ // Any attachment will be created while doing this.
+ try
+ {
+ scElement.writeElement( new NoopWriter() );
+ }
+ catch (IOException e)
+ {
+ //
+ }
+ }
+
+ class NoopWriter extends Writer {
+ public void write(char cbuf[], int off, int len) throws IOException {
+
+ }
+
+ public void flush() throws IOException {
+
+ }
+
+ public void close() throws IOException {
+
+ }
+ }
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/xop/DisableMTOMHandler.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/xop/DisableMTOMHandler.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/xop/DisableMTOMHandler.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/xop/DisableMTOMHandler.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -0,0 +1,59 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+package org.jboss.ws.extentions.xop;
+
+import javax.xml.namespace.QName;
+import javax.xml.rpc.handler.GenericHandler;
+import javax.xml.rpc.handler.MessageContext;
+
+import org.jboss.ws.core.jaxrpc.StubExt;
+
+/**
+ * @author Heiko Braun <heiko.braun(a)jboss.com>
+ * @version $Id$
+ * @since Oct 2, 2006
+ */
+public class DisableMTOMHandler extends GenericHandler {
+ public QName[] getHeaders() {
+ return new QName[0];
+ }
+
+ public boolean handleRequest(MessageContext msgContext) {
+ disableMTOM(msgContext);
+ return true;
+ }
+
+ public boolean handleResponse(MessageContext msgContext) {
+ disableMTOM(msgContext);
+ return true;
+ }
+
+ public boolean handleFault(MessageContext msgContext) {
+ disableMTOM(msgContext);
+ return true;
+ }
+
+ public void disableMTOM(MessageContext msgContext)
+ {
+ msgContext.setProperty(StubExt.PROPERTY_MTOM_ENABLED, Boolean.FALSE);
+ }
+}
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/xop/RestoreXOPElementVisitor.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/xop/RestoreXOPElementVisitor.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/xop/RestoreXOPElementVisitor.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/xop/RestoreXOPElementVisitor.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -0,0 +1,75 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+package org.jboss.ws.extentions.xop;
+
+import java.util.Iterator;
+
+import org.jboss.ws.core.soap.SAAJVisitor;
+import org.jboss.ws.core.soap.SOAPContentElement;
+import org.jboss.ws.core.soap.SOAPElementImpl;
+
+/**
+ * Visit soap object model and restore XOP contents.
+ * This visitor is invoked when:
+ * <ul>
+ * <li>Client side request handler chain has been executed
+ * <li>Server side response or fault handler chain been executed
+ * </ul>
+ *
+ * It basically takes care that when jaxrpc handlers have been in place,
+ * the XOP contents are being restored upon request and response.
+ *
+ * @author Heiko Braun <heiko.braun(a)jboss.com>
+ * @version $Id$
+ * @since Sep 26, 2006
+ */
+public class RestoreXOPElementVisitor implements SAAJVisitor {
+
+ public void visitXOPElements(SOAPElementImpl root)
+ {
+ boolean isSCE = (root instanceof SOAPContentElement);
+
+ // don't expand SOAPContentElements
+ if(isSCE)
+ {
+ root.accept(this);
+ }
+ else
+ {
+ Iterator it = root.getChildElements();
+ while(it.hasNext())
+ {
+ final Object o = it.next();
+ if(o instanceof SOAPElementImpl)
+ visitXOPElements((SOAPElementImpl)o);
+ }
+ }
+ }
+
+ public void visitSOAPElement(SOAPElementImpl soapElement) {
+ // nada
+ }
+
+ public void visitSOAPContentElement(SOAPContentElement scElement) {
+ scElement.handleMTOMTransitions();
+ }
+}
Copied: branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/xop/XOPContext.java
(from rev 1589,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/xop/XOPContext.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/xop/XOPContext.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/xop/XOPContext.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -0,0 +1,429 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ws.extentions.xop;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.util.Iterator;
+
+import javax.activation.DataHandler;
+import javax.xml.namespace.QName;
+import javax.xml.soap.AttachmentPart;
+import javax.xml.soap.SOAPBody;
+import javax.xml.soap.SOAPElement;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPMessage;
+
+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.jaxrpc.StubExt;
+import org.jboss.ws.core.metadata.umdm.EndpointMetaData;
+import org.jboss.ws.core.soap.MessageContextAssociation;
+import org.jboss.ws.core.soap.NameImpl;
+import org.jboss.ws.core.soap.SOAPElementImpl;
+import org.jboss.ws.core.soap.SOAPMessageImpl;
+import org.jboss.ws.core.soap.attachment.MimeConstants;
+import org.jboss.ws.core.utils.DOMUtils;
+import org.jboss.ws.core.utils.JavaUtils;
+import org.jboss.ws.core.utils.MimeUtils;
+import org.jboss.ws.extentions.xop.jaxrpc.XOPMarshallerImpl;
+import org.jboss.xb.binding.SimpleTypeBindings;
+import org.jboss.xb.binding.sunday.xop.XOPMarshaller;
+import org.jboss.xb.binding.sunday.xop.XOPObject;
+
+/**
+ * XOP context associated with a message context.
+ * Acts as a facade to the current soap message and supports the various XOP
transitions.<p>
+ * A good starting point to understand how MTOM in JBossWS works is to take a
+ * look at the SOAPContentElement implementation.
+ *
+ * @see org.jboss.ws.core.soap.SOAPContentElement#handleMTOMTransitions()
+ * @see org.jboss.ws.extentions.xop.jaxrpc.XOPUnmarshallerImpl
+ * @see XOPMarshallerImpl
+ *
+ * @author Heiko Braun <heiko.braun(a)jboss.com>
+ * @since May 10, 2006
+ * @version $Id$
+ */
+public class XOPContext
+{
+ // provide logging
+ private static final Logger log = Logger.getLogger(XOPContext.class);
+
+ private static final String NS_XOP_JBOSSWS = "http://org.jboss.ws/xop";
+
+ /**
+ * Check if the current soap message flagged as a XOP package.
+ * This may differ from the wire format when jaxrpc handlers are in place.
+ */
+ public static boolean isXOPMessage()
+ {
+ boolean isXOP = false;
+ CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
+ if (msgContext != null)
+ {
+ SOAPMessageImpl soapMessage = (SOAPMessageImpl)msgContext.getSOAPMessage();
+ isXOP = (soapMessage != null && soapMessage.isXOPMessage());
+ }
+ return isXOP;
+ }
+
+ /**
+ * Check if the wire format is actually a xop encoded multipart message
+ */
+ public static boolean isXOPEncodedRequest()
+ {
+ boolean isMultippartXOP = false;
+ CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
+ if (msgContext != null)
+ {
+ SOAPMessageImpl soapMessage = (SOAPMessageImpl)msgContext.getSOAPMessage();
+ String[] contentType =
soapMessage.getMimeHeaders().getHeader("content-type");
+ if (contentType != null)
+ {
+ for (String value : contentType)
+ {
+ if (value.indexOf(MimeConstants.TYPE_APPLICATION_XOP_XML) != -1)
+ {
+ isMultippartXOP = true;
+ break;
+ }
+ }
+ }
+ }
+
+ return isMultippartXOP;
+ }
+
+ /**
+ * Check if MTOM is enabled.<br>
+ *
+ * With JAX-WS is depends on a endpoint property and defaults to FALSE,
+ * opposed to JAX-RPC where it defaults to TRUE and is set through a message context
property.
+ * (<code>org.jboss.ws.mtom.enabled</code>)<br>
+ */
+ public static boolean isMTOMEnabled()
+ {
+ CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
+ boolean isJAXWS = msgContext.getEndpointMetaData().getType() ==
EndpointMetaData.Type.JAXWS;
+
+ if (isJAXWS)
+ {
+ return msgContext.getEndpointMetaData().isMtomEnabled();
+ }
+ else
+ {
+ Boolean mtomEnabled =
(Boolean)msgContext.getProperty(StubExt.PROPERTY_MTOM_ENABLED);
+ return Boolean.TRUE.equals(mtomEnabled) || mtomEnabled == null;
+ }
+ }
+
+ public static void setMTOMEnabled(boolean b)
+ {
+ CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
+ msgContext.setProperty(StubExt.PROPERTY_MTOM_ENABLED, Boolean.valueOf(b));
+ }
+
+ /**
+ * Replace all <code>xop:Include</code> elements with it's base64
representation.
+ * This happens when the associated SOAPContentElement transitions to state
dom-valid.<br>
+ * All attachement parts will be removed.
+ */
+ public static void inlineXOPData(SOAPElement xopElement)
+ {
+ String ns = xopElement.getNamespaceURI() != null ? xopElement.getNamespaceURI() :
"";
+ String localName = xopElement.getLocalName();
+
+ // rpc/lit
+ if (ns.equals(Constants.NS_XOP) && localName.equals("Include"))
+ {
+ replaceXOPInclude(xopElement.getParentElement(), xopElement);
+ }
+ else
+ {
+ // doc/lit
+ Iterator it = DOMUtils.getChildElements(xopElement);
+ while (it.hasNext())
+ {
+ SOAPElement childElement = (SOAPElement)it.next();
+ String childNS = childElement.getNamespaceURI() != null ?
childElement.getNamespaceURI() : "";
+ String childName = childElement.getLocalName();
+ if (childNS.equals(Constants.NS_XOP) &&
childName.equals("Include"))
+ {
+ replaceXOPInclude(xopElement, childElement);
+ }
+ else
+ {
+ inlineXOPData(childElement);
+ }
+ }
+ }
+ }
+
+ /**
+ * When handlers jump in, the SOAPMessage flag that indicates
+ * a xop encoded message (derived from wire format) becomes stale.
+ *
+ * @param isXOPMessage
+ */
+ private static void setXOPMessage(boolean isXOPMessage)
+ {
+ CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
+ SOAPMessageImpl soapMsg = (SOAPMessageImpl)msgContext.getSOAPMessage();
+ soapMsg.setXOPMessage(isXOPMessage);
+ }
+
+ /**
+ * The XOP attachments need to be created before the actual message is written
+ * to an output stream. This is necessary because it changes the overall message
content-type.
+ * If we would do this lazily (i.e. upon remoting callback) the previous content-type
+ * would already have been written.
+ *
+ * @see
org.jboss.ws.core.soap.SOAPConnectionImpl#callInternal(javax.xml.soap.SOAPMessage, Object,
boolean)
+ * @see org.jboss.ws.core.soap.SOAPMessageMarshaller#write(Object,
java.io.OutputStream)
+ */
+ public static void eagerlyCreateAttachments()
+ {
+ if (!isXOPMessage())
+ return;
+
+ try
+ {
+ CommonMessageContext msgContext =
MessageContextAssociation.peekMessageContext();
+ SOAPMessage soapMessage = msgContext != null ? msgContext.getSOAPMessage() :
null;
+ SOAPBody body = soapMessage != null ? soapMessage.getSOAPBody() : null;
+
+ if (body != null)
+ {
+ CreateAttachmentVisitor visitor = new CreateAttachmentVisitor();
+ visitor.visitXOPElements((SOAPElementImpl)body);
+ }
+ }
+ catch (SOAPException e)
+ {
+ throw new WSException("Failed to eagerly create XOP attachments", e);
+ }
+ }
+
+ /**
+ * Visit the soap object model elements and restore xop data.
+ */
+ public static void visitAndRestoreXOPData()
+ {
+ try
+ {
+ if (!isXOPMessage() && isMTOMEnabled())
+ {
+ CommonMessageContext msgContext =
MessageContextAssociation.peekMessageContext();
+ SOAPBody body = msgContext.getSOAPMessage().getSOAPBody();
+ RestoreXOPElementVisitor visitor = new RestoreXOPElementVisitor();
+ visitor.visitXOPElements((SOAPElementImpl)body);
+ }
+ }
+ catch (SOAPException e)
+ {
+ throw new WSException("Failed to restore XOP data", e);
+ }
+ }
+
+ /**
+ * Restore previously inlined XOP elements.
+ * All base64 representations will be replaced by
<code>xop:Include</code>
+ * elements and the attachment parts will be recreated. <br>
+ * This happens when a SOAPContentElement is written to an output stream.
+ */
+ public static void restoreXOPDataDOM(SOAPElement xopElement)
+ {
+ String contentType = xopElement.getAttributeNS(NS_XOP_JBOSSWS,
"content-type");
+ if (contentType != null && contentType.length() > 0)
+ {
+ replaceBase64Representation(xopElement, contentType);
+ xopElement.removeAttribute(new NameImpl(new QName(NS_XOP_JBOSSWS,
"content-type")));
+ }
+ else
+ {
+ Iterator it = DOMUtils.getChildElements(xopElement);
+ while (it.hasNext())
+ {
+ SOAPElement childElement = (SOAPElement)it.next();
+ restoreXOPDataDOM(childElement);
+ }
+ }
+ }
+
+ private static void replaceBase64Representation(SOAPElement xopElement, String
contentType)
+ {
+
+ SOAPElement parentElement = xopElement.getParentElement();
+ log.debug("Replace base64 representation on element [xmlName=" +
parentElement.getLocalName() + "]");
+
+ String base64 = xopElement.getValue();
+ byte[] data = SimpleTypeBindings.unmarshalBase64(base64);
+
+ MimeUtils.ByteArrayConverter converter =
MimeUtils.getConverterForContentType(contentType);
+ Object converted = converter.readFrom(new ByteArrayInputStream(data));
+
+ XOPObject xopObject = new XOPObject(converted);
+ xopObject.setContentType(contentType);
+
+ XOPMarshaller xopMarshaller = new XOPMarshallerImpl();
+ String cid = xopMarshaller.addMtomAttachment(xopObject,
xopElement.getNamespaceURI(), xopElement.getLocalName());
+
+ // remove base64 node with the xop:Include element
+ org.w3c.dom.Node child = (org.w3c.dom.Node)xopElement.getFirstChild();
+ xopElement.removeChild(child);
+
+ try
+ {
+ SOAPElement xopInclude =
xopElement.addChildElement(Constants.NAME_XOP_INCLUDE);
+ xopInclude.setAttribute("href", cid);
+ log.debug("Restored xop:Include element on [xmlName=" +
xopElement.getLocalName() + "]");
+
+ XOPContext.setXOPMessage(true);
+ }
+ catch (SOAPException e)
+ {
+ throw new WSException("Failed to create XOP include element", e);
+ }
+
+ }
+
+ private static void replaceXOPInclude(SOAPElement parent, SOAPElement
xopIncludeElement)
+ {
+
+ log.debug("Replace xop:Include on element [xmlName=" +
parent.getLocalName() + "]");
+
+ String cid = xopIncludeElement.getAttribute("href");
+ byte[] data;
+ String contentType;
+
+ try
+ {
+ AttachmentPart part = XOPContext.getAttachmentByCID(cid);
+ DataHandler dh = part.getDataHandler();
+ contentType = dh.getContentType();
+
+ // TODO: can't we create base64 directly from stream?
+ ByteArrayOutputStream bout = new ByteArrayOutputStream();
+ dh.writeTo(bout);
+ data = bout.toByteArray();
+
+ }
+ catch (Exception e)
+ {
+ throw new WSException("Failed to inline XOP data", e);
+ }
+
+ // create base64 contents
+ String base64 = SimpleTypeBindings.marshalBase64(data);
+ parent.removeChild(xopIncludeElement);
+ parent.setValue(base64);
+ parent.setAttributeNS(NS_XOP_JBOSSWS, "content-type", contentType);
+
+ log.debug("Created base64 representation for content-type " +
contentType);
+
+ // cleanup the attachment part
+ CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
+ SOAPMessageImpl soapMessage = (SOAPMessageImpl)msgContext.getSOAPMessage();
+
+ if (cid.startsWith("cid:"))
+ cid = cid.substring(4);
+ cid = '<' + cid + '>';
+
+ AttachmentPart removedPart = soapMessage.removeAttachmentByContentId(cid);
+ if (null == removedPart)
+ throw new WSException("Unable to remove attachment part " + cid);
+
+ log.debug("Removed attachment part " + cid);
+
+ // leave soap object model in a valid state
+ setXOPMessage(false);
+
+ }
+
+ /**
+ * Access an XOP attachment part by content id (CID).
+ */
+ public static AttachmentPart getAttachmentByCID(String cid) throws SOAPException
+ {
+ CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
+ SOAPMessageImpl soapMessage = (SOAPMessageImpl)msgContext.getSOAPMessage();
+
+ // RFC2392 requires the 'cid:' part to be stripped from the cid
+ if (cid.startsWith("cid:"))
+ cid = cid.substring(4);
+ cid = '<' + cid + '>';
+
+ AttachmentPart part = soapMessage.getAttachmentByContentId(cid);
+ if (part == null)
+ throw new WSException("Cannot find attachment part for: " + cid);
+
+ return part;
+ }
+
+ /**
+ * Create a <code>DataHandler</code> for an object.
+ * The handlers content type is based on the java type.
+ */
+ public static DataHandler createDataHandler(XOPObject xopObject)
+ {
+ DataHandler dataHandler;
+ Object o = xopObject.getContent();
+
+ if (o instanceof DataHandler)
+ {
+ dataHandler = (DataHandler)o;
+ }
+ else if (xopObject.getContentType() != null)
+ {
+ dataHandler = new DataHandler(o, xopObject.getContentType());
+ }
+ else
+ {
+ dataHandler = new DataHandler(o, getContentTypeForClazz(o.getClass()));
+ }
+
+ return dataHandler;
+ }
+
+ public static String getContentTypeForClazz(Class clazz)
+ {
+ if (JavaUtils.isAssignableFrom(java.awt.Image.class, clazz))
+ {
+ return "image/jpeg";
+ }
+ else if (JavaUtils.isAssignableFrom(javax.xml.transform.Source.class, clazz))
+ {
+ return "application/xml";
+ }
+ else if (JavaUtils.isAssignableFrom(java.lang.String.class, clazz))
+ {
+ return "text/plain";
+ }
+ else
+ {
+ return "application/octet-stream";
+ }
+ }
+}
Copied: branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/xop/jaxrpc (from rev
1589, branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/xop/jaxrpc)
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/xop/jaxrpc/JBossXBContentAdapter.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/xop/jaxrpc/JBossXBContentAdapter.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/xop/jaxrpc/JBossXBContentAdapter.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
*/
-package org.jboss.ws.extras.xop.jaxrpc;
+package org.jboss.ws.extentions.xop.jaxrpc;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
@@ -37,7 +37,7 @@
import org.jboss.ws.core.soap.attachment.SwapableMemoryDataSource;
import org.jboss.ws.core.utils.IOUtils;
import org.jboss.ws.core.utils.MimeUtils;
-import org.jboss.ws.extras.xop.XOPContext;
+import org.jboss.ws.extentions.xop.XOPContext;
import org.jboss.xb.binding.sunday.marshalling.MarshallingContext;
import org.jboss.xb.binding.sunday.marshalling.TermBeforeMarshallingCallback;
import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding;
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/xop/jaxrpc/XOPMarshallerImpl.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/xop/jaxrpc/XOPMarshallerImpl.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/xop/jaxrpc/XOPMarshallerImpl.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
*/
-package org.jboss.ws.extras.xop.jaxrpc;
+package org.jboss.ws.extentions.xop.jaxrpc;
import javax.activation.DataHandler;
import javax.xml.namespace.QName;
@@ -32,7 +32,7 @@
import org.jboss.ws.core.soap.SOAPMessageImpl;
import org.jboss.ws.core.soap.attachment.ContentHandlerRegistry;
import org.jboss.ws.core.soap.attachment.MimeConstants;
-import org.jboss.ws.extras.xop.XOPContext;
+import org.jboss.ws.extentions.xop.XOPContext;
import org.jboss.xb.binding.sunday.xop.XOPMarshaller;
import org.jboss.xb.binding.sunday.xop.XOPObject;
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/xop/jaxrpc/XOPScanner.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/xop/jaxrpc/XOPScanner.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/xop/jaxrpc/XOPScanner.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
*/
-package org.jboss.ws.extras.xop.jaxrpc;
+package org.jboss.ws.extentions.xop.jaxrpc;
import java.util.ArrayList;
import java.util.List;
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/xop/jaxrpc/XOPUnmarshallerImpl.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/xop/jaxrpc/XOPUnmarshallerImpl.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/xop/jaxrpc/XOPUnmarshallerImpl.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
*/
-package org.jboss.ws.extras.xop.jaxrpc;
+package org.jboss.ws.extentions.xop.jaxrpc;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
@@ -33,7 +33,7 @@
import org.jboss.ws.Constants;
import org.jboss.ws.WSException;
import org.jboss.ws.core.soap.attachment.ContentHandlerRegistry;
-import org.jboss.ws.extras.xop.XOPContext;
+import org.jboss.ws.extentions.xop.XOPContext;
import org.jboss.xb.binding.sunday.xop.XOPObject;
import org.jboss.xb.binding.sunday.xop.XOPUnmarshaller;
Copied: branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/xop/jaxws (from rev
1589, branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/xop/jaxws)
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/xop/jaxws/AttachmentMarshallerImpl.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/xop/jaxws/AttachmentMarshallerImpl.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/xop/jaxws/AttachmentMarshallerImpl.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -1,4 +1,4 @@
-package org.jboss.ws.extras.xop.jaxws;
+package org.jboss.ws.extentions.xop.jaxws;
import javax.activation.DataHandler;
import javax.xml.bind.attachment.AttachmentMarshaller;
@@ -12,7 +12,7 @@
import org.jboss.ws.core.soap.SOAPMessageImpl;
import org.jboss.ws.core.soap.attachment.ContentHandlerRegistry;
import org.jboss.ws.core.soap.attachment.MimeConstants;
-import org.jboss.ws.extras.xop.XOPContext;
+import org.jboss.ws.extentions.xop.XOPContext;
public class AttachmentMarshallerImpl extends AttachmentMarshaller
{
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/xop/jaxws/AttachmentUnmarshallerImpl.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/xop/jaxws/AttachmentUnmarshallerImpl.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/xop/jaxws/AttachmentUnmarshallerImpl.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -1,4 +1,4 @@
-package org.jboss.ws.extras.xop.jaxws;
+package org.jboss.ws.extentions.xop.jaxws;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
@@ -10,7 +10,7 @@
import org.jboss.ws.WSException;
import org.jboss.ws.core.soap.attachment.ContentHandlerRegistry;
-import org.jboss.ws.extras.xop.XOPContext;
+import org.jboss.ws.extentions.xop.XOPContext;
public class AttachmentUnmarshallerImpl extends AttachmentUnmarshaller
{
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/xop/jaxws/ReflectiveXOPScanner.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extras/xop/jaxws/ReflectiveXOPScanner.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/extentions/xop/jaxws/ReflectiveXOPScanner.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
*/
-package org.jboss.ws.extras.xop.jaxws;
+package org.jboss.ws.extentions.xop.jaxws;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/SecurityAdaptorFactoryImpl.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/SecurityAdaptorFactoryImpl.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/SecurityAdaptorFactoryImpl.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -26,8 +26,8 @@
import java.security.Principal;
import org.jboss.security.SecurityAssociation;
-import org.jboss.ws.extras.security.SecurityAdaptor;
-import org.jboss.ws.extras.security.SecurityAdaptorFactory;
+import org.jboss.ws.extentions.security.SecurityAdaptor;
+import org.jboss.ws.extentions.security.SecurityAdaptorFactory;
/**
* A Jboss specific SecurityAdaptorFactory
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/tools/jaxws/JAXBWSDLGenerator.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/tools/jaxws/JAXBWSDLGenerator.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/tools/jaxws/JAXBWSDLGenerator.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -32,7 +32,7 @@
import org.jboss.ws.Constants;
import org.jboss.ws.WSException;
import org.jboss.ws.core.metadata.wsdl.DOMTypes;
-import org.jboss.ws.extras.security.Util;
+import org.jboss.ws.extentions.security.Util;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
Modified:
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/config/WSConfigTestCase.java
===================================================================
---
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/config/WSConfigTestCase.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/config/WSConfigTestCase.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -71,6 +71,6 @@
assertEquals(1, preChain.getHandlers().size());
UnifiedHandlerMetaData h1 = (UnifiedHandlerMetaData)preChain.getHandlers().get(0);
assertEquals("WSSecurityHandlerInbound", h1.getHandlerName());
-
assertEquals("org.jboss.ws.extras.security.jaxrpc.WSSecurityHandlerInbound",
h1.getHandlerClass());
+
assertEquals("org.jboss.ws.extentions.security.jaxrpc.WSSecurityHandlerInbound",
h1.getHandlerClass());
}
}
Modified:
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/wsdl11/WSDL11TestCase.java
===================================================================
---
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/wsdl11/WSDL11TestCase.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/wsdl11/WSDL11TestCase.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -38,7 +38,7 @@
import org.jboss.ws.core.metadata.wsdl.WSDLService;
import org.jboss.ws.core.metadata.wsdl.WSDLTypes;
import org.jboss.ws.core.metadata.wsdl.WSDLUtils;
-import org.jboss.ws.extras.eventing.EventingConstants;
+import org.jboss.ws.extentions.eventing.EventingConstants;
import org.jboss.ws.tools.wsdl.WSDLDefinitionsFactory;
/**
Modified:
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/samples/wseventing/SysmonTestCase.java
===================================================================
---
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/samples/wseventing/SysmonTestCase.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/samples/wseventing/SysmonTestCase.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -45,18 +45,18 @@
import org.jboss.ws.core.jaxrpc.ServiceFactoryImpl;
import org.jboss.ws.core.jaxrpc.ServiceImpl;
import org.jboss.ws.core.jaxrpc.StubExt;
-import org.jboss.ws.extras.addressing.AddressingClientUtil;
-import org.jboss.ws.extras.addressing.jaxrpc.WSAddressingClientHandler;
-import org.jboss.ws.extras.eventing.EventSourceEndpoint;
-import org.jboss.ws.extras.eventing.EventingConstants;
-import org.jboss.ws.extras.eventing.SubscriptionManagerEndpoint;
-import org.jboss.ws.extras.eventing.element.DeliveryType;
-import org.jboss.ws.extras.eventing.element.EndpointReference;
-import org.jboss.ws.extras.eventing.element.FilterType;
-import org.jboss.ws.extras.eventing.element.StatusRequest;
-import org.jboss.ws.extras.eventing.element.SubscribeRequest;
-import org.jboss.ws.extras.eventing.element.SubscribeResponse;
-import org.jboss.ws.extras.eventing.element.UnsubscribeRequest;
+import org.jboss.ws.extentions.addressing.AddressingClientUtil;
+import org.jboss.ws.extentions.addressing.jaxrpc.WSAddressingClientHandler;
+import org.jboss.ws.extentions.eventing.EventSourceEndpoint;
+import org.jboss.ws.extentions.eventing.EventingConstants;
+import org.jboss.ws.extentions.eventing.SubscriptionManagerEndpoint;
+import org.jboss.ws.extentions.eventing.element.DeliveryType;
+import org.jboss.ws.extentions.eventing.element.EndpointReference;
+import org.jboss.ws.extentions.eventing.element.FilterType;
+import org.jboss.ws.extentions.eventing.element.StatusRequest;
+import org.jboss.ws.extentions.eventing.element.SubscribeRequest;
+import org.jboss.ws.extentions.eventing.element.SubscribeResponse;
+import org.jboss.ws.extentions.eventing.element.UnsubscribeRequest;
/**
* Test the eventing example service.
Modified:
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/samples/wseventing/SysmonUtil.java
===================================================================
---
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/samples/wseventing/SysmonUtil.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/samples/wseventing/SysmonUtil.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -10,9 +10,9 @@
import javax.xml.ws.addressing.JAXWSAConstants;
import org.jboss.logging.Logger;
-import org.jboss.ws.extras.addressing.AddressingClientUtil;
-import org.jboss.ws.extras.eventing.element.EndpointReference;
-import org.jboss.ws.extras.eventing.element.SubscribeResponse;
+import org.jboss.ws.extentions.addressing.AddressingClientUtil;
+import org.jboss.ws.extentions.eventing.element.EndpointReference;
+import org.jboss.ws.extentions.eventing.element.SubscribeResponse;
/**
* Util methods that drive the SysmoneTestCase.
Modified:
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/samples/wssecurity/SimpleEncryptTestCase.java
===================================================================
---
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/samples/wssecurity/SimpleEncryptTestCase.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/samples/wssecurity/SimpleEncryptTestCase.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -39,7 +39,7 @@
import org.jboss.test.ws.JBossWSTestSetup;
import org.jboss.ws.core.jaxrpc.ServiceFactoryImpl;
import org.jboss.ws.core.jaxrpc.ServiceImpl;
-import org.jboss.ws.extras.security.jaxrpc.WSSecurityHandlerOutbound;
+import org.jboss.ws.extentions.security.jaxrpc.WSSecurityHandlerOutbound;
/**
* Test WS-Security with RPC/Literal
Modified:
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/samples/wssecurity/SimpleSignTestCase.java
===================================================================
---
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/samples/wssecurity/SimpleSignTestCase.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/samples/wssecurity/SimpleSignTestCase.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -39,7 +39,7 @@
import org.jboss.test.ws.JBossWSTestSetup;
import org.jboss.ws.core.jaxrpc.ServiceFactoryImpl;
import org.jboss.ws.core.jaxrpc.ServiceImpl;
-import org.jboss.ws.extras.security.jaxrpc.WSSecurityHandlerOutbound;
+import org.jboss.ws.extentions.security.jaxrpc.WSSecurityHandlerOutbound;
/**
* Test WS-Security with RPC/Literal
Modified:
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/samples/wssecurity/StorePassEncryptTestCase.java
===================================================================
---
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/samples/wssecurity/StorePassEncryptTestCase.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/samples/wssecurity/StorePassEncryptTestCase.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -39,7 +39,7 @@
import org.jboss.test.ws.JBossWSTestSetup;
import org.jboss.ws.core.jaxrpc.ServiceFactoryImpl;
import org.jboss.ws.core.jaxrpc.ServiceImpl;
-import org.jboss.ws.extras.security.jaxrpc.WSSecurityHandlerOutbound;
+import org.jboss.ws.extentions.security.jaxrpc.WSSecurityHandlerOutbound;
/**
* This test simulates simulates the usage of a jboss-ws-security keystore and truststore
use cases
Modified:
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/wseventing/DIIClientTestCase.java
===================================================================
---
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/wseventing/DIIClientTestCase.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/wseventing/DIIClientTestCase.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -47,17 +47,17 @@
import org.jboss.ws.core.jaxrpc.ServiceFactoryImpl;
import org.jboss.ws.core.jaxrpc.StubExt;
import org.jboss.ws.core.metadata.wsdl.WSDLDefinitions;
-import org.jboss.ws.extras.addressing.AddressingClientUtil;
-import org.jboss.ws.extras.addressing.jaxrpc.WSAddressingClientHandler;
-import org.jboss.ws.extras.eventing.EventSourceEndpoint;
-import org.jboss.ws.extras.eventing.EventingConstants;
-import org.jboss.ws.extras.eventing.SubscriptionManagerEndpoint;
-import org.jboss.ws.extras.eventing.element.DeliveryType;
-import org.jboss.ws.extras.eventing.element.EndpointReference;
-import org.jboss.ws.extras.eventing.element.FilterType;
-import org.jboss.ws.extras.eventing.element.SubscribeRequest;
-import org.jboss.ws.extras.eventing.element.SubscribeResponse;
-import org.jboss.ws.extras.eventing.element.UnsubscribeRequest;
+import org.jboss.ws.extentions.addressing.AddressingClientUtil;
+import org.jboss.ws.extentions.addressing.jaxrpc.WSAddressingClientHandler;
+import org.jboss.ws.extentions.eventing.EventSourceEndpoint;
+import org.jboss.ws.extentions.eventing.EventingConstants;
+import org.jboss.ws.extentions.eventing.SubscriptionManagerEndpoint;
+import org.jboss.ws.extentions.eventing.element.DeliveryType;
+import org.jboss.ws.extentions.eventing.element.EndpointReference;
+import org.jboss.ws.extentions.eventing.element.FilterType;
+import org.jboss.ws.extentions.eventing.element.SubscribeRequest;
+import org.jboss.ws.extentions.eventing.element.SubscribeResponse;
+import org.jboss.ws.extentions.eventing.element.UnsubscribeRequest;
import org.jboss.ws.tools.wsdl.WSDLDefinitionsFactory;
/**
Modified:
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/wseventing/EventingSupport.java
===================================================================
---
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/wseventing/EventingSupport.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/wseventing/EventingSupport.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -37,15 +37,15 @@
import org.jboss.test.ws.JBossWSTest;
import org.jboss.ws.core.jaxrpc.StubExt;
import org.jboss.ws.core.metadata.wsdl.WSDLDefinitions;
-import org.jboss.ws.extras.addressing.AddressingClientUtil;
-import org.jboss.ws.extras.eventing.EventSourceEndpoint;
-import org.jboss.ws.extras.eventing.EventingConstants;
-import org.jboss.ws.extras.eventing.SubscriptionManagerEndpoint;
-import org.jboss.ws.extras.eventing.element.DeliveryType;
-import org.jboss.ws.extras.eventing.element.EndpointReference;
-import org.jboss.ws.extras.eventing.element.FilterType;
-import org.jboss.ws.extras.eventing.element.SubscribeRequest;
-import org.jboss.ws.extras.eventing.element.SubscribeResponse;
+import org.jboss.ws.extentions.addressing.AddressingClientUtil;
+import org.jboss.ws.extentions.eventing.EventSourceEndpoint;
+import org.jboss.ws.extentions.eventing.EventingConstants;
+import org.jboss.ws.extentions.eventing.SubscriptionManagerEndpoint;
+import org.jboss.ws.extentions.eventing.element.DeliveryType;
+import org.jboss.ws.extentions.eventing.element.EndpointReference;
+import org.jboss.ws.extentions.eventing.element.FilterType;
+import org.jboss.ws.extentions.eventing.element.SubscribeRequest;
+import org.jboss.ws.extentions.eventing.element.SubscribeResponse;
import org.jboss.ws.tools.wsdl.WSDLDefinitionsFactory;
/**
Modified:
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/wseventing/EventingTestCase.java
===================================================================
---
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/wseventing/EventingTestCase.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/wseventing/EventingTestCase.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -33,16 +33,16 @@
import org.jboss.test.ws.JBossWSTestSetup;
import org.jboss.ws.core.jaxrpc.StubExt;
-import org.jboss.ws.extras.addressing.AddressingClientUtil;
-import org.jboss.ws.extras.eventing.EventingConstants;
-import org.jboss.ws.extras.eventing.element.DeliveryType;
-import org.jboss.ws.extras.eventing.element.RenewRequest;
-import org.jboss.ws.extras.eventing.element.RenewResponse;
-import org.jboss.ws.extras.eventing.element.StatusRequest;
-import org.jboss.ws.extras.eventing.element.StatusResponse;
-import org.jboss.ws.extras.eventing.element.SubscribeRequest;
-import org.jboss.ws.extras.eventing.element.SubscribeResponse;
-import org.jboss.ws.extras.eventing.element.UnsubscribeRequest;
+import org.jboss.ws.extentions.addressing.AddressingClientUtil;
+import org.jboss.ws.extentions.eventing.EventingConstants;
+import org.jboss.ws.extentions.eventing.element.DeliveryType;
+import org.jboss.ws.extentions.eventing.element.RenewRequest;
+import org.jboss.ws.extentions.eventing.element.RenewResponse;
+import org.jboss.ws.extentions.eventing.element.StatusRequest;
+import org.jboss.ws.extentions.eventing.element.StatusResponse;
+import org.jboss.ws.extentions.eventing.element.SubscribeRequest;
+import org.jboss.ws.extentions.eventing.element.SubscribeResponse;
+import org.jboss.ws.extentions.eventing.element.UnsubscribeRequest;
/**
* Test the eventing endpoints.
Modified:
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/wseventing/NotificationTestCase.java
===================================================================
---
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/wseventing/NotificationTestCase.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/wseventing/NotificationTestCase.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -29,9 +29,9 @@
import org.jboss.test.ws.JBossWSTestSetup;
import org.jboss.ws.core.utils.DOMUtils;
-import org.jboss.ws.extras.eventing.EventingConstants;
-import org.jboss.ws.extras.eventing.element.SubscribeResponse;
-import org.jboss.ws.extras.eventing.mgmt.EventDispatcher;
+import org.jboss.ws.extentions.eventing.EventingConstants;
+import org.jboss.ws.extentions.eventing.element.SubscribeResponse;
+import org.jboss.ws.extentions.eventing.mgmt.EventDispatcher;
import org.w3c.dom.Element;
/**
Modified:
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/wseventing/SubscriptionManagerTestCase.java
===================================================================
---
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/wseventing/SubscriptionManagerTestCase.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/wseventing/SubscriptionManagerTestCase.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -28,12 +28,12 @@
import org.jboss.test.ws.JBossWSTest;
import org.jboss.ws.core.utils.DOMUtils;
-import org.jboss.ws.extras.eventing.EventingConstants;
-import org.jboss.ws.extras.eventing.deployment.EventingEndpointDI;
-import org.jboss.ws.extras.eventing.element.EndpointReference;
-import org.jboss.ws.extras.eventing.mgmt.Filter;
-import org.jboss.ws.extras.eventing.mgmt.SubscriptionManager;
-import org.jboss.ws.extras.eventing.mgmt.SubscriptionTicket;
+import org.jboss.ws.extentions.eventing.EventingConstants;
+import org.jboss.ws.extentions.eventing.deployment.EventingEndpointDI;
+import org.jboss.ws.extentions.eventing.element.EndpointReference;
+import org.jboss.ws.extentions.eventing.mgmt.Filter;
+import org.jboss.ws.extentions.eventing.mgmt.SubscriptionManager;
+import org.jboss.ws.extentions.eventing.mgmt.SubscriptionTicket;
import org.w3c.dom.Element;
/**
Modified:
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/wsse/MicrosoftInteropTestCase.java
===================================================================
---
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/wsse/MicrosoftInteropTestCase.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/wsse/MicrosoftInteropTestCase.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -34,10 +34,10 @@
import org.jboss.test.ws.JBossWSTest;
import org.jboss.ws.core.soap.MessageFactoryImpl;
import org.jboss.ws.core.utils.DOMUtils;
-import org.jboss.ws.extras.security.Constants;
-import org.jboss.ws.extras.security.SecurityDecoder;
-import org.jboss.ws.extras.security.SecurityStore;
-import org.jboss.ws.extras.security.Util;
+import org.jboss.ws.extentions.security.Constants;
+import org.jboss.ws.extentions.security.SecurityDecoder;
+import org.jboss.ws.extentions.security.SecurityStore;
+import org.jboss.ws.extentions.security.Util;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
Modified:
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/wsse/RoundTripTestCase.java
===================================================================
---
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/wsse/RoundTripTestCase.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/wsse/RoundTripTestCase.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -36,21 +36,21 @@
import org.jboss.test.ws.JBossWSTest;
import org.jboss.ws.core.soap.MessageFactoryImpl;
import org.jboss.ws.core.utils.DOMWriter;
-import org.jboss.ws.extras.security.Constants;
-import org.jboss.ws.extras.security.EncryptionOperation;
-import org.jboss.ws.extras.security.OperationDescription;
-import org.jboss.ws.extras.security.QNameTarget;
-import org.jboss.ws.extras.security.RequireEncryptionOperation;
-import org.jboss.ws.extras.security.RequireSignatureOperation;
-import org.jboss.ws.extras.security.SecurityDecoder;
-import org.jboss.ws.extras.security.SecurityEncoder;
-import org.jboss.ws.extras.security.SecurityStore;
-import org.jboss.ws.extras.security.SendUsernameOperation;
-import org.jboss.ws.extras.security.SignatureOperation;
-import org.jboss.ws.extras.security.Target;
-import org.jboss.ws.extras.security.TimestampOperation;
-import org.jboss.ws.extras.security.Util;
-import org.jboss.ws.extras.security.WsuIdTarget;
+import org.jboss.ws.extentions.security.Constants;
+import org.jboss.ws.extentions.security.EncryptionOperation;
+import org.jboss.ws.extentions.security.OperationDescription;
+import org.jboss.ws.extentions.security.QNameTarget;
+import org.jboss.ws.extentions.security.RequireEncryptionOperation;
+import org.jboss.ws.extentions.security.RequireSignatureOperation;
+import org.jboss.ws.extentions.security.SecurityDecoder;
+import org.jboss.ws.extentions.security.SecurityEncoder;
+import org.jboss.ws.extentions.security.SecurityStore;
+import org.jboss.ws.extentions.security.SendUsernameOperation;
+import org.jboss.ws.extentions.security.SignatureOperation;
+import org.jboss.ws.extentions.security.Target;
+import org.jboss.ws.extentions.security.TimestampOperation;
+import org.jboss.ws.extentions.security.Util;
+import org.jboss.ws.extentions.security.WsuIdTarget;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
Modified:
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/wsse/SunInteropTestCase.java
===================================================================
---
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/wsse/SunInteropTestCase.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/wsse/SunInteropTestCase.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -33,10 +33,10 @@
import org.jboss.test.ws.JBossWSTest;
import org.jboss.ws.core.soap.MessageFactoryImpl;
import org.jboss.ws.core.utils.DOMWriter;
-import org.jboss.ws.extras.security.Constants;
-import org.jboss.ws.extras.security.SecurityDecoder;
-import org.jboss.ws.extras.security.SecurityStore;
-import org.jboss.ws.extras.security.Util;
+import org.jboss.ws.extentions.security.Constants;
+import org.jboss.ws.extentions.security.SecurityDecoder;
+import org.jboss.ws.extentions.security.SecurityStore;
+import org.jboss.ws.extentions.security.Util;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
Modified:
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/xop/XOPTypeDefTestCase.java
===================================================================
---
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/xop/XOPTypeDefTestCase.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/xop/XOPTypeDefTestCase.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -10,7 +10,7 @@
import org.jboss.ws.core.metadata.wsdl.xmlschema.JBossXSModel;
import org.jboss.ws.core.metadata.wsdl.xmlschema.WSSchemaUtils;
import org.jboss.ws.core.metadata.wsdl.xsd.SchemaUtils;
-import org.jboss.ws.extras.xop.jaxrpc.XOPScanner;
+import org.jboss.ws.extentions.xop.jaxrpc.XOPScanner;
import org.jboss.xb.binding.NamespaceRegistry;
/**
Modified:
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/xop/shared/MTOMServiceBase.java
===================================================================
---
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/xop/shared/MTOMServiceBase.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/xop/shared/MTOMServiceBase.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -24,7 +24,7 @@
import org.jboss.ws.core.CommonMessageContext;
import org.jboss.ws.core.jaxrpc.StubExt;
import org.jboss.ws.core.soap.MessageContextAssociation;
-import org.jboss.ws.extras.xop.XOPContext;
+import org.jboss.ws.extentions.xop.XOPContext;
import java.util.StringTokenizer;
Modified:
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/samples/wsaddressing/AddressingStatefulTestCase.java
===================================================================
---
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/samples/wsaddressing/AddressingStatefulTestCase.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/samples/wsaddressing/AddressingStatefulTestCase.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -33,7 +33,7 @@
import org.jboss.test.ws.JBossWSTest;
import org.jboss.test.ws.JBossWSTestSetup;
-import org.jboss.ws.extras.addressing.jaxws.WSAddressingClientHandler;
+import org.jboss.ws.extentions.addressing.jaxws.WSAddressingClientHandler;
/**
* Test stateful endpoint using ws-addressing
Modified:
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/wsaddressing/EndpointReferenceTestCase.java
===================================================================
---
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/wsaddressing/EndpointReferenceTestCase.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/wsaddressing/EndpointReferenceTestCase.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -25,7 +25,7 @@
import org.jboss.test.ws.JBossWSTest;
import org.jboss.ws.core.utils.DOMUtils;
-import org.jboss.ws.extras.addressing.EndpointReferenceImpl;
+import org.jboss.ws.extentions.addressing.EndpointReferenceImpl;
import org.w3c.dom.Element;
/**
Modified:
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/xop/MimeDeclarationTestCase.java
===================================================================
---
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/xop/MimeDeclarationTestCase.java 2006-12-07
00:50:28 UTC (rev 1589)
+++
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/xop/MimeDeclarationTestCase.java 2006-12-07
00:59:53 UTC (rev 1590)
@@ -27,7 +27,7 @@
import java.awt.*;
import java.lang.reflect.Method;
-import org.jboss.ws.extras.xop.jaxws.ReflectiveXOPScanner;
+import org.jboss.ws.extentions.xop.jaxws.ReflectiveXOPScanner;
/**
* Test the ReflectiveXOPScanner.