diff options
author | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2009-02-20 20:10:37 +0000 |
---|---|---|
committer | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2009-02-20 20:10:37 +0000 |
commit | 3a8a64103bcc4891fb1a1f4cc4538f9d5b62a7ba (patch) | |
tree | ccd8919c277ad88c032acb3167fdd4645586cb07 /java/sca/modules/binding-ws-axis2/src | |
parent | 7b9fa54dced70baffa6578b0be902b06092584a7 (diff) |
Start to implement the SCA policy framework 1.1 spec draft from OASIS OpenCSA
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@746356 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/sca/modules/binding-ws-axis2/src')
15 files changed, 48 insertions, 140 deletions
diff --git a/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2BindingInvoker.java b/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2BindingInvoker.java index cfa2b2678f..85fb8dd20c 100644 --- a/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2BindingInvoker.java +++ b/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2BindingInvoker.java @@ -48,12 +48,10 @@ import org.apache.tuscany.sca.interfacedef.util.FaultException; import org.apache.tuscany.sca.invocation.DataExchangeSemantics; import org.apache.tuscany.sca.invocation.Invoker; import org.apache.tuscany.sca.invocation.Message; -import org.apache.tuscany.sca.policy.PolicySet; -import org.apache.tuscany.sca.policy.PolicySetAttachPoint; import org.apache.tuscany.sca.policy.authentication.basic.BasicAuthenticationPolicy; -import org.apache.tuscany.sca.policy.util.PolicyHandler; import org.apache.tuscany.sca.runtime.ReferenceParameters; + /** * Axis2BindingInvoker uses an Axis2 OperationClient to invoke a remote web service * @@ -75,7 +73,6 @@ public class Axis2BindingInvoker implements Invoker, DataExchangeSemantics { private QName wsdlOperationName; private Options options; private SOAPFactory soapFactory; - private List<PolicyHandler> policyHandlerList = null; private WebServiceBinding wsBinding; private BasicAuthenticationPolicy basicAuthenticationPolicy = null; @@ -86,18 +83,17 @@ public class Axis2BindingInvoker implements Invoker, DataExchangeSemantics { QName wsdlOperationName, Options options, SOAPFactory soapFactory, - List<PolicyHandler> policyHandlerList, WebServiceBinding wsBinding) { this.serviceClient = serviceClient; this.wsdlOperationName = wsdlOperationName; this.options = options; this.soapFactory = soapFactory; - this.policyHandlerList = policyHandlerList; this.wsBinding = wsBinding; // find out which policies are active - if (wsBinding instanceof PolicySetAttachPoint) { - List<PolicySet> policySets = ((PolicySetAttachPoint)wsBinding).getApplicablePolicySets(); + /* + if (wsBinding instanceof PolicySubject) { + List<PolicySet> policySets = ((PolicySubject)wsBinding).getPolicySets(); for (PolicySet ps : policySets) { for (Object p : ps.getPolicies()) { if (BasicAuthenticationPolicy.class.isInstance(p)) { @@ -112,6 +108,7 @@ public class Axis2BindingInvoker implements Invoker, DataExchangeSemantics { } } } + */ } private static final QName EXCEPTION = new QName("", "Exception"); @@ -144,9 +141,11 @@ public class Axis2BindingInvoker implements Invoker, DataExchangeSemantics { requestMC.getOptions().setProperty(HTTPConstants.REUSE_HTTP_CLIENT, Boolean.TRUE); requestMC.getOptions().setTimeOutInMilliSeconds(240000L); + /* for ( PolicyHandler policyHandler : policyHandlerList ) { policyHandler.beforeInvoke(msg, requestMC, operationClient); } + */ // set policy specified headers for (Axis2HeaderPolicy policy : axis2HeaderPolicies){ @@ -177,9 +176,11 @@ public class Axis2BindingInvoker implements Invoker, DataExchangeSemantics { MessageContext responseMC = operationClient.getMessageContext("In"); + /* for ( PolicyHandler policyHandler : policyHandlerList ) { policyHandler.afterInvoke(msg, responseMC, operationClient); } + */ OMElement response = responseMC.getEnvelope().getBody().getFirstElement(); diff --git a/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2BindingProviderFactory.java b/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2BindingProviderFactory.java index a532f899bc..cc65988553 100644 --- a/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2BindingProviderFactory.java +++ b/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2BindingProviderFactory.java @@ -26,15 +26,12 @@ import org.apache.tuscany.sca.core.FactoryExtensionPoint; import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint; import org.apache.tuscany.sca.host.http.ServletHost; import org.apache.tuscany.sca.host.http.ServletHostExtensionPoint; -import org.apache.tuscany.sca.policy.util.PolicyHandlerDefinitionsLoader; -import org.apache.tuscany.sca.policy.util.PolicyHandlerTuple; import org.apache.tuscany.sca.provider.BindingProviderFactory; import org.apache.tuscany.sca.provider.ReferenceBindingProvider; import org.apache.tuscany.sca.provider.ServiceBindingProvider; import org.apache.tuscany.sca.runtime.RuntimeComponent; import org.apache.tuscany.sca.runtime.RuntimeComponentReference; import org.apache.tuscany.sca.runtime.RuntimeComponentService; -import org.oasisopen.sca.ServiceRuntimeException; /** * Axis2BindingProviderFactory @@ -46,7 +43,6 @@ public class Axis2BindingProviderFactory implements BindingProviderFactory<WebSe private FactoryExtensionPoint modelFactories; private ServletHost servletHost; - private List<PolicyHandlerTuple> policyHandlerClassnames = null; private DataBindingExtensionPoint dataBindings; public Axis2BindingProviderFactory(ExtensionPointRegistry extensionPoints) { @@ -56,7 +52,6 @@ public class Axis2BindingProviderFactory implements BindingProviderFactory<WebSe this.servletHost = hosts.get(0); } modelFactories = extensionPoints.getExtensionPoint(FactoryExtensionPoint.class); - policyHandlerClassnames = PolicyHandlerDefinitionsLoader.loadPolicyHandlerClassnames(); dataBindings = extensionPoints.getExtensionPoint(DataBindingExtensionPoint.class); } @@ -64,7 +59,7 @@ public class Axis2BindingProviderFactory implements BindingProviderFactory<WebSe RuntimeComponentReference reference, WebServiceBinding binding) { return new Axis2ReferenceBindingProvider(component, reference, binding, - modelFactories, policyHandlerClassnames, dataBindings); + modelFactories, dataBindings); } public ServiceBindingProvider createServiceBindingProvider(RuntimeComponent component, @@ -72,7 +67,7 @@ public class Axis2BindingProviderFactory implements BindingProviderFactory<WebSe WebServiceBinding binding) { return new Axis2ServiceBindingProvider(component, service, binding, servletHost, modelFactories, - policyHandlerClassnames, dataBindings); + dataBindings); } public Class<WebServiceBinding> getModelType() { diff --git a/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2OneWayBindingInvoker.java b/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2OneWayBindingInvoker.java index 97eb3949af..abf5f4008d 100644 --- a/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2OneWayBindingInvoker.java +++ b/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2OneWayBindingInvoker.java @@ -18,8 +18,6 @@ */ package org.apache.tuscany.sca.binding.ws.axis2; -import java.util.List; - import javax.xml.namespace.QName; import org.apache.axiom.soap.SOAPFactory; @@ -30,7 +28,6 @@ import org.apache.axis2.context.MessageContext; import org.apache.axis2.transport.http.HTTPConstants; import org.apache.tuscany.sca.binding.ws.WebServiceBinding; import org.apache.tuscany.sca.invocation.Message; -import org.apache.tuscany.sca.policy.util.PolicyHandler; /** * Axis2OneWayBindingInvoker uses an Axis2 OperationClient to invoke a OneWay remote web service. @@ -43,10 +40,9 @@ public class Axis2OneWayBindingInvoker extends Axis2BindingInvoker { QName wsdlOperationName, Options options, SOAPFactory soapFactory, - List<PolicyHandler> policyHandlerList, WebServiceBinding wsBinding) { - super(serviceClient, wsdlOperationName, options, soapFactory, policyHandlerList, wsBinding); + super(serviceClient, wsdlOperationName, options, soapFactory, wsBinding); } @Override diff --git a/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ReferenceBindingProvider.java b/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ReferenceBindingProvider.java index 83f1f3219e..184d02642e 100644 --- a/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ReferenceBindingProvider.java +++ b/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ReferenceBindingProvider.java @@ -18,8 +18,6 @@ */ package org.apache.tuscany.sca.binding.ws.axis2; -import java.util.List; - import org.apache.axiom.om.OMElement; import org.apache.tuscany.sca.binding.ws.WebServiceBinding; import org.apache.tuscany.sca.core.FactoryExtensionPoint; @@ -28,7 +26,6 @@ import org.apache.tuscany.sca.interfacedef.InterfaceContract; import org.apache.tuscany.sca.interfacedef.Operation; import org.apache.tuscany.sca.invocation.Invoker; import org.apache.tuscany.sca.invocation.MessageFactory; -import org.apache.tuscany.sca.policy.util.PolicyHandlerTuple; import org.apache.tuscany.sca.provider.ReferenceBindingProvider; import org.apache.tuscany.sca.runtime.RuntimeComponent; import org.apache.tuscany.sca.runtime.RuntimeComponentReference; @@ -43,7 +40,6 @@ public class Axis2ReferenceBindingProvider implements ReferenceBindingProvider { RuntimeComponentReference reference, WebServiceBinding wsBinding, FactoryExtensionPoint modelFactories, - List<PolicyHandlerTuple> policyHandlerClassnames, DataBindingExtensionPoint dataBindings) { MessageFactory messageFactory = modelFactories.getFactory(MessageFactory.class); @@ -60,7 +56,7 @@ public class Axis2ReferenceBindingProvider implements ReferenceBindingProvider { contract.getInterface().resetDataBinding(OMElement.class.getName()); } - axisClient = new Axis2ServiceClient(component, reference, wsBinding, messageFactory, policyHandlerClassnames); + axisClient = new Axis2ServiceClient(component, reference, wsBinding, messageFactory); } public void start() { diff --git a/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceBindingProvider.java b/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceBindingProvider.java index d7f8096ff2..8aa2181c22 100644 --- a/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceBindingProvider.java +++ b/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceBindingProvider.java @@ -18,8 +18,6 @@ */ package org.apache.tuscany.sca.binding.ws.axis2; -import java.util.List; - import org.apache.axiom.om.OMElement; import org.apache.tuscany.sca.binding.ws.WebServiceBinding; import org.apache.tuscany.sca.core.FactoryExtensionPoint; @@ -27,7 +25,6 @@ import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint; import org.apache.tuscany.sca.host.http.ServletHost; import org.apache.tuscany.sca.interfacedef.InterfaceContract; import org.apache.tuscany.sca.invocation.MessageFactory; -import org.apache.tuscany.sca.policy.util.PolicyHandlerTuple; import org.apache.tuscany.sca.provider.ServiceBindingProvider; import org.apache.tuscany.sca.runtime.RuntimeComponent; import org.apache.tuscany.sca.runtime.RuntimeComponentService; @@ -43,7 +40,6 @@ public class Axis2ServiceBindingProvider implements ServiceBindingProvider { WebServiceBinding wsBinding, ServletHost servletHost, FactoryExtensionPoint modelFactories, - List<PolicyHandlerTuple> policyHandlerClassnames, DataBindingExtensionPoint dataBindings) { if (servletHost == null) { @@ -62,7 +58,7 @@ public class Axis2ServiceBindingProvider implements ServiceBindingProvider { InterfaceContract contract = wsBinding.getBindingInterfaceContract(); contract.getInterface().resetDataBinding(OMElement.class.getName()); - axisProvider = new Axis2ServiceProvider(component, service, wsBinding, servletHost, messageFactory, policyHandlerClassnames); + axisProvider = new Axis2ServiceProvider(component, service, wsBinding, servletHost, messageFactory); } public void start() { diff --git a/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceClient.java b/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceClient.java index c4bb3e9342..d2ba46a7e2 100644 --- a/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceClient.java +++ b/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceClient.java @@ -27,7 +27,6 @@ import java.security.AccessController; import java.security.PrivilegedAction; import java.security.PrivilegedActionException; import java.security.PrivilegedExceptionAction; -import java.util.ArrayList; import java.util.Collection; import java.util.List; import java.util.Map; @@ -74,10 +73,7 @@ import org.apache.tuscany.sca.interfacedef.Operation; import org.apache.tuscany.sca.invocation.Invoker; import org.apache.tuscany.sca.invocation.MessageFactory; import org.apache.tuscany.sca.policy.PolicySet; -import org.apache.tuscany.sca.policy.PolicySetAttachPoint; -import org.apache.tuscany.sca.policy.util.PolicyHandler; -import org.apache.tuscany.sca.policy.util.PolicyHandlerTuple; -import org.apache.tuscany.sca.policy.util.PolicyHandlerUtils; +import org.apache.tuscany.sca.policy.PolicySubject; import org.apache.tuscany.sca.runtime.RuntimeComponent; import org.apache.tuscany.sca.xsd.xml.XMLDocumentHelper; import org.apache.ws.commons.schema.resolver.URIResolver; @@ -89,19 +85,15 @@ public class Axis2ServiceClient { private AbstractContract contract; private WebServiceBinding wsBinding; private ServiceClient serviceClient; - List<PolicyHandlerTuple> policyHandlerClassnames = null; - private List<PolicyHandler> policyHandlerList = new ArrayList<PolicyHandler>(); public Axis2ServiceClient(RuntimeComponent component, AbstractContract contract, WebServiceBinding wsBinding, - MessageFactory messageFactory, - List<PolicyHandlerTuple> policyHandlerClassnames) { + MessageFactory messageFactory) { this.component = component; this.contract = contract; this.wsBinding = wsBinding; - this.policyHandlerClassnames = policyHandlerClassnames; } protected void start() { @@ -156,7 +148,6 @@ public class Axis2ServiceClient { } createPolicyHandlers(); - setupPolicyHandlers(policyHandlerList, configContext); Definition definition = wsBinding.getWSDLDocument(); QName serviceQName = wsBinding.getService().getQName(); @@ -374,9 +365,9 @@ public class Axis2ServiceClient { } Axis2BindingInvoker invoker; if (operation.isNonBlocking()) { - invoker = new Axis2OneWayBindingInvoker(this, wsdlOperationQName, options, soapFactory, policyHandlerList, wsBinding); + invoker = new Axis2OneWayBindingInvoker(this, wsdlOperationQName, options, soapFactory, wsBinding); } else { - invoker = new Axis2BindingInvoker(this, wsdlOperationQName, options, soapFactory, policyHandlerList, wsBinding); + invoker = new Axis2BindingInvoker(this, wsdlOperationQName, options, soapFactory, wsBinding); } return invoker; @@ -465,16 +456,7 @@ public class Axis2ServiceClient { } private void createPolicyHandlers() throws IllegalAccessException, InstantiationException, ClassNotFoundException { - if (wsBinding instanceof PolicySetAttachPoint) { - PolicySetAttachPoint policiedBinding = (PolicySetAttachPoint)wsBinding; - PolicyHandler policyHandler = null; - for (PolicySet policySet : policiedBinding.getPolicySets()) { - policyHandler = PolicyHandlerUtils.findPolicyHandler(policySet, policyHandlerClassnames); - if (policyHandler != null) { - policyHandler.setApplicablePolicySet(policySet); - policyHandlerList.add(policyHandler); - } - } + if (wsBinding instanceof PolicySubject) { // code to create policy handlers using the new policy SPI based // on policy providers @@ -491,10 +473,5 @@ public class Axis2ServiceClient { } } - private void setupPolicyHandlers(List<PolicyHandler> policyHandlers, ConfigurationContext configContext) { - for (PolicyHandler aHandler : policyHandlers) { - aHandler.setUp(configContext); - } - } } diff --git a/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceInMessageReceiver.java b/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceInMessageReceiver.java index a0cfab9154..795b3b256f 100644 --- a/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceInMessageReceiver.java +++ b/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceInMessageReceiver.java @@ -19,14 +19,12 @@ package org.apache.tuscany.sca.binding.ws.axis2; import java.lang.reflect.InvocationTargetException; -import java.util.List; import org.apache.axiom.om.OMElement; import org.apache.axis2.AxisFault; import org.apache.axis2.context.MessageContext; import org.apache.axis2.receivers.AbstractInMessageReceiver; import org.apache.tuscany.sca.interfacedef.Operation; -import org.apache.tuscany.sca.policy.util.PolicyHandler; public class Axis2ServiceInMessageReceiver extends AbstractInMessageReceiver { @@ -34,12 +32,9 @@ public class Axis2ServiceInMessageReceiver extends AbstractInMessageReceiver { private Axis2ServiceProvider provider; - private List<PolicyHandler> policyHandlerList = null; - - public Axis2ServiceInMessageReceiver(Axis2ServiceProvider provider, Operation operation, List<PolicyHandler> policyHandlerList) { + public Axis2ServiceInMessageReceiver(Axis2ServiceProvider provider, Operation operation) { this.provider = provider; this.operation = operation; - this.policyHandlerList = policyHandlerList; } public Axis2ServiceInMessageReceiver() { @@ -51,20 +46,8 @@ public class Axis2ServiceInMessageReceiver extends AbstractInMessageReceiver { OMElement requestOM = inMC.getEnvelope().getBody().getFirstElement(); Object[] args = new Object[] {requestOM}; - /* - for ( PolicyHandler policyHandler : policyHandlerList ) { - policyHandler.beforeInvoke(operation, args, inMC); - } - */ - provider.invokeTarget(operation, args, inMC); - /* - for ( PolicyHandler policyHandler : policyHandlerList ) { - policyHandler.afterInvoke(operation, args, inMC); - } - */ - } catch (InvocationTargetException e) { Throwable t = e.getCause(); if (t instanceof Exception) { diff --git a/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceInOutSyncMessageReceiver.java b/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceInOutSyncMessageReceiver.java index 64e49e0b0d..2cd176aae0 100644 --- a/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceInOutSyncMessageReceiver.java +++ b/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceInOutSyncMessageReceiver.java @@ -19,7 +19,6 @@ package org.apache.tuscany.sca.binding.ws.axis2; import java.lang.reflect.InvocationTargetException; -import java.util.List; import java.util.logging.Level; import java.util.logging.Logger; @@ -31,21 +30,18 @@ import org.apache.axis2.context.MessageContext; import org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver; import org.apache.tuscany.sca.interfacedef.Operation; import org.apache.tuscany.sca.interfacedef.util.FaultException; -import org.apache.tuscany.sca.policy.util.PolicyHandler; import org.oasisopen.sca.ServiceRuntimeException; public class Axis2ServiceInOutSyncMessageReceiver extends AbstractInOutSyncMessageReceiver { private static final Logger logger = Logger.getLogger(Axis2ServiceInOutSyncMessageReceiver.class.getName()); protected Operation operation; - private List<PolicyHandler> policyHandlerList = null; private Axis2ServiceProvider provider; - public Axis2ServiceInOutSyncMessageReceiver(Axis2ServiceProvider provider, Operation operation, List<PolicyHandler> policyHandlerList) { + public Axis2ServiceInOutSyncMessageReceiver(Axis2ServiceProvider provider, Operation operation) { this.provider = provider; this.operation = operation; - this.policyHandlerList = policyHandlerList; } public Axis2ServiceInOutSyncMessageReceiver() { diff --git a/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceProvider.java b/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceProvider.java index e5b64b99cc..ae67fa8a80 100644 --- a/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceProvider.java +++ b/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceProvider.java @@ -91,11 +91,8 @@ import org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition; import org.apache.tuscany.sca.invocation.Message; import org.apache.tuscany.sca.invocation.MessageFactory; import org.apache.tuscany.sca.policy.PolicySet; -import org.apache.tuscany.sca.policy.PolicySetAttachPoint; +import org.apache.tuscany.sca.policy.PolicySubject; import org.apache.tuscany.sca.policy.authentication.basic.BasicAuthenticationPolicy; -import org.apache.tuscany.sca.policy.util.PolicyHandler; -import org.apache.tuscany.sca.policy.util.PolicyHandlerTuple; -import org.apache.tuscany.sca.policy.util.PolicyHandlerUtils; import org.apache.tuscany.sca.runtime.EndpointReference; import org.apache.tuscany.sca.runtime.ReferenceParameters; import org.apache.tuscany.sca.runtime.RuntimeComponent; @@ -128,8 +125,6 @@ public class Axis2ServiceProvider { private ConfigurationContext configContext; private JMSSender jmsSender; private JMSListener jmsListener; - private List<PolicyHandlerTuple> policyHandlerClassnames = null; - private List<PolicyHandler> policyHandlerList = new ArrayList<PolicyHandler>(); private Map<String, Port> urlMap = new HashMap<String, Port>(); private BasicAuthenticationPolicy basicAuthenticationPolicy = null; @@ -166,15 +161,13 @@ public class Axis2ServiceProvider { AbstractContract contract, WebServiceBinding wsBinding, ServletHost servletHost, - MessageFactory messageFactory, - List<PolicyHandlerTuple> policyHandlerClassnames) { + MessageFactory messageFactory) { this.component = component; this.contract = contract; this.wsBinding = wsBinding; this.servletHost = servletHost; this.messageFactory = messageFactory; - this.policyHandlerClassnames = policyHandlerClassnames; final boolean isRampartRequired = AxisPolicyHelper.isRampartRequired(wsBinding); try { @@ -214,9 +207,10 @@ public class Axis2ServiceProvider { urlMap.put(endpointURI, (Port)port); } + /* // find out which policies are active - if (wsBinding instanceof PolicySetAttachPoint) { - List<PolicySet> policySets = ((PolicySetAttachPoint)wsBinding).getApplicablePolicySets(); + if (wsBinding instanceof PolicySubject) { + List<PolicySet> policySets = ((PolicySubject)wsBinding).getApplicablePolicySets(); for (PolicySet ps : policySets) { for (Object p : ps.getPolicies()) { if (BasicAuthenticationPolicy.class.isInstance(p)) { @@ -230,7 +224,8 @@ public class Axis2ServiceProvider { } } } - } + } + */ } static String getPortAddress(Port port) { @@ -319,7 +314,6 @@ public class Axis2ServiceProvider { AxisService axisService = createAxisService(entry.getKey(), entry.getValue()); configContext.getAxisConfiguration().addService(axisService); } - setupPolicyHandlers(policyHandlerList, configContext); Axis2ServiceServlet servlet = null; for (String endpointURL : urlMap.keySet()) { @@ -640,9 +634,9 @@ public class Axis2ServiceProvider { MessageReceiver msgrec = null; if (op.isNonBlocking()) { - msgrec = new Axis2ServiceInMessageReceiver(this, op, policyHandlerList); + msgrec = new Axis2ServiceInMessageReceiver(this, op); } else { - msgrec = new Axis2ServiceInOutSyncMessageReceiver(this, op, policyHandlerList); + msgrec = new Axis2ServiceInOutSyncMessageReceiver(this, op); } axisOp.setMessageReceiver(msgrec); } @@ -739,10 +733,6 @@ public class Axis2ServiceProvider { parameters.setConversationID(conversationID); } - for ( PolicyHandler policyHandler : policyHandlerList ) { - policyHandler.beforeInvoke(msg, inMC); - } - if (basicAuthenticationPolicy != null) { Axis2BindingBasicAuthenticationConfigurator.parseHTTPHeader(inMC, msg, basicAuthenticationPolicy); } @@ -751,10 +741,6 @@ public class Axis2ServiceProvider { RuntimeWire wire = ((RuntimeComponentService)contract).getRuntimeWire(getBinding()); Object response = wire.invoke(op, msg); - for ( PolicyHandler policyHandler : policyHandlerList ) { - policyHandler.afterInvoke(response, inMC); - } - return response; } @@ -772,28 +758,10 @@ public class Axis2ServiceProvider { return wsBinding; } - private void setupPolicyHandlers(List<PolicyHandler> policyHandlers, ConfigurationContext configContext) { - for ( PolicyHandler aHandler : policyHandlers ) { - aHandler.setUp(configContext); - } - } - private void createPolicyHandlers() throws IllegalAccessException, InstantiationException, ClassNotFoundException { - if (wsBinding instanceof PolicySetAttachPoint) { - PolicySetAttachPoint policiedBinding = (PolicySetAttachPoint)wsBinding; - PolicyHandler policyHandler = null; - - for (PolicySet policySet : policiedBinding.getPolicySets()) { - policyHandler = - PolicyHandlerUtils.findPolicyHandler(policySet, policyHandlerClassnames); - - if (policyHandler != null) { - policyHandler.setApplicablePolicySet(policySet); - policyHandlerList.add(policyHandler); - } - } + if (wsBinding instanceof PolicySubject) { // code to create policy handlers using a policy SPI based // on policy providers diff --git a/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/AxisPolicyHelper.java b/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/AxisPolicyHelper.java index 1f389b422f..13e32b0bfd 100644 --- a/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/AxisPolicyHelper.java +++ b/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/AxisPolicyHelper.java @@ -25,9 +25,9 @@ import javax.xml.namespace.QName; import org.apache.tuscany.sca.assembly.Binding; import org.apache.tuscany.sca.policy.Intent; -import org.apache.tuscany.sca.policy.IntentAttachPoint; +import org.apache.tuscany.sca.policy.PolicySubject; import org.apache.tuscany.sca.policy.PolicySet; -import org.apache.tuscany.sca.policy.PolicySetAttachPoint; +import org.apache.tuscany.sca.policy.PolicySubject; /** * @version $Rev$ $Date$ @@ -44,8 +44,8 @@ public class AxisPolicyHelper { public static PolicySet getPolicySet(Binding wsBinding, QName intentName) { PolicySet returnPolicySet = null; - if (wsBinding instanceof PolicySetAttachPoint) { - PolicySetAttachPoint policiedBinding = (PolicySetAttachPoint)wsBinding; + if (wsBinding instanceof PolicySubject) { + PolicySubject policiedBinding = (PolicySubject)wsBinding; for (PolicySet policySet : policiedBinding.getPolicySets()) { for (Intent intent : policySet.getProvidedIntents()) { if (intent.getName().equals(intentName)) { @@ -60,8 +60,8 @@ public class AxisPolicyHelper { } public static boolean isIntentRequired(Binding wsBinding, QName intent) { - if (wsBinding instanceof IntentAttachPoint) { - List<Intent> intents = ((IntentAttachPoint)wsBinding).getRequiredIntents(); + if (wsBinding instanceof PolicySubject) { + List<Intent> intents = ((PolicySubject)wsBinding).getRequiredIntents(); for (Intent i : intents) { if (intent.equals(i.getName())) { return true; diff --git a/java/sca/modules/binding-ws-axis2/src/main/resources/org/apache/tuscany/sca/binding/ws/axis2/definitions.xml b/java/sca/modules/binding-ws-axis2/src/main/resources/org/apache/tuscany/sca/binding/ws/axis2/definitions.xml index 6bff613a7c..88c0ef14d1 100644 --- a/java/sca/modules/binding-ws-axis2/src/main/resources/org/apache/tuscany/sca/binding/ws/axis2/definitions.xml +++ b/java/sca/modules/binding-ws-axis2/src/main/resources/org/apache/tuscany/sca/binding/ws/axis2/definitions.xml @@ -20,9 +20,9 @@ <!-- $Rev$ $Date$ -->
-<sca:definitions xmlns="http://www.osoa.org/xmlns/sca/1.0"
- targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
- xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+<sca:definitions xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200712"
+ targetNamespace="http://docs.oasis-open.org/ns/opencsa/sca/200712"
+ xmlns:sca="http://docs.oasis-open.org/ns/opencsa/sca/200712"
xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0">
<sca:bindingType type="sca:binding.ws" mayProvide="SOAP SOAP.1_1 SOAP.1_2 MTOM" alwaysProvides=""/>
diff --git a/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/definitions.xml b/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/definitions.xml index 8fa2d3b8c0..063cd0b3e6 100644 --- a/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/definitions.xml +++ b/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/definitions.xml @@ -17,9 +17,9 @@ * specific language governing permissions and limitations
* under the License.
-->
-<sca:definitions xmlns="http://www.osoa.org/xmlns/sca/1.0"
+<sca:definitions xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200712"
targetNamespace="http://tuscany.apache.org/xmlns/sca/1.0"
- xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:sca="http://docs.oasis-open.org/ns/opencsa/sca/200712"
xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0">
<!-- WS Security POLICY SETS -->
diff --git a/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/intent/definitions.xml b/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/intent/definitions.xml index 65f8cb67d8..21ab1d8a47 100644 --- a/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/intent/definitions.xml +++ b/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/intent/definitions.xml @@ -17,9 +17,9 @@ * specific language governing permissions and limitations
* under the License.
-->
-<sca:definitions xmlns="http://www.osoa.org/xmlns/sca/1.0"
+<sca:definitions xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200712"
targetNamespace="http://tuscany.apache.org/xmlns/sca/1.0"
- xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:sca="http://docs.oasis-open.org/ns/opencsa/sca/200712"
xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0">
<sca:intent name="wsAuthentication"
diff --git a/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/mixed/definitions.xml b/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/mixed/definitions.xml index 871e889835..3239d855b6 100644 --- a/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/mixed/definitions.xml +++ b/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/mixed/definitions.xml @@ -17,9 +17,9 @@ * specific language governing permissions and limitations * under the License. --> -<sca:definitions xmlns="http://www.osoa.org/xmlns/sca/1.0" +<sca:definitions xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200712" targetNamespace="http://tuscany.apache.org/xmlns/sca/1.0" - xmlns:sca="http://www.osoa.org/xmlns/sca/1.0" + xmlns:sca="http://docs.oasis-open.org/ns/opencsa/sca/200712" xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"> <!-- WS Security POLICY SETS --> diff --git a/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/definitions.xml b/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/definitions.xml index d7f40ccf0e..2f43f6f484 100644 --- a/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/definitions.xml +++ b/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/definitions.xml @@ -17,9 +17,9 @@ * specific language governing permissions and limitations
* under the License.
-->
-<sca:definitions xmlns="http://www.osoa.org/xmlns/sca/1.0"
+<sca:definitions xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200712"
targetNamespace="http://tuscany.apache.org/xmlns/sca/1.0"
- xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:sca="http://docs.oasis-open.org/ns/opencsa/sca/200712"
xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0">
<!-- WS Security POLICY SETS -->
|