diff options
Diffstat (limited to 'java/sca/modules/binding-ws-axis2-policy')
11 files changed, 117 insertions, 216 deletions
diff --git a/java/sca/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/token/Axis2TokenAuthenticationPolicyProviderFactory.java b/java/sca/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/token/Axis2TokenAuthenticationPolicyProviderFactory.java index 805d6f80cb..af9689bc2a 100644 --- a/java/sca/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/token/Axis2TokenAuthenticationPolicyProviderFactory.java +++ b/java/sca/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/token/Axis2TokenAuthenticationPolicyProviderFactory.java @@ -19,14 +19,12 @@ package org.apache.tuscany.sca.binding.ws.axis2.policy.authentication.token;
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.assembly.Implementation;
+import org.apache.tuscany.sca.assembly.Endpoint;
+import org.apache.tuscany.sca.assembly.EndpointReference;
import org.apache.tuscany.sca.core.ExtensionPointRegistry;
import org.apache.tuscany.sca.provider.PolicyProvider;
import org.apache.tuscany.sca.provider.PolicyProviderFactory;
import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
/**
* @version $Rev: 695374 $ $Date: 2008-09-15 09:07:58 +0100 (Mon, 15 Sep 2008) $
@@ -39,37 +37,23 @@ public class Axis2TokenAuthenticationPolicyProviderFactory implements PolicyProv this.registry = registry;
}
- /**
- * @see org.apache.tuscany.sca.provider.PolicyProviderFactory#createImplementationPolicyProvider(org.apache.tuscany.sca.runtime.RuntimeComponent, org.apache.tuscany.sca.assembly.Implementation)
- */
- public PolicyProvider createImplementationPolicyProvider(RuntimeComponent component, Implementation implementation) {
+ public PolicyProvider createImplementationPolicyProvider(RuntimeComponent component) {
return null;//new TokenAuthenticationImplementationPolicyProvider(component, implementation);
}
- /**
- * @see org.apache.tuscany.sca.provider.PolicyProviderFactory#createReferencePolicyProvider(org.apache.tuscany.sca.runtime.RuntimeComponent, org.apache.tuscany.sca.runtime.RuntimeComponentReference, org.apache.tuscany.sca.assembly.Binding)
- */
- public PolicyProvider createReferencePolicyProvider(RuntimeComponent component,
- RuntimeComponentReference reference,
- Binding binding) {
- return new Axis2TokenAuthenticationReferencePolicyProvider(component, reference, binding);
+ public PolicyProvider createReferencePolicyProvider(EndpointReference endpointReference) {
+ return new Axis2TokenAuthenticationReferencePolicyProvider(endpointReference);
}
- /**
- * @see org.apache.tuscany.sca.provider.PolicyProviderFactory#createServicePolicyProvider(org.apache.tuscany.sca.runtime.RuntimeComponent, org.apache.tuscany.sca.runtime.RuntimeComponentService, org.apache.tuscany.sca.assembly.Binding)
- */
- public PolicyProvider createServicePolicyProvider(RuntimeComponent component,
- RuntimeComponentService service,
- Binding binding) {
- return new Axis2TokenAuthenticationServicePolicyProvider(component, service, binding);
+ public PolicyProvider createServicePolicyProvider(Endpoint endpoint) {
+ return new Axis2TokenAuthenticationServicePolicyProvider(endpoint);
}
/**
* @see org.apache.tuscany.sca.provider.ProviderFactory#getModelType()
*/
- public Class getModelType() {
- // TODO Auto-generated method stub
- return null;
+ public Class<Axis2TokenAuthenticationPolicy> getModelType() {
+ return Axis2TokenAuthenticationPolicy.class;
}
}
diff --git a/java/sca/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/token/Axis2TokenAuthenticationReferencePolicyInterceptor.java b/java/sca/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/token/Axis2TokenAuthenticationReferencePolicyInterceptor.java index 0046d3d6ca..d9e4373c2f 100644 --- a/java/sca/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/token/Axis2TokenAuthenticationReferencePolicyInterceptor.java +++ b/java/sca/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/token/Axis2TokenAuthenticationReferencePolicyInterceptor.java @@ -20,9 +20,10 @@ package org.apache.tuscany.sca.binding.ws.axis2.policy.authentication.token; import org.apache.tuscany.sca.binding.ws.axis2.policy.header.Axis2SOAPHeaderString;
import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.Interceptor;
import org.apache.tuscany.sca.invocation.Invoker;
import org.apache.tuscany.sca.invocation.Message;
+import org.apache.tuscany.sca.invocation.Phase;
+import org.apache.tuscany.sca.invocation.PhasedInterceptor;
import org.apache.tuscany.sca.policy.PolicySet;
/**
@@ -31,7 +32,7 @@ import org.apache.tuscany.sca.policy.PolicySet; *
* @version $Rev: 698457 $ $Date: 2008-09-24 09:13:02 +0100 (Wed, 24 Sep 2008) $
*/
-public class Axis2TokenAuthenticationReferencePolicyInterceptor implements Interceptor {
+public class Axis2TokenAuthenticationReferencePolicyInterceptor implements PhasedInterceptor {
private Invoker next;
private Operation operation;
@@ -81,4 +82,9 @@ public class Axis2TokenAuthenticationReferencePolicyInterceptor implements Inter public void setNext(Invoker next) {
this.next = next;
}
+
+ public String getPhase() {
+ return Phase.REFERENCE_POLICY;
+ }
+
}
diff --git a/java/sca/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/token/Axis2TokenAuthenticationReferencePolicyProvider.java b/java/sca/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/token/Axis2TokenAuthenticationReferencePolicyProvider.java index 4753012de4..94fcb236f8 100644 --- a/java/sca/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/token/Axis2TokenAuthenticationReferencePolicyProvider.java +++ b/java/sca/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/token/Axis2TokenAuthenticationReferencePolicyProvider.java @@ -21,41 +21,29 @@ package org.apache.tuscany.sca.binding.ws.axis2.policy.authentication.token; import java.util.List;
-import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.EndpointReference;
import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.Interceptor;
-import org.apache.tuscany.sca.invocation.Phase;
+import org.apache.tuscany.sca.invocation.PhasedInterceptor;
import org.apache.tuscany.sca.policy.PolicySet;
-import org.apache.tuscany.sca.policy.PolicySubject;
import org.apache.tuscany.sca.provider.PolicyProvider;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
/**
* @version $Rev: 695374 $ $Date: 2008-09-15 09:07:58 +0100 (Mon, 15 Sep 2008) $
*/
public class Axis2TokenAuthenticationReferencePolicyProvider implements PolicyProvider {
- private RuntimeComponent component;
- private RuntimeComponentReference reference;
- private Binding binding;
+ private EndpointReference endpointReference;
- public Axis2TokenAuthenticationReferencePolicyProvider(RuntimeComponent component,
- RuntimeComponentReference reference,
- Binding binding) {
+ public Axis2TokenAuthenticationReferencePolicyProvider(EndpointReference endpointReference) {
super();
- this.component = component;
- this.reference = reference;
- this.binding = binding;
+ this.endpointReference = endpointReference;
}
private PolicySet findPolicySet() {
- if (binding instanceof PolicySubject) {
- List<PolicySet> policySets = ((PolicySubject)binding).getPolicySets();
- for (PolicySet ps : policySets) {
- for (Object p : ps.getPolicies()) {
- if (Axis2TokenAuthenticationPolicy.class.isInstance(p)) {
- return ps;
- }
+ List<PolicySet> policySets = endpointReference.getPolicySets();
+ for (PolicySet ps : policySets) {
+ for (Object p : ps.getPolicies()) {
+ if (Axis2TokenAuthenticationPolicy.class.isInstance(p)) {
+ return ps;
}
}
}
@@ -63,27 +51,21 @@ public class Axis2TokenAuthenticationReferencePolicyProvider implements PolicyPr }
private String getContext() {
- return "component.reference: " + component.getURI()
- + "#"
- + reference.getName()
- + "("
- + binding.getClass().getName()
- + ")";
+ return endpointReference.getURI();
}
/**
* @see org.apache.tuscany.sca.provider.PolicyProvider#createInterceptor(org.apache.tuscany.sca.interfacedef.Operation)
*/
- public Interceptor createInterceptor(Operation operation) {
+ public PhasedInterceptor createInterceptor(Operation operation) {
PolicySet ps = findPolicySet();
return ps == null ? null : new Axis2TokenAuthenticationReferencePolicyInterceptor(getContext(), operation, ps);
}
+
+ public void start() {
+ }
- /**
- * @see org.apache.tuscany.sca.provider.PolicyProvider#getPhase()
- */
- public String getPhase() {
- return Phase.REFERENCE_POLICY;
+ public void stop() {
}
}
diff --git a/java/sca/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/token/Axis2TokenAuthenticationServicePolicyInterceptor.java b/java/sca/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/token/Axis2TokenAuthenticationServicePolicyInterceptor.java index cf081e1121..33f7d97869 100644 --- a/java/sca/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/token/Axis2TokenAuthenticationServicePolicyInterceptor.java +++ b/java/sca/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/token/Axis2TokenAuthenticationServicePolicyInterceptor.java @@ -26,9 +26,10 @@ import javax.security.auth.Subject; import org.apache.tuscany.sca.binding.ws.axis2.policy.header.Axis2HeaderPolicyUtil;
import org.apache.tuscany.sca.binding.ws.axis2.policy.header.Axis2SOAPHeaderString;
import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.Interceptor;
import org.apache.tuscany.sca.invocation.Invoker;
import org.apache.tuscany.sca.invocation.Message;
+import org.apache.tuscany.sca.invocation.Phase;
+import org.apache.tuscany.sca.invocation.PhasedInterceptor;
import org.apache.tuscany.sca.policy.PolicySet;
import org.apache.tuscany.sca.policy.authentication.token.TokenPrincipal;
import org.apache.tuscany.sca.policy.security.SecurityUtil;
@@ -39,7 +40,7 @@ import org.apache.tuscany.sca.policy.security.SecurityUtil; *
* @version $Rev: 721811 $ $Date: 2008-11-30 13:46:51 +0000 (Sun, 30 Nov 2008) $
*/
-public class Axis2TokenAuthenticationServicePolicyInterceptor implements Interceptor {
+public class Axis2TokenAuthenticationServicePolicyInterceptor implements PhasedInterceptor {
private Invoker next;
private Operation operation;
private PolicySet policySet = null;
@@ -90,4 +91,8 @@ public class Axis2TokenAuthenticationServicePolicyInterceptor implements Interce public void setNext(Invoker next) {
this.next = next;
}
+
+ public String getPhase() {
+ return Phase.SERVICE_POLICY;
+ }
}
diff --git a/java/sca/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/token/Axis2TokenAuthenticationServicePolicyProvider.java b/java/sca/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/token/Axis2TokenAuthenticationServicePolicyProvider.java index d1be46d1ce..e229a7d328 100644 --- a/java/sca/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/token/Axis2TokenAuthenticationServicePolicyProvider.java +++ b/java/sca/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/token/Axis2TokenAuthenticationServicePolicyProvider.java @@ -21,39 +21,29 @@ package org.apache.tuscany.sca.binding.ws.axis2.policy.authentication.token; import java.util.List;
-import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.Endpoint;
import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.Interceptor;
-import org.apache.tuscany.sca.invocation.Phase;
+import org.apache.tuscany.sca.invocation.PhasedInterceptor;
import org.apache.tuscany.sca.policy.PolicySet;
-import org.apache.tuscany.sca.policy.PolicySubject;
import org.apache.tuscany.sca.provider.PolicyProvider;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
/**
* @version $Rev: 695374 $ $Date: 2008-09-15 09:07:58 +0100 (Mon, 15 Sep 2008) $
*/
public class Axis2TokenAuthenticationServicePolicyProvider implements PolicyProvider {
- private RuntimeComponent component;
- private RuntimeComponentService service;
- private Binding binding;
+ private Endpoint endpoint;
- public Axis2TokenAuthenticationServicePolicyProvider(RuntimeComponent component, RuntimeComponentService service, Binding binding) {
+ public Axis2TokenAuthenticationServicePolicyProvider(Endpoint endpoint) {
super();
- this.component = component;
- this.service = service;
- this.binding = binding;
+ this.endpoint = endpoint;
}
private PolicySet findPolicySet() {
- if (binding instanceof PolicySubject) {
- List<PolicySet> policySets = ((PolicySubject)binding).getPolicySets();
- for (PolicySet ps : policySets) {
- for (Object p : ps.getPolicies()) {
- if (Axis2TokenAuthenticationPolicy.class.isInstance(p)) {
- return ps;
- }
+ List<PolicySet> policySets = endpoint.getPolicySets();
+ for (PolicySet ps : policySets) {
+ for (Object p : ps.getPolicies()) {
+ if (Axis2TokenAuthenticationPolicy.class.isInstance(p)) {
+ return ps;
}
}
}
@@ -61,27 +51,20 @@ public class Axis2TokenAuthenticationServicePolicyProvider implements PolicyProv }
private String getContext() {
- return "component.service: " + component.getURI()
- + "#"
- + service.getName()
- + "("
- + binding.getClass().getName()
- + ")";
+ return endpoint.getURI();
}
/**
* @see org.apache.tuscany.sca.provider.PolicyProvider#createInterceptor(org.apache.tuscany.sca.interfacedef.Operation)
*/
- public Interceptor createInterceptor(Operation operation) {
+ public PhasedInterceptor createInterceptor(Operation operation) {
PolicySet ps = findPolicySet();
return ps == null ? null : new Axis2TokenAuthenticationServicePolicyInterceptor(getContext(), operation, ps);
}
- /**
- * @see org.apache.tuscany.sca.provider.PolicyProvider#getPhase()
- */
- public String getPhase() {
- return Phase.SERVICE_POLICY;
+ public void start() {
}
+ public void stop() {
+ }
}
diff --git a/java/sca/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/configuration/Axis2ConfigParamPolicyProviderFactory.java b/java/sca/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/configuration/Axis2ConfigParamPolicyProviderFactory.java index ed4335baa7..c224e7615a 100644 --- a/java/sca/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/configuration/Axis2ConfigParamPolicyProviderFactory.java +++ b/java/sca/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/configuration/Axis2ConfigParamPolicyProviderFactory.java @@ -22,15 +22,13 @@ package org.apache.tuscany.sca.binding.ws.axis2.policy.configuration; import org.apache.axis2.AxisFault; import org.apache.axis2.context.ConfigurationContext; import org.apache.axis2.description.Parameter; -import org.apache.tuscany.sca.assembly.Binding; -import org.apache.tuscany.sca.assembly.Implementation; +import org.apache.tuscany.sca.assembly.Endpoint; +import org.apache.tuscany.sca.assembly.EndpointReference; import org.apache.tuscany.sca.core.ExtensionPointRegistry; import org.apache.tuscany.sca.policy.PolicySet; import org.apache.tuscany.sca.provider.PolicyProvider; import org.apache.tuscany.sca.provider.PolicyProviderFactory; 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; /** @@ -42,34 +40,18 @@ public class Axis2ConfigParamPolicyProviderFactory implements PolicyProviderFact super(); } - /** - * @see org.apache.tuscany.sca.provider.PolicyProviderFactory#createImplementationPolicyProvider(org.apache.tuscany.sca.runtime.RuntimeComponent, org.apache.tuscany.sca.assembly.Implementation) - */ - public PolicyProvider createImplementationPolicyProvider(RuntimeComponent component, Implementation implementation) { + public PolicyProvider createImplementationPolicyProvider(RuntimeComponent component) { return null; } - /** - * @see org.apache.tuscany.sca.provider.PolicyProviderFactory#createReferencePolicyProvider(org.apache.tuscany.sca.runtime.RuntimeComponent, org.apache.tuscany.sca.runtime.RuntimeComponentReference, org.apache.tuscany.sca.assembly.Binding) - */ - public PolicyProvider createReferencePolicyProvider(RuntimeComponent component, - RuntimeComponentReference reference, - Binding binding) { + public PolicyProvider createReferencePolicyProvider(EndpointReference endpointReference) { return null; } - /** - * @see org.apache.tuscany.sca.provider.PolicyProviderFactory#createServicePolicyProvider(org.apache.tuscany.sca.runtime.RuntimeComponent, org.apache.tuscany.sca.runtime.RuntimeComponentService, org.apache.tuscany.sca.assembly.Binding) - */ - public PolicyProvider createServicePolicyProvider(RuntimeComponent component, - RuntimeComponentService service, - Binding binding) { + public PolicyProvider createServicePolicyProvider(Endpoint endpoint) { return null; } - /** - * @see org.apache.tuscany.sca.provider.ProviderFactory#getModelType() - */ public Class<Axis2ConfigParamPolicy> getModelType() { return Axis2ConfigParamPolicy.class; } diff --git a/java/sca/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderPolicyProviderFactory.java b/java/sca/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderPolicyProviderFactory.java index 71833df382..64d816a8e7 100644 --- a/java/sca/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderPolicyProviderFactory.java +++ b/java/sca/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderPolicyProviderFactory.java @@ -19,14 +19,12 @@ package org.apache.tuscany.sca.binding.ws.axis2.policy.header; -import org.apache.tuscany.sca.assembly.Binding; -import org.apache.tuscany.sca.assembly.Implementation; +import org.apache.tuscany.sca.assembly.Endpoint; +import org.apache.tuscany.sca.assembly.EndpointReference; import org.apache.tuscany.sca.core.ExtensionPointRegistry; import org.apache.tuscany.sca.provider.PolicyProvider; import org.apache.tuscany.sca.provider.PolicyProviderFactory; import org.apache.tuscany.sca.runtime.RuntimeComponent; -import org.apache.tuscany.sca.runtime.RuntimeComponentReference; -import org.apache.tuscany.sca.runtime.RuntimeComponentService; /** * @version $Rev$ $Date$ @@ -39,37 +37,23 @@ public class Axis2HeaderPolicyProviderFactory implements PolicyProviderFactory<A this.registry = registry; } - /** - * @see org.apache.tuscany.sca.provider.PolicyProviderFactory#createImplementationPolicyProvider(org.apache.tuscany.sca.runtime.RuntimeComponent, org.apache.tuscany.sca.assembly.Implementation) - */ - public PolicyProvider createImplementationPolicyProvider(RuntimeComponent component, Implementation implementation) { + public PolicyProvider createImplementationPolicyProvider(RuntimeComponent component) { return null;//new TokenAuthenticationImplementationPolicyProvider(component, implementation); } - /** - * @see org.apache.tuscany.sca.provider.PolicyProviderFactory#createReferencePolicyProvider(org.apache.tuscany.sca.runtime.RuntimeComponent, org.apache.tuscany.sca.runtime.RuntimeComponentReference, org.apache.tuscany.sca.assembly.Binding) - */ - public PolicyProvider createReferencePolicyProvider(RuntimeComponent component, - RuntimeComponentReference reference, - Binding binding) { - return new Axis2HeaderReferencePolicyProvider(component, reference, binding); + public PolicyProvider createReferencePolicyProvider(EndpointReference endpointReference) { + return new Axis2HeaderReferencePolicyProvider(endpointReference); } - /** - * @see org.apache.tuscany.sca.provider.PolicyProviderFactory#createServicePolicyProvider(org.apache.tuscany.sca.runtime.RuntimeComponent, org.apache.tuscany.sca.runtime.RuntimeComponentService, org.apache.tuscany.sca.assembly.Binding) - */ - public PolicyProvider createServicePolicyProvider(RuntimeComponent component, - RuntimeComponentService service, - Binding binding) { - return new Axis2HeaderServicePolicyProvider(component, service, binding); + public PolicyProvider createServicePolicyProvider(Endpoint endpoint) { + return new Axis2HeaderServicePolicyProvider(endpoint); } /** * @see org.apache.tuscany.sca.provider.ProviderFactory#getModelType() */ - public Class getModelType() { - // TODO Auto-generated method stub - return null; + public Class<Axis2HeaderPolicy> getModelType() { + return Axis2HeaderPolicy.class; } } diff --git a/java/sca/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderReferencePolicyInterceptor.java b/java/sca/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderReferencePolicyInterceptor.java index 35c8a68be2..9c2418a44f 100644 --- a/java/sca/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderReferencePolicyInterceptor.java +++ b/java/sca/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderReferencePolicyInterceptor.java @@ -19,18 +19,17 @@ package org.apache.tuscany.sca.binding.ws.axis2.policy.header; import org.apache.tuscany.sca.interfacedef.Operation; -import org.apache.tuscany.sca.invocation.Interceptor; import org.apache.tuscany.sca.invocation.Invoker; import org.apache.tuscany.sca.invocation.Message; +import org.apache.tuscany.sca.invocation.Phase; +import org.apache.tuscany.sca.invocation.PhasedInterceptor; import org.apache.tuscany.sca.policy.PolicySet; /** - * Policy handler to handle PolicySet related to Logging with the QName - * {http://tuscany.apache.org/xmlns/sca/1.1/impl/java}LoggingPolicy * * @version $Rev$ $Date$ */ -public class Axis2HeaderReferencePolicyInterceptor implements Interceptor { +public class Axis2HeaderReferencePolicyInterceptor implements PhasedInterceptor { private Invoker next; private Operation operation; private PolicySet policySet = null; @@ -69,4 +68,9 @@ public class Axis2HeaderReferencePolicyInterceptor implements Interceptor { public void setNext(Invoker next) { this.next = next; } + + public String getPhase() { + return Phase.REFERENCE_POLICY; + } + } diff --git a/java/sca/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderReferencePolicyProvider.java b/java/sca/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderReferencePolicyProvider.java index d0fc58cd33..9037f3d9de 100644 --- a/java/sca/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderReferencePolicyProvider.java +++ b/java/sca/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderReferencePolicyProvider.java @@ -21,42 +21,29 @@ package org.apache.tuscany.sca.binding.ws.axis2.policy.header; import java.util.List; -import org.apache.tuscany.sca.assembly.Binding; +import org.apache.tuscany.sca.assembly.EndpointReference; import org.apache.tuscany.sca.interfacedef.Operation; -import org.apache.tuscany.sca.invocation.Interceptor; -import org.apache.tuscany.sca.invocation.Phase; +import org.apache.tuscany.sca.invocation.PhasedInterceptor; import org.apache.tuscany.sca.policy.PolicySet; -import org.apache.tuscany.sca.policy.PolicySubject; import org.apache.tuscany.sca.provider.PolicyProvider; -import org.apache.tuscany.sca.runtime.RuntimeComponent; -import org.apache.tuscany.sca.runtime.RuntimeComponentReference; /** * @version $Rev$ $Date$ */ public class Axis2HeaderReferencePolicyProvider implements PolicyProvider { - private RuntimeComponent component; - private RuntimeComponentReference reference; - private Binding binding; + private EndpointReference endpointReference; - public Axis2HeaderReferencePolicyProvider(RuntimeComponent component, - RuntimeComponentReference reference, - Binding binding) { + public Axis2HeaderReferencePolicyProvider(EndpointReference endpointReference) { super(); - this.component = component; - this.reference = reference; - this.binding = binding; + this.endpointReference = endpointReference; } - // FIXME: Need to use the endpoint with effective policies private PolicySet findPolicySet() { - if (binding instanceof PolicySubject) { - List<PolicySet> policySets = ((PolicySubject)binding).getPolicySets(); - for (PolicySet ps : policySets) { - for (Object p : ps.getPolicies()) { - if (Axis2HeaderPolicy.class.isInstance(p)) { - return ps; - } + List<PolicySet> policySets = endpointReference.getPolicySets(); + for (PolicySet ps : policySets) { + for (Object p : ps.getPolicies()) { + if (Axis2HeaderPolicy.class.isInstance(p)) { + return ps; } } } @@ -64,27 +51,21 @@ public class Axis2HeaderReferencePolicyProvider implements PolicyProvider { } private String getContext() { - return "component.reference: " + component.getURI() - + "#" - + reference.getName() - + "(" - + binding.getClass().getName() - + ")"; + return endpointReference.getURI(); } /** * @see org.apache.tuscany.sca.provider.PolicyProvider#createInterceptor(org.apache.tuscany.sca.interfacedef.Operation) */ - public Interceptor createInterceptor(Operation operation) { + public PhasedInterceptor createInterceptor(Operation operation) { PolicySet ps = findPolicySet(); return ps == null ? null : new Axis2HeaderReferencePolicyInterceptor(getContext(), operation, ps); } - /** - * @see org.apache.tuscany.sca.provider.PolicyProvider#getPhase() - */ - public String getPhase() { - return Phase.REFERENCE_POLICY; + public void start() { + } + + public void stop() { } } diff --git a/java/sca/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderServicePolicyInterceptor.java b/java/sca/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderServicePolicyInterceptor.java index c6758aea48..a05f04ad01 100644 --- a/java/sca/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderServicePolicyInterceptor.java +++ b/java/sca/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderServicePolicyInterceptor.java @@ -20,9 +20,10 @@ package org.apache.tuscany.sca.binding.ws.axis2.policy.header; import org.apache.tuscany.sca.interfacedef.Operation; -import org.apache.tuscany.sca.invocation.Interceptor; import org.apache.tuscany.sca.invocation.Invoker; import org.apache.tuscany.sca.invocation.Message; +import org.apache.tuscany.sca.invocation.Phase; +import org.apache.tuscany.sca.invocation.PhasedInterceptor; import org.apache.tuscany.sca.policy.PolicySet; /** @@ -31,7 +32,7 @@ import org.apache.tuscany.sca.policy.PolicySet; * * @version $Rev$ $Date$ */ -public class Axis2HeaderServicePolicyInterceptor implements Interceptor { +public class Axis2HeaderServicePolicyInterceptor implements PhasedInterceptor { private Invoker next; private Operation operation; private PolicySet policySet = null; @@ -70,4 +71,9 @@ public class Axis2HeaderServicePolicyInterceptor implements Interceptor { public void setNext(Invoker next) { this.next = next; } + + public String getPhase() { + return Phase.SERVICE_POLICY; + } + } diff --git a/java/sca/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderServicePolicyProvider.java b/java/sca/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderServicePolicyProvider.java index 3cb6d8007b..88c77711eb 100644 --- a/java/sca/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderServicePolicyProvider.java +++ b/java/sca/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderServicePolicyProvider.java @@ -21,39 +21,29 @@ package org.apache.tuscany.sca.binding.ws.axis2.policy.header; import java.util.List; -import org.apache.tuscany.sca.assembly.Binding; +import org.apache.tuscany.sca.assembly.Endpoint; import org.apache.tuscany.sca.interfacedef.Operation; -import org.apache.tuscany.sca.invocation.Interceptor; -import org.apache.tuscany.sca.invocation.Phase; +import org.apache.tuscany.sca.invocation.PhasedInterceptor; import org.apache.tuscany.sca.policy.PolicySet; -import org.apache.tuscany.sca.policy.PolicySubject; import org.apache.tuscany.sca.provider.PolicyProvider; -import org.apache.tuscany.sca.runtime.RuntimeComponent; -import org.apache.tuscany.sca.runtime.RuntimeComponentService; /** * @version $Rev$ $Date$ */ public class Axis2HeaderServicePolicyProvider implements PolicyProvider { - private RuntimeComponent component; - private RuntimeComponentService service; - private Binding binding; + private Endpoint endpoint; - public Axis2HeaderServicePolicyProvider(RuntimeComponent component, RuntimeComponentService service, Binding binding) { + public Axis2HeaderServicePolicyProvider(Endpoint endpoint) { super(); - this.component = component; - this.service = service; - this.binding = binding; + this.endpoint = endpoint; } private PolicySet findPolicySet() { - if (binding instanceof PolicySubject) { - List<PolicySet> policySets = ((PolicySubject)binding).getPolicySets(); - for (PolicySet ps : policySets) { - for (Object p : ps.getPolicies()) { - if (Axis2HeaderPolicy.class.isInstance(p)) { - return ps; - } + List<PolicySet> policySets = endpoint.getPolicySets(); + for (PolicySet ps : policySets) { + for (Object p : ps.getPolicies()) { + if (Axis2HeaderPolicy.class.isInstance(p)) { + return ps; } } } @@ -61,27 +51,21 @@ public class Axis2HeaderServicePolicyProvider implements PolicyProvider { } private String getContext() { - return "component.service: " + component.getURI() - + "#" - + service.getName() - + "(" - + binding.getClass().getName() - + ")"; + return endpoint.getURI(); } /** * @see org.apache.tuscany.sca.provider.PolicyProvider#createInterceptor(org.apache.tuscany.sca.interfacedef.Operation) */ - public Interceptor createInterceptor(Operation operation) { + public PhasedInterceptor createInterceptor(Operation operation) { PolicySet ps = findPolicySet(); return ps == null ? null : new Axis2HeaderServicePolicyInterceptor(getContext(), operation, ps); } - /** - * @see org.apache.tuscany.sca.provider.PolicyProvider#getPhase() - */ - public String getPhase() { - return Phase.SERVICE_POLICY; + public void start() { + } + + public void stop() { } } |