summaryrefslogtreecommitdiffstats
path: root/java
diff options
context:
space:
mode:
authorslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2009-11-13 17:59:05 +0000
committerslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2009-11-13 17:59:05 +0000
commitc6a1c369e49090b6b9a6f2448045740a368c7ca3 (patch)
tree352986537b316538084d81f1752af6c7ca98aca2 /java
parent6ddc91e6681877ba1f131641042f175bd63d6334 (diff)
Remove some of the commented out code that resulted from moving over to the Endpoint/EndpointReference approach. Still some left in that needs looking at.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@835940 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java')
-rw-r--r--java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2BindingInvoker.java27
-rw-r--r--java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceProvider.java45
-rw-r--r--java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/QuestionMarkWSDLImportTestCase.java2
-rw-r--r--java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/QuestionMarkWSDLIncludeTestCase.java2
-rw-r--r--java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/QuestionMarkWSDLTestCase.java3
-rw-r--r--java/sca/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/WSDLServiceGenerator.java7
-rw-r--r--java/sca/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/EndpointBuilderImpl.java22
-rw-r--r--java/sca/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/EndpointReferenceBuilderImpl.java13
-rw-r--r--java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/CompositeActivatorImpl.java159
-rw-r--r--java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/RequestContextImpl.java17
-rw-r--r--java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/JDKInvocationHandler.java222
-rw-r--r--java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/MessageImpl.java3
-rw-r--r--java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationInvoker.java43
13 files changed, 11 insertions, 554 deletions
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 46c97e7553..fe10e6a4eb 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
@@ -221,33 +221,6 @@ public class Axis2BindingInvoker implements Invoker, DataExchangeSemantics {
Endpoint 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();
- if (callbackEPR != null) {
- fromEPR = new EndpointReference(callbackEPR.getBinding().getURI());
- }
- Object callbackID = parameters.getCallbackID();
- if (callbackID != null) {
- if (fromEPR == null) {
- fromEPR = new EndpointReference(AddressingConstants.Final.WSA_ANONYMOUS_URL);
- }
- //FIXME: serialize callback ID to XML in case it is not a string
- fromEPR.addReferenceParameter(CALLBACK_ID_REFPARM_QN, callbackID.toString());
- }
-
- // set conversation ID for WS-Addressing header
- Object conversationId = parameters.getConversationID();
- if (conversationId != null) {
- if (fromEPR == null) {
- fromEPR = new EndpointReference(AddressingConstants.Final.WSA_ANONYMOUS_URL);
- }
- //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 (callbackEndpoint != null) {
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 4f7e308eb5..1ee885b004 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
@@ -237,16 +237,6 @@ public class Axis2ServiceProvider {
}
}
- // 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();
- }
- */
-
private String computeEndpointURI(String uri, ServletHost servletHost) {
if (uri == null) {
@@ -673,24 +663,6 @@ 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 =
- params.getFirstChildWithName(Axis2BindingInvoker.CONVERSATION_ID_REFPARM_QN);
- if (convIDElement != null) {
- if (isConversational()) {
- conversationID = convIDElement.getText();
- }
- }
- OMElement callbackIDElement =
- params.getFirstChildWithName(Axis2BindingInvoker.CALLBACK_ID_REFPARM_QN);
- if (callbackIDElement != null) {
- callbackID = callbackIDElement.getText();
- }
- }
-*/
}
// get policy specified headers
@@ -724,23 +696,6 @@ public class Axis2ServiceProvider {
from.setCallbackEndpoint(callbackEndpoint);
}
- /* TODO - EPR - not required in OASIS
- // set the reference parameters into the "From" EPR
- if (callbackAddress != null) {
- parameters.setCallbackReference(createEndpointReference(callbackAddress));
- }
- if (callbackID != null) {
- parameters.setCallbackID(callbackID);
- }
- if (conversationID != null) {
- parameters.setConversationID(conversationID);
- }
-
- 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/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/QuestionMarkWSDLImportTestCase.java b/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/QuestionMarkWSDLImportTestCase.java
index 51aa9f25f8..8f86050108 100644
--- a/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/QuestionMarkWSDLImportTestCase.java
+++ b/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/QuestionMarkWSDLImportTestCase.java
@@ -68,8 +68,6 @@ public class QuestionMarkWSDLImportTestCase extends TestCase {
Definition definition = wsdlReader.readWSDL("http://localhost:8086/AccountService?wsdl");
assertNotNull(definition);
- // TODO - EPR - $promoted$ no longer used
- //Service service = definition.getService(new QName("http://account2/AccountService/$promoted$ep1", "AccountService"));
Service service = definition.getService(new QName("http://account2/AccountService/Account", "AccountService"));
Port port = service.getPort("AccountSoapPort");
diff --git a/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/QuestionMarkWSDLIncludeTestCase.java b/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/QuestionMarkWSDLIncludeTestCase.java
index 0b780f2b96..0b6cfe15e5 100644
--- a/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/QuestionMarkWSDLIncludeTestCase.java
+++ b/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/QuestionMarkWSDLIncludeTestCase.java
@@ -68,8 +68,6 @@ public class QuestionMarkWSDLIncludeTestCase extends TestCase {
Definition definition = wsdlReader.readWSDL("http://localhost:8085/AccountService?wsdl");
assertNotNull(definition);
- // TODO - EPR - $promoted$ no longer used
- //Service service = definition.getService(new QName("http://accounts/AccountService/$promoted$ep1", "AccountService"));
Service service = definition.getService(new QName("http://accounts/AccountService/Account", "AccountService"));
Port port = service.getPort("AccountSoapPort");
diff --git a/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/QuestionMarkWSDLTestCase.java b/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/QuestionMarkWSDLTestCase.java
index bbec9dd342..f47b0a0e38 100644
--- a/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/QuestionMarkWSDLTestCase.java
+++ b/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/QuestionMarkWSDLTestCase.java
@@ -68,9 +68,6 @@ public class QuestionMarkWSDLTestCase extends TestCase {
Definition definition = wsdlReader.readWSDL("http://localhost:8085/services/HelloWorldWebService?wsdl");
assertNotNull(definition);
- // TODO - EPR - $promoted$ no longer used
- //Service service = definition.getService(new QName("http://helloworld/HelloWorldService/$promoted$ep1",
- // "HelloWorldService"));
Service service = definition.getService(new QName("http://helloworld/HelloWorldService/HelloWorld",
"HelloWorldService"));
Port port = service.getPort("HelloWorldSoapPort");
diff --git a/java/sca/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/WSDLServiceGenerator.java b/java/sca/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/WSDLServiceGenerator.java
index bfd95bd292..de5c1c389e 100644
--- a/java/sca/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/WSDLServiceGenerator.java
+++ b/java/sca/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/WSDLServiceGenerator.java
@@ -131,12 +131,7 @@ public class WSDLServiceGenerator {
//[nash] changes to the builder sequence avoid calling this for a CompositeService
assert !(contract instanceof CompositeService);
- // TODO - EPR - $promoted$ no longer used
- /*
- // For every promoted composite service, the underlying component
- // gets a copy of the service with the name prefixed by "$promoted$."
- String contractName = (contract instanceof CompositeService ? "$promoted$." : "") + contract.getName();
- */
+
String contractName = contract.getName();
List<Port> ports = new ArrayList<Port>();
diff --git a/java/sca/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/EndpointBuilderImpl.java b/java/sca/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/EndpointBuilderImpl.java
index 6b181db0c1..ca13532bcf 100644
--- a/java/sca/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/EndpointBuilderImpl.java
+++ b/java/sca/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/EndpointBuilderImpl.java
@@ -104,25 +104,9 @@ public class EndpointBuilderImpl implements CompositeBuilder {
}
}
-
-
-
- /* change to finding the promoted component and service
- * when the wire is created as storing them here leads to
- * the wrong URI being calculated
- Component endpointComponent = component;
- ComponentService endpointService = service;
-
- // TODO - EPR - We maintain all endpoints at the right level now
- // but endpoints for promoting services must point down
- // to the services they promote.
- if (service.getService() instanceof CompositeService) {
- CompositeService compositeService = (CompositeService)service.getService();
- endpointService = ServiceConfigurationUtil.getPromotedComponentService(compositeService);
- endpointComponent = ServiceConfigurationUtil.getPromotedComponent(compositeService);
- } // end if
- */
-
+ // We maintain all endpoints at the right level now
+ // but endpoints for promoting services must point down
+ // to the services they promote.
for (Binding binding : service.getBindings()) {
Endpoint endpoint = assemblyFactory.createEndpoint();
endpoint.setComponent(component);
diff --git a/java/sca/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/EndpointReferenceBuilderImpl.java b/java/sca/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/EndpointReferenceBuilderImpl.java
index df941e8879..be55be3bbe 100644
--- a/java/sca/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/EndpointReferenceBuilderImpl.java
+++ b/java/sca/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/EndpointReferenceBuilderImpl.java
@@ -218,25 +218,16 @@ public class EndpointReferenceBuilderImpl {
String uri = component.getName() + '/' + componentService.getName();
componentServices.put(uri, componentService);
- // TODO - EPR - $promoted$ no longer used but it doesn't do any
- // harm here
- boolean promotedService = false;
- if (componentService.getName() != null && componentService.getName().indexOf("$promoted$") > -1) {
- promotedService = true;
- }
-
- // count how many non-callback, non-promoted services there are
+ // count how many non-callback services there are
// if there is only one the component name also acts as the
// service name
- if ((!componentService.isForCallback()) && (!promotedService)) {
-
+ if (!componentService.isForCallback()) {
// Check how many non callback non-promoted services we have
if (nonCallbackServices == 0) {
nonCallbackService = componentService;
}
nonCallbackServices++;
}
-
}
if (nonCallbackServices == 1) {
diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/CompositeActivatorImpl.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/CompositeActivatorImpl.java
index ecc1a4e599..f8e3a70ad2 100644
--- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/CompositeActivatorImpl.java
+++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/CompositeActivatorImpl.java
@@ -247,13 +247,6 @@ public class CompositeActivatorImpl implements CompositeActivator {
return;
}
- /* TODO - EPR - activate services at all levels as promoted endpoin references are maintained
- * on the higher level services
- if (service.getService() instanceof CompositeService) {
- return;
- }
- */
-
if (logger.isLoggable(Level.FINE)) {
logger.fine("Activating component service: " + component.getURI() + "#" + service.getName());
}
@@ -390,8 +383,6 @@ public class CompositeActivatorImpl implements CompositeActivator {
// reference is asked to return it's runtime wires. If there are none the reference
// asks the component context to start the reference which creates the wires
reference.setComponent(component);
-
- // TODO reference wires are added at component start for some reason
}
public void deactivate(RuntimeComponent component, RuntimeComponentReference reference) {
@@ -405,40 +396,7 @@ public class CompositeActivatorImpl implements CompositeActivator {
}
}
}
-/*
- private ReferenceBindingProvider addReferenceBindingProvider(
- RuntimeComponent component, RuntimeComponentReference reference,
- Binding binding) {
- BindingProviderFactory providerFactory = (BindingProviderFactory) providerFactories
- .getProviderFactory(binding.getClass());
- if (providerFactory != null) {
- @SuppressWarnings("unchecked")
- ReferenceBindingProvider bindingProvider = providerFactory
- .createReferenceBindingProvider(
- (RuntimeComponent) component,
- (RuntimeComponentReference) reference, binding);
- if (bindingProvider != null) {
- ((RuntimeComponentReference) reference).setBindingProvider(
- binding, bindingProvider);
- }
- for (PolicyProviderFactory f : providerFactories
- .getPolicyProviderFactories()) {
- PolicyProvider policyProvider = f
- .createReferencePolicyProvider(component, reference,
- binding);
- if (policyProvider != null) {
- reference.addPolicyProvider(binding, policyProvider);
- }
- }
- return bindingProvider;
- } else {
- throw new IllegalStateException(
- "Provider factory not found for binding: "
- + binding.getClass().getType());
- }
- }
-*/
private void removeReferenceBindingProvider(RuntimeComponent component,
RuntimeComponentReference reference, Binding binding) {
reference.setBindingProvider(binding, null);
@@ -454,11 +412,6 @@ public class CompositeActivatorImpl implements CompositeActivator {
if (!(reference instanceof RuntimeComponentReference)) {
return;
}
-
- // TODO - EPR what is this all about?
- // [rfeng] Comment out the following statements to avoid the on-demand activation
- // RuntimeComponentReference runtimeRef = (RuntimeComponentReference)reference;
- // runtimeRef.getRuntimeWires().clear();
}
//=========================================================================
@@ -634,11 +587,10 @@ public class CompositeActivatorImpl implements CompositeActivator {
// Service start/stop
- // TODO - EPR done as part of the component start above
+ // done as part of the component start above
// Reference start/stop
// Used by component context start
- // TODO - EPR I don't know why reference wires don't get added until component start
public void start(CompositeContext compositeContext, RuntimeComponent component, RuntimeComponentReference componentReference) {
synchronized (componentReference) {
@@ -647,46 +599,6 @@ public class CompositeActivatorImpl implements CompositeActivator {
return;
}
- /* The way it was
- // create a wire for each endpoint reference. An endpoint reference says that a
- // target has been specified and hence the reference has been wired in some way.
- // The service may not have been found yet, depending on the way the composite
- // is deployed, but it is expected to be found. In the case where the reference
- // is unwired (a target has not been specified) there will be no endpoint
- // reference and this will lead to null being injected
- for (EndpointReference2 endpointReference : componentReference.getEndpointReferences()){
-
- // if there is a binding an endpoint has been found for the endpoint reference
- if (endpointReference.getBinding() != null){
-
- // add the binding provider. This is apparently a repeat
- // of previous configuration as self references are created
- // on the fly and miss the previous point where providers are added
- RuntimeComponentReference runtimeRef = (RuntimeComponentReference)componentReference;
-
- if (runtimeRef.getBindingProvider(endpointReference.getBinding()) == null) {
- addReferenceBindingProvider(component, componentReference, endpointReference.getBinding());
- }
-
- // start the binding provider
- final ReferenceBindingProvider bindingProvider = runtimeRef.getBindingProvider(endpointReference.getBinding());
-
- if (bindingProvider != null) {
- // Allow bindings to add shutdown hooks. Requires RuntimePermission shutdownHooks in policy.
- AccessController.doPrivileged(new PrivilegedAction<Object>() {
- public Object run() {
- bindingProvider.start();
- return null;
- }
- });
- }
-
- // add the wire
- addReferenceWire(component, componentReference, endpointReference);
- }
- }
- */
-
// create a wire for each endpoint reference. An endpoint reference says either that
// - a target has been specified and hence the reference has been wired in some way.
// - an unwired binding ha been specified
@@ -747,44 +659,6 @@ public class CompositeActivatorImpl implements CompositeActivator {
endpointReference.setInterfaceContract(sourceContract.makeUnidirectional(false));
-/* TODO - EPR should have been done previously during matching
- ComponentService callbackService = reference.getCallbackService();
- if (callbackService != null) {
- // select a reference callback binding to pass with invocations on this wire
- Binding callbackBinding = null;
- for (Binding binding : callbackService.getBindings()) {
- // first look for a callback binding whose name matches the reference binding name
- if (refBinding.getName().startsWith(binding.getName())) {
- callbackBinding = binding;
- break;
- }
- }
- // if no callback binding found, try again based on reference binding type
- if (callbackBinding == null) {
- callbackBinding = callbackService.getBinding(refBinding.getClass());
- }
- InterfaceContract callbackContract = callbackService.getInterfaceContract();
- EndpointReference callbackEndpoint =
- new EndpointReferenceImpl((RuntimeComponent)refComponent, callbackService, callbackBinding,
- callbackContract);
- wireSource.setCallbackEndpoint(callbackEndpoint);
- }
-*/
-
-/* TODO - EPR can't do this until the binding matches the EPR
- InterfaceContract bindingContract = getInterfaceContract(reference, endpointReference.getBinding());
- Endpoint2 endpoint = endpointReference.getTargetEndpoint();
- endpoint.setInterfaceContract(bindingContract);
-*/
-
-/* TODO - EPR review in the light of new matching code
- // TUSCANY-2029 - We should use the URI of the serviceBinding because the target may be a Component in a
- // nested composite.
- if (serviceBinding != null) {
- wireTarget.setURI(serviceBinding.getURI());
- }
-*/
-
// create the wire
// null endpoint passed in here as the endpoint reference may
// not be resolved yet
@@ -811,35 +685,4 @@ public class CompositeActivatorImpl implements CompositeActivator {
}
return interfaceContract.makeUnidirectional(false);
}
-
-
- /* TODO - EPR - Resolved via registry now
- public Component resolve(String componentURI) {
- for (Composite composite : domainComposite.getIncludes()) {
- Component component = resolve(composite, componentURI);
- if (component != null) {
- return component;
- }
- }
- return null;
- }
-
-
- public Component resolve(Composite composite, String componentURI) {
- for (Component component : composite.getComponents()) {
- String uri = component.getURI();
- if (uri.equals(componentURI)) {
- return component;
- }
- if (componentURI.startsWith(uri)) {
- Implementation implementation = component.getImplementation();
- if (!(implementation instanceof Composite)) {
- return null;
- }
- return resolve((Composite)implementation, componentURI);
- }
- }
- 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 e8a1254dc9..dbd243a70b 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
@@ -73,12 +73,7 @@ public class RequestContextImpl implements RequestContext {
RuntimeComponent component = (RuntimeComponent) to.getComponent();
ServiceReference<B> callableReference = component.getComponentContext().getCallableReference(null, component, service);
-
- //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;
}
@@ -104,15 +99,7 @@ public class RequestContextImpl implements RequestContext {
List<RuntimeWire> wires = callbackReference.getRuntimeWires();
ProxyFactory proxyFactory = new ExtensibleProxyFactory(proxyFactoryExtensionPoint);
ServiceReferenceImpl ref = new CallbackServiceReferenceImpl(javaClass, wires, proxyFactory);
- if (ref != null) {
- //ref.resolveTarget();
- // 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/invocation/impl/JDKInvocationHandler.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/JDKInvocationHandler.java
index cfe572ee42..08521d1b88 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
@@ -82,49 +82,15 @@ public class JDKInvocationHandler implements InvocationHandler, Serializable {
}
protected void init(RuntimeWire wire) {
- // TODO - EPR not required for OASIS
- /*
- if (wire != null) {
- try {
- // Clone the endpoint reference so that reference parameters can be changed
- source = (EndpointReference)wire.getSource().clone();
- } catch (CloneNotSupportedException e) {
- throw new ServiceRuntimeException(e);
- }
- initConversational(wire);
- }
- */
- }
-
- /* TODO - EPR - not required for OASIS
- protected void initConversational(RuntimeWire wire) {
- InterfaceContract contract = wire.getSource().getInterfaceContract();
- this.conversational = contract.getInterface().isConversational();
}
- */
public Class<?> getBusinessInterface() {
return businessInterface;
}
-
protected Object getCallbackID() {
-// if (callableReference != null) {
-// return callableReference.getCallbackID();
-// } else {
- return null;
-// }
- }
-
- /* TODO - EPR - Not reqiured for OASIS
- protected Object getCallbackObject() {
- if (callableReference != null && callableReference instanceof ServiceReference) {
- return ((ServiceReference)callableReference).getService();
- } else {
- return null;
- }
+ return null;
}
- */
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
if (Object.class == method.getDeclaringClass()) {
@@ -275,11 +241,7 @@ public class JDKInvocationHandler implements InvocationHandler, Serializable {
msg.setBody(args);
Message msgContext = ThreadMessageContext.getMessageContext();
-
- // TODO - EPR - not required for OASIS
- //Object currentConversationID = msgContext.getFrom().getReferenceParameters().getConversationID();
- //conversationPreinvoke(msg, wire);
-
+
handleCallback(msg, wire);
ThreadMessageContext.setMessageContext(msg);
boolean abnormalEndConversation = false;
@@ -288,28 +250,6 @@ 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 {
- boolean businessException = false;
-
- for (DataType dataType : operation.getFaultTypes()){
- if (dataType.getPhysical() == ((Throwable)body).getClass()){
- businessException = true;
- break;
- }
- }
-
- if (businessException == false){
- abnormalEndConversation = true;
- }
- } catch (Exception ex){
- // TODO - sure what the best course of action is here. We have
- // a system exception in the middle of a business exception
- }
- }
- */
throw (Throwable)body;
}
return body;
@@ -334,165 +274,7 @@ public class JDKInvocationHandler implements InvocationHandler, Serializable {
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
- // register the calling component instance against this
- // new conversation id so that stateful callbacks will be
- // able to find it
- Object callbackObject = getCallbackObject();
- if (conversational && callbackObject == null) {
- // the component instance is already registered
- // so add another registration
- ScopeContainer<Object> scopeContainer = getConversationalScopeContainer(wire);
-
- if (scopeContainer != null && currentConversationID != null) {
- scopeContainer.addWrapperReference(currentConversationID, conversation.getConversationID());
- }
- }
-
- Interface interfaze = msg.getFrom().getCallbackEndpoint().getInterfaceContract().getInterface();
- if (callbackObject != null) {
- if (callbackObject instanceof ServiceReference) {
- CallableReferenceExt<?> callableReference = (CallableReferenceExt<?>)callbackObject;
- EndpointReference callbackRef = callableReference.getEndpointReference();
-
- // TODO - EPR - create chains on the callback reference in case this hasn't already happened
- // needed as the bindings are not now matched until the chanins are created
- callableReference.getRuntimeWire().getInvocationChains();
-
- parameters.setCallbackReference(callbackRef);
- } else {
- if (interfaze != null) {
- if (!interfaze.isConversational()) {
- throw new IllegalArgumentException(
- "Callback object for stateless callback is not a ServiceReference");
- } else {
- if (!(callbackObject instanceof Serializable)) {
- throw new IllegalArgumentException(
- "Callback object for stateful callback is not Serializable");
- }
- ScopeContainer scopeContainer = getConversationalScopeContainer(wire);
- if (scopeContainer != null) {
- InstanceWrapper wrapper = new CallbackObjectWrapper(callbackObject);
- scopeContainer.registerWrapper(wrapper, conversation.getConversationID());
- }
- parameters.setCallbackObjectID(callbackObject);
- }
- }
- }
- }
- */
- }
-
- /**
- * Pre-invoke for the conversation handling
- * @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
- return;
- }
-
- ConversationManager conversationManager = ((RuntimeWireImpl2)wire).getConversationManager();
-
- if (conversation == null || conversation.getState() == ConversationState.ENDED) {
-
- conversation = conversationManager.startConversation(getConversationID());
-
- // if this is a local wire then set up the conversation timeouts here based on the
- // parameters from the component
- 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
- if (callableReference != null) {
- ((CallableReferenceImpl)callableReference).attachConversation(conversation);
- }
- } else if (conversation.isExpired()) {
- throw new ConversationEndedException("Conversation " + conversation.getConversationID() + " has expired.");
- }
-
- // 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.getEndpoint().getComponent() != null){
- conversation.updateLastReferencedTime();
- }
-
- msg.getFrom().getReferenceParameters().setConversationID(conversation.getConversationID());
-
- }
- */
-
- /**
- * Post-invoke for the conversation handling
- * @param wire
- * @param operation
- * @throws TargetDestructionException
- */
- /* TODO - not required for OASIS
- @SuppressWarnings("unchecked")
- private void conversationPostInvoke(Message msg, RuntimeWire wire, boolean abnormalEndConversation)
- throws TargetDestructionException {
- Operation operation = msg.getOperation();
- ConversationSequence sequence = operation.getConversationSequence();
- // We check that conversation has not already ended as there is only one
- // conversation manager in the runtime and so, in the case of remote bindings,
- // the conversation will already have been stopped when we get back to the client
- if ((sequence == ConversationSequence.CONVERSATION_END || abnormalEndConversation) &&
- (conversation.getState() != ConversationState.ENDED)) {
-
- // remove conversation id from scope container
- ScopeContainer scopeContainer = getConversationalScopeContainer(wire);
-
- if (scopeContainer != null) {
- scopeContainer.remove(conversation.getConversationID());
- }
-
- conversation.end();
- }
- }
-
-
- private ScopeContainer<Object> getConversationalScopeContainer(RuntimeWire wire) {
- ScopeContainer<Object> scopeContainer = null;
-
- RuntimeComponent runtimeComponent = (RuntimeComponent)wire.getEndpointReference().getComponent();
-
- if (runtimeComponent instanceof ScopedRuntimeComponent) {
- ScopedRuntimeComponent scopedRuntimeComponent = (ScopedRuntimeComponent)runtimeComponent;
- ScopeContainer<Object> tmpScopeContainer = scopedRuntimeComponent.getScopeContainer();
-
- if ((tmpScopeContainer != null) && (tmpScopeContainer.getScope() == Scope.CONVERSATION)) {
- scopeContainer = tmpScopeContainer;
- }
- }
-
- 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();
- } else {
- 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 53fab3392c..e66fb0567a 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
@@ -44,9 +44,6 @@ public class MessageImpl implements Message {
private Object bindingContext;
public MessageImpl() {
- // TODO - EPR - What to do by default?
- //this.from = new EndpointReferenceImpl("/");
- //this.to = new EndpointReferenceImpl("/");
this.from = null;
this.to = null;
}
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 476ed9ac83..ed7a4d278f 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
@@ -76,43 +76,12 @@ public class JavaImplementationInvoker implements Invoker, DataExchangeSemantics
Object contextId = null;
EndpointReference 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();
- if (scope == Scope.REQUEST) {
- contextId = Thread.currentThread();
- } else if (scope == Scope.CONVERSATION && parameters != null) {
- contextId = parameters.getConversationID();
- }
- }
- */
try {
// The following call might create a new conversation, as a result, the msg.getConversationID() might
// return a new value
InstanceWrapper wrapper = scopeContainer.getWrapper(contextId);
- // detects whether the scope container has created a conversation Id. This will
- // happen in the case that the component has conversational scope but only the
- // callback interface is conversational. Or in the callback case if the service interface
- // is conversational and the callback interface isn't. If we are in this situation we need
- // 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();
// If the method couldn't be computed statically, or the instance being
@@ -136,15 +105,6 @@ 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) {
@@ -174,9 +134,6 @@ 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