diff options
author | lresende <lresende@13f79535-47bb-0310-9956-ffa450edef68> | 2009-10-01 03:55:29 +0000 |
---|---|---|
committer | lresende <lresende@13f79535-47bb-0310-9956-ffa450edef68> | 2009-10-01 03:55:29 +0000 |
commit | 4de86da7aa917b043ed4b892886b34f7ea09a50d (patch) | |
tree | 42ff8e77e57bcabb0ffbf41b3734294bded78542 /java/sca/modules/binding-jsonrpc-runtime/src/main | |
parent | ee007fd981ef628e59c4dcaf570f58ad6fc08231 (diff) |
Porting pieces of JSONRPC Binding : ProviderFactory, ReferenceBindingProvider and ServiceBindingProvider
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@820519 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to '')
3 files changed, 33 insertions, 38 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 245eade7ad..af73caf675 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,18 +19,18 @@ package org.apache.tuscany.sca.binding.jsonrpc.provider; +import javax.xml.soap.MessageFactory; + +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.contribution.ModelFactoryExtensionPoint; import org.apache.tuscany.sca.core.ExtensionPointRegistry; +import org.apache.tuscany.sca.core.FactoryExtensionPoint; import org.apache.tuscany.sca.host.http.ServletHost; import org.apache.tuscany.sca.host.http.ServletHostExtensionPoint; -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.RuntimeComponent; -import org.apache.tuscany.sca.runtime.RuntimeComponentReference; -import org.apache.tuscany.sca.runtime.RuntimeComponentService; /** * JSON-RPC Provider Factory @@ -46,21 +46,17 @@ public class JSONRPCBindingProviderFactory implements BindingProviderFactory<JSO ServletHostExtensionPoint servletHosts = extensionPoints.getExtensionPoint(ServletHostExtensionPoint.class); this.servletHost = servletHosts.getServletHosts().get(0); - ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class); + FactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(FactoryExtensionPoint.class); messageFactory = modelFactories.getFactory(MessageFactory.class); } - public ReferenceBindingProvider createReferenceBindingProvider(RuntimeComponent component, - RuntimeComponentReference reference, - JSONRPCBinding binding) { + public ReferenceBindingProvider createReferenceBindingProvider(EndpointReference endpointReference) { - return new JSONRPCReferenceBindingProvider(component, reference, binding); + return new JSONRPCReferenceBindingProvider(endpointReference); } - public ServiceBindingProvider createServiceBindingProvider(RuntimeComponent component, - RuntimeComponentService service, - JSONRPCBinding binding) { - return new JSONRPCServiceBindingProvider(component, service, binding, messageFactory, servletHost); + public ServiceBindingProvider createServiceBindingProvider(Endpoint endpoint) { + return new JSONRPCServiceBindingProvider(endpoint, messageFactory, servletHost); } public Class<JSONRPCBinding> getModelType() { diff --git a/java/sca/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCReferenceBindingProvider.java b/java/sca/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCReferenceBindingProvider.java index e2528f59e5..e7a830e5d0 100644 --- a/java/sca/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCReferenceBindingProvider.java +++ b/java/sca/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCReferenceBindingProvider.java @@ -19,12 +19,12 @@ package org.apache.tuscany.sca.binding.jsonrpc.provider; +import org.apache.tuscany.sca.assembly.EndpointReference; import org.apache.tuscany.sca.binding.jsonrpc.JSONRPCBinding; import org.apache.tuscany.sca.interfacedef.InterfaceContract; import org.apache.tuscany.sca.interfacedef.Operation; import org.apache.tuscany.sca.invocation.Invoker; import org.apache.tuscany.sca.provider.ReferenceBindingProvider; -import org.apache.tuscany.sca.runtime.RuntimeComponent; import org.apache.tuscany.sca.runtime.RuntimeComponentReference; /** @@ -34,15 +34,15 @@ import org.apache.tuscany.sca.runtime.RuntimeComponentReference; */ public class JSONRPCReferenceBindingProvider implements ReferenceBindingProvider { + private EndpointReference endpointReference; private RuntimeComponentReference reference; private JSONRPCBinding binding; - public JSONRPCReferenceBindingProvider(RuntimeComponent component, - RuntimeComponentReference reference, - JSONRPCBinding binding) { - this.reference = reference; - this.binding = binding; + public JSONRPCReferenceBindingProvider(EndpointReference endpointReference) { + this.endpointReference = endpointReference; + this.reference = (RuntimeComponentReference) endpointReference.getReference(); + this.binding = (JSONRPCBinding) endpointReference.getBinding(); } public InterfaceContract getBindingInterfaceContract() { @@ -54,13 +54,11 @@ public class JSONRPCReferenceBindingProvider implements ReferenceBindingProvider } public void start() { - // TODO Auto-generated method stub - + // TODO Provide support for JSONRPC References } public void stop() { - // TODO Auto-generated method stub - + // TODO Provide support for JSONRPC References } public boolean supportsOneWayInvocation() { 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 909bd7bc19..92ec956959 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 @@ -23,20 +23,18 @@ import java.net.URI; 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.javabeans.SimpleJavaDataBinding; -import org.apache.tuscany.sca.databinding.json.JSONDataBinding; import org.apache.tuscany.sca.host.http.ServletHost; -import org.apache.tuscany.sca.interfacedef.DataType; import org.apache.tuscany.sca.interfacedef.Interface; import org.apache.tuscany.sca.interfacedef.InterfaceContract; -import org.apache.tuscany.sca.interfacedef.Operation; import org.apache.tuscany.sca.interfacedef.java.JavaInterface; 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; + /** * Implementation of the JSONRPC Binding Provider for Services * @@ -51,6 +49,7 @@ public class JSONRPCServiceBindingProvider implements ServiceBindingProvider { private MessageFactory messageFactory; + private Endpoint endpoint; private RuntimeComponent component; private RuntimeComponentService service; private InterfaceContract serviceContract; @@ -59,14 +58,13 @@ public class JSONRPCServiceBindingProvider implements ServiceBindingProvider { private List<String> servletMappings = new ArrayList<String>(); private String domainScriptMapping; - public JSONRPCServiceBindingProvider(RuntimeComponent component, - RuntimeComponentService service, - JSONRPCBinding binding, + public JSONRPCServiceBindingProvider(Endpoint endpoint, MessageFactory messageFactory, ServletHost servletHost) { - this.component = component; - this.service = service; - this.binding = binding; + this.endpoint = endpoint; + this.component = (RuntimeComponent)endpoint.getComponent(); + this.service = (RuntimeComponentService)endpoint.getService(); + this.binding = (JSONRPCBinding) endpoint.getBinding(); this.messageFactory = messageFactory; this.servletHost = servletHost; @@ -77,7 +75,8 @@ public class JSONRPCServiceBindingProvider implements ServiceBindingProvider { this.serviceContract = service.getInterfaceContract(); } - setDataBinding(serviceContract.getInterface()); + // FIXME Bringup JSON Databing + // setDataBinding(serviceContract.getInterface()); } public InterfaceContract getBindingInterfaceContract() { @@ -90,7 +89,8 @@ public class JSONRPCServiceBindingProvider implements ServiceBindingProvider { public void start() { // Set default databinding to json - serviceContract.getInterface().resetDataBinding(JSONDataBinding.NAME); + // FIXME : port json databinding support + // serviceContract.getInterface().resetDataBinding(JSONDataBinding.NAME); // Determine the service business interface Class<?> serviceInterface = getTargetJavaClass(serviceContract.getInterface()); @@ -163,6 +163,8 @@ public class JSONRPCServiceBindingProvider implements ServiceBindingProvider { return ((JavaInterface)targetInterface).getJavaClass(); } + // FIXME Bringup JSON Databinding support + /* private void setDataBinding(Interface interfaze) { List<Operation> operations = interfaze.getOperations(); for (Operation operation : operations) { @@ -184,6 +186,5 @@ public class JSONRPCServiceBindingProvider implements ServiceBindingProvider { } } } - - + */ } |