summaryrefslogtreecommitdiffstats
path: root/java/sca/modules/binding-jsonrpc-runtime/src
diff options
context:
space:
mode:
authorrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2009-11-13 21:49:15 +0000
committerrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2009-11-13 21:49:15 +0000
commit4dcff7533534e4b634b349a1105c7862d1655405 (patch)
tree61674abfb88ba63870bec8576101dc3d222454fa /java/sca/modules/binding-jsonrpc-runtime/src
parentc6a1c369e49090b6b9a6f2448045740a368c7ca3 (diff)
Replace RuntimeWire with RuntimeEnpoint/RuntimeEndpointReference as the owner of invocaiton chains
(http://www.mail-archive.com/dev@tuscany.apache.org/msg07856.html) git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@836009 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/sca/modules/binding-jsonrpc-runtime/src')
-rw-r--r--java/sca/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCBindingProviderFactory.java8
-rw-r--r--java/sca/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCServiceBindingProvider.java13
-rw-r--r--java/sca/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCServiceServlet.java21
3 files changed, 17 insertions, 25 deletions
diff --git a/java/sca/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCBindingProviderFactory.java b/java/sca/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCBindingProviderFactory.java
index 4059d5a1f0..2a1fa8ba6b 100644
--- a/java/sca/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCBindingProviderFactory.java
+++ b/java/sca/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCBindingProviderFactory.java
@@ -19,8 +19,6 @@
package org.apache.tuscany.sca.binding.jsonrpc.provider;
-import org.apache.tuscany.sca.assembly.Endpoint;
-import org.apache.tuscany.sca.assembly.EndpointReference;
import org.apache.tuscany.sca.binding.jsonrpc.JSONRPCBinding;
import org.apache.tuscany.sca.core.ExtensionPointRegistry;
import org.apache.tuscany.sca.core.FactoryExtensionPoint;
@@ -30,6 +28,8 @@ import org.apache.tuscany.sca.invocation.MessageFactory;
import org.apache.tuscany.sca.provider.BindingProviderFactory;
import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
import org.apache.tuscany.sca.provider.ServiceBindingProvider;
+import org.apache.tuscany.sca.runtime.RuntimeEndpoint;
+import org.apache.tuscany.sca.runtime.RuntimeEndpointReference;
/**
* JSON-RPC Provider Factory
@@ -49,12 +49,12 @@ public class JSONRPCBindingProviderFactory implements BindingProviderFactory<JSO
messageFactory = modelFactories.getFactory(MessageFactory.class);
}
- public ReferenceBindingProvider createReferenceBindingProvider(EndpointReference endpointReference) {
+ public ReferenceBindingProvider createReferenceBindingProvider(RuntimeEndpointReference endpointReference) {
return new JSONRPCReferenceBindingProvider(endpointReference);
}
- public ServiceBindingProvider createServiceBindingProvider(Endpoint endpoint) {
+ public ServiceBindingProvider createServiceBindingProvider(RuntimeEndpoint endpoint) {
return new JSONRPCServiceBindingProvider(endpoint, messageFactory, servletHost);
}
diff --git a/java/sca/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCServiceBindingProvider.java b/java/sca/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCServiceBindingProvider.java
index dca4965378..1ab46aaff6 100644
--- a/java/sca/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCServiceBindingProvider.java
+++ b/java/sca/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCServiceBindingProvider.java
@@ -22,9 +22,7 @@ package org.apache.tuscany.sca.binding.jsonrpc.provider;
import java.util.ArrayList;
import java.util.List;
-import org.apache.tuscany.sca.assembly.Endpoint;
import org.apache.tuscany.sca.binding.jsonrpc.JSONRPCBinding;
-import org.apache.tuscany.sca.databinding.json.JSONDataBinding;
import org.apache.tuscany.sca.host.http.ServletHost;
import org.apache.tuscany.sca.interfacedef.Interface;
import org.apache.tuscany.sca.interfacedef.InterfaceContract;
@@ -33,6 +31,7 @@ import org.apache.tuscany.sca.invocation.MessageFactory;
import org.apache.tuscany.sca.provider.ServiceBindingProvider;
import org.apache.tuscany.sca.runtime.RuntimeComponent;
import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+import org.apache.tuscany.sca.runtime.RuntimeEndpoint;
/**
@@ -43,7 +42,7 @@ import org.apache.tuscany.sca.runtime.RuntimeComponentService;
public class JSONRPCServiceBindingProvider implements ServiceBindingProvider {
private MessageFactory messageFactory;
- private Endpoint endpoint;
+ private RuntimeEndpoint endpoint;
private RuntimeComponent component;
private RuntimeComponentService service;
private InterfaceContract serviceContract;
@@ -51,7 +50,7 @@ public class JSONRPCServiceBindingProvider implements ServiceBindingProvider {
private ServletHost servletHost;
private List<String> servletMappings = new ArrayList<String>();
- public JSONRPCServiceBindingProvider(Endpoint endpoint,
+ public JSONRPCServiceBindingProvider(RuntimeEndpoint endpoint,
MessageFactory messageFactory,
ServletHost servletHost) {
this.endpoint = endpoint;
@@ -72,7 +71,7 @@ public class JSONRPCServiceBindingProvider implements ServiceBindingProvider {
}
public InterfaceContract getBindingInterfaceContract() {
- return service.getInterfaceContract();
+ return serviceContract;
}
public boolean supportsOneWayInvocation() {
@@ -81,7 +80,7 @@ public class JSONRPCServiceBindingProvider implements ServiceBindingProvider {
public void start() {
// Set default databinding to json
- serviceContract.getInterface().resetDataBinding(JSONDataBinding.NAME);
+ // serviceContract.getInterface().resetDataBinding(JSONDataBinding.NAME);
// Determine the service business interface
Class<?> serviceInterface = getTargetJavaClass(serviceContract.getInterface());
@@ -91,7 +90,7 @@ public class JSONRPCServiceBindingProvider implements ServiceBindingProvider {
// Create and register a Servlet for this service
JSONRPCServiceServlet serviceServlet =
- new JSONRPCServiceServlet(messageFactory, binding, service, serviceContract, serviceInterface, proxy);
+ new JSONRPCServiceServlet(messageFactory, endpoint, serviceInterface, proxy);
String mapping = binding.getURI();
if (!mapping.endsWith("/")) {
mapping += "/";
diff --git a/java/sca/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCServiceServlet.java b/java/sca/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCServiceServlet.java
index 71d335acc8..9034e24485 100644
--- a/java/sca/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCServiceServlet.java
+++ b/java/sca/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCServiceServlet.java
@@ -32,12 +32,10 @@ import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.interfacedef.InterfaceContract;
import org.apache.tuscany.sca.interfacedef.Operation;
import org.apache.tuscany.sca.invocation.Message;
import org.apache.tuscany.sca.invocation.MessageFactory;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-import org.apache.tuscany.sca.runtime.RuntimeWire;
+import org.apache.tuscany.sca.runtime.RuntimeEndpoint;
import org.jabsorb.JSONRPCBridge;
import org.jabsorb.JSONRPCResult;
import org.jabsorb.JSONRPCServlet;
@@ -61,21 +59,17 @@ public class JSONRPCServiceServlet extends JSONRPCServlet {
transient Binding binding;
transient String serviceName;
transient Object serviceInstance;
- transient RuntimeComponentService componentService;
- transient InterfaceContract serviceContract;
+ transient RuntimeEndpoint endpoint;
transient Class<?> serviceInterface;
public JSONRPCServiceServlet(MessageFactory messageFactory,
- Binding binding,
- RuntimeComponentService componentService,
- InterfaceContract serviceContract,
+ RuntimeEndpoint endpoint,
Class<?> serviceInterface,
Object serviceInstance) {
+ this.endpoint = endpoint;
this.messageFactory = messageFactory;
- this.binding = binding;
+ this.binding = endpoint.getBinding();
this.serviceName = binding.getName();
- this.componentService = componentService;
- this.serviceContract = serviceContract;
this.serviceInterface = serviceInterface;
this.serviceInstance = serviceInstance;
}
@@ -238,7 +232,6 @@ public class JSONRPCServiceServlet extends JSONRPCServlet {
}
// invoke the request
- RuntimeWire wire = componentService.getRuntimeWire(binding, serviceContract);
Operation jsonOperation = findOperation(method);
Object result = null;
@@ -254,7 +247,7 @@ public class JSONRPCServiceServlet extends JSONRPCServlet {
//result = wire.invoke(jsonOperation, args);
Message responseMessage = null;
try {
- responseMessage = wire.getInvocationChain(jsonOperation).getHeadInvoker().invoke(requestMessage);
+ responseMessage = endpoint.getInvocationChain(jsonOperation).getHeadInvoker().invoke(requestMessage);
} catch (RuntimeException re) {
if (re.getCause() instanceof javax.security.auth.login.LoginException) {
throw re;
@@ -297,7 +290,7 @@ public class JSONRPCServiceServlet extends JSONRPCServlet {
method = method.substring(method.lastIndexOf(".") + 1);
}
- List<Operation> operations = serviceContract.getInterface().getOperations();
+ List<Operation> operations = endpoint.getServiceInterfaceContract().getInterface().getOperations();
//componentService.getBindingProvider(binding).getBindingInterfaceContract().getInterface().getOperations();