tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lrese...@apache.org
Subject svn commit: r1173891 - /tuscany/sca-java-2.x/trunk/modules/binding-websocket/src/main/java/org/apache/tuscany/sca/binding/websocket/runtime/
Date Wed, 21 Sep 2011 22:11:11 GMT
Author: lresende
Date: Wed Sep 21 22:11:10 2011
New Revision: 1173891

URL: http://svn.apache.org/viewvc?rev=1173891&view=rev
Log:
Properly creating endpoints, to avoid issues with OSGi in Eclipse env

Modified:
    tuscany/sca-java-2.x/trunk/modules/binding-websocket/src/main/java/org/apache/tuscany/sca/binding/websocket/runtime/WebsocketBindingDispatcher.java
    tuscany/sca-java-2.x/trunk/modules/binding-websocket/src/main/java/org/apache/tuscany/sca/binding/websocket/runtime/WebsocketBindingProviderFactory.java
    tuscany/sca-java-2.x/trunk/modules/binding-websocket/src/main/java/org/apache/tuscany/sca/binding/websocket/runtime/WebsocketServiceBindingProvider.java
    tuscany/sca-java-2.x/trunk/modules/binding-websocket/src/main/java/org/apache/tuscany/sca/binding/websocket/runtime/WebsocketServiceInvoker.java

Modified: tuscany/sca-java-2.x/trunk/modules/binding-websocket/src/main/java/org/apache/tuscany/sca/binding/websocket/runtime/WebsocketBindingDispatcher.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/binding-websocket/src/main/java/org/apache/tuscany/sca/binding/websocket/runtime/WebsocketBindingDispatcher.java?rev=1173891&r1=1173890&r2=1173891&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/binding-websocket/src/main/java/org/apache/tuscany/sca/binding/websocket/runtime/WebsocketBindingDispatcher.java
(original)
+++ tuscany/sca-java-2.x/trunk/modules/binding-websocket/src/main/java/org/apache/tuscany/sca/binding/websocket/runtime/WebsocketBindingDispatcher.java
Wed Sep 21 22:11:10 2011
@@ -21,6 +21,7 @@ package org.apache.tuscany.sca.binding.w
 import java.util.HashMap;
 import java.util.Map;
 
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
 import org.apache.tuscany.sca.interfacedef.Operation;
 import org.apache.tuscany.sca.runtime.RuntimeEndpoint;
 
@@ -32,8 +33,8 @@ public class WebsocketBindingDispatcher 
 
     private Map<String, WebsocketServiceInvoker> invokers = new HashMap<String,
WebsocketServiceInvoker>();
 
