diff options
Diffstat (limited to 'sca-java-2.x/trunk/modules/core')
3 files changed, 16 insertions, 4 deletions
diff --git a/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointReferenceImpl.java b/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointReferenceImpl.java index 940155d613..ff290ee150 100644 --- a/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointReferenceImpl.java +++ b/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointReferenceImpl.java @@ -71,7 +71,6 @@ import org.apache.tuscany.sca.runtime.RuntimeEndpointReference; import org.apache.tuscany.sca.runtime.RuntimeWireProcessor; import org.apache.tuscany.sca.runtime.RuntimeWireProcessorExtensionPoint; import org.apache.tuscany.sca.work.WorkScheduler; -import org.oasisopen.sca.SCARuntimeException; import org.oasisopen.sca.ServiceRuntimeException; /** @@ -304,7 +303,7 @@ public class RuntimeEndpointReferenceImpl extends EndpointReferenceImpl implemen boolean ok = eprBinder.bindRunTime(endpointRegistry, this); if (!ok) { - throw new SCARuntimeException("Unable to bind " + this); + throw new ServiceRuntimeException("Unable to bind " + this); } // start the binding provider diff --git a/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/InvocationChainImpl.java b/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/InvocationChainImpl.java index 60914f799b..8569af0de8 100644 --- a/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/InvocationChainImpl.java +++ b/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/InvocationChainImpl.java @@ -86,6 +86,19 @@ public class InvocationChainImpl implements InvocationChain { public Invoker getHeadInvoker() { return nodes.isEmpty() ? null : nodes.get(0).getInvoker(); } + + public Invoker getHeadInvoker(String phase) { + int index = phaseManager.getAllPhases().indexOf(phase); + if (index == -1) { + throw new IllegalArgumentException("Invalid phase name: " + phase); + } + for (Node node : nodes) { + if (index <= node.getPhaseIndex()) { + return node.getInvoker(); + } + } + return null; + } /** * @return the sourceOperation diff --git a/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/PhaseManager.java b/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/PhaseManager.java index 1649eade87..85ef79b5d7 100644 --- a/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/PhaseManager.java +++ b/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/PhaseManager.java @@ -69,7 +69,7 @@ public class PhaseManager { public static final String STAGE_IMPLEMENTATION = "implementation"; private static final String[] SYSTEM_REFERENCE_PHASES = - {REFERENCE, REFERENCE_INTERFACE, REFERENCE_POLICY, REFERENCE_BINDING}; + {REFERENCE, REFERENCE_POLICY, REFERENCE_INTERFACE, REFERENCE_BINDING}; private static final String[] SYSTEM_REFERENCE_BINDING_PHASES = {REFERENCE_BINDING_WIREFORMAT, REFERENCE_BINDING_POLICY, REFERENCE_BINDING_TRANSPORT}; @@ -78,7 +78,7 @@ public class PhaseManager { {SERVICE_BINDING_TRANSPORT, SERVICE_BINDING_OPERATION_SELECTOR, SERVICE_BINDING_WIREFORMAT, SERVICE_BINDING_POLICY}; private static final String[] SYSTEM_SERVICE_PHASES = - {SERVICE_BINDING, SERVICE_POLICY, SERVICE_INTERFACE, SERVICE}; + {SERVICE_BINDING, SERVICE_INTERFACE, SERVICE_POLICY, SERVICE}; private static final String[] SYSTEM_IMPLEMENTATION_PHASES = {IMPLEMENTATION_POLICY, IMPLEMENTATION}; |