summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/tags/2.0.1-RC1/testing/itest/policy/interceptors/src/main/java/testbindingwspolicy
diff options
context:
space:
mode:
Diffstat (limited to 'sca-java-2.x/tags/2.0.1-RC1/testing/itest/policy/interceptors/src/main/java/testbindingwspolicy')
-rw-r--r--sca-java-2.x/tags/2.0.1-RC1/testing/itest/policy/interceptors/src/main/java/testbindingwspolicy/TestBindingWSAxisHandler.java45
-rw-r--r--sca-java-2.x/tags/2.0.1-RC1/testing/itest/policy/interceptors/src/main/java/testbindingwspolicy/TestBindingWSPolicy.java63
-rw-r--r--sca-java-2.x/tags/2.0.1-RC1/testing/itest/policy/interceptors/src/main/java/testbindingwspolicy/TestBindingWSPolicyBuilder.java84
-rw-r--r--sca-java-2.x/tags/2.0.1-RC1/testing/itest/policy/interceptors/src/main/java/testbindingwspolicy/TestBindingWSPolicyInterceptor.java84
-rw-r--r--sca-java-2.x/tags/2.0.1-RC1/testing/itest/policy/interceptors/src/main/java/testbindingwspolicy/TestBindingWSPolicyProcessor.java99
-rw-r--r--sca-java-2.x/tags/2.0.1-RC1/testing/itest/policy/interceptors/src/main/java/testbindingwspolicy/TestBindingWSPolicyProviderFactory.java69
-rw-r--r--sca-java-2.x/tags/2.0.1-RC1/testing/itest/policy/interceptors/src/main/java/testbindingwspolicy/TestBindingWSPolicyProviderReference.java72
-rw-r--r--sca-java-2.x/tags/2.0.1-RC1/testing/itest/policy/interceptors/src/main/java/testbindingwspolicy/TestBindingWSPolicyProviderService.java72
8 files changed, 588 insertions, 0 deletions
diff --git a/sca-java-2.x/tags/2.0.1-RC1/testing/itest/policy/interceptors/src/main/java/testbindingwspolicy/TestBindingWSAxisHandler.java b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/policy/interceptors/src/main/java/testbindingwspolicy/TestBindingWSAxisHandler.java
new file mode 100644
index 0000000000..686866e12d
--- /dev/null
+++ b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/policy/interceptors/src/main/java/testbindingwspolicy/TestBindingWSAxisHandler.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package testbindingwspolicy;
+
+import helloworld.StatusImpl;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.handlers.AbstractHandler;
+
+/**
+ * An Axis handler to show that policy can add one of needs be
+ *
+ * @version $Rev: 881959 $ $Date: 2009-11-18 22:07:09 +0000 (Wed, 18 Nov 2009) $
+ */
+public class TestBindingWSAxisHandler extends AbstractHandler
+{
+ private String name;
+
+ public TestBindingWSAxisHandler(String name)
+ {
+ this.name = name;
+ }
+
+ public InvocationResponse invoke(MessageContext msgContext) throws AxisFault {
+ StatusImpl.appendStatus("TestAxisHandler.invoke()", name);
+ return InvocationResponse.CONTINUE;
+ }
+}
diff --git a/sca-java-2.x/tags/2.0.1-RC1/testing/itest/policy/interceptors/src/main/java/testbindingwspolicy/TestBindingWSPolicy.java b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/policy/interceptors/src/main/java/testbindingwspolicy/TestBindingWSPolicy.java
new file mode 100644
index 0000000000..c7803f03bc
--- /dev/null
+++ b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/policy/interceptors/src/main/java/testbindingwspolicy/TestBindingWSPolicy.java
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package testbindingwspolicy;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.Base;
+
+/**
+ * Implementation for policies that could be injected as parameter
+ * into the axis2config.
+ *
+ * @version $Rev: 824551 $ $Date: 2009-10-13 01:21:22 +0100 (Tue, 13 Oct 2009) $
+ */
+public class TestBindingWSPolicy {
+ static final String SCA11_NS = Base.SCA11_NS;
+ static final String SCA11_TUSCANY_NS = Base.SCA11_TUSCANY_NS;
+ static final QName TEST_BINDINGWS_POLICY_QNAME = new QName(SCA11_TUSCANY_NS, "testBindingWSPolicy");
+
+ private String testString;
+
+ public String getTestString() {
+ return testString;
+ }
+
+ public void setTestString(String testString) {
+ this.testString = testString;
+ }
+
+ public QName getSchemaName() {
+ return TEST_BINDINGWS_POLICY_QNAME;
+ }
+
+ public boolean isUnresolved() {
+ return false;
+ }
+
+ public void setUnresolved(boolean unresolved) {
+ }
+
+ @Override
+ public String toString() {
+ return "TestBindingWSPolicy [testString=" +
+ testString
+ + "]";
+ }
+}
diff --git a/sca-java-2.x/tags/2.0.1-RC1/testing/itest/policy/interceptors/src/main/java/testbindingwspolicy/TestBindingWSPolicyBuilder.java b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/policy/interceptors/src/main/java/testbindingwspolicy/TestBindingWSPolicyBuilder.java
new file mode 100644
index 0000000000..4fdcde678d
--- /dev/null
+++ b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/policy/interceptors/src/main/java/testbindingwspolicy/TestBindingWSPolicyBuilder.java
@@ -0,0 +1,84 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package testbindingwspolicy;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.Endpoint;
+import org.apache.tuscany.sca.assembly.EndpointReference;
+import org.apache.tuscany.sca.assembly.Implementation;
+import org.apache.tuscany.sca.assembly.builder.BuilderContext;
+import org.apache.tuscany.sca.assembly.builder.PolicyBuilder;
+import org.apache.tuscany.sca.policy.PolicyExpression;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.policy.PolicySubject;
+
+/**
+ *
+ */
+public class TestBindingWSPolicyBuilder implements PolicyBuilder<TestBindingWSPolicy> {
+
+ public boolean build(Endpoint endpoint, BuilderContext context) {
+ List<TestBindingWSPolicy> polices = getPolicies(endpoint);
+ System.out.println(endpoint + ": " + polices);
+ return true;
+ }
+
+ public boolean build(EndpointReference endpointReference, BuilderContext context) {
+ List<TestBindingWSPolicy> polices = getPolicies(endpointReference);
+ System.out.println(endpointReference + ": " + polices);
+ return true;
+ }
+
+ public boolean build(Component component, Implementation implementation, BuilderContext context) {
+ List<TestBindingWSPolicy> polices = getPolicies(implementation);
+ System.out.println(implementation + ": " + polices);
+ return true;
+ }
+
+ public QName getPolicyType() {
+ return TestBindingWSPolicy.TEST_BINDINGWS_POLICY_QNAME;
+ }
+
+ public List<QName> getSupportedBindings() {
+ return null;
+ }
+
+ private List<TestBindingWSPolicy> getPolicies(PolicySubject subject) {
+ List<TestBindingWSPolicy> polices = new ArrayList<TestBindingWSPolicy>();
+ for (PolicySet ps : subject.getPolicySets()) {
+ for (PolicyExpression exp : ps.getPolicies()) {
+ if (getPolicyType().equals(exp.getName())) {
+ polices.add((TestBindingWSPolicy)exp.getPolicy());
+ }
+ }
+ }
+ return polices;
+ }
+
+ public boolean build(EndpointReference endpointReference, Endpoint endpoint, BuilderContext context) {
+ return true;
+ }
+
+}
diff --git a/sca-java-2.x/tags/2.0.1-RC1/testing/itest/policy/interceptors/src/main/java/testbindingwspolicy/TestBindingWSPolicyInterceptor.java b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/policy/interceptors/src/main/java/testbindingwspolicy/TestBindingWSPolicyInterceptor.java
new file mode 100644
index 0000000000..aa33c74aea
--- /dev/null
+++ b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/policy/interceptors/src/main/java/testbindingwspolicy/TestBindingWSPolicyInterceptor.java
@@ -0,0 +1,84 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package testbindingwspolicy;
+
+import helloworld.StatusImpl;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.Endpoint;
+import org.apache.tuscany.sca.assembly.EndpointReference;
+import org.apache.tuscany.sca.core.invocation.InterceptorAsyncImpl;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Message;
+import org.apache.tuscany.sca.invocation.PhasedInterceptor;
+import org.apache.tuscany.sca.policy.PolicySubject;
+
+
+public class TestBindingWSPolicyInterceptor extends InterceptorAsyncImpl implements PhasedInterceptor {
+
+ private Operation operation;
+ private List<TestBindingWSPolicy> policies;
+ private PolicySubject subject;
+ private String context;
+ private String phase;
+
+ public TestBindingWSPolicyInterceptor(PolicySubject subject,
+ String context,
+ Operation operation,
+ List<TestBindingWSPolicy> policies,
+ String phase) {
+ super();
+ this.operation = operation;
+ this.policies = policies;
+ this.subject = subject;
+ this.phase = phase;
+ this.context = getContext();
+ }
+
+ private String getContext() {
+ if (subject instanceof Endpoint) {
+ Endpoint endpoint = (Endpoint)subject;
+ return endpoint.getURI();
+ } else if (subject instanceof EndpointReference) {
+ EndpointReference endpointReference = (EndpointReference)subject;
+ return endpointReference.getURI();
+ } else if (subject instanceof Component) {
+ Component component = (Component)subject;
+ return component.getURI();
+ }
+ return null;
+ }
+
+ public Message processRequest(Message msg) {
+ StatusImpl.appendStatus("TestBindingWSPolicyInterceptor.processRequest()", context + " @ " + phase);
+ return msg;
+ }
+
+ public Message processResponse(Message msg) {
+ StatusImpl.appendStatus("TestBindingWSPolicyInterceptor.processResponse()", context + " @ " + phase);
+ return msg;
+ }
+
+ public String getPhase() {
+ return phase;
+ }
+
+}
diff --git a/sca-java-2.x/tags/2.0.1-RC1/testing/itest/policy/interceptors/src/main/java/testbindingwspolicy/TestBindingWSPolicyProcessor.java b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/policy/interceptors/src/main/java/testbindingwspolicy/TestBindingWSPolicyProcessor.java
new file mode 100644
index 0000000000..2b013f7ba2
--- /dev/null
+++ b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/policy/interceptors/src/main/java/testbindingwspolicy/TestBindingWSPolicyProcessor.java
@@ -0,0 +1,99 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package testbindingwspolicy;
+
+import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
+
+import java.util.logging.Level;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.sca.contribution.processor.ContributionReadException;
+import org.apache.tuscany.sca.contribution.processor.ContributionResolveException;
+import org.apache.tuscany.sca.contribution.processor.ContributionWriteException;
+import org.apache.tuscany.sca.contribution.processor.ProcessorContext;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.core.FactoryExtensionPoint;
+
+/**
+ *
+ * @version $Rev: 883438 $ $Date: 2009-11-23 18:07:34 +0000 (Mon, 23 Nov 2009) $
+ */
+public class TestBindingWSPolicyProcessor implements StAXArtifactProcessor<TestBindingWSPolicy> {
+
+ public QName getArtifactType() {
+ return TestBindingWSPolicy.TEST_BINDINGWS_POLICY_QNAME;
+ }
+
+ public TestBindingWSPolicyProcessor(FactoryExtensionPoint modelFactories) {
+ }
+
+
+ public TestBindingWSPolicy read(XMLStreamReader reader, ProcessorContext context) throws ContributionReadException, XMLStreamException {
+ TestBindingWSPolicy policy = new TestBindingWSPolicy();
+ int event = reader.getEventType();
+ QName name = null;
+
+
+ while (reader.hasNext()) {
+ event = reader.getEventType();
+ switch (event) {
+ case START_ELEMENT : {
+ name = reader.getName();
+ if ( name.equals("testString") ) {
+ String testString = reader.getAttributeValue(null, "testString");
+ policy.setTestString(testString);
+ }
+ break;
+ }
+ }
+
+ if ( event == END_ELEMENT ) {
+ if ( TestBindingWSPolicy.TEST_BINDINGWS_POLICY_QNAME.equals(reader.getName()) ) {
+ break;
+ }
+ }
+
+ //Read the next element
+ if (reader.hasNext()) {
+ reader.next();
+ }
+ }
+
+ return policy;
+ }
+
+ public void write(TestBindingWSPolicy policy, XMLStreamWriter writer, ProcessorContext context) throws ContributionWriteException, XMLStreamException {
+ // TODO
+ }
+
+ public Class<TestBindingWSPolicy> getModelType() {
+ return TestBindingWSPolicy.class;
+ }
+
+ public void resolve(TestBindingWSPolicy arg0, ModelResolver arg1, ProcessorContext context) throws ContributionResolveException {
+
+ }
+
+}
diff --git a/sca-java-2.x/tags/2.0.1-RC1/testing/itest/policy/interceptors/src/main/java/testbindingwspolicy/TestBindingWSPolicyProviderFactory.java b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/policy/interceptors/src/main/java/testbindingwspolicy/TestBindingWSPolicyProviderFactory.java
new file mode 100644
index 0000000000..df626a10ff
--- /dev/null
+++ b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/policy/interceptors/src/main/java/testbindingwspolicy/TestBindingWSPolicyProviderFactory.java
@@ -0,0 +1,69 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package testbindingwspolicy;
+
+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;
+
+/**
+ * @version $Rev: 792622 $ $Date: 2009-07-09 19:14:18 +0100 (Thu, 09 Jul 2009) $
+ */
+public class TestBindingWSPolicyProviderFactory implements PolicyProviderFactory<TestBindingWSPolicy> {
+ private ExtensionPointRegistry registry;
+
+ public TestBindingWSPolicyProviderFactory(ExtensionPointRegistry registry) {
+ super();
+ 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) {
+ // no implementation provider for this binding specific policy
+ 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(EndpointReference endpointReference) {
+ return new TestBindingWSPolicyProviderReference(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(Endpoint endpoint) {
+ return new TestBindingWSPolicyProviderService(endpoint);
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.provider.ProviderFactory#getModelType()
+ */
+ public Class<TestBindingWSPolicy> getModelType() {
+ return TestBindingWSPolicy.class;
+ }
+
+}
diff --git a/sca-java-2.x/tags/2.0.1-RC1/testing/itest/policy/interceptors/src/main/java/testbindingwspolicy/TestBindingWSPolicyProviderReference.java b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/policy/interceptors/src/main/java/testbindingwspolicy/TestBindingWSPolicyProviderReference.java
new file mode 100644
index 0000000000..489c069ea8
--- /dev/null
+++ b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/policy/interceptors/src/main/java/testbindingwspolicy/TestBindingWSPolicyProviderReference.java
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package testbindingwspolicy;
+
+import helloworld.StatusImpl;
+
+import java.util.List;
+
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.engine.AxisConfiguration;
+import org.apache.tuscany.sca.assembly.EndpointReference;
+import org.apache.tuscany.sca.binding.ws.axis2.provider.Axis2BaseBindingProvider;
+import org.apache.tuscany.sca.invocation.Phase;
+import org.apache.tuscany.sca.invocation.PhasedInterceptor;
+import org.apache.tuscany.sca.provider.BasePolicyProvider;
+
+/**
+ * @version $Rev: 792641 $ $Date: 2009-07-09 20:13:08 +0100 (Thu, 09 Jul 2009) $
+ */
+public class TestBindingWSPolicyProviderReference extends BasePolicyProvider<TestBindingWSPolicy> {
+
+ public TestBindingWSPolicyProviderReference(EndpointReference endpointReference) {
+ super(TestBindingWSPolicy.class, endpointReference);
+ }
+
+ public void configureBinding(Object configuration) {
+ super.configureBinding(configuration);
+
+ StatusImpl.appendStatus("TestBindingWSPolicyProviderReference.configureBinding()", configuration.getClass().getName());
+
+ Axis2BaseBindingProvider bindingProvider = (Axis2BaseBindingProvider)configuration;
+ ConfigurationContext axisConfigurationContext = bindingProvider.getAxisConfigurationContext();
+ AxisConfiguration axisConfiguration = axisConfigurationContext.getAxisConfiguration();
+ List<org.apache.axis2.engine.Phase> outPhases = axisConfiguration.getOutFlowPhases();
+ outPhases.get(0).addHandler(new TestBindingWSAxisHandler("Reference OutFlow Handler"));
+ List<org.apache.axis2.engine.Phase> inPhases = axisConfiguration.getInFlowPhases();
+ inPhases.get(0).addHandler(new TestBindingWSAxisHandler("Reference InFlow Handler"));
+ List<org.apache.axis2.engine.Phase> inFaultPhases = axisConfiguration.getInFaultFlowPhases();
+ inFaultPhases.get(0).addHandler(new TestBindingWSAxisHandler("Reference InFaultFlow Handler"));
+ }
+
+ public PhasedInterceptor createBindingInterceptor() {
+ List<TestBindingWSPolicy> policies = findPolicies();
+
+ if (policies.isEmpty()){
+ return null;
+ } else {
+ return new TestBindingWSPolicyInterceptor(subject,
+ getContext(),
+ null,
+ policies,
+ Phase.REFERENCE_BINDING_POLICY);
+ }
+ }
+}
diff --git a/sca-java-2.x/tags/2.0.1-RC1/testing/itest/policy/interceptors/src/main/java/testbindingwspolicy/TestBindingWSPolicyProviderService.java b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/policy/interceptors/src/main/java/testbindingwspolicy/TestBindingWSPolicyProviderService.java
new file mode 100644
index 0000000000..9880bf04b0
--- /dev/null
+++ b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/policy/interceptors/src/main/java/testbindingwspolicy/TestBindingWSPolicyProviderService.java
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package testbindingwspolicy;
+
+import helloworld.StatusImpl;
+
+import java.util.List;
+
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.engine.AxisConfiguration;
+import org.apache.tuscany.sca.assembly.Endpoint;
+import org.apache.tuscany.sca.binding.ws.axis2.provider.Axis2BaseBindingProvider;
+import org.apache.tuscany.sca.invocation.Phase;
+import org.apache.tuscany.sca.invocation.PhasedInterceptor;
+import org.apache.tuscany.sca.provider.BasePolicyProvider;
+
+/**
+ * @version $Rev: 792641 $ $Date: 2009-07-09 20:13:08 +0100 (Thu, 09 Jul 2009) $
+ */
+public class TestBindingWSPolicyProviderService extends BasePolicyProvider<TestBindingWSPolicy> {
+
+ public TestBindingWSPolicyProviderService(Endpoint endpoint) {
+ super(TestBindingWSPolicy.class, endpoint);
+ }
+
+ public void configureBinding(Object configuration) {
+ super.configureBinding(configuration);
+
+ StatusImpl.appendStatus("TestBindingWSPolicyProviderService.configureBinding()", configuration.getClass().getName());
+
+ Axis2BaseBindingProvider bindingProvider = (Axis2BaseBindingProvider)configuration;
+ ConfigurationContext axisConfigurationContext = bindingProvider.getAxisConfigurationContext();
+ AxisConfiguration axisConfiguration = axisConfigurationContext.getAxisConfiguration();
+ List<org.apache.axis2.engine.Phase> inPhases = axisConfiguration.getInFlowPhases();
+ inPhases.get(0).addHandler(new TestBindingWSAxisHandler("Service InFlow Handler"));
+ List<org.apache.axis2.engine.Phase> outPhases = axisConfiguration.getOutFlowPhases();
+ outPhases.get(0).addHandler(new TestBindingWSAxisHandler("Service OutFlow Handler"));
+ List<org.apache.axis2.engine.Phase> outFaultPhases = axisConfiguration.getOutFaultFlowPhases();
+ outFaultPhases.get(0).addHandler(new TestBindingWSAxisHandler("Service OutFaultFlow Handler"));
+ }
+
+ public PhasedInterceptor createBindingInterceptor() {
+ List<TestBindingWSPolicy> policies = findPolicies();
+
+ if (policies.isEmpty()){
+ return null;
+ } else {
+ return new TestBindingWSPolicyInterceptor(subject,
+ getContext(),
+ null,
+ policies,
+ Phase.SERVICE_BINDING_POLICY);
+ }
+ }
+}