From 94c1f358aa3a64b5ec05d37bafc3e873d45c98ba Mon Sep 17 00:00:00 2001 From: edwardsmj Date: Tue, 11 Jan 2011 14:15:07 +0000 Subject: Add capability to support Bindings that support Async invocations natively - as under TUSCANY-3801 git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1057650 13f79535-47bb-0310-9956-ffa450edef68 --- .../tuscany/sca/invocation/InvocationChain.java | 31 ++++++++++++++------ .../sca/provider/OptimisingBindingProvider.java | 34 ++++++++++++++++++++++ .../sca/runtime/RuntimeComponentReference.java | 6 ++++ 3 files changed, 62 insertions(+), 9 deletions(-) create mode 100644 sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/OptimisingBindingProvider.java (limited to 'sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany') diff --git a/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InvocationChain.java b/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InvocationChain.java index 1d38ec7101..b7e26d68eb 100644 --- a/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InvocationChain.java +++ b/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InvocationChain.java @@ -60,15 +60,35 @@ public interface InvocationChain { void setSourceOperation(Operation operation); /** - * Adds an interceptor to the chain. For reference side, it will be added to + * Adds an interceptor to the end of the chain. For reference side, it will be added to * Phase.REFERENCE. For service side, it will be added to Phase.SERVICE * * @param interceptor The interceptor to add */ void addInterceptor(Interceptor interceptor); + + /** + * Add an interceptor to the end of the given phase + * @param phase - the phase + * @param interceptor - the interceptor + */ + void addInterceptor(String phase, Interceptor interceptor); + + /** + * Adds an interceptor to the head of the chain + * @param interceptor - the interceptor + */ + void addHeadInterceptor(Interceptor interceptor); + + /** + * Adds an interceptor to the head of the given phase + * @param phase - the phase + * @param interceptor - the interceptor + */ + void addHeadInterceptor(String phase, Interceptor interceptor); /** - * Adds an invoker to the chain + * Adds an invoker to the end of the chain * * @param invoker The invoker to add */ @@ -95,13 +115,6 @@ public interface InvocationChain { */ Invoker getHeadInvoker(String phase); - /** - * Add an interceptor to the given phase - * @param phase - * @param interceptor - */ - void addInterceptor(String phase, Interceptor interceptor); - /** * Indicate if the data can be passed in by reference as they won't be mutated. * @return true if pass-by-reference is allowed diff --git a/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/OptimisingBindingProvider.java b/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/OptimisingBindingProvider.java new file mode 100644 index 0000000000..57c9b48349 --- /dev/null +++ b/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/OptimisingBindingProvider.java @@ -0,0 +1,34 @@ +/* + * 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.provider; + +import org.apache.tuscany.sca.runtime.RuntimeEndpoint; + +/** + * Defines the extra operation that binding providers implement + * when they provide local optimisation of reference to service invocations + */ +public interface OptimisingBindingProvider { + /** + * Optimise the binding chain for a service endpoint + */ + void optimiseBinding( RuntimeEndpoint ep ); + +} // end interface OptimisingBindingProvider diff --git a/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentReference.java b/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentReference.java index 8abecee0bf..5dc114ade0 100644 --- a/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentReference.java +++ b/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentReference.java @@ -35,4 +35,10 @@ public interface RuntimeComponentReference extends ComponentReference { * @param component */ void setComponent(RuntimeComponent component); + + /** + * Get the owning component + * @return the owning component + */ + RuntimeComponent getComponent(); } -- cgit v1.2.3