summaryrefslogtreecommitdiffstats
path: root/java/sca/modules/binding-sca-axis2-runtime/src/main
diff options
context:
space:
mode:
authorslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2009-06-16 16:51:51 +0000
committerslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2009-06-16 16:51:51 +0000
commite86867392665ea27caadf5408f797a95ae046c96 (patch)
tree71d3101babe225b875d53552b5347873ea327d37 /java/sca/modules/binding-sca-axis2-runtime/src/main
parent3b703d40d4bd3387b8c751fab8065350703e8620 (diff)
TUSCANY-3092 pull in binding-sca-axis2 from 1.x. Not in build and only two of the unit tests are working at the moment.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@785290 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/sca/modules/binding-sca-axis2-runtime/src/main')
-rw-r--r--java/sca/modules/binding-sca-axis2-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCABindingProviderFactory.java61
-rw-r--r--java/sca/modules/binding-sca-axis2-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCAReferenceBindingProvider.java110
-rw-r--r--java/sca/modules/binding-sca-axis2-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCAServiceBindingProvider.java120
-rw-r--r--java/sca/modules/binding-sca-axis2-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCAServiceProvider.java82
-rw-r--r--java/sca/modules/binding-sca-axis2-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory19
5 files changed, 392 insertions, 0 deletions
diff --git a/java/sca/modules/binding-sca-axis2-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCABindingProviderFactory.java b/java/sca/modules/binding-sca-axis2-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCABindingProviderFactory.java
new file mode 100644
index 0000000000..45331114a5
--- /dev/null
+++ b/java/sca/modules/binding-sca-axis2-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCABindingProviderFactory.java
@@ -0,0 +1,61 @@
+/*
+ * 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.sca.axis2.impl;
+
+import org.apache.tuscany.sca.assembly.DistributedSCABinding;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+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;
+
+/**
+ * The factory for the Axis2 based implementation of the distributed sca binding
+ *
+ * @version $Rev$ $Date$
+ */
+public class Axis2SCABindingProviderFactory implements BindingProviderFactory<DistributedSCABinding> {
+
+ private ExtensionPointRegistry extensionPoints;
+
+ public Axis2SCABindingProviderFactory(ExtensionPointRegistry extensionPoints) {
+ this.extensionPoints = extensionPoints;
+ }
+
+ public ReferenceBindingProvider createReferenceBindingProvider(RuntimeComponent component,
+ RuntimeComponentReference reference,
+ DistributedSCABinding binding) {
+ return new Axis2SCAReferenceBindingProvider(component, reference, binding,
+ extensionPoints);
+ }
+
+ public ServiceBindingProvider createServiceBindingProvider(RuntimeComponent component,
+ RuntimeComponentService service,
+ DistributedSCABinding binding) {
+ return new Axis2SCAServiceBindingProvider(component, service, binding,
+ extensionPoints);
+ }
+
+ public Class<DistributedSCABinding> getModelType() {
+ return DistributedSCABinding.class;
+ }
+}
diff --git a/java/sca/modules/binding-sca-axis2-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCAReferenceBindingProvider.java b/java/sca/modules/binding-sca-axis2-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCAReferenceBindingProvider.java
new file mode 100644
index 0000000000..ef92540e9c
--- /dev/null
+++ b/java/sca/modules/binding-sca-axis2-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCAReferenceBindingProvider.java
@@ -0,0 +1,110 @@
+/*
+ * 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.sca.axis2.impl;
+
+import java.util.logging.Logger;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.tuscany.sca.assembly.DistributedSCABinding;
+import org.apache.tuscany.sca.assembly.SCABinding;
+import org.apache.tuscany.sca.binding.ws.WebServiceBinding;
+import org.apache.tuscany.sca.binding.ws.WebServiceBindingFactory;
+import org.apache.tuscany.sca.binding.ws.axis2.Axis2ReferenceBindingProvider;
+import org.apache.tuscany.sca.binding.ws.wsdlgen.BindingWSDLGenerator;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.FactoryExtensionPoint;
+import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint;
+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.provider.ReferenceBindingProvider;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
+
+/**
+ * The reference binding provider for the remote sca binding implementation. Relies on the
+ * binding-ws-axis implementation for sending messages to remote services so this provider
+ * uses the ws-axis provider under the covers.
+ */
+public class Axis2SCAReferenceBindingProvider implements ReferenceBindingProvider {
+
+ private static final Logger logger = Logger.getLogger(Axis2SCAReferenceBindingProvider.class.getName());
+
+ private RuntimeComponent component;
+ private RuntimeComponentReference reference;
+ private SCABinding binding;
+ private Axis2ReferenceBindingProvider axisReferenceBindingProvider;
+ private WebServiceBinding wsBinding;
+
+ public Axis2SCAReferenceBindingProvider(RuntimeComponent component,
+ RuntimeComponentReference reference,
+ DistributedSCABinding binding,
+ ExtensionPointRegistry extensionPoints) {
+
+ FactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(FactoryExtensionPoint.class);
+ DataBindingExtensionPoint dataBindings = extensionPoints.getExtensionPoint(DataBindingExtensionPoint.class);
+
+ this.component = component;
+ this.reference = reference;
+ this.binding = binding.getSCABinding();
+
+ // build a ws binding model
+ wsBinding = modelFactories.getFactory(WebServiceBindingFactory.class).createWebServiceBinding();
+ wsBinding.setName(this.binding.getName());
+
+ // Turn the java interface contract into a WSDL interface contract
+ BindingWSDLGenerator.generateWSDL(component, reference, wsBinding, extensionPoints, null);
+
+ // Set to use the Axiom data binding
+ InterfaceContract contract = wsBinding.getBindingInterfaceContract();
+ contract.getInterface().resetDataBinding(OMElement.class.getName());
+
+ // create the real Axis2 reference binding provider
+ axisReferenceBindingProvider = new Axis2ReferenceBindingProvider(component,
+ reference,
+ wsBinding,
+ modelFactories,
+ dataBindings);
+ }
+
+ public InterfaceContract getBindingInterfaceContract() {
+ return wsBinding.getBindingInterfaceContract();
+ }
+
+ public boolean supportsOneWayInvocation() {
+ return false;
+ }
+
+ public Invoker createInvoker(Operation operation) {
+ return axisReferenceBindingProvider.createInvoker(operation);
+ }
+
+ public SCABinding getSCABinding () {
+ return binding;
+ }
+
+ public void start() {
+ axisReferenceBindingProvider.start();
+ }
+
+ public void stop() {
+ axisReferenceBindingProvider.stop();
+ }
+}
diff --git a/java/sca/modules/binding-sca-axis2-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCAServiceBindingProvider.java b/java/sca/modules/binding-sca-axis2-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCAServiceBindingProvider.java
new file mode 100644
index 0000000000..10387c62cc
--- /dev/null
+++ b/java/sca/modules/binding-sca-axis2-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCAServiceBindingProvider.java
@@ -0,0 +1,120 @@
+/*
+ * 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.sca.axis2.impl;
+
+import java.util.logging.Logger;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.tuscany.sca.assembly.DistributedSCABinding;
+import org.apache.tuscany.sca.assembly.SCABinding;
+import org.apache.tuscany.sca.binding.ws.WebServiceBinding;
+import org.apache.tuscany.sca.binding.ws.WebServiceBindingFactory;
+import org.apache.tuscany.sca.binding.ws.axis2.Axis2ServiceProvider;
+import org.apache.tuscany.sca.binding.ws.wsdlgen.BindingWSDLGenerator;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.FactoryExtensionPoint;
+import org.apache.tuscany.sca.host.http.ServletHost;
+import org.apache.tuscany.sca.host.http.ServletHostExtensionPoint;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.invocation.MessageFactory;
+import org.apache.tuscany.sca.provider.ServiceBindingProvider;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+
+/**
+ * The service binding provider for the remote sca binding implementation. Relies on the
+ * binding-ws-axis implementation for providing a remote message endpoint
+ *
+ * @version $Rev$ $Date$
+ */
+public class Axis2SCAServiceBindingProvider implements ServiceBindingProvider {
+
+ private static final Logger logger = Logger.getLogger(Axis2SCAServiceBindingProvider.class.getName());
+
+ private SCABinding binding;
+ private Axis2ServiceProvider axisProvider;
+ private WebServiceBinding wsBinding;
+
+ private boolean started = false;
+
+
+ public Axis2SCAServiceBindingProvider(RuntimeComponent component,
+ RuntimeComponentService service,
+ DistributedSCABinding binding,
+ ExtensionPointRegistry extensionPoints) {
+
+ ServletHostExtensionPoint servletHosts = extensionPoints.getExtensionPoint(ServletHostExtensionPoint.class);
+ ServletHost servletHost = servletHosts.getServletHosts().get(0);
+ FactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(FactoryExtensionPoint.class);
+ MessageFactory messageFactory = modelFactories.getFactory(MessageFactory.class);
+
+ this.binding = binding.getSCABinding();
+
+ // create a ws binding model
+ wsBinding = modelFactories.getFactory(WebServiceBindingFactory.class).createWebServiceBinding();
+ wsBinding.setName(this.binding.getName());
+ wsBinding.setURI(this.binding.getURI());
+
+ // Turn the java interface contract into a WSDL interface contract
+ BindingWSDLGenerator.generateWSDL(component, service, wsBinding, extensionPoints, null);
+
+ // Set to use the Axiom data binding
+ InterfaceContract contract = wsBinding.getBindingInterfaceContract();
+ contract.getInterface().resetDataBinding(OMElement.class.getName());
+
+ // create the real Axis2 service provider
+ axisProvider = new Axis2SCAServiceProvider(component,
+ service,
+ this.binding,
+ wsBinding,
+ servletHost,
+ messageFactory,
+ modelFactories);
+ }
+
+ public InterfaceContract getBindingInterfaceContract() {
+ return wsBinding.getBindingInterfaceContract();
+ }
+
+ public boolean supportsOneWayInvocation() {
+ return false;
+ }
+
+ public void start() {
+ if (started) {
+ return;
+ } else {
+ started = true;
+ }
+
+ axisProvider.start();
+ }
+
+ public void stop() {
+ if (!started) {
+ return;
+ } else {
+ started = false;
+ }
+
+ axisProvider.stop();
+ }
+
+}
diff --git a/java/sca/modules/binding-sca-axis2-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCAServiceProvider.java b/java/sca/modules/binding-sca-axis2-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCAServiceProvider.java
new file mode 100644
index 0000000000..51a175a9e6
--- /dev/null
+++ b/java/sca/modules/binding-sca-axis2-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCAServiceProvider.java
@@ -0,0 +1,82 @@
+/*
+ * 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.sca.axis2.impl;
+
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.SCABinding;
+import org.apache.tuscany.sca.binding.ws.WebServiceBinding;
+import org.apache.tuscany.sca.binding.ws.axis2.Axis2ServiceProvider;
+import org.apache.tuscany.sca.core.FactoryExtensionPoint;
+import org.apache.tuscany.sca.host.http.ServletHost;
+import org.apache.tuscany.sca.invocation.MessageFactory;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+
+/**
+ * A specialization of the Axis2BindingProvider that just switches in the SCABinding model
+ * element when it is required. The SCABinding is required as the service binding provider
+ * finds the service wire based on the binding
+ *
+ * @version $Rev$ $Date$
+ */
+public class Axis2SCAServiceProvider extends Axis2ServiceProvider {
+
+ private SCABinding binding;
+
+ /**
+ * Switch in the fake ws binding
+ *
+ * @param component
+ * @param service
+ * @param binding
+ * @param wsBinding
+ * @param servletHost
+ * @param messageFactory
+ */
+ public Axis2SCAServiceProvider(RuntimeComponent component,
+ RuntimeComponentService service,
+ SCABinding binding,
+ WebServiceBinding wsBinding,
+ ServletHost servletHost,
+ MessageFactory messageFactory,
+ FactoryExtensionPoint modelFactories) {
+
+ super(component,
+ service,
+ wsBinding,
+ servletHost,
+ messageFactory,
+ modelFactories);
+
+ this.binding = binding;
+ }
+
+ /**
+ * Return the sca binding as wires will be registered against this rather
+ * than against the wsBinding that the Axis2SCAServiceProvider is
+ * expecting
+ *
+ * @return the binding
+ */
+ @Override
+ protected Binding getBinding(){
+ return binding;
+ }
+}
diff --git a/java/sca/modules/binding-sca-axis2-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory b/java/sca/modules/binding-sca-axis2-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory
new file mode 100644
index 0000000000..97b9b2fa90
--- /dev/null
+++ b/java/sca/modules/binding-sca-axis2-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory
@@ -0,0 +1,19 @@
+# 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.
+
+# Implementation class for the binding extension
+org.apache.tuscany.sca.binding.sca.axis2.impl.Axis2SCABindingProviderFactory;model=org.apache.tuscany.sca.assembly.DistributedSCABinding