summaryrefslogtreecommitdiffstats
path: root/java/sca/modules/core-spi
diff options
context:
space:
mode:
Diffstat (limited to 'java/sca/modules/core-spi')
-rw-r--r--java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/context/CompositeContext.java46
-rw-r--r--java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/BasePolicyProvider.java31
-rw-r--r--java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/BindingPolicyProvider.java (renamed from java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/PolicyProviderRRB.java)2
-rw-r--r--java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/BindingProviderFactory.java8
-rw-r--r--java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/DefaultProviderFactoryExtensionPoint.java33
-rw-r--r--java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/EndpointProvider.java (renamed from java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ReferenceBindingProviderRRB.java)10
-rw-r--r--java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/EndpointReferenceProvider.java (renamed from java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ServiceBindingProviderRRB.java)9
-rw-r--r--java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/OperationSelectorProviderFactory.java22
-rw-r--r--java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/WireFormatProviderFactory.java22
-rw-r--r--java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/Invocable.java (renamed from java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeWire.java)88
-rw-r--r--java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentContext.java25
-rw-r--r--java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentReference.java71
-rw-r--r--java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentService.java106
-rw-r--r--java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeEndpoint.java76
-rw-r--r--java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeEndpointReference.java78
-rw-r--r--java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeWireProcessor.java15
16 files changed, 188 insertions, 454 deletions
diff --git a/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/context/CompositeContext.java b/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/context/CompositeContext.java
index a805985a11..a55de8f20e 100644
--- a/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/context/CompositeContext.java
+++ b/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/context/CompositeContext.java
@@ -33,7 +33,24 @@ import org.apache.tuscany.sca.runtime.RuntimeComponentContext;
*
* @version $Rev$ $Date$
*/
-public abstract class CompositeContext {
+public class CompositeContext {
+ protected ExtensionPointRegistry extensionPointRegistry;
+ protected EndpointRegistry endpointRegistry;
+ protected ComponentContextFactory componentContextFactory;
+ protected Composite domainComposite;
+
+ public CompositeContext(ExtensionPointRegistry registry, EndpointRegistry endpointRegistry, Composite domainComposite) {
+ this.extensionPointRegistry = registry;
+ this.endpointRegistry = endpointRegistry;
+ ContextFactoryExtensionPoint contextFactories = registry.getExtensionPoint(ContextFactoryExtensionPoint.class);
+ this.componentContextFactory = contextFactories.getFactory(ComponentContextFactory.class);
+ this.domainComposite = domainComposite;
+ }
+
+ public CompositeContext(ExtensionPointRegistry registry, EndpointRegistry endpointRegistry) {
+ this(registry, endpointRegistry, null);
+ }
+
/**
* @return
*/
@@ -62,30 +79,37 @@ public abstract class CompositeContext {
return null;
}
- /**
- * Attach a component context to the component
- * @param runtimeComponent
- */
- public abstract void bindComponent(RuntimeComponent runtimeComponent);
-
+ public void bindComponent(RuntimeComponent runtimeComponent) {
+ RuntimeComponentContext componentContext =
+ (RuntimeComponentContext)componentContextFactory.createComponentContext(this, runtimeComponent);
+ runtimeComponent.setComponentContext(componentContext);
+ }
/**
*
* @param endpointReference
*/
- public abstract void bindEndpointReference(EndpointReference endpointReference);
+ public void bindEndpointReference(EndpointReference endpointReference) {
+
+ }
/**
* Get the ExtensionPointRegistry for this node
* @return The ExtensionPointRegistry
*/
- public abstract ExtensionPointRegistry getExtensionPointRegistry();
+ public ExtensionPointRegistry getExtensionPointRegistry() {
+ return extensionPointRegistry;
+ }
/**
* Get the EndpointRegistry
* @return The EndpointRegistry for this node
*/
- public abstract EndpointRegistry getEndpointRegistry();
+ public EndpointRegistry getEndpointRegistry() {
+ return endpointRegistry;
+ }
- public abstract Composite getDomainComposite();
+ public Composite getDomainComposite() {
+ return domainComposite;
+ }
}
diff --git a/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/BasePolicyProvider.java b/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/BasePolicyProvider.java
index 785ac70271..8f93476c85 100644
--- a/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/BasePolicyProvider.java
+++ b/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/BasePolicyProvider.java
@@ -32,9 +32,10 @@ import org.apache.tuscany.sca.invocation.PhasedInterceptor;
import org.apache.tuscany.sca.policy.PolicyExpression;
import org.apache.tuscany.sca.policy.PolicySet;
import org.apache.tuscany.sca.policy.PolicySubject;
-import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-import org.apache.tuscany.sca.runtime.RuntimeWire;
+import org.apache.tuscany.sca.runtime.RuntimeEndpoint;
+import org.apache.tuscany.sca.runtime.RuntimeEndpointReference;
/**
* Abstract base class for policy providers
@@ -129,30 +130,26 @@ public abstract class BasePolicyProvider<T> implements PolicyProvider {
return null;
}
- private InvocationChain getInvocationChain() {
- if (subject instanceof Endpoint) {
- Endpoint endpoint = (Endpoint)subject;
- RuntimeComponentService service = (RuntimeComponentService)endpoint.getService();
- RuntimeWire wire = service.getRuntimeWire(endpoint.getBinding());
- List<InvocationChain> chains = wire.getInvocationChains();
+ protected InvocationChain getInvocationChain() {
+ if (subject instanceof RuntimeEndpoint) {
+ RuntimeEndpoint endpoint = (RuntimeEndpoint)subject;
+ List<InvocationChain> chains = endpoint.getInvocationChains();
for (InvocationChain chain : chains) {
configure(chain, chain.getTargetOperation());
}
- } else if (subject instanceof EndpointReference) {
- EndpointReference endpointReference = (EndpointReference)subject;
- RuntimeComponentReference reference = (RuntimeComponentReference)endpointReference.getReference();
- RuntimeWire wire = reference.getRuntimeWire(endpointReference.getBinding());
- List<InvocationChain> chains = wire.getInvocationChains();
+ } else if (subject instanceof RuntimeEndpointReference) {
+ RuntimeEndpointReference endpointReference = (RuntimeEndpointReference)subject;
+ List<InvocationChain> chains = endpointReference.getInvocationChains();
for (InvocationChain chain : chains) {
configure(chain, chain.getSourceOperation());
}
- } else if (subject instanceof Component) {
- Component component = (Component)subject;
+ } else if (subject instanceof RuntimeComponent) {
+ RuntimeComponent component = (RuntimeComponent)subject;
for (ComponentService s : component.getServices()) {
RuntimeComponentService service = (RuntimeComponentService)s;
- for (RuntimeWire wire : service.getRuntimeWires()) {
- List<InvocationChain> chains = wire.getInvocationChains();
+ for (Endpoint ep : service.getEndpoints()) {
+ List<InvocationChain> chains = ((RuntimeEndpoint)ep).getInvocationChains();
for (InvocationChain chain : chains) {
configure(chain, chain.getTargetOperation());
}
diff --git a/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/PolicyProviderRRB.java b/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/BindingPolicyProvider.java
index 6e7f2bd554..5f2e6bd315 100644
--- a/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/PolicyProviderRRB.java
+++ b/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/BindingPolicyProvider.java
@@ -27,7 +27,7 @@ import org.apache.tuscany.sca.invocation.PhasedInterceptor;
* binding function
* @version $Rev$ $Date$
*/
-public interface PolicyProviderRRB extends PolicyProvider {
+public interface BindingPolicyProvider extends PolicyProvider {
/**
* Create a binding interceptor
* @return An interceptor that realize the policySet
diff --git a/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/BindingProviderFactory.java b/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/BindingProviderFactory.java
index 0e94a28d98..5fa8454b95 100644
--- a/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/BindingProviderFactory.java
+++ b/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/BindingProviderFactory.java
@@ -20,8 +20,8 @@
package org.apache.tuscany.sca.provider;
import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.assembly.Endpoint;
-import org.apache.tuscany.sca.assembly.EndpointReference;
+import org.apache.tuscany.sca.runtime.RuntimeEndpoint;
+import org.apache.tuscany.sca.runtime.RuntimeEndpointReference;
/**
* A factory for creating the runtime artifacts that represent bindings.
@@ -36,7 +36,7 @@ public interface BindingProviderFactory<M extends Binding> extends ProviderFacto
* @param endpointReference defines the component/reference/binding against which to create the provider
* @return The binding provider
*/
- ReferenceBindingProvider createReferenceBindingProvider(EndpointReference endpointReference);
+ ReferenceBindingProvider createReferenceBindingProvider(RuntimeEndpointReference endpointReference);
/**
* Creates a new service binding provider for the given component and
@@ -45,6 +45,6 @@ public interface BindingProviderFactory<M extends Binding> extends ProviderFacto
* @param endpoint defines the component/service/binding against which to create the provider
* @return The binding provider
*/
- ServiceBindingProvider createServiceBindingProvider(Endpoint endpoint);
+ ServiceBindingProvider createServiceBindingProvider(RuntimeEndpoint endpoint);
}
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 2ee058a14d..8621baca2e 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
@@ -26,7 +26,6 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import org.apache.tuscany.sca.assembly.Binding;
import org.apache.tuscany.sca.assembly.Endpoint;
import org.apache.tuscany.sca.assembly.EndpointReference;
import org.apache.tuscany.sca.assembly.Implementation;
@@ -34,8 +33,8 @@ import org.apache.tuscany.sca.core.ExtensionPointRegistry;
import org.apache.tuscany.sca.extensibility.ServiceDeclaration;
import org.apache.tuscany.sca.extensibility.ServiceDiscovery;
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.runtime.RuntimeEndpoint;
+import org.apache.tuscany.sca.runtime.RuntimeEndpointReference;
/**
* Default implementation of a provider factory extension point.
@@ -237,12 +236,12 @@ public class DefaultProviderFactoryExtensionPoint implements ProviderFactoryExte
}
@SuppressWarnings("unchecked")
- public ReferenceBindingProvider createReferenceBindingProvider(EndpointReference endpointReference) {
+ public ReferenceBindingProvider createReferenceBindingProvider(RuntimeEndpointReference endpointReference) {
return getFactory().createReferenceBindingProvider(endpointReference);
}
@SuppressWarnings("unchecked")
- public ServiceBindingProvider createServiceBindingProvider(Endpoint endpoint) {
+ public ServiceBindingProvider createServiceBindingProvider(RuntimeEndpoint endpoint) {
return getFactory().createServiceBindingProvider(endpoint);
}
@@ -409,16 +408,12 @@ public class DefaultProviderFactoryExtensionPoint implements ProviderFactoryExte
return factory;
}
- public WireFormatProvider createReferenceWireFormatProvider(RuntimeComponent component,
- RuntimeComponentReference reference,
- Binding binding){
- return getFactory().createReferenceWireFormatProvider(component, reference, binding);
+ public WireFormatProvider createReferenceWireFormatProvider(RuntimeEndpointReference endpointReference){
+ return getFactory().createReferenceWireFormatProvider(endpointReference);
}
- public WireFormatProvider createServiceWireFormatProvider(RuntimeComponent component,
- RuntimeComponentService service,
- Binding binding){
- return getFactory().createServiceWireFormatProvider(component, service, binding);
+ public WireFormatProvider createServiceWireFormatProvider(RuntimeEndpoint endpoint){
+ return getFactory().createServiceWireFormatProvider(endpoint);
}
public Class<?> getModelType() {
@@ -470,16 +465,12 @@ public class DefaultProviderFactoryExtensionPoint implements ProviderFactoryExte
return factory;
}
- public OperationSelectorProvider createReferenceOperationSelectorProvider(RuntimeComponent component,
- RuntimeComponentReference reference,
- Binding binding){
- return getFactory().createReferenceOperationSelectorProvider(component, reference, binding);
+ public OperationSelectorProvider createReferenceOperationSelectorProvider(RuntimeEndpointReference endpointReference){
+ return getFactory().createReferenceOperationSelectorProvider(endpointReference);
}
- public OperationSelectorProvider createServiceOperationSelectorProvider(RuntimeComponent component,
- RuntimeComponentService service,
- Binding binding){
- return getFactory().createServiceOperationSelectorProvider(component, service, binding);
+ public OperationSelectorProvider createServiceOperationSelectorProvider(RuntimeEndpoint endpoint){
+ return getFactory().createServiceOperationSelectorProvider(endpoint);
}
public Class<?> getModelType() {
diff --git a/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ReferenceBindingProviderRRB.java b/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/EndpointProvider.java
index 3ea9d0ac3c..2672c31304 100644
--- a/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ReferenceBindingProviderRRB.java
+++ b/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/EndpointProvider.java
@@ -19,7 +19,6 @@
package org.apache.tuscany.sca.provider;
-import org.apache.tuscany.sca.runtime.RuntimeWire;
/**
* TODO RRB experiment
@@ -28,8 +27,9 @@ import org.apache.tuscany.sca.runtime.RuntimeWire;
*
* @version $Rev$ $Date$
*/
-public interface ReferenceBindingProviderRRB extends ReferenceBindingProvider {
-
- void configureBindingChain(RuntimeWire runtimeWire);
-
+public interface EndpointProvider extends ServiceBindingProvider {
+ /**
+ * Configure the binding invocation chain
+ */
+ void configure();
}
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/EndpointReferenceProvider.java
index 278bb23e0a..6430fe4d34 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/EndpointReferenceProvider.java
@@ -19,7 +19,6 @@
package org.apache.tuscany.sca.provider;
-import org.apache.tuscany.sca.runtime.RuntimeWire;
/**
* TODO RRB experiment
@@ -28,8 +27,10 @@ import org.apache.tuscany.sca.runtime.RuntimeWire;
*
* @version $Rev$ $Date$
*/
-public interface ServiceBindingProviderRRB extends ServiceBindingProvider {
-
- void configureBindingChain(RuntimeWire runtimeWire);
+public interface EndpointReferenceProvider extends ReferenceBindingProvider {
+ /**
+ * Configure the binding invocation chain
+ */
+ void configure();
}
diff --git a/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/OperationSelectorProviderFactory.java b/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/OperationSelectorProviderFactory.java
index 183b38cb33..4aca3e04e0 100644
--- a/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/OperationSelectorProviderFactory.java
+++ b/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/OperationSelectorProviderFactory.java
@@ -19,11 +19,9 @@
package org.apache.tuscany.sca.provider;
-import org.apache.tuscany.sca.assembly.Binding;
import org.apache.tuscany.sca.assembly.OperationSelector;
-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.runtime.RuntimeEndpoint;
+import org.apache.tuscany.sca.runtime.RuntimeEndpointReference;
/**
* @version $Rev$ $Date$
@@ -31,23 +29,15 @@ import org.apache.tuscany.sca.runtime.RuntimeComponentService;
public interface OperationSelectorProviderFactory<M extends OperationSelector> extends ProviderFactory<M> {
/**
* Create wire format provider for a given reference binding
- * @param component
- * @param reference
- * @param binding
+ * @param endpointReference TODO
* @return
*/
- OperationSelectorProvider createReferenceOperationSelectorProvider(RuntimeComponent component,
- RuntimeComponentReference reference,
- Binding binding);
+ OperationSelectorProvider createReferenceOperationSelectorProvider(RuntimeEndpointReference endpointReference);
/**
* Create policy provider for a given service binding
- * @param component
- * @param service
- * @param binding
+ * @param endpoint TODO
* @return
*/
- OperationSelectorProvider createServiceOperationSelectorProvider(RuntimeComponent component,
- RuntimeComponentService service,
- Binding binding);
+ OperationSelectorProvider createServiceOperationSelectorProvider(RuntimeEndpoint endpoint);
}
diff --git a/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/WireFormatProviderFactory.java b/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/WireFormatProviderFactory.java
index fd748df6ca..1033ce8951 100644
--- a/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/WireFormatProviderFactory.java
+++ b/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/WireFormatProviderFactory.java
@@ -19,11 +19,9 @@
package org.apache.tuscany.sca.provider;
-import org.apache.tuscany.sca.assembly.Binding;
import org.apache.tuscany.sca.assembly.WireFormat;
-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.runtime.RuntimeEndpoint;
+import org.apache.tuscany.sca.runtime.RuntimeEndpointReference;
/**
* @version $Rev$ $Date$
@@ -31,23 +29,15 @@ import org.apache.tuscany.sca.runtime.RuntimeComponentService;
public interface WireFormatProviderFactory<M extends WireFormat> extends ProviderFactory<M> {
/**
* Create wire format provider for a given reference binding
- * @param component
- * @param reference
- * @param binding
+ * @param endpointReference The endpoint reference
* @return
*/
- WireFormatProvider createReferenceWireFormatProvider(RuntimeComponent component,
- RuntimeComponentReference reference,
- Binding binding);
+ WireFormatProvider createReferenceWireFormatProvider(RuntimeEndpointReference endpointReference);
/**
* Create policy provider for a given service binding
- * @param component
- * @param service
- * @param binding
+ * @param endpoint TODO
* @return
*/
- WireFormatProvider createServiceWireFormatProvider(RuntimeComponent component,
- RuntimeComponentService service,
- Binding binding);
+ WireFormatProvider createServiceWireFormatProvider(RuntimeEndpoint endpoint);
}
diff --git a/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeWire.java b/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/Invocable.java
index c0150c6138..4e0128c49a 100644
--- a/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeWire.java
+++ b/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/Invocable.java
@@ -6,15 +6,15 @@
* 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.
+ * under the License.
*/
package org.apache.tuscany.sca.runtime;
@@ -22,39 +22,64 @@ package org.apache.tuscany.sca.runtime;
import java.lang.reflect.InvocationTargetException;
import java.util.List;
-import org.apache.tuscany.sca.assembly.Endpoint;
-import org.apache.tuscany.sca.assembly.EndpointReference;
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.Contract;
+import org.apache.tuscany.sca.context.CompositeContext;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
import org.apache.tuscany.sca.interfacedef.Operation;
import org.apache.tuscany.sca.invocation.InvocationChain;
import org.apache.tuscany.sca.invocation.Message;
+import org.apache.tuscany.sca.provider.PolicyProvider;
/**
- * The runtime wire interface that connects a component reference to a
- * component service (or an external service) over the selected binding
- *
- * @version $Rev$ $Date$
+ * The abstraction of an invocable model that contains invocation chains
*/
-public interface RuntimeWire extends Cloneable {
+public interface Invocable {
/**
- * return the endpoint reference that configured this wire
- *
- * @return the endpoint reference that configured this wire
+ * Bind the invocable to the composite context
+ * @param context
+ */
+ void bind(CompositeContext context);
+
+ /**
+ * Bind the invocable to the extension point registry and endpoint registry. This is typically
+ * called after the endpoint or endpoint reference is deserialized
+ * @param registry
+ * @param endpointRegistry
+ */
+ void bind(ExtensionPointRegistry registry, EndpointRegistry endpointRegistry);
+
+ /**
+ * Get the associated composite context
+ * @return
*/
- EndpointReference getEndpointReference();
+ CompositeContext getCompositeContext();
/**
- * return the endpoint that configured this wire
- *
- * @return the endpoint that configured this wire
+ * Unbind the invocable from the composite context
*/
- Endpoint getEndpoint();
+ void unbind();
/**
- * Force the invocation chains to be rebuilt
+ * Get the component
+ * @return
*/
- void rebuild();
+ Component getComponent();
/**
+ * Get the service or reference (contract)
+ * @return
+ */
+ Contract getContract();
+
+ /**
+ * Get the binding
+ * @return
+ */
+ Binding getBinding();
+
+ /**
* Returns the invocation chains for service operations associated with the
* wire
*
@@ -72,7 +97,7 @@ public interface RuntimeWire extends Cloneable {
/**
* Get the invocation chain for the binding-specific handling
- * @return
+ * @return The binding invocation chain
*/
InvocationChain getBindingInvocationChain();
@@ -80,11 +105,10 @@ public interface RuntimeWire extends Cloneable {
* This invoke method assumes that the binding invocation chain is in force
* and that there will be an operation selector element there to
* determine which operation to call
- * @param msg The message
- * @return The result
- * @throws InvocationTargetException
+ * @param msg The request message
+ * @return The response message
*/
- Object invoke(Message msg) throws InvocationTargetException;
+ Message invoke(Message msg);
/**
* Invoke an operation with given arguments
@@ -98,17 +122,15 @@ public interface RuntimeWire extends Cloneable {
/**
* Invoke an operation with a context message
* @param operation The operation
- * @param msg The message
- * @return The result
+ * @param msg The request message
+ * @return The response message
* @throws InvocationTargetException
*/
- Object invoke(Operation operation, Message msg) throws InvocationTargetException;
+ Message invoke(Operation operation, Message msg);
/**
- * @return a clone of the runtime wire
- * @throws CloneNotSupportedException
+ * Get a list of policy providers
+ * @return
*/
- Object clone() throws CloneNotSupportedException;
-
- boolean isOutOfDate();
+ List<PolicyProvider> getPolicyProviders();
}
diff --git a/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentContext.java b/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentContext.java
index 5f9ff4fa7e..861ca2d6f9 100644
--- a/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentContext.java
+++ b/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentContext.java
@@ -20,7 +20,6 @@
package org.apache.tuscany.sca.runtime;
import org.apache.tuscany.sca.assembly.ComponentService;
-import org.apache.tuscany.sca.assembly.EndpointReference;
import org.apache.tuscany.sca.context.CompositeContext;
import org.apache.tuscany.sca.core.ExtensionPointRegistry;
import org.oasisopen.sca.ComponentContext;
@@ -40,27 +39,12 @@ public interface RuntimeComponentContext extends ComponentContext {
* Get the CallableReference for a given component reference
* @param <B>
* @param businessInterface The business interface
- * @param reference The reference to be wired
* @param endpointReference The endpointReference to be used
* @return A service reference representing the wire
*/
<B> ServiceReference<B> getServiceReference(Class<B> businessInterface,
- RuntimeComponentReference reference,
- EndpointReference endpointReference);
+ RuntimeEndpointReference endpointReference);
- /**
- * Bind the reference to a target component/componentService
- * @param <B>
- * @param businessInterface The business interface
- * @param reference The reference to be wired
- * @param component The target component
- * @param service The target component service
- * @return A service reference representing the wire
- */
- <B> ServiceReference<B> getServiceReference(Class<B> businessInterface,
- RuntimeComponentReference reference,
- RuntimeComponent component,
- RuntimeComponentService service);
/**
* Create a CallableReference for the given component service
@@ -70,9 +54,7 @@ public interface RuntimeComponentContext extends ComponentContext {
* @param service
* @return
*/
- <B> ServiceReference<B> getCallableReference(Class<B> businessInterface,
- RuntimeComponent component,
- RuntimeComponentService service);
+ <B> ServiceReference<B> getServiceReference(Class<B> businessInterface, RuntimeEndpoint endpoint);
/**
* @param <B>
@@ -81,7 +63,8 @@ public interface RuntimeComponentContext extends ComponentContext {
* @return
*/
<B> ServiceReference<B> createSelfReference(Class<B> businessInterface, ComponentService service);
-
+
ExtensionPointRegistry getExtensionPointRegistry();
+
CompositeContext getCompositeContext();
}
diff --git a/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentReference.java b/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentReference.java
index 0105abd6e4..c0f393c827 100644
--- a/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentReference.java
+++ b/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentReference.java
@@ -19,15 +19,7 @@
package org.apache.tuscany.sca.runtime;
-import java.util.List;
-
-import org.apache.tuscany.sca.assembly.Binding;
import org.apache.tuscany.sca.assembly.ComponentReference;
-import org.apache.tuscany.sca.assembly.EndpointReference;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.provider.PolicyProvider;
-import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
/**
* The runtime component reference. Provides the bridge between the
@@ -37,69 +29,6 @@ import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
* @version $Rev$ $Date$
*/
public interface RuntimeComponentReference extends ComponentReference {
-
- /**
- * Get a list of runtime wires to the reference
- *
- * @return The list of wires
- */
- List<RuntimeWire> getRuntimeWires();
-
- /**
- * Get the runtime wire for the given binding
- * @param binding The assembly model binding
- * @return The runtime wire
- */
- RuntimeWire getRuntimeWire(Binding binding);
-
- /**
- * Get the runtime wire for the given endpoint reference
- * @param endpointReference The assembly model endpoint reference
- * @return The runtime wire
- */
- RuntimeWire getRuntimeWire(EndpointReference endpointReference);
-
- /**
- * Returns the reference binding provider associated with this
- * component reference and the given binding.
- *
- * @param binding The assembly model binding
- * @return The runtime reference binding provider
- */
- ReferenceBindingProvider getBindingProvider(Binding binding);
-
- /**
- * Sets the reference binding provider associated with this
- * component reference and the given binding.
- *
- * @param binding The assembly model binding
- * @param bindingProvider The runtime reference binding provider
- */
- void setBindingProvider(Binding binding, ReferenceBindingProvider bindingProvider);
-
-
- /**
- * Add a policy provider for the given binding to the reference
- * @param binding The assembly model binding
- * @param policyProvider The policy handler
- */
- void addPolicyProvider(Binding binding, PolicyProvider policyProvider);
-
- /**
- * Get a list of policy providers for the given binding
- * @param binding The assembly model binding
- * @return A list of policy providers for the given binding
- */
- List<PolicyProvider> getPolicyProviders(Binding binding);
-
- /**
- * Get the invoker for the given binding and operation
- * @param binding The assembly model binding
- * @param operation The assembly model operation
- * @return The runtime Invoker
- */
- Invoker getInvoker(Binding binding, Operation operation);
-
/**
* Set the owning component
* @param component
diff --git a/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentService.java b/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentService.java
index 982724d798..28dd97756a 100644
--- a/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentService.java
+++ b/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentService.java
@@ -19,16 +19,7 @@
package org.apache.tuscany.sca.runtime;
-import java.util.List;
-
-import org.apache.tuscany.sca.assembly.Binding;
import org.apache.tuscany.sca.assembly.ComponentService;
-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.provider.PolicyProvider;
-import org.apache.tuscany.sca.provider.ServiceBindingProvider;
/**
* The runtime component service. Provides the bridge between the
@@ -38,101 +29,4 @@ import org.apache.tuscany.sca.provider.ServiceBindingProvider;
* @version $Rev$ $Date$
*/
public interface RuntimeComponentService extends ComponentService {
-
- /**
- * Get a list of runtime wires to the service
- *
- * @return The list of wires
- */
- List<RuntimeWire> getRuntimeWires();
- /**
- * Get the runtime wire for the given binding
- * @param binding The assembly model binding
- * @return The runtime wire
- */
- RuntimeWire getRuntimeWire(Binding binding);
-
- /**
- * Get the callback wires associated with this service
- *
- * @return The list of runtime callback wires
- */
- List<RuntimeWire> getCallbackWires();
-
- /**
- * Returns the service binding provider associated with this
- * component service and the given binding.
- *
- * @param binding The assembly model binding
- * @return The runtime service binding provider
- */
- ServiceBindingProvider getBindingProvider(Binding binding);
-
- /**
- * Returns the service binding provider associated with this
- * component service and the given binding.
- *
- * @param binding
- * @param interfaceContract
- * @return
- */
- RuntimeWire getRuntimeWire(Binding binding, InterfaceContract interfaceContract);
-
- /**
- * Sets the service binding provider associated with this
- * component service and the given binding.
- *
- * @param binding The assembly model binding
- * @param bindingProvider The runtime service binding provider
- */
- void setBindingProvider(Binding binding, ServiceBindingProvider bindingProvider);
-
- /**
- * Get the invoker for the given binding and operation
- * @param binding The assembly model binding
- * @param operation The assembly model operation
- * @return The runtime invoker
- */
- Invoker getInvoker(Binding binding, Operation operation);
-
- /**
- * Get the invoker for the given binding and operation
- * @param binding The assembly model binding
- * @param interfaceContract the client interface contract
- * @param operation The assembly model operation
- * @return The runtime invoker
- */
- Invoker getInvoker(Binding binding, InterfaceContract interfaceContract, Operation operation);
-
- /**
- * Get the invocation chain for the given binding and operation
- * @param binding The assembly model binding
- * @param operation The assembly model operation
- * @return The runtime invocation chain
- */
- InvocationChain getInvocationChain(Binding binding, Operation operation);
-
- /**
- * Get the invocation chain for the given binding and operation
- * @param binding The assembly model binding
- * @param operation The assembly model operation
- * @param interfaceContract the client interface contract
- * @return The runtime invocation chain
- */
- InvocationChain getInvocationChain(Binding binding, InterfaceContract interfaceContract, Operation operation);
-
- /**
- * Add a policy provider for the given binding to the service
- * @param binding The assembly model binding
- * @param policyProvider The policy handler
- */
- void addPolicyProvider(Binding binding, PolicyProvider policyProvider);
-
- /**
- * Get a list of policy providers for the given binding
- * @param binding The assembly model binding
- * @return A list of policy providers for the given binding
- */
- List<PolicyProvider> getPolicyProviders(Binding binding);
-
}
diff --git a/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeEndpoint.java b/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeEndpoint.java
index 7000da9093..2a4cf4fc84 100644
--- a/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeEndpoint.java
+++ b/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeEndpoint.java
@@ -20,70 +20,15 @@
package org.apache.tuscany.sca.runtime;
import java.io.Serializable;
-import java.lang.reflect.InvocationTargetException;
-import java.util.List;
import org.apache.tuscany.sca.assembly.Endpoint;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.InvocationChain;
-import org.apache.tuscany.sca.invocation.Message;
-import org.apache.tuscany.sca.provider.PolicyProvider;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
import org.apache.tuscany.sca.provider.ServiceBindingProvider;
/**
* The runtime representation of a service endpoint
*/
-public interface RuntimeEndpoint extends Endpoint, Serializable {
- /**
- * Returns the invocation chains for service operations associated with the
- * wire
- *
- * @return the invocation chains for service operations associated with the
- * wire
- */
- List<InvocationChain> getInvocationChains();
-
- /**
- * Lookup the invocation chain by operation
- * @param operation The operation
- * @return The invocation chain for the given operation
- */
- InvocationChain getInvocationChain(Operation operation);
-
- /**
- * Get the invocation chain for the binding-specific handling
- * @return The binding invocation chain
- */
- InvocationChain getBindingInvocationChain();
-
- /**
- * This invoke method assumes that the binding invocation chain is in force
- * and that there will be an operation selector element there to
- * determine which operation to call
- * @param msg The message
- * @return The result
- * @throws InvocationTargetException
- */
- Object invoke(Message msg) throws InvocationTargetException;
-
- /**
- * Invoke an operation with given arguments
- * @param operation The operation
- * @param args The arguments
- * @return The result
- * @throws InvocationTargetException
- */
- Object invoke(Operation operation, Object[] args) throws InvocationTargetException;
-
- /**
- * Invoke an operation with a context message
- * @param operation The operation
- * @param msg The message
- * @return The result
- * @throws InvocationTargetException
- */
- Object invoke(Operation operation, Message msg) throws InvocationTargetException;
-
+public interface RuntimeEndpoint extends Endpoint, Invocable, Serializable {
/**
* Attach the service binding provider
* @param provider
@@ -95,10 +40,19 @@ public interface RuntimeEndpoint extends Endpoint, Serializable {
* @return
*/
ServiceBindingProvider getBindingProvider();
-
+
/**
- * Get a list of policy providers
- * @return
+ * Get the interface contract for the binding. This represents the data types that the binding
+ * protocol stack can process.
+ * @return The binding interface contract
+ */
+ InterfaceContract getBindingInterfaceContract();
+
+ /**
+ * Get the interface contract of the service of the target component type, i.e., the
+ * componentType.service.interfaceContract. This represents the data types that the implementation
+ * code can process.
+ * @return The target component type service interface contract
*/
- List<PolicyProvider> getPolicyProviders();
+ InterfaceContract getServiceInterfaceContract();
}
diff --git a/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeEndpointReference.java b/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeEndpointReference.java
index 86c808c0fb..d6f8431d48 100644
--- a/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeEndpointReference.java
+++ b/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeEndpointReference.java
@@ -20,70 +20,15 @@
package org.apache.tuscany.sca.runtime;
import java.io.Serializable;
-import java.lang.reflect.InvocationTargetException;
-import java.util.List;
import org.apache.tuscany.sca.assembly.EndpointReference;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.InvocationChain;
-import org.apache.tuscany.sca.invocation.Message;
-import org.apache.tuscany.sca.provider.PolicyProvider;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
/**
* The runtime representation of an endpoint reference
*/
-public interface RuntimeEndpointReference extends EndpointReference, Serializable {
- /**
- * Returns the invocation chains for service operations associated with the
- * wire
- *
- * @return the invocation chains for service operations associated with the
- * wire
- */
- List<InvocationChain> getInvocationChains();
-
- /**
- * Lookup the invocation chain by operation
- * @param operation The operation
- * @return The invocation chain for the given operation
- */
- InvocationChain getInvocationChain(Operation operation);
-
- /**
- * Get the invocation chain for the binding-specific handling
- * @return The binding invocation chain
- */
- InvocationChain getBindingInvocationChain();
-
- /**
- * This invoke method assumes that the binding invocation chain is in force
- * and that there will be an operation selector element there to
- * determine which operation to call
- * @param msg The message
- * @return The result
- * @throws InvocationTargetException
- */
- Object invoke(Message msg) throws InvocationTargetException;
-
- /**
- * Invoke an operation with given arguments
- * @param operation The operation
- * @param args The arguments
- * @return The result
- * @throws InvocationTargetException
- */
- Object invoke(Operation operation, Object[] args) throws InvocationTargetException;
-
- /**
- * Invoke an operation with a context message
- * @param operation The operation
- * @param msg The message
- * @return The result
- * @throws InvocationTargetException
- */
- Object invoke(Operation operation, Message msg) throws InvocationTargetException;
-
+public interface RuntimeEndpointReference extends EndpointReference, Invocable, Serializable {
/**
* Set the reference binding provider for the endpoint reference
* @param provider The binding provider
@@ -95,10 +40,21 @@ public interface RuntimeEndpointReference extends EndpointReference, Serializabl
* @return The binding provider
*/
ReferenceBindingProvider getBindingProvider();
-
/**
- * Get the list of policy providers for the endpoint reference
- * @return A list of policy providers for the endpoint reference
+ * Get the interface contract for the binding. This represents the data types that the binding
+ * protocol stack can process.
+ * @return The binding interface contract
*/
- List<PolicyProvider> getPolicyProviders();
+ InterfaceContract getBindingInterfaceContract();
+
+ /**
+ * Get the interface contract of the reference of the source component type, i.e., the
+ * componentType.reference.interfaceContract. This represents the data types that the
+ * implementation code uses to make the outbound call.
+ * @return The source component type reference interface contract
+ */
+ InterfaceContract getReferenceInterfaceContract();
+ boolean isOutOfDate();
+ void rebuild();
+
}
diff --git a/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeWireProcessor.java b/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeWireProcessor.java
index fbb7aae467..06db5b10af 100644
--- a/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeWireProcessor.java
+++ b/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeWireProcessor.java
@@ -24,12 +24,15 @@ package org.apache.tuscany.sca.runtime;
* @version $Rev$ $Date$
*/
public interface RuntimeWireProcessor {
-
/**
- * Process the runtime wire to add interceptors
- *
- * @param wire
+ * Configure the runtime endpoint
+ * @param endpoint
*/
- void process(RuntimeWire wire);
-
+ void process(RuntimeEndpoint endpoint);
+
+ /**
+ * Configure the runtime endpoint reference
+ * @param endpointReference
+ */
+ void process(RuntimeEndpointReference endpointReference);
}