summaryrefslogtreecommitdiffstats
path: root/java/sca/modules/core-spi/src/main
diff options
context:
space:
mode:
authorslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2008-10-23 15:42:42 +0000
committerslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2008-10-23 15:42:42 +0000
commit3336ce7cd343c5b5ec51c1762f3133d044cff3be (patch)
treefab70d14ee4ea840beeff82759c1b01628f0de5a /java/sca/modules/core-spi/src/main
parent3a62e18e7392a2a4ef9eca611443fa1966f31360 (diff)
Merge the runtime wire changes to add a binding invocation wire with the jms binding changes to exploit the binding wire. Still early days so see the ongoing conversation on the ML. This function is only enabled if you include a wire format in a jms service binding element.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@707394 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/sca/modules/core-spi/src/main')
-rw-r--r--java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/BindingInterceptor.java46
-rw-r--r--java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/DefaultProviderFactoryExtensionPoint.java147
-rw-r--r--java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/OperationSelectorProviderFactory.java (renamed from java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/OperationSelectortProviderFactory.java)14
-rw-r--r--java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ServiceBindingProviderRRB.java3
4 files changed, 155 insertions, 55 deletions
diff --git a/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/BindingInterceptor.java b/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/BindingInterceptor.java
deleted file mode 100644
index 9aad2dd458..0000000000
--- a/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/BindingInterceptor.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * 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.invocation;
-
-/**
- * TODO RRB experiment to allow the request and respose side of the
- * invoke to be called independently
- * Synchronous mediation associated with a client- or target- side wire.
- *
- * @version $Rev$ $Date$
- */
-public interface BindingInterceptor extends Invoker {
-
- /**
- * Process a synchronous request
- *
- * @param msg The request Message for the wire
- * @return The response Message from the wire
- */
- Message invokeRequest(Message msg);
-
- /**
- * Process a synchronous response
- *
- * @param msg The request Message for the wire
- * @return The response Message from the wire
- */
- Message invokeResponse(Message msg);
-
-}
diff --git a/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/DefaultProviderFactoryExtensionPoint.java b/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/DefaultProviderFactoryExtensionPoint.java
index dfc3ddb468..1edf612780 100644
--- a/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/DefaultProviderFactoryExtensionPoint.java
+++ b/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/DefaultProviderFactoryExtensionPoint.java
@@ -113,6 +113,8 @@ public class DefaultProviderFactoryExtensionPoint implements ProviderFactoryExte
loadProviderFactories(BindingProviderFactory.class);
loadProviderFactories(ImplementationProviderFactory.class);
loadProviderFactories(PolicyProviderFactory.class);
+ loadProviderFactories(WireFormatProviderFactory.class);
+ loadProviderFactories(OperationSelectorProviderFactory.class);
loaded = true;
}
@@ -171,6 +173,26 @@ public class DefaultProviderFactoryExtensionPoint implements ProviderFactoryExte
new LazyPolicyProviderFactory(registry, modelTypeName, factoryDeclaration);
factoryExtensionPoint.addProviderFactory(factory);
factories.add(factory);
+ } else if (factoryClass == WireFormatProviderFactory.class) {
+
+ // Load a wire format provider factory
+ String modelTypeName = attributes.get("model");
+
+ // Create a provider factory wrapper and register it
+ WireFormatProviderFactory factory =
+ new LazyWireFormatProviderFactory(registry, modelTypeName, factoryDeclaration);
+ factoryExtensionPoint.addProviderFactory(factory);
+ factories.add(factory);
+ } else if (factoryClass == OperationSelectorProviderFactory.class) {
+
+ // Load a wire format provider factory
+ String modelTypeName = attributes.get("model");
+
+ // Create a provider factory wrapper and register it
+ OperationSelectorProviderFactory factory =
+ new LazyOperationSelectorProviderFactory(registry, modelTypeName, factoryDeclaration);
+ factoryExtensionPoint.addProviderFactory(factory);
+ factories.add(factory);
}
}
return factories;
@@ -356,7 +378,132 @@ public class DefaultProviderFactoryExtensionPoint implements ProviderFactoryExte
}
return modelType;
}
+ }
+ /**
+ * A wrapper around a wire format provider factory allowing lazy
+ * loading and initialization of wire format providers.
+ */
+ private class LazyWireFormatProviderFactory implements WireFormatProviderFactory {
+
+ private ExtensionPointRegistry registry;
+ private String modelTypeName;
+ private ServiceDeclaration providerClass;
+ private WireFormatProviderFactory factory;
+ private Class modelType;
+
+ private LazyWireFormatProviderFactory(ExtensionPointRegistry registry,
+ String modelTypeName,
+ ServiceDeclaration providerClass) {
+ this.registry = registry;
+ this.modelTypeName = modelTypeName;
+ this.providerClass = providerClass;
+ }
+
+ @SuppressWarnings("unchecked")
+ private WireFormatProviderFactory getFactory() {
+ if (factory == null) {
+ try {
+ Class<WireFormatProviderFactory> factoryClass =
+ (Class<WireFormatProviderFactory>)providerClass.loadClass();
+ Constructor<WireFormatProviderFactory> constructor =
+ factoryClass.getConstructor(ExtensionPointRegistry.class);
+ factory = constructor.newInstance(registry);
+ } catch (Exception e) {
+ throw new IllegalStateException(e);
+ }
+ }
+ return factory;
+ }
+
+ @SuppressWarnings("unchecked")
+ public WireFormatProvider createReferenceWireFormatProvider(RuntimeComponent component,
+ RuntimeComponentReference reference,
+ Binding binding){
+ return getFactory().createReferenceWireFormatProvider(component, reference, binding);
+ }
+
+ @SuppressWarnings("unchecked")
+ public WireFormatProvider createServiceWireFormatProvider(RuntimeComponent component,
+ RuntimeComponentService service,
+ Binding binding){
+ return getFactory().createServiceWireFormatProvider(component, service, binding);
+ }
+
+ public Class getModelType() {
+ if (modelType == null) {
+ try {
+
+ modelType = providerClass.loadClass(modelTypeName);
+ } catch (Exception e) {
+ throw new IllegalStateException(e);
+ }
+ }
+ return modelType;
+ }
}
+ /**
+ * A wrapper around a operation selector provider factory allowing lazy
+ * loading and initialization of operation selector providers.
+ */
+ private class LazyOperationSelectorProviderFactory implements OperationSelectorProviderFactory {
+
+ private ExtensionPointRegistry registry;
+ private String modelTypeName;
+ private ServiceDeclaration providerClass;
+ private OperationSelectorProviderFactory factory;
+ private Class modelType;
+
+ private LazyOperationSelectorProviderFactory(ExtensionPointRegistry registry,
+ String modelTypeName,
+ ServiceDeclaration providerClass) {
+ this.registry = registry;
+ this.modelTypeName = modelTypeName;
+ this.providerClass = providerClass;
+ }
+
+ @SuppressWarnings("unchecked")
+ private OperationSelectorProviderFactory getFactory() {
+ if (factory == null) {
+ try {
+ Class<OperationSelectorProviderFactory> factoryClass =
+ (Class<OperationSelectorProviderFactory>)providerClass.loadClass();
+ Constructor<OperationSelectorProviderFactory> constructor =
+ factoryClass.getConstructor(ExtensionPointRegistry.class);
+ factory = constructor.newInstance(registry);
+ } catch (Exception e) {
+ throw new IllegalStateException(e);
+ }
+ }
+ return factory;
+ }
+
+ @SuppressWarnings("unchecked")
+ public OperationSelectorProvider createReferenceOperationSelectorProvider(RuntimeComponent component,
+ RuntimeComponentReference reference,
+ Binding binding){
+ return getFactory().createReferenceOperationSelectorProvider(component, reference, binding);
+ }
+
+ @SuppressWarnings("unchecked")
+ public OperationSelectorProvider createServiceOperationSelectorProvider(RuntimeComponent component,
+ RuntimeComponentService service,
+ Binding binding){
+ return getFactory().createServiceOperationSelectorProvider(component, service, binding);
+ }
+
+ public Class getModelType() {
+ if (modelType == null) {
+ try {
+
+ modelType = providerClass.loadClass(modelTypeName);
+ } catch (Exception e) {
+ throw new IllegalStateException(e);
+ }
+ }
+ return modelType;
+ }
+ }
+
}
diff --git a/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/OperationSelectortProviderFactory.java b/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/OperationSelectorProviderFactory.java
index 21d36e5078..183b38cb33 100644
--- a/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/OperationSelectortProviderFactory.java
+++ b/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/OperationSelectorProviderFactory.java
@@ -28,7 +28,7 @@ import org.apache.tuscany.sca.runtime.RuntimeComponentService;
/**
* @version $Rev$ $Date$
*/
-public interface OperationSelectortProviderFactory<M extends OperationSelector> extends ProviderFactory<M> {
+public interface OperationSelectorProviderFactory<M extends OperationSelector> extends ProviderFactory<M> {
/**
* Create wire format provider for a given reference binding
* @param component
@@ -36,9 +36,9 @@ public interface OperationSelectortProviderFactory<M extends OperationSelector>
* @param binding
* @return
*/
- PolicyProvider createReferenceOperationSelectorProvider(RuntimeComponent component,
- RuntimeComponentReference reference,
- Binding binding);
+ OperationSelectorProvider createReferenceOperationSelectorProvider(RuntimeComponent component,
+ RuntimeComponentReference reference,
+ Binding binding);
/**
* Create policy provider for a given service binding
@@ -47,7 +47,7 @@ public interface OperationSelectortProviderFactory<M extends OperationSelector>
* @param binding
* @return
*/
- PolicyProvider createServiceOperationSelectorProvider(RuntimeComponent component,
- RuntimeComponentService service,
- Binding binding);
+ OperationSelectorProvider createServiceOperationSelectorProvider(RuntimeComponent component,
+ RuntimeComponentService service,
+ Binding binding);
}
diff --git a/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ServiceBindingProviderRRB.java b/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ServiceBindingProviderRRB.java
index cad31cb2b7..e23a37360a 100644
--- a/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ServiceBindingProviderRRB.java
+++ b/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ServiceBindingProviderRRB.java
@@ -34,7 +34,6 @@ import org.apache.tuscany.sca.runtime.RuntimeWire;
*/
public interface ServiceBindingProviderRRB extends ServiceBindingProvider {
- void configureServiceBindingRequestChain(List<Invoker> bindingRequestChain, RuntimeWire runtimeWire);
- void configureServiceBindingResponseChain(List<Invoker> bindingResponseChain, RuntimeWire runtimeWire);
+ void configureBindingChain(RuntimeWire runtimeWire);
}