-    public void addOperation(String uri, RuntimeEndpoint endpoint, Operation operation) {
-        invokers.put(uri, new WebsocketServiceInvoker(operation, endpoint));
+    public void addOperation(String uri, ExtensionPointRegistry extensionPoints, RuntimeEndpoint
endpoint, Operation operation) {
+        invokers.put(uri, new WebsocketServiceInvoker(extensionPoints, operation, endpoint));
     }
 
     public WebsocketServiceInvoker dispatch(String uri) {

Modified: tuscany/sca-java-2.x/trunk/modules/binding-websocket/src/main/java/org/apache/tuscany/sca/binding/websocket/runtime/WebsocketBindingProviderFactory.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/binding-websocket/src/main/java/org/apache/tuscany/sca/binding/websocket/runtime/WebsocketBindingProviderFactory.java?rev=1173891&r1=1173890&r2=1173891&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/binding-websocket/src/main/java/org/apache/tuscany/sca/binding/websocket/runtime/WebsocketBindingProviderFactory.java
(original)
+++ tuscany/sca-java-2.x/trunk/modules/binding-websocket/src/main/java/org/apache/tuscany/sca/binding/websocket/runtime/WebsocketBindingProviderFactory.java
Wed Sep 21 22:11:10 2011
@@ -34,9 +34,11 @@ import org.apache.tuscany.sca.runtime.Ru
  */
 public class WebsocketBindingProviderFactory implements BindingProviderFactory<WebsocketBinding>
{
 
+    private ExtensionPointRegistry extensionPoints;
     private ServletHost servletHost;
 
     public WebsocketBindingProviderFactory(ExtensionPointRegistry extensionPoints) {
+        this.extensionPoints = extensionPoints;
         this.servletHost = ServletHostHelper.getServletHost(extensionPoints);
     }
 
@@ -49,7 +51,7 @@ public class WebsocketBindingProviderFac
     }
 
     public ServiceBindingProvider createServiceBindingProvider(RuntimeEndpoint endpoint)
{
-        return new WebsocketServiceBindingProvider(endpoint, servletHost);
+        return new WebsocketServiceBindingProvider(extensionPoints, endpoint, servletHost);
     }
 
 }

Modified: tuscany/sca-java-2.x/trunk/modules/binding-websocket/src/main/java/org/apache/tuscany/sca/binding/websocket/runtime/WebsocketServiceBindingProvider.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/binding-websocket/src/main/java/org/apache/tuscany/sca/binding/websocket/runtime/WebsocketServiceBindingProvider.java?rev=1173891&r1=1173890&r2=1173891&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/binding-websocket/src/main/java/org/apache/tuscany/sca/binding/websocket/runtime/WebsocketServiceBindingProvider.java
(original)
+++ tuscany/sca-java-2.x/trunk/modules/binding-websocket/src/main/java/org/apache/tuscany/sca/binding/websocket/runtime/WebsocketServiceBindingProvider.java
Wed Sep 21 22:11:10 2011
@@ -23,6 +23,7 @@ import java.util.HashMap;
 import java.util.Map;
 
 import org.apache.tuscany.sca.binding.websocket.WebsocketBinding;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
 import org.apache.tuscany.sca.host.http.ServletHost;
 import org.apache.tuscany.sca.interfacedef.InterfaceContract;
 import org.apache.tuscany.sca.interfacedef.Operation;
@@ -38,10 +39,12 @@ public class WebsocketServiceBindingProv
     private static final int DEFAULT_PORT = 9000;
     private static final String JAVASCRIPT_RESOURCE_PATH = "/org.apache.tuscany.sca.WebsocketComponentContext.js";
     private static Map<Integer, WebsocketServer> servers = new HashMap<Integer,
WebsocketServer>();
+    private ExtensionPointRegistry extensionPoints;
     private RuntimeEndpoint endpoint;
     private ServletHost servletHost;
 
-    public WebsocketServiceBindingProvider(RuntimeEndpoint endpoint, ServletHost servletHost)
{
+    public WebsocketServiceBindingProvider(ExtensionPointRegistry extensionPoints, RuntimeEndpoint
endpoint, ServletHost servletHost) {
+        this.extensionPoints = extensionPoints;
         this.endpoint = endpoint;
         this.servletHost = servletHost;
     }
@@ -58,7 +61,7 @@ public class WebsocketServiceBindingProv
             String service = endpoint.getService().getName();
             for (Operation op : getBindingInterfaceContract().getInterface().getOperations())
{
                 String operation = op.getName();
-                server.getDispatcher().addOperation(component + "." + service + "." + operation,
endpoint, op);
+                server.getDispatcher().addOperation(component + "." + service + "." + operation,
extensionPoints, endpoint, op);
             }
             JavascriptGenerator.generateServiceProxy(component, service, getBindingInterfaceContract().getInterface()
                     .getOperations(), port);

Modified: tuscany/sca-java-2.x/trunk/modules/binding-websocket/src/main/java/org/apache/tuscany/sca/binding/websocket/runtime/WebsocketServiceInvoker.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/binding-websocket/src/main/java/org/apache/tuscany/sca/binding/websocket/runtime/WebsocketServiceInvoker.java?rev=1173891&r1=1173890&r2=1173891&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/binding-websocket/src/main/java/org/apache/tuscany/sca/binding/websocket/runtime/WebsocketServiceInvoker.java
(original)
+++ tuscany/sca-java-2.x/trunk/modules/binding-websocket/src/main/java/org/apache/tuscany/sca/binding/websocket/runtime/WebsocketServiceInvoker.java
Wed Sep 21 22:11:10 2011
@@ -21,9 +21,11 @@ package org.apache.tuscany.sca.binding.w
 
 import java.lang.reflect.InvocationTargetException;
 
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Endpoint;
 import org.apache.tuscany.sca.assembly.EndpointReference;
-import org.apache.tuscany.sca.core.assembly.impl.RuntimeEndpointImpl;
-import org.apache.tuscany.sca.core.assembly.impl.RuntimeEndpointReferenceImpl;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.FactoryExtensionPoint;
 import org.apache.tuscany.sca.core.invocation.Constants;
 import org.apache.tuscany.sca.core.invocation.impl.MessageImpl;
 import org.apache.tuscany.sca.interfacedef.Operation;
@@ -36,10 +38,14 @@ import org.apache.tuscany.sca.runtime.Ru
  */
 public class WebsocketServiceInvoker {
 
+    protected AssemblyFactory assemblyFactory;
     protected Operation operation;
     protected RuntimeEndpoint endpoint;
 
-    public WebsocketServiceInvoker(Operation operation, RuntimeEndpoint endpoint) {
+    public WebsocketServiceInvoker(ExtensionPointRegistry extensionPoints, Operation operation,
RuntimeEndpoint endpoint) {
+        FactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(FactoryExtensionPoint.class);
+        assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
+        
         this.operation = operation;
         this.endpoint = endpoint;
     }
@@ -63,8 +69,8 @@ public class WebsocketServiceInvoker {
         Message msg = new MessageImpl();
         msg.getHeaders().put(Constants.MESSAGE_ID, channel.getId());
         msg.setBody(args);
-        EndpointReference re = new RuntimeEndpointReferenceImpl();
-        RuntimeEndpointImpl callbackEndpoint = new RuntimeEndpointImpl();
+        EndpointReference re = assemblyFactory.createEndpointReference(); //new RuntimeEndpointReferenceImpl();
+        Endpoint callbackEndpoint = assemblyFactory.createEndpoint(); //new RuntimeEndpointImpl();
         callbackEndpoint.setURI(request.getOperation());
         re.setCallbackEndpoint(callbackEndpoint);
         msg.setFrom(re);



Mime
View raw message