summaryrefslogtreecommitdiffstats
path: root/java/sca/modules/binding-sca-jms/src/main
diff options
context:
space:
mode:
authorantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2008-09-02 08:18:13 +0000
committerantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2008-09-02 08:18:13 +0000
commitb2cbbd0bb90295c9f73ac2ada44b7f0772a19212 (patch)
tree855c648596b62647502c0373816591c2e0d1bdf1 /java/sca/modules/binding-sca-jms/src/main
parent1d6063e7a20ae2246f77ad1879a982786fd92caf (diff)
Start of a remote SCA binding that uses JMS. I'll post to the ML more about this, i want to use it initially for the JEE work and webapps talking to each other in the same container
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@691144 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/sca/modules/binding-sca-jms/src/main')
-rw-r--r--java/sca/modules/binding-sca-jms/src/main/java/org/apache/tuscany/sca/binding/sca/jms/JMSSCABindingProviderFactory.java81
-rw-r--r--java/sca/modules/binding-sca-jms/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory19
2 files changed, 100 insertions, 0 deletions
diff --git a/java/sca/modules/binding-sca-jms/src/main/java/org/apache/tuscany/sca/binding/sca/jms/JMSSCABindingProviderFactory.java b/java/sca/modules/binding-sca-jms/src/main/java/org/apache/tuscany/sca/binding/sca/jms/JMSSCABindingProviderFactory.java
new file mode 100644
index 0000000000..5e60ba4607
--- /dev/null
+++ b/java/sca/modules/binding-sca-jms/src/main/java/org/apache/tuscany/sca/binding/sca/jms/JMSSCABindingProviderFactory.java
@@ -0,0 +1,81 @@
+/*
+ * 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.jms;
+
+import org.apache.tuscany.sca.binding.jms.impl.JMSBinding;
+import org.apache.tuscany.sca.binding.jms.impl.JMSBindingConstants;
+import org.apache.tuscany.sca.binding.jms.provider.JMSBindingReferenceBindingProvider;
+import org.apache.tuscany.sca.binding.jms.provider.JMSBindingServiceBindingProvider;
+import org.apache.tuscany.sca.binding.sca.DistributedSCABinding;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.UtilityExtensionPoint;
+import org.apache.tuscany.sca.provider.BindingProviderFactory;
+import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
+import org.apache.tuscany.sca.provider.ServiceBindingProvider;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+import org.apache.tuscany.sca.work.WorkScheduler;
+
+/**
+ * The factory for the JMS based implementation of the distributed sca binding
+ */
+public class JMSSCABindingProviderFactory implements BindingProviderFactory<DistributedSCABinding> {
+
+ private WorkScheduler workScheduler;
+
+ public JMSSCABindingProviderFactory(ExtensionPointRegistry extensionPoints) {
+ UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class);
+ workScheduler = utilities.getUtility(WorkScheduler.class);
+ assert workScheduler != null;
+ }
+
+ public ReferenceBindingProvider createReferenceBindingProvider(RuntimeComponent component,
+ RuntimeComponentReference reference,
+ DistributedSCABinding binding) {
+ JMSBinding jmsBinding = createBinding(binding);
+ return new JMSBindingReferenceBindingProvider(component, reference, jmsBinding);
+ }
+
+ public ServiceBindingProvider createServiceBindingProvider(RuntimeComponent component,
+ RuntimeComponentService service,
+ DistributedSCABinding binding) {
+ JMSBinding jmsBinding = createBinding(binding);
+ return new JMSBindingServiceBindingProvider(component, service, binding.getSCABinding(), jmsBinding, workScheduler);
+ }
+
+ private JMSBinding createBinding(DistributedSCABinding binding) {
+ JMSBinding b = new JMSBinding();
+ b.setInitialContextFactoryName("org.apache.activemq.jndi.ActiveMQInitialContextFactory");
+ b.setJndiURL("tcp://localhost:61616"); // TODO: plug in jndi url from definitions.xml
+ b.setRequestMessageProcessorName(JMSBindingConstants.OBJECT_MP_CLASSNAME);
+ b.setResponseMessageProcessorName(JMSBindingConstants.OBJECT_MP_CLASSNAME);
+ if (binding.getSCABinding().getURI().startsWith("/")) {
+ b.setDestinationName(binding.getSCABinding().getURI().substring(1));
+ } else {
+ b.setDestinationName(binding.getSCABinding().getURI());
+ }
+ return b;
+ }
+
+ public Class<DistributedSCABinding> getModelType() {
+ return DistributedSCABinding.class;
+ }
+}
diff --git a/java/sca/modules/binding-sca-jms/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory b/java/sca/modules/binding-sca-jms/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory
new file mode 100644
index 0000000000..8e53649af1
--- /dev/null
+++ b/java/sca/modules/binding-sca-jms/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.jms.JMSSCABindingProviderFactory;model=org.apache.tuscany.sca.binding.sca.DistributedSCABinding