summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main
diff options
context:
space:
mode:
authorslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2010-02-25 15:06:28 +0000
committerslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2010-02-25 15:06:28 +0000
commitfe464e64738bc7d3e97f67cdbf813bda5e9be418 (patch)
tree3dd1d874a3fac8205978e4cf3136979516b4bf5b /sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main
parent3662be91d1148b7a02b4713026b9e82eb7d846ea (diff)
Separate the common parts of the binding.ws reference and service binding provider into a base class. Provides a common class that can be passed out for policy configuration if separate reference and service side configuration is not required.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@916309 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main')
-rw-r--r--sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2BaseBindingProvider.java62
-rw-r--r--sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ReferenceBindingProvider.java31
-rw-r--r--sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceBindingProvider.java31
-rw-r--r--sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/configuration/Axis2ConfigParamPolicyProvider.java4
4 files changed, 87 insertions, 41 deletions
diff --git a/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2BaseBindingProvider.java b/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2BaseBindingProvider.java
new file mode 100644
index 0000000000..6d0fc37ba5
--- /dev/null
+++ b/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2BaseBindingProvider.java
@@ -0,0 +1,62 @@
+/*
+ * 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 org.apache.tuscany.sca.binding.ws.axis2;
+
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.FactoryExtensionPoint;
+import org.apache.tuscany.sca.host.http.SecurityContext;
+import org.apache.tuscany.sca.invocation.MessageFactory;
+
+public class Axis2BaseBindingProvider {
+
+ // Tuscany extensions
+ protected ExtensionPointRegistry extensionPoints;
+ protected FactoryExtensionPoint modelFactories;
+ protected MessageFactory messageFactory;
+
+ // derived policy configuration
+ protected boolean isSOAP12Required = false;
+ protected boolean isRampartRequired = false;
+ protected boolean isMTOMRequired = false;
+ protected boolean isJMSRequired = false;
+
+ // The Axis2 configuration that the binding creates
+ protected ConfigurationContext configContext;
+ protected SecurityContext httpSecurityContext;
+
+ public Axis2BaseBindingProvider(ExtensionPointRegistry extensionPoints) {
+
+ this.extensionPoints = extensionPoints;
+
+ this.modelFactories = extensionPoints.getExtensionPoint(FactoryExtensionPoint.class);
+ this.messageFactory = modelFactories.getFactory(MessageFactory.class);
+
+ this.httpSecurityContext = new SecurityContext();
+ }
+
+ public ConfigurationContext getAxisConfigurationContext() {
+ return configContext;
+ }
+
+ public SecurityContext getHttpSecurityContext() {
+ return httpSecurityContext;
+ }
+
+}
diff --git a/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ReferenceBindingProvider.java b/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ReferenceBindingProvider.java
index 67ffcaebe7..1f3cac26a7 100644
--- a/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ReferenceBindingProvider.java
+++ b/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ReferenceBindingProvider.java
@@ -46,7 +46,6 @@ import org.apache.axis2.AxisFault;
import org.apache.axis2.addressing.EndpointReferenceHelper;
import org.apache.axis2.client.Options;
import org.apache.axis2.client.ServiceClient;
-import org.apache.axis2.context.ConfigurationContext;
import org.apache.axis2.description.AxisService;
import org.apache.axis2.transport.http.HTTPConstants;
import org.apache.axis2.util.threadpool.ThreadPool;
@@ -59,28 +58,21 @@ import org.apache.tuscany.sca.binding.ws.axis2.transport.TransportReferenceInter
import org.apache.tuscany.sca.binding.ws.WebServiceBinding;
import org.apache.tuscany.sca.binding.ws.axis2.provider.Axis2ReferenceBindingInvoker;
import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.core.FactoryExtensionPoint;
import org.apache.tuscany.sca.interfacedef.InterfaceContract;
import org.apache.tuscany.sca.interfacedef.Operation;
import org.apache.tuscany.sca.invocation.InvocationChain;
import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.invocation.MessageFactory;
import org.apache.tuscany.sca.invocation.Phase;
import org.apache.tuscany.sca.policy.util.PolicyHelper;
import org.apache.tuscany.sca.provider.EndpointReferenceProvider;
-import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
+import org.apache.tuscany.sca.provider.PolicyProvider;
import org.apache.tuscany.sca.runtime.RuntimeComponent;
import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
import org.apache.tuscany.sca.runtime.RuntimeEndpointReference;
import org.oasisopen.sca.ServiceRuntimeException;
-public class Axis2ReferenceBindingProvider implements EndpointReferenceProvider {
+public class Axis2ReferenceBindingProvider extends Axis2BaseBindingProvider implements EndpointReferenceProvider {
- // Tuscany extensions
- private ExtensionPointRegistry extensionPoints;
- private FactoryExtensionPoint modelFactories;
- private MessageFactory messageFactory;
-
// the endpoint reference configuration that's driving this binding provider
// and some convenience data retrieved from the endpoint reference
private RuntimeEndpointReference endpointReference;
@@ -88,26 +80,18 @@ public class Axis2ReferenceBindingProvider implements EndpointReferenceProvider
private RuntimeComponentReference reference;
private WebServiceBinding wsBinding;
- // derived policy configuration
- private boolean isSOAP12Required = false;
- private boolean isRampartRequired = false;
- private boolean isMTOMRequired = false;
- private boolean isJMSRequired = false;
-
// The Axis2 configuration that the binding creates
- private ConfigurationContext configContext;
private ServiceClient serviceClient;
private AxisService axisClientSideService;
public Axis2ReferenceBindingProvider(ExtensionPointRegistry extensionPoints,
EndpointReference endpointReference) {
+
+ super(extensionPoints);
- this.extensionPoints = extensionPoints;
this.endpointReference = (RuntimeEndpointReference)endpointReference;
- this.modelFactories = extensionPoints.getExtensionPoint(FactoryExtensionPoint.class);
- this.messageFactory = modelFactories.getFactory(MessageFactory.class);
this.wsBinding = (WebServiceBinding)endpointReference.getBinding();
this.component = (RuntimeComponent)endpointReference.getComponent();
this.reference = (RuntimeComponentReference)endpointReference.getReference();
@@ -127,13 +111,18 @@ public class Axis2ReferenceBindingProvider implements EndpointReferenceProvider
isMTOMRequired = PolicyHelper.isIntentRequired(wsBinding, Axis2BindingProviderFactory.MTOM_INTENT);
- // this is not correct as there may be other, custom, policies that
+ // TODO - this is not correct as there may be other, custom, policies that
// require rampart. For example this is not going to pick up the case
// of external policy attachment
isRampartRequired = PolicyHelper.isIntentRequired(wsBinding, Constants.AUTHENTICATION_INTENT) ||
PolicyHelper.isIntentRequired(wsBinding, Constants.CONFIDENTIALITY_INTENT) ||
PolicyHelper.isIntentRequired(wsBinding, Constants.INTEGRITY_INTENT);
+ // Apply the configuration from any other policies
+
+ for (PolicyProvider pp : this.endpointReference.getPolicyProviders()) {
+ pp.configureBinding(this);
+ }
}
public void start() {
diff --git a/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceBindingProvider.java b/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceBindingProvider.java
index 63f506f179..fc31bcaa50 100644
--- a/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceBindingProvider.java
+++ b/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceBindingProvider.java
@@ -58,17 +58,14 @@ import org.apache.tuscany.sca.runtime.RuntimeComponentService;
import org.apache.tuscany.sca.runtime.RuntimeEndpoint;
import org.oasisopen.sca.ServiceRuntimeException;
-public class Axis2ServiceBindingProvider implements ServiceBindingProvider {
+public class Axis2ServiceBindingProvider extends Axis2BaseBindingProvider implements ServiceBindingProvider {
private static final Logger logger = Logger.getLogger(Axis2ServiceBindingProvider.class.getName());
// Tuscany extensions
- private ExtensionPointRegistry extensionPoints;
+ private AssemblyFactory assemblyFactory;
private ServletHost servletHost;
private RuntimeComponent component;
private RuntimeComponentService service;
- private MessageFactory messageFactory;
- private FactoryExtensionPoint modelFactories;
- private RuntimeAssemblyFactory assemblyFactory;
// the endpoint configuration that's driving this binding provider
// and some convenience data retrieved from the endpoint
@@ -77,27 +74,20 @@ public class Axis2ServiceBindingProvider implements ServiceBindingProvider {
private Port wsdlPort;
private String endpointURI;
private InterfaceContract contract;
-
- // derived policy configuration
- private boolean isSOAP12Required = false;
- private boolean isRampartRequired = false;
- private boolean isMTOMRequired = false;
- private boolean isJMSRequired = false;
-
+
// The Axis2 configuration that the binding creates
- private ConfigurationContext configContext;
private JMSSender jmsSender;
private JMSListener jmsListener;
public Axis2ServiceBindingProvider(ExtensionPointRegistry extensionPoints,
RuntimeEndpoint endpoint,
ServletHost servletHost ) {
+ super(extensionPoints);
+
this.extensionPoints = extensionPoints;
this.endpoint = endpoint;
this.servletHost = servletHost;
- this.modelFactories = extensionPoints.getExtensionPoint(FactoryExtensionPoint.class);
- this.messageFactory = modelFactories.getFactory(MessageFactory.class);
this.assemblyFactory = (RuntimeAssemblyFactory)modelFactories.getFactory(AssemblyFactory.class);
this.wsBinding = (WebServiceBinding)endpoint.getBinding();
this.component = (RuntimeComponent)endpoint.getComponent();
@@ -162,9 +152,7 @@ public class Axis2ServiceBindingProvider implements ServiceBindingProvider {
// Apply the configuration from any other policies
for (PolicyProvider pp : endpoint.getPolicyProviders()) {
- // we probably want to pass the whole provider in here
- // so that the policy providers can get at the rampart configuration
- pp.configureBinding(configContext);
+ pp.configureBinding(this);
}
// Apply the configuration from the mayProvides intents
@@ -193,7 +181,12 @@ public class Axis2ServiceBindingProvider implements ServiceBindingProvider {
endpointURI.startsWith("/")) {
Axis2ServiceServlet servlet = new Axis2ServiceServlet();
servlet.init(configContext);
- servletHost.addServletMapping(endpointURI, servlet);
+
+ if (httpSecurityContext.isSSLEnabled()){
+ servletHost.addServletMapping(endpointURI, servlet, httpSecurityContext);
+ } else {
+ servletHost.addServletMapping(endpointURI, servlet);
+ }
} else if (endpointURI.startsWith("jms")) {
logger.log(Level.INFO, "Axis2 JMS URL=" + endpointURI);
diff --git a/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/configuration/Axis2ConfigParamPolicyProvider.java b/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/configuration/Axis2ConfigParamPolicyProvider.java
index 4fad95fc56..4c7d3a480a 100644
--- a/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/configuration/Axis2ConfigParamPolicyProvider.java
+++ b/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/configuration/Axis2ConfigParamPolicyProvider.java
@@ -22,6 +22,7 @@ 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.binding.ws.axis2.Axis2BaseBindingProvider;
import org.apache.tuscany.sca.policy.PolicySubject;
import org.apache.tuscany.sca.provider.BasePolicyProvider;
import org.oasisopen.sca.ServiceRuntimeException;
@@ -35,7 +36,8 @@ public class Axis2ConfigParamPolicyProvider extends BasePolicyProvider<Axis2Conf
super(Axis2ConfigParamPolicy.class, subject);
}
- public void configureBinding(ConfigurationContext configurationContext) {
+ public void configureBinding(Object context) {
+ ConfigurationContext configurationContext = ((Axis2BaseBindingProvider)context).getAxisConfigurationContext();
Axis2ConfigParamPolicy axis2ConfigParamPolicy = null;
Parameter configParam = null;
for (Object policy : findPolicies()) {