summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--java/sca/itest/pom.xml8
-rw-r--r--java/sca/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/RuntimeSCAReferenceBindingProvider.java9
-rw-r--r--java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2BindingInvoker.java12
-rw-r--r--java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceProvider.java31
-rw-r--r--java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/wire/DataBindingRuntimeWireProcessor.java6
-rw-r--r--java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Message.java11
-rw-r--r--java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/EndpointReference.java93
-rw-r--r--java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/ReferenceParameters.java6
-rw-r--r--java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeWire.java14
-rw-r--r--java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeAssemblyFactory.java13
-rw-r--r--java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/EndpointReferenceImpl.java186
-rw-r--r--java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/ReferenceParametersImpl.java8
-rw-r--r--java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeComponentReferenceImpl.java2
-rw-r--r--java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeComponentServiceImpl.java10
-rw-r--r--java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeWireImpl2.java19
-rw-r--r--java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/CallableReferenceExt.java4
-rw-r--r--java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/CompositeContext.java6
-rw-r--r--java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/CallableReferenceImpl.java34
-rw-r--r--java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/CompositeContextImpl.java7
-rw-r--r--java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/RequestContextImpl.java32
-rw-r--r--java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/ServiceReferenceImpl.java3
-rw-r--r--java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CallbackInterfaceInterceptor.java5
-rw-r--r--java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/NonBlockingInterceptor.java13
-rw-r--r--java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/RuntimeWireInvoker.java44
-rw-r--r--java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/ThreadMessageContext.java4
-rw-r--r--java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/CallbackReferenceImpl.java109
-rw-r--r--java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/JDKCallbackInvocationHandler.java5
-rw-r--r--java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/JDKInvocationHandler.java60
-rw-r--r--java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/MessageImpl.java23
-rw-r--r--java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/impl/ConversationalScopeContainer.java3
-rw-r--r--java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ConversationIDObjectFactory.java3
-rw-r--r--java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaCallbackRuntimeWireProcessor.java10
-rw-r--r--java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaComponentContextProvider.java4
-rw-r--r--java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationInvoker.java15
34 files changed, 335 insertions, 477 deletions
diff --git a/java/sca/itest/pom.xml b/java/sca/itest/pom.xml
index 16b26438b1..f3bc903087 100644
--- a/java/sca/itest/pom.xml
+++ b/java/sca/itest/pom.xml
@@ -52,15 +52,19 @@
<module>callback-api</module>
<module>callback-basic</module>
<module>callback-complex-type</module>
- <module>callback-id</module>
<module>callback-multiple-wires</module>
<module>callback-separatethread</module>
+
+ <!-- not supported in OASIS
+ <module>callback-id</module>
<module>callback-set-callback</module>
<module>callback-set-conversation</module>
+ <module>conversations</module>
+ -->
<module>component-type</module>
<module>contribution-folder</module>
<module>contribution-zip</module>
- <module>conversations</module>
+
<!--module>definitions-multiple</module-->
<module>distribution</module>
<module>exceptions</module>
diff --git a/java/sca/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/RuntimeSCAReferenceBindingProvider.java b/java/sca/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/RuntimeSCAReferenceBindingProvider.java
index 23b3e60fea..d1667f7645 100644
--- a/java/sca/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/RuntimeSCAReferenceBindingProvider.java
+++ b/java/sca/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/RuntimeSCAReferenceBindingProvider.java
@@ -23,6 +23,8 @@ import java.net.URI;
import java.util.logging.Logger;
import org.apache.tuscany.sca.assembly.DistributedSCABinding;
+import org.apache.tuscany.sca.assembly.Endpoint2;
+import org.apache.tuscany.sca.assembly.EndpointReference2;
import org.apache.tuscany.sca.assembly.OptimizableBinding;
import org.apache.tuscany.sca.assembly.SCABinding;
import org.apache.tuscany.sca.assembly.SCABindingFactory;
@@ -35,7 +37,6 @@ import org.apache.tuscany.sca.invocation.Invoker;
import org.apache.tuscany.sca.provider.BindingProviderFactory;
import org.apache.tuscany.sca.provider.ProviderFactoryExtensionPoint;
import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
-import org.apache.tuscany.sca.runtime.EndpointReference;
import org.apache.tuscany.sca.runtime.RuntimeComponent;
import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
import org.apache.tuscany.sca.runtime.RuntimeComponentService;
@@ -185,13 +186,13 @@ public class RuntimeSCAReferenceBindingProvider implements ReferenceBindingProvi
}
private Invoker getInvoker(RuntimeWire wire, Operation operation) {
- EndpointReference target = wire.getTarget();
+ Endpoint2 target = wire.getEndpoint();
if (target != null) {
- RuntimeComponentService service = (RuntimeComponentService)target.getContract();
+ RuntimeComponentService service = (RuntimeComponentService)target.getService();
if (service != null) { // not a callback wire
SCABinding scaBinding = service.getBinding(SCABinding.class);
InvocationChain chain =
- service.getInvocationChain(scaBinding, wire.getSource().getInterfaceContract(), operation);
+ service.getInvocationChain(scaBinding, wire.getEndpointReference().getInterfaceContract(), operation);
return chain == null ? null : new SCABindingInvoker(chain);
}
}
diff --git a/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2BindingInvoker.java b/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2BindingInvoker.java
index 325bd3a09b..9040ef9e4a 100644
--- a/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2BindingInvoker.java
+++ b/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2BindingInvoker.java
@@ -39,6 +39,7 @@ import org.apache.axis2.client.OperationClient;
import org.apache.axis2.client.Options;
import org.apache.axis2.context.MessageContext;
import org.apache.axis2.transport.http.HTTPConstants;
+import org.apache.tuscany.sca.assembly.Endpoint2;
import org.apache.tuscany.sca.binding.ws.WebServiceBinding;
import org.apache.tuscany.sca.binding.ws.axis2.policy.authentication.token.Axis2TokenAuthenticationPolicy;
import org.apache.tuscany.sca.binding.ws.axis2.policy.configurator.Axis2BindingBasicAuthenticationConfigurator;
@@ -218,8 +219,9 @@ public class Axis2BindingInvoker implements Invoker, DataExchangeSemantics {
final OperationClient operationClient = serviceClient.getServiceClient().createClient(wsdlOperationName);
operationClient.setOptions(options);
- ReferenceParameters parameters = msg.getFrom().getReferenceParameters();
+ Endpoint2 callbackEndpoint = msg.getFrom().getCallbackEndpoint();
+/* TODO - EPR - not required for OASIS
// set callback endpoint and callback ID for WS-Addressing header
EndpointReference fromEPR = null;
org.apache.tuscany.sca.runtime.EndpointReference callbackEPR = parameters.getCallbackReference();
@@ -244,10 +246,12 @@ public class Axis2BindingInvoker implements Invoker, DataExchangeSemantics {
//FIXME: serialize conversation ID to XML in case it is not a string
fromEPR.addReferenceParameter(CONVERSATION_ID_REFPARM_QN, conversationId.toString());
}
+*/
// add WS-Addressing header
//FIXME: is there any way to use the Axis2 addressing support for this?
- if (fromEPR != null) {
+ if (callbackEndpoint != null) {
+ EndpointReference fromEPR = new EndpointReference(callbackEndpoint.getBinding().getURI());
SOAPEnvelope sev = requestMC.getEnvelope();
SOAPHeader sh = sev.getHeader();
OMElement epr =
@@ -267,9 +271,9 @@ public class Axis2BindingInvoker implements Invoker, DataExchangeSemantics {
// if target endpoint was not specified when this invoker was created,
// use dynamically specified target endpoint passed in on this call
if (options.getTo() == null) {
- org.apache.tuscany.sca.runtime.EndpointReference ep = msg.getTo();
+ Endpoint2 ep = msg.getTo();
if (ep != null) {
- requestMC.setTo(new EndpointReference(ep.getURI()));
+ requestMC.setTo(new EndpointReference(ep.getBinding().getURI()));
} else {
throw new RuntimeException("Unable to determine destination endpoint");
}
diff --git a/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceProvider.java b/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceProvider.java
index 6846d61c5b..147150f75b 100644
--- a/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceProvider.java
+++ b/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceProvider.java
@@ -80,6 +80,8 @@ import org.apache.axis2.transport.jms.JMSUtils;
import org.apache.tuscany.sca.assembly.AbstractContract;
import org.apache.tuscany.sca.assembly.AssemblyFactory;
import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.Endpoint2;
+import org.apache.tuscany.sca.assembly.EndpointReference2;
import org.apache.tuscany.sca.binding.ws.WebServiceBinding;
import org.apache.tuscany.sca.binding.ws.axis2.Axis2ServiceClient.URIResolverImpl;
import org.apache.tuscany.sca.binding.ws.axis2.policy.authentication.token.Axis2TokenAuthenticationPolicy;
@@ -100,7 +102,6 @@ import org.apache.tuscany.sca.invocation.MessageFactory;
import org.apache.tuscany.sca.policy.PolicySet;
import org.apache.tuscany.sca.policy.PolicySubject;
import org.apache.tuscany.sca.policy.authentication.basic.BasicAuthenticationPolicy;
-import org.apache.tuscany.sca.runtime.EndpointReference;
import org.apache.tuscany.sca.runtime.ReferenceParameters;
import org.apache.tuscany.sca.runtime.RuntimeComponent;
import org.apache.tuscany.sca.runtime.RuntimeComponentService;
@@ -130,6 +131,8 @@ public class Axis2ServiceProvider {
private WebServiceBinding wsBinding;
private ServletHost servletHost;
private MessageFactory messageFactory;
+ private FactoryExtensionPoint modelFactories;
+ private RuntimeAssemblyFactory assemblyFactory;
private ConfigurationContext configContext;
private JMSSender jmsSender;
private JMSListener jmsListener;
@@ -236,6 +239,8 @@ public class Axis2ServiceProvider {
this.wsBinding = wsBinding;
this.servletHost = servletHost;
this.messageFactory = messageFactory;
+ this.modelFactories = modelFactories;
+ this.assemblyFactory = (RuntimeAssemblyFactory)modelFactories.getFactory(AssemblyFactory.class);
final boolean isRampartRequired = AxisPolicyHelper.isRampartRequired(wsBinding);
try {
@@ -330,13 +335,15 @@ public class Axis2ServiceProvider {
}
}
- // FIXME: [rfeng] Need to have a better way
- private EndpointReference createEndpointReference(String uri) {
+ // TODO - EPR - what to do with URI
+ /*
+ private EndpointReference2 createEndpointReference() {
FactoryExtensionPoint factories =
component.getComponentContext().getExtensionPointRegistry().getExtensionPoint(FactoryExtensionPoint.class);
RuntimeAssemblyFactory factory = (RuntimeAssemblyFactory)factories.getFactory(AssemblyFactory.class);
- return factory.createEndpointReference(uri);
+ return factory.createEndpointReference();
}
+ */
private String computeEndpointURI(String uri, ServletHost servletHost) {
@@ -762,6 +769,8 @@ public class Axis2ServiceProvider {
callbackAddress = callbackAddrElement.getText();
}
}
+
+/* TODO - EPR - not required by OASIS
OMElement params = from.getFirstChildWithName(QNAME_WSA_REFERENCE_PARAMETERS);
if (params != null) {
OMElement convIDElement =
@@ -777,6 +786,7 @@ public class Axis2ServiceProvider {
callbackID = callbackIDElement.getText();
}
}
+*/
}
// get policy specified headers
@@ -797,14 +807,16 @@ public class Axis2ServiceProvider {
fillQoSContext(msg, inMC);
// if reference parameters are needed, create a new "From" EPR to hold them
- EndpointReference from = null;
- ReferenceParameters parameters = null;
- if (callbackAddress != null || callbackID != null || conversationID != null) {
- from = createEndpointReference(null);
- parameters = from.getReferenceParameters();
+ EndpointReference2 from = null;
+ if (callbackAddress != null ) {
+ from = assemblyFactory.createEndpointReference();
+ Endpoint2 fromEndpoint = assemblyFactory.createEndpoint();
+ from.setTargetEndpoint(fromEndpoint);
+ // TODO - EPR - need to set callback address
msg.setFrom(from);
}
+ /* TODO - EPR - not required in OASIS
// set the reference parameters into the "From" EPR
if (callbackAddress != null) {
parameters.setCallbackReference(createEndpointReference(callbackAddress));
@@ -819,6 +831,7 @@ public class Axis2ServiceProvider {
if (basicAuthenticationPolicy != null) {
Axis2BindingBasicAuthenticationConfigurator.parseHTTPHeader(inMC, msg, basicAuthenticationPolicy);
}
+ */
// find the runtime wire and invoke it with the message
RuntimeWire wire = ((RuntimeComponentService)contract).getRuntimeWire(getBinding());
diff --git a/java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/wire/DataBindingRuntimeWireProcessor.java b/java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/wire/DataBindingRuntimeWireProcessor.java
index a255763fbf..90b6f24872 100644
--- a/java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/wire/DataBindingRuntimeWireProcessor.java
+++ b/java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/wire/DataBindingRuntimeWireProcessor.java
@@ -130,8 +130,8 @@ public class DataBindingRuntimeWireProcessor implements RuntimeWireProcessor {
}
public void process(RuntimeWire wire) {
- InterfaceContract sourceContract = wire.getSource().getInterfaceContract();
- InterfaceContract targetContract = wire.getTarget().getInterfaceContract();
+ InterfaceContract sourceContract = wire.getEndpointReference().getInterfaceContract();
+ InterfaceContract targetContract = wire.getEndpoint().getInterfaceContract();
if (targetContract == null) {
targetContract = sourceContract;
}
@@ -160,7 +160,7 @@ public class DataBindingRuntimeWireProcessor implements RuntimeWireProcessor {
}
if (interceptor != null) {
String phase =
- (wire.getSource().getContract() instanceof ComponentReference) ? Phase.REFERENCE_INTERFACE
+ (wire.getEndpointReference().getReference() instanceof ComponentReference) ? Phase.REFERENCE_INTERFACE
: Phase.SERVICE_INTERFACE;
chain.addInterceptor(phase, interceptor);
}
diff --git a/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Message.java b/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Message.java
index 938a834c21..bb7dbca046 100644
--- a/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Message.java
+++ b/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Message.java
@@ -20,8 +20,9 @@ package org.apache.tuscany.sca.invocation;
import java.util.List;
+import org.apache.tuscany.sca.assembly.Endpoint2;
+import org.apache.tuscany.sca.assembly.EndpointReference2;
import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.runtime.EndpointReference;
/**
* Represents a request, response, or exception flowing through a wire
@@ -46,25 +47,25 @@ public interface Message {
* Get the end point reference of the source reference
* @return The end point reference of the reference originating the message
*/
- EndpointReference getFrom();
+ EndpointReference2 getFrom();
/**
* Set the end point reference of the reference originating the message
* @param from The end point reference of the reference originating the message
*/
- void setFrom(EndpointReference from);
+ void setFrom(EndpointReference2 from);
/**
* Get the end point reference of target service
* @return The end point reference of the service that the message targets
*/
- EndpointReference getTo();
+ Endpoint2 getTo();
/**
* Set the end point reference of target service
* @param to The end point reference of the service that the message targets
*/
- void setTo(EndpointReference to);
+ void setTo(Endpoint2 to);
/**
* Returns the id of the message
diff --git a/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/EndpointReference.java b/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/EndpointReference.java
deleted file mode 100644
index b6fafa5fb6..0000000000
--- a/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/EndpointReference.java
+++ /dev/null
@@ -1,93 +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.runtime;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.assembly.Contract;
-import org.apache.tuscany.sca.interfacedef.InterfaceContract;
-
-/**
- * The endpoint reference for a component service or reference
- *
- * @version $Rev$ $Date$
- */
-public interface EndpointReference extends Cloneable {
- /**
- * Get the component for the endpoint
- * @return The component, null of the EPR is for a non-SCA service
- */
- RuntimeComponent getComponent();
-
- /**
- * Get the component service or reference for the endpoint
- * @return The component service or reference, null if the EPR is for a non-SCA service
- */
- Contract getContract();
-
- /**
- * Get the binding for the endpoint
- * @return The binding
- */
- Binding getBinding();
-
- /**
- * Get the interface contract for the endpoint
- * @return The interface contract
- */
- InterfaceContract getInterfaceContract();
-
- /**
- * Update the interface contract for the endpoint
- * @param interfaceContract The updated interface contract
- */
- void setInterfaceContract(InterfaceContract interfaceContract);
-
- /**
- * Get the URI for this endpoint
- * @return The URI of the endpoint
- */
- String getURI();
-
- /**
- * Set the URI for this endpoint
- * @param uri The new URI of the endpoint
- */
- void setURI(String uri);
-
- /**
- * Get the callback endpoint for this endpoint
- * @return The callback endpoint for this endpoint
- */
- EndpointReference getCallbackEndpoint();
-
- /**
- * Set the callback endpoint for this endpoint
- * @param callbackEndpoint The new callback endpoint for this endpoint
- */
- void setCallbackEndpoint(EndpointReference callbackEndpoint);
-
- Object clone() throws CloneNotSupportedException;
-
- void setReferenceParameters(ReferenceParameters parameters);
- ReferenceParameters getReferenceParameters();
-
- void mergeEndpoint(EndpointReference epr);
-
-}
diff --git a/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/ReferenceParameters.java b/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/ReferenceParameters.java
index 0e19538aff..71768807c4 100644
--- a/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/ReferenceParameters.java
+++ b/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/ReferenceParameters.java
@@ -19,6 +19,8 @@
package org.apache.tuscany.sca.runtime;
+import org.apache.tuscany.sca.assembly.EndpointReference2;
+
/**
* Parameters for the EndPointReference
*
@@ -61,9 +63,9 @@ public interface ReferenceParameters extends Cloneable {
*/
void setCallbackObjectID(Object callbackObjectID);
- EndpointReference getCallbackReference();
+ EndpointReference2 getCallbackReference();
- void setCallbackReference(EndpointReference callback);
+ void setCallbackReference(EndpointReference2 callback);
Object clone() throws CloneNotSupportedException;
}
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/RuntimeWire.java
index 7366d511ae..fbd47fd0ea 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/RuntimeWire.java
@@ -22,6 +22,7 @@ package org.apache.tuscany.sca.runtime;
import java.lang.reflect.InvocationTargetException;
import java.util.List;
+import org.apache.tuscany.sca.assembly.Endpoint2;
import org.apache.tuscany.sca.assembly.EndpointReference2;
import org.apache.tuscany.sca.interfacedef.Operation;
import org.apache.tuscany.sca.invocation.InvocationChain;
@@ -45,20 +46,20 @@ public interface RuntimeWire extends Cloneable {
*
* @return The end point reference of the source
*/
- EndpointReference getSource();
+ // EndpointReference getSource();
/**
* Get the target of the wire
*
* @return The end point reference of the target
*/
- EndpointReference getTarget();
+ // EndpointReference getTarget();
/**
* Rebind the runtime wire with the given target
* @param target The target endpoint reference
*/
- void setTarget(EndpointReference target);
+ // void setTarget(EndpointReference target);
//==================================================================
@@ -70,6 +71,13 @@ public interface RuntimeWire extends Cloneable {
EndpointReference2 getEndpointReference();
/**
+ * return the endpoint that configured this wire
+ *
+ * @return the endpoint that configured this wire
+ */
+ Endpoint2 getEndpoint();
+
+ /**
* Force the invocation chains to be rebuilt
*/
void rebuild();
diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeAssemblyFactory.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeAssemblyFactory.java
index 27845b445c..8b03ea7a02 100644
--- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeAssemblyFactory.java
+++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeAssemblyFactory.java
@@ -20,25 +20,19 @@
package org.apache.tuscany.sca.core.assembly;
import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.assembly.Binding;
+
import org.apache.tuscany.sca.assembly.Component;
import org.apache.tuscany.sca.assembly.ComponentReference;
import org.apache.tuscany.sca.assembly.ComponentService;
-import org.apache.tuscany.sca.assembly.Contract;
import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
import org.apache.tuscany.sca.assembly.Endpoint2;
import org.apache.tuscany.sca.assembly.EndpointReference2;
import org.apache.tuscany.sca.core.ExtensionPointRegistry;
import org.apache.tuscany.sca.core.assembly.impl.RuntimeEndpointImpl;
-import org.apache.tuscany.sca.core.assembly.impl.EndpointReferenceImpl;
-import org.apache.tuscany.sca.core.assembly.impl.ReferenceParametersImpl;
import org.apache.tuscany.sca.core.assembly.impl.RuntimeComponentImpl;
import org.apache.tuscany.sca.core.assembly.impl.RuntimeComponentReferenceImpl;
import org.apache.tuscany.sca.core.assembly.impl.RuntimeComponentServiceImpl;
-import org.apache.tuscany.sca.interfacedef.InterfaceContract;
-import org.apache.tuscany.sca.runtime.EndpointReference;
-import org.apache.tuscany.sca.runtime.ReferenceParameters;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
+
/**
* The runtime version of assembly factory
@@ -65,6 +59,7 @@ public class RuntimeAssemblyFactory extends DefaultAssemblyFactory implements As
return new RuntimeComponentServiceImpl();
}
+ /* TODO - EPR - remove now
// FIXME: [rfeng] We need to find a more consistent story to deal with EPR, EP and CallableReference
public EndpointReference createEndpointReference(String uri) {
return new EndpointReferenceImpl(uri);
@@ -76,10 +71,12 @@ public class RuntimeAssemblyFactory extends DefaultAssemblyFactory implements As
InterfaceContract interfaceContract) {
return new EndpointReferenceImpl(component, contract, binding, interfaceContract);
}
+
public ReferenceParameters createReferenceParameters() {
return new ReferenceParametersImpl();
}
+ */
@Override
public Endpoint2 createEndpoint() {
diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/EndpointReferenceImpl.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/EndpointReferenceImpl.java
deleted file mode 100644
index 022cac398a..0000000000
--- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/EndpointReferenceImpl.java
+++ /dev/null
@@ -1,186 +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.core.assembly.impl;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.assembly.Contract;
-import org.apache.tuscany.sca.interfacedef.InterfaceContract;
-import org.apache.tuscany.sca.runtime.EndpointReference;
-import org.apache.tuscany.sca.runtime.ReferenceParameters;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-
-/**
- * @version $Rev$ $Date$
- */
-public class EndpointReferenceImpl implements EndpointReference {
- private RuntimeComponent component;
- private Contract contract;
- private Binding binding;
- private InterfaceContract interfaceContract;
- private String uri;
- private EndpointReference callbackEndpoint;
- private ReferenceParameters parameters = new ReferenceParametersImpl();
-
- /**
- * @param component
- * @param contract
- * @param binding
- * @param interfaceContract
- */
- public EndpointReferenceImpl(RuntimeComponent component,
- Contract contract,
- Binding binding,
- InterfaceContract interfaceContract) {
- super();
- this.component = component;
- this.contract = contract;
- this.binding = binding;
- this.interfaceContract = interfaceContract;
- this.uri = (component != null ? component.getURI() : "") + '/' +
- (contract != null ? contract.getName() : "");
- }
-
- /**
- * @param uri
- */
- public EndpointReferenceImpl(String uri) {
- super();
- this.uri = uri;
- }
-
- public Binding getBinding() {
- return binding;
- }
-
- public void setBinding(Binding binding) {
- this.binding = binding;
- }
-
- public RuntimeComponent getComponent() {
- return component;
- }
-
- public void setComponent(RuntimeComponent component) {
- this.component = component;
- }
-
- public Contract getContract() {
- return contract;
- }
-
- public void setContract(Contract contract) {
- this.contract = contract;
- }
-
- public InterfaceContract getInterfaceContract() {
- return interfaceContract;
- }
-
- public void setInterfaceContract(InterfaceContract interfaceContract) {
- this.interfaceContract = interfaceContract;
- }
-
- public String getURI() {
- return uri;
- }
-
- public void setURI(String uri) {
- this.uri = uri;
- }
-
- public EndpointReference getCallbackEndpoint() {
- return callbackEndpoint;
- }
-
- public void setCallbackEndpoint(EndpointReference callbackEndpoint) {
- this.callbackEndpoint = callbackEndpoint;
- }
-
- @Override
- public int hashCode() {
- final int PRIME = 31;
- int result = 1;
- result = PRIME * result + ((uri == null) ? 0 : uri.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- final EndpointReferenceImpl other = (EndpointReferenceImpl)obj;
- if (uri == null) {
- if (other.uri != null) {
- return false;
- }
- } else if (!uri.equals(other.uri)) {
- return false;
- }
- return true;
- }
-
- /**
- * @see java.lang.Object#clone()
- */
- @Override
- public Object clone() throws CloneNotSupportedException {
- EndpointReferenceImpl copy = (EndpointReferenceImpl)super.clone();
- /* [nash] no need to copy callback endpoint
- if (callbackEndpoint != null) {
- copy.callbackEndpoint = (EndpointReference)callbackEndpoint.clone();
- }
- */
- if (parameters != null) {
- copy.parameters = (ReferenceParameters)parameters.clone();
- }
- return copy;
- }
-
- /**
- * @return the parameters
- */
- public ReferenceParameters getReferenceParameters() {
- return parameters;
- }
-
- /**
- * @param parameters the parameters to set
- */
- public void setReferenceParameters(ReferenceParameters parameters) {
- this.parameters = parameters;
- }
-
- public void mergeEndpoint(EndpointReference epr) {
- this.component = epr.getComponent();
- this.contract = epr.getContract();
- this.binding = epr.getBinding();
- this.interfaceContract = epr.getInterfaceContract();
- this.uri = epr.getURI();
- this.callbackEndpoint = epr.getCallbackEndpoint();
- }
-
-}
diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/ReferenceParametersImpl.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/ReferenceParametersImpl.java
index 0170af54fc..4413bae39c 100644
--- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/ReferenceParametersImpl.java
+++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/ReferenceParametersImpl.java
@@ -19,7 +19,7 @@
package org.apache.tuscany.sca.core.assembly.impl;
-import org.apache.tuscany.sca.runtime.EndpointReference;
+import org.apache.tuscany.sca.assembly.EndpointReference2;
import org.apache.tuscany.sca.runtime.ReferenceParameters;
/**
@@ -28,7 +28,7 @@ import org.apache.tuscany.sca.runtime.ReferenceParameters;
public class ReferenceParametersImpl implements ReferenceParameters {
private Object callbackID;
private Object conversationID;
- private EndpointReference callbackReference;
+ private EndpointReference2 callbackReference;
private Object callbackObjectID;
/**
@@ -59,13 +59,13 @@ public class ReferenceParametersImpl implements ReferenceParameters {
/**
* @see org.apache.tuscany.sca.runtime.ReferenceParameters#getCallbackReference()
*/
- public EndpointReference getCallbackReference() {
+ public EndpointReference2 getCallbackReference() {
return callbackReference;
}
/**
* @see org.apache.tuscany.sca.runtime.ReferenceParameters#setCallback(java.lang.Object)
*/
- public void setCallbackReference(EndpointReference callback) {
+ public void setCallbackReference(EndpointReference2 callback) {
this.callbackReference = callback;
}
diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeComponentReferenceImpl.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeComponentReferenceImpl.java
index dbdba54dc0..2026754f57 100644
--- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeComponentReferenceImpl.java
+++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeComponentReferenceImpl.java
@@ -63,7 +63,7 @@ public class RuntimeComponentReferenceImpl extends ComponentReferenceImpl implem
// TODO - EPR - shouldn't rely on this anymore
public RuntimeWire getRuntimeWire(Binding binding) {
for (RuntimeWire wire : getRuntimeWires()) {
- if (wire.getSource().getBinding() == binding) {
+ if (wire.getEndpointReference().getBinding() == binding) {
return wire;
}
}
diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeComponentServiceImpl.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeComponentServiceImpl.java
index 2cbd72f218..776d35327d 100644
--- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeComponentServiceImpl.java
+++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeComponentServiceImpl.java
@@ -56,7 +56,7 @@ public class RuntimeComponentServiceImpl extends ComponentServiceImpl implements
public RuntimeWire getRuntimeWire(Binding binding) {
for (RuntimeWire wire : wires) {
- if (wire.getTarget().getBinding() == binding) {
+ if (wire.getEndpoint().getBinding() == binding) {
return wire;
}
}
@@ -68,11 +68,11 @@ public class RuntimeComponentServiceImpl extends ComponentServiceImpl implements
if (wire == null) {
return null;
}
- if (interfaceContract != null && interfaceContract != wire.getSource().getInterfaceContract()) {
+ if (interfaceContract != null && interfaceContract != wire.getEndpointReference().getInterfaceContract()) {
try {
// FIXME: [rfeng] We could avoid clone() using a better comparison of the two interface contracts
wire = (RuntimeWire)wire.clone();
- wire.getSource().setInterfaceContract(interfaceContract);
+ wire.getEndpointReference().setInterfaceContract(interfaceContract);
wire.rebuild();
} catch (CloneNotSupportedException e) {
throw new ServiceRuntimeException(e);
@@ -112,11 +112,11 @@ public class RuntimeComponentServiceImpl extends ComponentServiceImpl implements
if (wire == null) {
return null;
}
- if (interfaceContract != null && interfaceContract != wire.getSource().getInterfaceContract()) {
+ if (interfaceContract != null && interfaceContract != wire.getEndpointReference().getInterfaceContract()) {
try {
// FIXME: [rfeng] We could avoid clone() using a better comparison of the two interface contracts
wire = (RuntimeWire)wire.clone();
- wire.getSource().setInterfaceContract(interfaceContract);
+ wire.getEndpointReference().setInterfaceContract(interfaceContract);
wire.rebuild();
} catch (CloneNotSupportedException e) {
throw new ServiceRuntimeException(e);
diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeWireImpl2.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeWireImpl2.java
index ebe8c1b9ed..6f521686f2 100644
--- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeWireImpl2.java
+++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeWireImpl2.java
@@ -60,7 +60,6 @@ import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
import org.apache.tuscany.sca.provider.ReferenceBindingProviderRRB;
import org.apache.tuscany.sca.provider.ServiceBindingProvider;
import org.apache.tuscany.sca.provider.ServiceBindingProviderRRB;
-import org.apache.tuscany.sca.runtime.EndpointReference;
import org.apache.tuscany.sca.runtime.RuntimeComponent;
import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
import org.apache.tuscany.sca.runtime.RuntimeComponentService;
@@ -89,7 +88,7 @@ public class RuntimeWireImpl2 implements RuntimeWire {
// the following is a very simple cache that avoids re-cloning a wire
// when consecutive callbacks to the same endpoint are made
- private EndpointReference lastCallback;
+ private Endpoint2 lastCallback;
private RuntimeWire cachedWire;
private boolean wireReserved;
private RuntimeWireImpl2 clonedFrom;
@@ -441,6 +440,7 @@ public class RuntimeWireImpl2 implements RuntimeWire {
// TODO - EPR remove when we convert fully over to EndpointReference2
// TODO - remove. Just here during development
+/*
static EndpointReference epr;
public EndpointReference getSource() {
@@ -482,6 +482,7 @@ public class RuntimeWireImpl2 implements RuntimeWire {
// TODO - can we use the idea of setTarget to rebuild the wire?
}
+*/
// ===================================================================
@@ -493,12 +494,16 @@ public class RuntimeWireImpl2 implements RuntimeWire {
// TODO - cheating here as I fixed the RuntimeComponentService code
// to call this when it resets the interface contract
- endpointReference.setInterfaceContract(epr.getInterfaceContract());
+ //endpointReference.setInterfaceContract(epr.getInterfaceContract());
}
public EndpointReference2 getEndpointReference() {
return endpointReference;
}
+
+ public Endpoint2 getEndpoint() {
+ return endpoint;
+ }
/**
* Add the interceptor for a reference binding
@@ -635,8 +640,10 @@ public class RuntimeWireImpl2 implements RuntimeWire {
return conversationManager;
}
- public synchronized RuntimeWire lookupCache(EndpointReference callback) {
- if (lastCallback != null && callback.getURI().equals(lastCallback.getURI()) && !wireReserved) {
+ public synchronized RuntimeWire lookupCache(Endpoint2 callback) {
+ if (lastCallback != null &&
+ callback.getURI().equals(lastCallback.getURI()) &&
+ !wireReserved) {
wireReserved = true;
return cachedWire;
} else {
@@ -644,7 +651,7 @@ public class RuntimeWireImpl2 implements RuntimeWire {
}
}
- public synchronized void addToCache(EndpointReference callback, RuntimeWire clonedWire) {
+ public synchronized void addToCache(Endpoint2 callback, RuntimeWire clonedWire) {
((RuntimeWireImpl2)clonedWire).setClonedFrom(this);
lastCallback = callback;
cachedWire = clonedWire;
diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/CallableReferenceExt.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/CallableReferenceExt.java
index c0217e7336..c0464cc153 100644
--- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/CallableReferenceExt.java
+++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/CallableReferenceExt.java
@@ -24,8 +24,8 @@ import java.io.IOException;
import javax.xml.stream.XMLStreamReader;
+import org.apache.tuscany.sca.assembly.EndpointReference2;
import org.apache.tuscany.sca.core.conversation.ConversationExt;
-import org.apache.tuscany.sca.runtime.EndpointReference;
import org.apache.tuscany.sca.runtime.RuntimeWire;
import org.oasisopen.sca.CallableReference;
@@ -58,7 +58,7 @@ public interface CallableReferenceExt<B> extends CallableReference<B>, Externali
/**
* @return
*/
- EndpointReference getEndpointReference();
+ EndpointReference2 getEndpointReference();
/**
* @return
diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/CompositeContext.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/CompositeContext.java
index 29c4dfd362..e67872567c 100644
--- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/CompositeContext.java
+++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/CompositeContext.java
@@ -30,6 +30,7 @@ import javax.xml.stream.XMLStreamReader;
import org.apache.tuscany.sca.assembly.Component;
import org.apache.tuscany.sca.assembly.ComponentReference;
import org.apache.tuscany.sca.assembly.ComponentService;
+import org.apache.tuscany.sca.assembly.Endpoint2;
import org.apache.tuscany.sca.core.ExtensionPointRegistry;
import org.apache.tuscany.sca.core.assembly.CompositeActivator;
import org.apache.tuscany.sca.core.conversation.ConversationManager;
@@ -38,7 +39,6 @@ import org.apache.tuscany.sca.core.invocation.ThreadMessageContext;
import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
import org.apache.tuscany.sca.invocation.Message;
-import org.apache.tuscany.sca.runtime.EndpointReference;
import org.apache.tuscany.sca.runtime.RuntimeComponent;
import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
import org.apache.tuscany.sca.runtime.RuntimeComponentService;
@@ -146,11 +146,11 @@ public abstract class CompositeContext {
public static RuntimeComponent getCurrentComponent() {
Message message = ThreadMessageContext.getMessageContext();
if (message != null) {
- EndpointReference to = message.getTo();
+ Endpoint2 to = message.getTo();
if (to == null) {
return null;
}
- RuntimeComponent component = message.getTo().getComponent();
+ RuntimeComponent component = (RuntimeComponent) message.getTo().getComponent();
return component;
}
return null;
diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/CallableReferenceImpl.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/CallableReferenceImpl.java
index e0ef3d5c97..b39cbe6d17 100644
--- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/CallableReferenceImpl.java
+++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/CallableReferenceImpl.java
@@ -27,19 +27,23 @@ import java.util.UUID;
import javax.xml.stream.XMLStreamReader;
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
import org.apache.tuscany.sca.assembly.Binding;
import org.apache.tuscany.sca.assembly.Component;
import org.apache.tuscany.sca.assembly.ComponentService;
import org.apache.tuscany.sca.assembly.CompositeService;
+import org.apache.tuscany.sca.assembly.Endpoint2;
import org.apache.tuscany.sca.assembly.EndpointReference2;
import org.apache.tuscany.sca.assembly.OptimizableBinding;
import org.apache.tuscany.sca.assembly.Reference;
import org.apache.tuscany.sca.assembly.SCABinding;
import org.apache.tuscany.sca.assembly.Service;
import org.apache.tuscany.sca.assembly.builder.BindingBuilderExtension;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.FactoryExtensionPoint;
import org.apache.tuscany.sca.core.assembly.CompositeActivator;
+import org.apache.tuscany.sca.core.assembly.RuntimeAssemblyFactory;
import org.apache.tuscany.sca.core.assembly.impl.CompositeActivatorImpl2;
-import org.apache.tuscany.sca.core.assembly.impl.EndpointReferenceImpl;
import org.apache.tuscany.sca.core.assembly.impl.ReferenceParametersImpl;
import org.apache.tuscany.sca.core.context.CallableReferenceExt;
import org.apache.tuscany.sca.core.context.ComponentContextExt;
@@ -52,7 +56,6 @@ import org.apache.tuscany.sca.core.invocation.ProxyFactory;
import org.apache.tuscany.sca.interfacedef.Interface;
import org.apache.tuscany.sca.interfacedef.InterfaceContract;
import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
-import org.apache.tuscany.sca.runtime.EndpointReference;
import org.apache.tuscany.sca.runtime.ReferenceParameters;
import org.apache.tuscany.sca.runtime.RuntimeComponent;
import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
@@ -88,6 +91,9 @@ public class CallableReferenceImpl<B> implements CallableReferenceExt<B> {
private transient RuntimeComponentReference clonedRef;
private transient ReferenceParameters refParams;
private transient XMLStreamReader xmlReader;
+
+ private FactoryExtensionPoint modelFactories;
+ protected RuntimeAssemblyFactory assemblyFactory;
/*
* Public constructor for Externalizable serialization/deserialization
@@ -116,6 +122,11 @@ public class CallableReferenceImpl<B> implements CallableReferenceExt<B> {
this.reference = reference;
this.endpointReference = endpointReference;
+ ExtensionPointRegistry registry = compositeActivator.getCompositeContext().getExtensionPointRegistry();
+ this.modelFactories = registry.getExtensionPoint(FactoryExtensionPoint.class);
+ this.assemblyFactory = (RuntimeAssemblyFactory)modelFactories.getFactory(AssemblyFactory.class);
+
+
// FIXME: The SCA Specification is not clear how we should handle multiplicity
// for CallableReference
if (this.endpointReference == null) {
@@ -164,8 +175,8 @@ public class CallableReferenceImpl<B> implements CallableReferenceExt<B> {
protected void bind(RuntimeWire wire) {
if (wire != null) {
- this.component = wire.getSource().getComponent();
- this.reference = (RuntimeComponentReference)wire.getSource().getContract();
+ this.component = (RuntimeComponent)wire.getEndpointReference().getComponent();
+ this.reference = (RuntimeComponentReference)wire.getEndpointReference().getReference();
this.endpointReference = wire.getEndpointReference();
this.compositeActivator = ((ComponentContextExt)component.getComponentContext()).getCompositeActivator();
this.conversationManager = this.compositeActivator.getCompositeContext().getConversationManager();
@@ -508,7 +519,7 @@ public class CallableReferenceImpl<B> implements CallableReferenceExt<B> {
}
// TODO - EPR - needs sorting out for new endpoint references
- public EndpointReference getEndpointReference() {
+ public EndpointReference2 getEndpointReference() {
try {
resolve();
@@ -517,9 +528,16 @@ public class CallableReferenceImpl<B> implements CallableReferenceExt<B> {
InterfaceContract sourceContract =
componentTypeRef == null ? reference.getInterfaceContract() : componentTypeRef.getInterfaceContract();
sourceContract = sourceContract.makeUnidirectional(false);
- EndpointReference epr = new EndpointReferenceImpl(component, reference, null /*binding*/, sourceContract);
- ReferenceParameters parameters = getReferenceParameters();
- epr.setReferenceParameters(parameters);
+
+ EndpointReference2 epr = assemblyFactory.createEndpointReference();
+ epr.setComponent(component);
+ epr.setReference(reference);
+ //epr.setBinding(binding);
+ epr.setInterfaceContract(sourceContract);
+
+ Endpoint2 endpoint = assemblyFactory.createEndpoint();
+ epr.setTargetEndpoint(endpoint);
+
return epr;
} catch (Exception e) {
throw new ServiceRuntimeException(e);
diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/CompositeContextImpl.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/CompositeContextImpl.java
index 72789b72a1..de0ea04fad 100644
--- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/CompositeContextImpl.java
+++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/CompositeContextImpl.java
@@ -39,6 +39,8 @@ import org.apache.tuscany.sca.assembly.Component;
import org.apache.tuscany.sca.assembly.ComponentReference;
import org.apache.tuscany.sca.assembly.ComponentService;
import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.Endpoint2;
+import org.apache.tuscany.sca.assembly.EndpointReference2;
import org.apache.tuscany.sca.assembly.Multiplicity;
import org.apache.tuscany.sca.assembly.OptimizableBinding;
import org.apache.tuscany.sca.assembly.Reference;
@@ -61,7 +63,6 @@ import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
import org.apache.tuscany.sca.invocation.Message;
-import org.apache.tuscany.sca.runtime.EndpointReference;
import org.apache.tuscany.sca.runtime.RuntimeComponent;
import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
import org.apache.tuscany.sca.runtime.RuntimeComponentService;
@@ -274,11 +275,11 @@ public class CompositeContextImpl extends CompositeContext {
public static RuntimeComponent getCurrentComponent() {
Message message = ThreadMessageContext.getMessageContext();
if (message != null) {
- EndpointReference to = message.getTo();
+ Endpoint2 to = message.getTo();
if (to == null) {
return null;
}
- RuntimeComponent component = message.getTo().getComponent();
+ RuntimeComponent component = (RuntimeComponent) message.getTo().getComponent();
return component;
}
return null;
diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/RequestContextImpl.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/RequestContextImpl.java
index 015c80c6fa..a701bd50b4 100644
--- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/RequestContextImpl.java
+++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/RequestContextImpl.java
@@ -22,6 +22,7 @@ import java.util.List;
import javax.security.auth.Subject;
+import org.apache.tuscany.sca.assembly.Endpoint2;
import org.apache.tuscany.sca.core.ExtensionPointRegistry;
import org.apache.tuscany.sca.core.context.CallableReferenceExt;
import org.apache.tuscany.sca.core.invocation.ExtensibleProxyFactory;
@@ -31,7 +32,6 @@ import org.apache.tuscany.sca.core.invocation.ThreadMessageContext;
import org.apache.tuscany.sca.core.invocation.impl.CallbackReferenceImpl;
import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
import org.apache.tuscany.sca.invocation.Message;
-import org.apache.tuscany.sca.runtime.EndpointReference;
import org.apache.tuscany.sca.runtime.ReferenceParameters;
import org.apache.tuscany.sca.runtime.RuntimeComponent;
import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
@@ -65,20 +65,23 @@ public class RequestContextImpl implements RequestContext {
}
public String getServiceName() {
- return ThreadMessageContext.getMessageContext().getTo().getContract().getName();
+ return ThreadMessageContext.getMessageContext().getTo().getService().getName();
}
public <B> CallableReference<B> getServiceReference() {
Message msgContext = ThreadMessageContext.getMessageContext();
// FIXME: [rfeng] Is this the service reference matching the caller side?
- EndpointReference to = msgContext.getTo();
- RuntimeComponentService service = (RuntimeComponentService) to.getContract();
+ Endpoint2 to = msgContext.getTo();
+ RuntimeComponentService service = (RuntimeComponentService) to.getService();
RuntimeComponent component = (RuntimeComponent) to.getComponent();
CallableReference<B> callableReference = component.getComponentContext().getCallableReference(null, component, service);
- ReferenceParameters parameters = msgContext.getFrom().getReferenceParameters();
- ((CallableReferenceExt<B>) callableReference).attachCallbackID(parameters.getCallbackID());
- ((CallableReferenceExt<B>) callableReference).attachConversation(parameters.getConversationID());
+
+ //TODO - EPR - not required for OASIS
+ //ReferenceParameters parameters = msgContext.getFrom().getReferenceParameters();
+ //((CallableReferenceExt<B>) callableReference).attachCallbackID(parameters.getCallbackID());
+ //((CallableReferenceExt<B>) callableReference).attachConversation(parameters.getConversationID());
+
return callableReference;
}
@@ -93,8 +96,8 @@ public class RequestContextImpl implements RequestContext {
@SuppressWarnings("unchecked")
public <CB> CallableReference<CB> getCallbackReference() {
Message msgContext = ThreadMessageContext.getMessageContext();
- EndpointReference to = msgContext.getTo();
- RuntimeComponentService service = (RuntimeComponentService) to.getContract();
+ Endpoint2 to = msgContext.getTo();
+ RuntimeComponentService service = (RuntimeComponentService) to.getService();
RuntimeComponentReference callbackReference = (RuntimeComponentReference)service.getCallbackReference();
if (callbackReference == null) {
return null;
@@ -106,11 +109,12 @@ public class RequestContextImpl implements RequestContext {
CallbackReferenceImpl ref = CallbackReferenceImpl.newInstance(javaClass, proxyFactory, wires);
if (ref != null) {
//ref.resolveTarget();
- ReferenceParameters parameters = msgContext.getFrom().getReferenceParameters();
- ref.attachCallbackID(parameters.getCallbackID());
- if (ref.getConversation() != null) {
- ref.attachConversationID(parameters.getConversationID());
- }
+ // TODO - EPR - not required for OASIS
+ //ReferenceParameters parameters = msgContext.getFrom().getReferenceParameters();
+ //ref.attachCallbackID(parameters.getCallbackID());
+ //if (ref.getConversation() != null) {
+ // ref.attachConversationID(parameters.getConversationID());
+ //}
}
return ref;
}
diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/ServiceReferenceImpl.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/ServiceReferenceImpl.java
index 52f506c6cd..265b08ed12 100644
--- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/ServiceReferenceImpl.java
+++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/ServiceReferenceImpl.java
@@ -27,7 +27,6 @@ import org.apache.tuscany.sca.core.context.CallableReferenceExt;
import org.apache.tuscany.sca.core.context.ServiceReferenceExt;
import org.apache.tuscany.sca.core.conversation.ConversationState;
import org.apache.tuscany.sca.core.invocation.ProxyFactory;
-import org.apache.tuscany.sca.runtime.EndpointReference;
import org.apache.tuscany.sca.runtime.ReferenceParameters;
import org.apache.tuscany.sca.runtime.RuntimeComponent;
import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
@@ -118,6 +117,7 @@ public class ServiceReferenceImpl<B> extends CallableReferenceImpl<B> implements
this.callback = callback;
}
+/* TODO - EPR - not required in OASIS
@Override
protected ReferenceParameters getReferenceParameters() {
ReferenceParameters parameters = super.getReferenceParameters();
@@ -133,4 +133,5 @@ public class ServiceReferenceImpl<B> extends CallableReferenceImpl<B> implements
}
return parameters;
}
+*/
}
diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CallbackInterfaceInterceptor.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CallbackInterfaceInterceptor.java
index 1ee922144f..e6bee6b8d9 100644
--- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CallbackInterfaceInterceptor.java
+++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CallbackInterfaceInterceptor.java
@@ -37,13 +37,18 @@ public class CallbackInterfaceInterceptor implements Interceptor {
}
public Message invoke(Message msg) {
+
+ /* TODO - EPR - not required for OASIS
ReferenceParameters parameters = msg.getFrom().getReferenceParameters();
if (parameters.getCallbackObjectID() != null || parameters.getCallbackReference() != msg.getFrom()
.getCallbackEndpoint()) {
+ */
return next.invoke(msg);
+ /*
} else {
throw new NoRegisteredCallbackException("Callback target does not implement the callback interface");
}
+ */
}
public void setNext(Invoker next) {
diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/NonBlockingInterceptor.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/NonBlockingInterceptor.java
index 494cb93d97..0af48a9add 100644
--- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/NonBlockingInterceptor.java
+++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/NonBlockingInterceptor.java
@@ -24,11 +24,12 @@ import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
+import org.apache.tuscany.sca.assembly.Endpoint2;
+import org.apache.tuscany.sca.assembly.EndpointReference2;
import org.apache.tuscany.sca.interfacedef.Operation;
import org.apache.tuscany.sca.invocation.Interceptor;
import org.apache.tuscany.sca.invocation.Invoker;
import org.apache.tuscany.sca.invocation.Message;
-import org.apache.tuscany.sca.runtime.EndpointReference;
import org.apache.tuscany.sca.runtime.RuntimeWire;
import org.apache.tuscany.sca.work.WorkScheduler;
import org.oasisopen.sca.ServiceRuntimeException;
@@ -151,19 +152,19 @@ public class NonBlockingInterceptor implements Interceptor {
throw new UnsupportedOperationException();
}
- public EndpointReference getFrom() {
+ public EndpointReference2 getFrom() {
return null;
}
- public EndpointReference getTo() {
+ public Endpoint2 getTo() {
return null;
}
- public void setFrom(EndpointReference from) {
+ public void setFrom(EndpointReference2 from) {
throw new UnsupportedOperationException();
}
- public void setTo(EndpointReference to) {
+ public void setTo(Endpoint2 to) {
throw new UnsupportedOperationException();
}
@@ -178,7 +179,7 @@ public class NonBlockingInterceptor implements Interceptor {
/**
* @see org.apache.tuscany.sca.invocation.Message#getReplyTo()
*/
- public EndpointReference getReplyTo() {
+ public EndpointReference2 getReplyTo() {
return null;
}
diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/RuntimeWireInvoker.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/RuntimeWireInvoker.java
index 831bb62bd8..649942f923 100644
--- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/RuntimeWireInvoker.java
+++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/RuntimeWireInvoker.java
@@ -21,6 +21,7 @@ package org.apache.tuscany.sca.core.invocation;
import java.lang.reflect.InvocationTargetException;
+import org.apache.tuscany.sca.assembly.EndpointReference2;
import org.apache.tuscany.sca.core.conversation.ConversationExt;
import org.apache.tuscany.sca.core.conversation.ConversationManager;
import org.apache.tuscany.sca.core.conversation.ConversationState;
@@ -37,7 +38,6 @@ import org.apache.tuscany.sca.invocation.InvocationChain;
import org.apache.tuscany.sca.invocation.Invoker;
import org.apache.tuscany.sca.invocation.Message;
import org.apache.tuscany.sca.invocation.MessageFactory;
-import org.apache.tuscany.sca.runtime.EndpointReference;
import org.apache.tuscany.sca.runtime.ReferenceParameters;
import org.apache.tuscany.sca.runtime.RuntimeComponent;
import org.apache.tuscany.sca.runtime.RuntimeWire;
@@ -61,11 +61,13 @@ public class RuntimeWireInvoker implements Invoker{
this.messageFactory = messageFactory;
this.wire = wire;
this.conversationManager = conversationManager;
- init(wire);
+ //init(wire);
}
+ /* TODO - EPR - not required for OASIS
protected void init(RuntimeWire wire) {
if (wire != null) {
+
ReferenceParameters parameters = wire.getSource().getReferenceParameters();
this.callbackID = parameters.getCallbackID();
this.callbackObject = parameters.getCallbackReference();
@@ -74,6 +76,7 @@ public class RuntimeWireInvoker implements Invoker{
this.conversational = contract.getInterface().isConversational();
}
}
+ */
/*
* TODO - Introduced to allow the RuntimeWireInvoker to sit on the end of the
@@ -105,25 +108,35 @@ public class RuntimeWireInvoker implements Invoker{
}
protected Object invoke(InvocationChain chain, Message msg, RuntimeWire wire) throws InvocationTargetException {
- EndpointReference from = msg.getFrom();
- EndpointReference epFrom = wire.getSource();
+ EndpointReference2 from = msg.getFrom();
+ EndpointReference2 epFrom = wire.getEndpointReference();
if (from != null) {
- from.mergeEndpoint(epFrom);
+ from.setComponent(epFrom.getComponent());
+ from.setReference(epFrom.getReference());
+ from.setBinding(epFrom.getBinding());
+ from.setInterfaceContract(epFrom.getInterfaceContract());
+ from.setTargetEndpoint(epFrom.getTargetEndpoint());
+ from.setCallbackEndpoint(epFrom.getCallbackEndpoint());
+
+ // TODO - EPR - what's going on here?
+ //from.mergeEndpoint(epFrom);
} else {
msg.setFrom(epFrom);
}
- msg.setTo(wire.getTarget());
+ msg.setTo(wire.getEndpoint());
Invoker headInvoker = chain.getHeadInvoker();
Operation operation = chain.getTargetOperation();
msg.setOperation(operation);
Message msgContext = ThreadMessageContext.getMessageContext();
- Object currentConversationID = msgContext.getFrom().getReferenceParameters().getConversationID();
+ // TODO - EPR - no required for OASIS
+ //Object currentConversationID = msgContext.getFrom().getReferenceParameters().getConversationID();
ThreadMessageContext.setMessageContext(msg);
try {
- conversationPreinvoke(msg);
+ // TODO - EPR - no required for OASIS
+ //conversationPreinvoke(msg);
// handleCallback(msg, currentConversationID);
// dispatch the wire down the chain and get the response
Message resp = headInvoker.invoke(msg);
@@ -138,9 +151,10 @@ public class RuntimeWireInvoker implements Invoker{
throw new ServiceRuntimeException(e);
} finally {
try {
- conversationPostInvoke(msg);
- } catch (TargetDestructionException e) {
- throw new ServiceRuntimeException(e);
+ // TODO - EPR - no required for OASIS
+ //conversationPostInvoke(msg);
+ //} catch (TargetDestructionException e) {
+ // throw new ServiceRuntimeException(e);
} finally {
ThreadMessageContext.setMessageContext(msgContext);
}
@@ -150,16 +164,19 @@ public class RuntimeWireInvoker implements Invoker{
/**
* @param msgContext
*/
+ /* TODO - EPR - no required for OASIS
protected EndpointReference getCallbackEndpoint(Message msgContext) {
EndpointReference from = msgContext.getFrom();
return from == null ? null : from.getReferenceParameters().getCallbackReference();
}
+ */
/**
* Pre-invoke for the conversation handling
* @param msg
* @throws TargetResolutionException
*/
+ /* TODO - EPR - no required for OASIS
private void conversationPreinvoke(Message msg) {
if (conversational) {
ReferenceParameters parameters = msg.getFrom().getReferenceParameters();
@@ -185,6 +202,7 @@ public class RuntimeWireInvoker implements Invoker{
parameters.setConversationID(conversation.getConversationID());
}
}
+ */
/**
* Post-invoke for the conversation handling
@@ -192,6 +210,7 @@ public class RuntimeWireInvoker implements Invoker{
* @param operation
* @throws TargetDestructionException
*/
+ /* TODO - EPR - no required for OASIS
@SuppressWarnings("unchecked")
private void conversationPostInvoke(Message msg) throws TargetDestructionException {
if (conversational) {
@@ -222,7 +241,7 @@ public class RuntimeWireInvoker implements Invoker{
private ScopeContainer getConversationalScopeContainer(Message msg) {
ScopeContainer scopeContainer = null;
- RuntimeComponent component = msg.getTo().getComponent();
+ RuntimeComponent component = (RuntimeComponent) msg.getTo().getComponent();
if (component instanceof ScopedRuntimeComponent) {
ScopedRuntimeComponent scopedRuntimeComponent = (ScopedRuntimeComponent)component;
@@ -235,6 +254,7 @@ public class RuntimeWireInvoker implements Invoker{
return scopeContainer;
}
+ */
/**
diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/ThreadMessageContext.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/ThreadMessageContext.java
index 5ae4a24b36..f81e17c49b 100644
--- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/ThreadMessageContext.java
+++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/ThreadMessageContext.java
@@ -18,7 +18,6 @@
*/
package org.apache.tuscany.sca.core.invocation;
-import org.apache.tuscany.sca.core.assembly.impl.EndpointReferenceImpl;
import org.apache.tuscany.sca.core.invocation.impl.MessageImpl;
import org.apache.tuscany.sca.invocation.Message;
@@ -33,7 +32,8 @@ public final class ThreadMessageContext {
@Override
protected synchronized Message initialValue() {
Message msg = new MessageImpl();
- msg.setFrom(new EndpointReferenceImpl("/"));
+ // TODO - EPR - What to set as default?
+ //msg.setFrom(new EndpointReferenceImpl("/"));
return msg;
}
};
diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/CallbackReferenceImpl.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/CallbackReferenceImpl.java
index 5071a7ef94..fea1f4216b 100644
--- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/CallbackReferenceImpl.java
+++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/CallbackReferenceImpl.java
@@ -27,9 +27,9 @@ import org.apache.tuscany.sca.assembly.Binding;
import org.apache.tuscany.sca.assembly.Component;
import org.apache.tuscany.sca.assembly.ComponentService;
import org.apache.tuscany.sca.assembly.Contract;
+import org.apache.tuscany.sca.assembly.Endpoint2;
import org.apache.tuscany.sca.assembly.EndpointReference2;
import org.apache.tuscany.sca.assembly.OptimizableBinding;
-import org.apache.tuscany.sca.core.assembly.impl.EndpointReferenceImpl;
import org.apache.tuscany.sca.core.assembly.impl.RuntimeComponentReferenceImpl;
import org.apache.tuscany.sca.core.assembly.impl.RuntimeWireImpl2;
import org.apache.tuscany.sca.core.context.CompositeContext;
@@ -39,7 +39,6 @@ import org.apache.tuscany.sca.core.invocation.ThreadMessageContext;
import org.apache.tuscany.sca.interfacedef.InterfaceContract;
import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
import org.apache.tuscany.sca.invocation.Message;
-import org.apache.tuscany.sca.runtime.EndpointReference;
import org.apache.tuscany.sca.runtime.RuntimeComponent;
import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
import org.apache.tuscany.sca.runtime.RuntimeComponentService;
@@ -53,13 +52,13 @@ import org.apache.tuscany.sca.runtime.RuntimeWire;
public class CallbackReferenceImpl<B> extends CallableReferenceImpl<B> {
private RuntimeWire wire;
private List<RuntimeWire> wires;
- private EndpointReference resolvedEndpoint;
+ private Endpoint2 resolvedEndpoint;
private Object convID;
public static CallbackReferenceImpl newInstance(Class interfaze,
ProxyFactory proxyFactory,
List<RuntimeWire> wires) {
- if (getCallbackEndpoint(ThreadMessageContext.getMessageContext()) != null) {
+ if (ThreadMessageContext.getMessageContext().getFrom().getCallbackEndpoint() != null) {
return new CallbackReferenceImpl(interfaze, proxyFactory, wires);
} else {
return null;
@@ -84,11 +83,14 @@ public class CallbackReferenceImpl<B> extends CallableReferenceImpl<B> {
wire = selectCallbackWire(msgContext);
if (wire == null) {
//FIXME: need better exception
- throw new RuntimeException("No callback binding found for " + msgContext.getTo().getURI());
+ throw new RuntimeException("No callback binding found for " + msgContext.getTo().toString());
}
- resolvedEndpoint = getCallbackEndpoint(msgContext);
+ resolvedEndpoint = msgContext.getFrom().getCallbackEndpoint();
+
+ /* TODO - EPR - not required for OASIS
convID = msgContext.getFrom().getReferenceParameters().getConversationID();
callbackID = msgContext.getFrom().getReferenceParameters().getCallbackID();
+ */
}
@Override
@@ -108,26 +110,26 @@ public class CallbackReferenceImpl<B> extends CallableReferenceImpl<B> {
return convID;
}
- protected EndpointReference getResolvedEndpoint() {
+ protected Endpoint2 getResolvedEndpoint() {
return resolvedEndpoint;
}
private RuntimeWire selectCallbackWire(Message msgContext) {
// look for callback binding with same name as service binding
- EndpointReference to = msgContext.getTo();
+ Endpoint2 to = msgContext.getTo();
if (to == null) {
//FIXME: need better exception
throw new RuntimeException("Destination for forward call is not available");
}
for (RuntimeWire wire : wires) {
- if (wire.getSource().getBinding().getName().equals(to.getBinding().getName())) {
+ if (wire.getEndpointReference().getBinding().getName().equals(to.getBinding().getName())) {
return wire;
}
}
// if no match, look for callback binding with same type as service binding
for (RuntimeWire wire : wires) {
- if (wire.getSource().getBinding().getClass() == to.getBinding().getClass()) {
+ if (wire.getEndpointReference().getBinding().getClass() == to.getBinding().getClass()) {
return wire;
}
}
@@ -136,20 +138,6 @@ public class CallbackReferenceImpl<B> extends CallableReferenceImpl<B> {
return null;
}
- /**
- * Gets the endpoint reference from the incoming message that points
- * back to the callback service
- *
- * @param msgContext
- */
- private static EndpointReference getCallbackEndpoint(Message msgContext) {
- EndpointReference from = msgContext.getFrom();
- if (from == null) {
- return null;
- }
- return from.getReferenceParameters().getCallbackReference();
- }
-
private RuntimeWire cloneAndBind(RuntimeWire wire) {
RuntimeWire boundWire = null;
if (resolvedEndpoint != null) {
@@ -158,7 +146,20 @@ public class CallbackReferenceImpl<B> extends CallableReferenceImpl<B> {
return boundWire;
}
try {
- Contract contract = resolvedEndpoint.getContract();
+ // TODO - EPR - is this correct?
+
+ // Fluff up a new response wire based on the callback endpoint
+ RuntimeComponentReference ref =
+ bind((RuntimeComponentReference)wire.getEndpointReference().getReference(),
+ resolvedEndpoint);
+
+ boundWire = ref.getRuntimeWires().get(0);
+
+ Binding binding = wire.getEndpointReference().getBinding();
+ binding.setURI(resolvedEndpoint.getBinding().getURI());
+
+/* TODO - EPR - remove as there are no callback objects now
+ * Contract contract = resolvedEndpoint.getContract();
RuntimeComponentReference ref = null;
if (contract == null) {
//TODO - EPR - does it ever go through here?
@@ -177,24 +178,27 @@ public class CallbackReferenceImpl<B> extends CallableReferenceImpl<B> {
// TODO - EPR - get the wire from the reference that matches the
// injected callback reference wire. We don't have bindings yet as the
// callback object wire hasn't been initialized
-/*
- for (RuntimeWire runtimeWire : ref.getRuntimeWires()){
- if (runtimeWire.getEndpointReference().getBinding().getName().equals(wire.getEndpointReference().getBinding().getName())){
- boundWire = runtimeWire;
- break;
- }
- }
-*/
+
+// for (RuntimeWire runtimeWire : ref.getRuntimeWires()){
+// if (runtimeWire.getEndpointReference().getBinding().getName().equals(wire.getEndpointReference().getBinding().getName())){
+// boundWire = runtimeWire;
+// break;
+// }
+// }
+
// just get the first one for now
boundWire = ref.getRuntimeWires().get(0);
} else { // contract instanceof RuntimeComponentService
//TODO - EPR - I think it does this if no callback object has been set explicitly
- ref = bind((RuntimeComponentReference)wire.getSource().getContract(),
+ ref = bind((RuntimeComponentReference)wire.getEndpointReference().getReference(),
resolvedEndpoint);
boundWire = ref.getRuntimeWires().get(0);
}
+
configureWire(boundWire);
+*/
+
((RuntimeWireImpl2)wire).addToCache(resolvedEndpoint, boundWire);
} catch (CloneNotSupportedException e) {
// will not happen
@@ -205,13 +209,15 @@ public class CallbackReferenceImpl<B> extends CallableReferenceImpl<B> {
// TODO - EPR - why static & convert to ne endpoint reference
private static RuntimeComponentReference bind(RuntimeComponentReference reference,
- EndpointReference resolvedEndpoint) throws CloneNotSupportedException {
- RuntimeComponent component = resolvedEndpoint.getComponent();
- RuntimeComponentService service = (RuntimeComponentService)resolvedEndpoint.getContract();
+ Endpoint2 resolvedEndpoint) throws CloneNotSupportedException {
+ RuntimeComponent component = (RuntimeComponent)resolvedEndpoint.getComponent();
+ RuntimeComponentService service = (RuntimeComponentService)resolvedEndpoint.getService();
RuntimeComponentReference ref = (RuntimeComponentReference)reference.clone();
ref.getTargets().add(service);
ref.getBindings().clear();
+
+ /* TODO - EPR - don't think this is require now we have endpoint references
for (Binding binding : service.getBindings()) {
if (binding instanceof OptimizableBinding) {
OptimizableBinding optimizableBinding = (OptimizableBinding)((OptimizableBinding)binding).clone();
@@ -223,6 +229,7 @@ public class CallbackReferenceImpl<B> extends CallableReferenceImpl<B> {
ref.getBindings().add(binding);
}
}
+ */
ref.getEndpointReferences().clear();
@@ -230,10 +237,10 @@ public class CallbackReferenceImpl<B> extends CallableReferenceImpl<B> {
EndpointReference2 clone = (EndpointReference2)endpointReference.clone();
clone.setReference(ref);
- clone.getBinding().setURI(resolvedEndpoint.getURI());
+ clone.getBinding().setURI(resolvedEndpoint.getBinding().getURI());
clone.getTargetEndpoint().setComponent(resolvedEndpoint.getComponent());
- clone.getTargetEndpoint().setService((ComponentService)resolvedEndpoint.getContract());
+ clone.getTargetEndpoint().setService((ComponentService)resolvedEndpoint.getService());
clone.getTargetEndpoint().setBinding(resolvedEndpoint.getBinding());
ref.getEndpointReferences().add(clone);
@@ -242,27 +249,29 @@ public class CallbackReferenceImpl<B> extends CallableReferenceImpl<B> {
return ref;
}
+ /* TODO - EPR - remove
private void configureWire(RuntimeWire wire ) {
- // TODO - EPR - do we actiually need this code? Combine with bind?
+ // TODO - EPR - do we actually need this code? Combine with bind?
// need to set the endpoint on the binding also so that when the chains are created next
// the sca binding can decide whether to provide local or remote invokers.
// TODO - there is a problem here though in that I'm setting a target on a
// binding that may possibly be trying to point at two things in the multi threaded
// case. Need to confirm the general model here and how the clone and bind part
// is intended to work
- Binding binding = wire.getSource().getBinding();
- binding.setURI(resolvedEndpoint.getURI());
+ Binding binding = wire.getEndpointReference().getBinding();
+ binding.setURI(resolvedEndpoint.getBinding().getURI());
// set the target contract as it varies for the sca binding depending on
// whether it is local or remote
- RuntimeComponentReference ref = (RuntimeComponentReference)wire.getSource().getContract();
+ RuntimeComponentReference ref = (RuntimeComponentReference)wire.getEndpointReference().getReference();
// TODO - EPR
// needs to be set after the chains have been created for the first time
// as now the binding provider won't be created until that time
//wire.getEndpointReference().getTargetEndpoint().setInterfaceContract(ref.getBindingProvider(binding).getBindingInterfaceContract());
}
+ */
/**
* {@inheritDoc}
@@ -282,9 +291,10 @@ public class CallbackReferenceImpl<B> extends CallableReferenceImpl<B> {
final InterfaceContract targetServiceIfaceContract = targetService.getInterfaceContract();
// Re-create the resolved Endpoint
- this.resolvedEndpoint = new EndpointReferenceImpl(
- (RuntimeComponent) targetComponent, targetService, null,
- targetServiceIfaceContract);
+ this.resolvedEndpoint = assemblyFactory.createEndpoint();
+ this.resolvedEndpoint.setComponent(targetComponent);
+ this.resolvedEndpoint.setService(targetService);
+ this.resolvedEndpoint.setInterfaceContract(targetServiceIfaceContract);
// Copy the Java Interface from the Service
final JavaInterface ji = (JavaInterface) targetServiceIfaceContract.getInterface();
@@ -300,11 +310,12 @@ public class CallbackReferenceImpl<B> extends CallableReferenceImpl<B> {
throw new IOException(e.toString());
}
+ // TODO - EPR - This doesn't sound right to me.
// Setup the reference on the cloned wire
final RuntimeComponentReference ref = new RuntimeComponentReferenceImpl();
ref.setComponent((RuntimeComponent) targetComponent);
ref.setInterfaceContract(targetServiceIfaceContract);
- ((EndpointReferenceImpl) this.wire.getSource()).setContract(ref);
+ ((EndpointReference2) this.wire.getEndpointReference()).setReference(ref);
}
/**
@@ -315,6 +326,8 @@ public class CallbackReferenceImpl<B> extends CallableReferenceImpl<B> {
super.writeExternal(out);
out.writeObject(this.callbackID);
out.writeObject(this.convID);
- out.writeUTF(this.resolvedEndpoint.getURI());
+
+ // TODO - EPR - What to do about URI?
+ out.writeUTF(this.resolvedEndpoint.getBinding().getURI());
}
}
diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/JDKCallbackInvocationHandler.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/JDKCallbackInvocationHandler.java
index 9a0540915a..460df7b007 100644
--- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/JDKCallbackInvocationHandler.java
+++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/JDKCallbackInvocationHandler.java
@@ -60,7 +60,8 @@ public class JDKCallbackInvocationHandler extends JDKInvocationHandler {
// set the conversational state based on the interface that
// is specified for the reference that this wire belongs to
- initConversational(wire);
+ // TODO - EPR - not required for OASIS
+ //initConversational(wire);
// set the conversation id into the conversation object. This is
// a special case for callbacks as, unless otherwise set manually,
@@ -94,7 +95,7 @@ public class JDKCallbackInvocationHandler extends JDKInvocationHandler {
}
try {
- return invoke(chain, args, wire, wire.getSource());
+ return invoke(chain, args, wire, wire.getEndpointReference());
} catch (InvocationTargetException e) {
Throwable t = e.getCause();
if (t instanceof NoRegisteredCallbackException) {
diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/JDKInvocationHandler.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/JDKInvocationHandler.java
index a4a2d8c99a..06d9d7aa77 100644
--- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/JDKInvocationHandler.java
+++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/JDKInvocationHandler.java
@@ -28,6 +28,8 @@ import java.util.List;
import java.util.Map;
import java.util.UUID;
+import org.apache.tuscany.sca.assembly.Endpoint2;
+import org.apache.tuscany.sca.assembly.EndpointReference2;
import org.apache.tuscany.sca.core.assembly.impl.RuntimeWireImpl2;
import org.apache.tuscany.sca.core.context.CallableReferenceExt;
import org.apache.tuscany.sca.core.context.impl.CallableReferenceImpl;
@@ -51,7 +53,6 @@ import org.apache.tuscany.sca.invocation.InvocationChain;
import org.apache.tuscany.sca.invocation.Invoker;
import org.apache.tuscany.sca.invocation.Message;
import org.apache.tuscany.sca.invocation.MessageFactory;
-import org.apache.tuscany.sca.runtime.EndpointReference;
import org.apache.tuscany.sca.runtime.ReferenceParameters;
import org.apache.tuscany.sca.runtime.RuntimeComponent;
import org.apache.tuscany.sca.runtime.RuntimeWire;
@@ -69,8 +70,8 @@ public class JDKInvocationHandler implements InvocationHandler, Serializable {
protected boolean conversational;
protected ConversationExt conversation;
protected MessageFactory messageFactory;
- protected EndpointReference source;
- protected EndpointReference target;
+ protected EndpointReference2 source;
+ protected Endpoint2 target;
protected RuntimeWire wire;
protected CallableReference<?> callableReference;
protected Class<?> businessInterface;
@@ -100,7 +101,8 @@ public class JDKInvocationHandler implements InvocationHandler, Serializable {
}
protected void init(RuntimeWire wire) {
- // TODO - EPR needs fixing when we remove the old EndpointReference
+ // TODO - EPR not required for OASIS
+ /*
if (wire != null) {
try {
// Clone the endpoint reference so that reference parameters can be changed
@@ -110,12 +112,15 @@ public class JDKInvocationHandler implements InvocationHandler, Serializable {
}
initConversational(wire);
}
+ */
}
+ /* TODO - EPR - not required for OASIS
protected void initConversational(RuntimeWire wire) {
InterfaceContract contract = wire.getSource().getInterfaceContract();
this.conversational = contract.getInterface().isConversational();
}
+ */
protected Object getCallbackID() {
if (callableReference != null) {
@@ -156,7 +161,7 @@ public class JDKInvocationHandler implements InvocationHandler, Serializable {
// The EndpointReference is not now resolved until the invocation chain
// is first created so reset the source here
- source = wire.getSource();
+ source = wire.getEndpointReference();
// send the invocation down the wire
Object result = invoke(chain, args, wire, source);
@@ -265,18 +270,18 @@ public class JDKInvocationHandler implements InvocationHandler, Serializable {
return found;
}
- protected void setEndpoint(EndpointReference endpoint) {
+ protected void setEndpoint(Endpoint2 endpoint) {
this.target = endpoint;
}
- protected Object invoke(InvocationChain chain, Object[] args, RuntimeWire wire, EndpointReference source)
+ protected Object invoke(InvocationChain chain, Object[] args, RuntimeWire wire, EndpointReference2 source)
throws Throwable {
Message msg = messageFactory.createMessage();
msg.setFrom(source);
if (target != null) {
msg.setTo(target);
} else {
- msg.setTo(wire.getTarget());
+ msg.setTo(wire.getEndpoint());
}
Invoker headInvoker = chain.getHeadInvoker();
Operation operation = chain.getTargetOperation();
@@ -284,10 +289,12 @@ public class JDKInvocationHandler implements InvocationHandler, Serializable {
msg.setBody(args);
Message msgContext = ThreadMessageContext.getMessageContext();
- Object currentConversationID = msgContext.getFrom().getReferenceParameters().getConversationID();
-
- conversationPreinvoke(msg, wire);
- handleCallback(msg, wire, currentConversationID);
+
+ // TODO - EPR - not required for OASIS
+ //Object currentConversationID = msgContext.getFrom().getReferenceParameters().getConversationID();
+ //conversationPreinvoke(msg, wire);
+
+ handleCallback(msg, wire);
ThreadMessageContext.setMessageContext(msg);
boolean abnormalEndConversation = false;
try {
@@ -295,6 +302,7 @@ public class JDKInvocationHandler implements InvocationHandler, Serializable {
Message resp = headInvoker.invoke(msg);
Object body = resp.getBody();
if (resp.isFault()) {
+ /* TODO - EPR - not required in OASIS
// mark the conversation as ended if the exception is not a business exception
if (currentConversationID != null ){
try {
@@ -315,11 +323,12 @@ public class JDKInvocationHandler implements InvocationHandler, Serializable {
// a system exception in the middle of a business exception
}
}
+ */
throw (Throwable)body;
}
return body;
} finally {
- conversationPostInvoke(msg, wire, abnormalEndConversation);
+ //conversationPostInvoke(msg, wire, abnormalEndConversation);
ThreadMessageContext.setMessageContext(msgContext);
}
}
@@ -330,14 +339,17 @@ public class JDKInvocationHandler implements InvocationHandler, Serializable {
* @param interfaze
* @throws TargetResolutionException
*/
- private void handleCallback(Message msg, RuntimeWire wire, Object currentConversationID)
+ private void handleCallback(Message msg, RuntimeWire wire)
throws TargetResolutionException {
- ReferenceParameters parameters = msg.getFrom().getReferenceParameters();
- parameters.setCallbackID(getCallbackID());
+
+ //ReferenceParameters parameters = msg.getFrom().getReferenceParameters();
+ //parameters.setCallbackID(getCallbackID());
+
if (msg.getFrom() == null || msg.getFrom().getCallbackEndpoint() == null) {
return;
}
+ /* TODO - EPR - not required for OASIS
parameters.setCallbackReference(msg.getFrom().getCallbackEndpoint());
// If we are passing out a callback target
@@ -386,6 +398,7 @@ public class JDKInvocationHandler implements InvocationHandler, Serializable {
}
}
}
+ */
}
/**
@@ -393,6 +406,7 @@ public class JDKInvocationHandler implements InvocationHandler, Serializable {
* @param msg
* @throws TargetResolutionException
*/
+ /* TODO - EPR - not required for OASIS
private void conversationPreinvoke(Message msg, RuntimeWire wire) {
if (!conversational) {
// Not conversational or the conversation has been started
@@ -407,8 +421,8 @@ public class JDKInvocationHandler implements InvocationHandler, Serializable {
// if this is a local wire then set up the conversation timeouts here based on the
// parameters from the component
- if (wire.getTarget().getComponent() != null){
- conversation.initializeConversationAttributes(wire.getTarget().getComponent());
+ if (wire.getEndpoint().getComponent() != null){
+ conversation.initializeConversationAttributes((RuntimeComponent)wire.getEndpoint().getComponent());
}
// connect the conversation to the CallableReference so it can be retrieve in the future
@@ -422,13 +436,14 @@ public class JDKInvocationHandler implements InvocationHandler, Serializable {
// if this is a local wire then schedule conversation timeouts based on the timeout
// parameters from the service implementation. If this isn't a local wire then
// the RuntimeWireInvoker will take care of this
- if (wire.getTarget().getComponent() != null){
+ if (wire.getEndpoint().getComponent() != null){
conversation.updateLastReferencedTime();
}
msg.getFrom().getReferenceParameters().setConversationID(conversation.getConversationID());
}
+ */
/**
* Post-invoke for the conversation handling
@@ -436,6 +451,7 @@ public class JDKInvocationHandler implements InvocationHandler, Serializable {
* @param operation
* @throws TargetDestructionException
*/
+ /* TODO - not required for OASIS
@SuppressWarnings("unchecked")
private void conversationPostInvoke(Message msg, RuntimeWire wire, boolean abnormalEndConversation)
throws TargetDestructionException {
@@ -457,11 +473,12 @@ public class JDKInvocationHandler implements InvocationHandler, Serializable {
conversation.end();
}
}
+
private ScopeContainer<Object> getConversationalScopeContainer(RuntimeWire wire) {
ScopeContainer<Object> scopeContainer = null;
- RuntimeComponent runtimeComponent = wire.getSource().getComponent();
+ RuntimeComponent runtimeComponent = (RuntimeComponent)wire.getEndpointReference().getComponent();
if (runtimeComponent instanceof ScopedRuntimeComponent) {
ScopedRuntimeComponent scopedRuntimeComponent = (ScopedRuntimeComponent)runtimeComponent;
@@ -474,12 +491,14 @@ public class JDKInvocationHandler implements InvocationHandler, Serializable {
return scopeContainer;
}
+ */
/**
* Creates a new conversation id
*
* @return the conversation id
*/
+ /* TODO - EPR - not required for OASIS
private Object createConversationID() {
if (getConversationID() != null) {
return getConversationID();
@@ -487,6 +506,7 @@ public class JDKInvocationHandler implements InvocationHandler, Serializable {
return UUID.randomUUID().toString();
}
}
+ */
/**
* @return the callableReference
diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/MessageImpl.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/MessageImpl.java
index e81e5a2f31..bd7b9dcb8f 100644
--- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/MessageImpl.java
+++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/MessageImpl.java
@@ -21,10 +21,10 @@ package org.apache.tuscany.sca.core.invocation.impl;
import java.util.ArrayList;
import java.util.List;
-import org.apache.tuscany.sca.core.assembly.impl.EndpointReferenceImpl;
+import org.apache.tuscany.sca.assembly.Endpoint2;
+import org.apache.tuscany.sca.assembly.EndpointReference2;
import org.apache.tuscany.sca.interfacedef.Operation;
import org.apache.tuscany.sca.invocation.Message;
-import org.apache.tuscany.sca.runtime.EndpointReference;
/**
* The default implementation of a message flowed through a wire during an invocation
@@ -38,12 +38,15 @@ public class MessageImpl implements Message {
private boolean isFault;
private Operation operation;
- private EndpointReference from;
- private EndpointReference to;
+ private EndpointReference2 from;
+ private Endpoint2 to;
public MessageImpl() {
- this.from = new EndpointReferenceImpl("/");
- this.to = new EndpointReferenceImpl("/");
+ // TODO - EPR - What to do by default?
+ //this.from = new EndpointReferenceImpl("/");
+ //this.to = new EndpointReferenceImpl("/");
+ this.from = null;
+ this.to = null;
}
@SuppressWarnings("unchecked")
@@ -73,19 +76,19 @@ public class MessageImpl implements Message {
this.body = fault;
}
- public EndpointReference getFrom() {
+ public EndpointReference2 getFrom() {
return from;
}
- public void setFrom(EndpointReference from) {
+ public void setFrom(EndpointReference2 from) {
this.from = from;
}
- public EndpointReference getTo() {
+ public Endpoint2 getTo() {
return to;
}
- public void setTo(EndpointReference to) {
+ public void setTo(Endpoint2 to) {
this.to = to;
}
diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/impl/ConversationalScopeContainer.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/impl/ConversationalScopeContainer.java
index 1ae7bd58e1..8dfe77f61b 100644
--- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/impl/ConversationalScopeContainer.java
+++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/impl/ConversationalScopeContainer.java
@@ -72,7 +72,8 @@ public class ConversationalScopeContainer extends AbstractScopeContainer<Object>
Message msgContext = ThreadMessageContext.getMessageContext();
if (msgContext != null) {
- msgContext.getFrom().getReferenceParameters().setConversationID(contextId);
+ // TODO - EPR - not required for OASIS
+ //msgContext.getFrom().getReferenceParameters().setConversationID(contextId);
}
}
diff --git a/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ConversationIDObjectFactory.java b/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ConversationIDObjectFactory.java
index ffce7ce467..e8aa178232 100644
--- a/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ConversationIDObjectFactory.java
+++ b/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ConversationIDObjectFactory.java
@@ -33,7 +33,10 @@ public class ConversationIDObjectFactory implements ObjectFactory {
}
public Object getInstance() {
+ /* TODO - EPR - not reqiured for OASIS
return ThreadMessageContext.getMessageContext().getFrom().getReferenceParameters().getConversationID();
+ */
+ return null;
}
}
diff --git a/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaCallbackRuntimeWireProcessor.java b/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaCallbackRuntimeWireProcessor.java
index ef4e67d79a..8ac5d34257 100644
--- a/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaCallbackRuntimeWireProcessor.java
+++ b/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaCallbackRuntimeWireProcessor.java
@@ -23,6 +23,7 @@ import java.util.logging.Level;
import java.util.logging.Logger;
import org.apache.tuscany.sca.assembly.Contract;
+import org.apache.tuscany.sca.assembly.Endpoint2;
import org.apache.tuscany.sca.assembly.Implementation;
import org.apache.tuscany.sca.core.invocation.CallbackInterfaceInterceptor;
import org.apache.tuscany.sca.implementation.java.JavaImplementation;
@@ -33,7 +34,6 @@ import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
import org.apache.tuscany.sca.invocation.InvocationChain;
import org.apache.tuscany.sca.invocation.Phase;
-import org.apache.tuscany.sca.runtime.EndpointReference;
import org.apache.tuscany.sca.runtime.RuntimeComponent;
import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
import org.apache.tuscany.sca.runtime.RuntimeWire;
@@ -63,19 +63,19 @@ public class JavaCallbackRuntimeWireProcessor implements RuntimeWireProcessor {
}
private void addCallbackInterfaceInterceptors(RuntimeWire wire) {
- Contract contract = wire.getSource().getContract();
+ Contract contract = wire.getEndpointReference().getReference();
if (!(contract instanceof RuntimeComponentReference)) {
return;
}
- RuntimeComponent component = wire.getSource().getComponent();
+ RuntimeComponent component = (RuntimeComponent) wire.getEndpointReference().getComponent();
Implementation implementation = component.getImplementation();
if (!(implementation instanceof JavaImplementation)) {
return;
}
JavaImplementation javaImpl = (JavaImplementation)implementation;
- EndpointReference callbackEndpoint = wire.getSource().getCallbackEndpoint();
+ Endpoint2 callbackEndpoint = wire.getEndpointReference().getCallbackEndpoint();
if (callbackEndpoint != null) {
- Interface iface = callbackEndpoint.getContract().getInterfaceContract().getInterface();
+ Interface iface = callbackEndpoint.getService().getInterfaceContract().getInterface();
if (!supportsCallbackInterface(iface, javaImpl)) {
// callback to this impl is not possible, so ensure a callback object is set
for (InvocationChain chain : wire.getInvocationChains()) {
diff --git a/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaComponentContextProvider.java b/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaComponentContextProvider.java
index e73fe3a13d..8e90ddb577 100644
--- a/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaComponentContextProvider.java
+++ b/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaComponentContextProvider.java
@@ -149,7 +149,7 @@ public class JavaComponentContextProvider {
if (callbackReference != null) {
List<RuntimeWire> wires = callbackReference.getRuntimeWires();
if (!wires.isEmpty()) {
- callbackWires.put(wires.get(0).getSource().getInterfaceContract().getInterface().toString(),
+ callbackWires.put(wires.get(0).getEndpointReference().getInterfaceContract().getInterface().toString(),
wires);
}
}
@@ -220,7 +220,7 @@ public class JavaComponentContextProvider {
factory =
new CallableReferenceObjectFactory(businessInterface, component,
(RuntimeComponentReference)wireList.get(i)
- .getSource().getContract(), wireList.get(i)
+ .getEndpointReference().getReference(), wireList.get(i)
.getEndpointReference());
} else {
factory = createObjectFactory(baseType, wireList.get(i));
diff --git a/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationInvoker.java b/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationInvoker.java
index 60e093d0dc..507ac07b6e 100644
--- a/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationInvoker.java
+++ b/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationInvoker.java
@@ -21,8 +21,8 @@ package org.apache.tuscany.sca.implementation.java.invocation;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
+import org.apache.tuscany.sca.assembly.EndpointReference2;
import org.apache.tuscany.sca.core.factory.InstanceWrapper;
-import org.apache.tuscany.sca.core.scope.Scope;
import org.apache.tuscany.sca.core.scope.ScopeContainer;
import org.apache.tuscany.sca.core.scope.ScopedRuntimeComponent;
import org.apache.tuscany.sca.implementation.java.JavaImplementation;
@@ -33,7 +33,6 @@ import org.apache.tuscany.sca.interfacedef.java.impl.JavaInterfaceUtil;
import org.apache.tuscany.sca.invocation.DataExchangeSemantics;
import org.apache.tuscany.sca.invocation.Invoker;
import org.apache.tuscany.sca.invocation.Message;
-import org.apache.tuscany.sca.runtime.EndpointReference;
import org.apache.tuscany.sca.runtime.ReferenceParameters;
import org.apache.tuscany.sca.runtime.RuntimeComponent;
import org.oasisopen.sca.ServiceRuntimeException;
@@ -77,11 +76,13 @@ public class JavaImplementationInvoker implements Invoker, DataExchangeSemantics
Object contextId = null;
- EndpointReference from = msg.getFrom();
+ EndpointReference2 from = msg.getFrom();
+ /* TODO - EPR - not required for OASIS
ReferenceParameters parameters = null;
if (from != null) {
parameters = from.getReferenceParameters();
}
+
// check what sort of context is required
if (scopeContainer != null) {
Scope scope = scopeContainer.getScope();
@@ -91,6 +92,7 @@ public class JavaImplementationInvoker implements Invoker, DataExchangeSemantics
contextId = parameters.getConversationID();
}
}
+ */
try {
// The following call might create a new conversation, as a result, the msg.getConversationID() might
@@ -104,11 +106,13 @@ public class JavaImplementationInvoker implements Invoker, DataExchangeSemantics
// to get the contextId of this component and remove it after we have invoked the method on
// it. It is possible that the component instance will not go away when it is removed below
// because a callback conversation will still be holding a reference to it
+ /* TODO - EPR - not required for OASIS
boolean removeTemporaryConversationalComponentAfterCall = false;
if (parameters != null && (contextId == null) && (parameters.getConversationID() != null)) {
contextId = parameters.getConversationID();
removeTemporaryConversationalComponentAfterCall = true;
}
+ */
Object instance = wrapper.getInstance();
@@ -134,12 +138,15 @@ public class JavaImplementationInvoker implements Invoker, DataExchangeSemantics
scopeContainer.returnWrapper(wrapper, contextId);
+ /* TODO - EPR - not required for OASIS
if ((sequence == ConversationSequence.CONVERSATION_END) || (removeTemporaryConversationalComponentAfterCall)) {
// if end conversation, or we have the special case where a conversational
// object was created to service the stateless half of a stateful component
scopeContainer.remove(contextId);
parameters.setConversationID(null);
}
+ */
+
msg.setBody(ret);
} catch (InvocationTargetException e) {
Throwable cause = e.getTargetException();
@@ -168,7 +175,9 @@ public class JavaImplementationInvoker implements Invoker, DataExchangeSemantics
if (!isChecked && contextId != null) {
scopeContainer.remove(contextId);
+ /* TODO - EPR - not required for OASIS
parameters.setConversationID(null);
+ */
}
} catch (Exception ex){
// TODO - sure what the best course of action is here. We have