tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From antel...@apache.org
Subject svn commit: r564976 - in /incubator/tuscany/java/sca/modules: binding-ajax/src/main/java/org/apache/tuscany/sca/binding/ajax/ binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/ extension-helper/src/main/java/org/apache/tuscany/sca/sp...
Date Sat, 11 Aug 2007 21:18:04 GMT
Author: antelder
Date: Sat Aug 11 14:18:03 2007
New Revision: 564976

URL: http://svn.apache.org/viewvc?view=rev&rev=564976
Log:
Simplifiy extensions using ServletHost

Modified:
    incubator/tuscany/java/sca/modules/binding-ajax/src/main/java/org/apache/tuscany/sca/binding/ajax/AjaxBindingActivator.java
    incubator/tuscany/java/sca/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCBinding.java
    incubator/tuscany/java/sca/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCBindingActivator.java
    incubator/tuscany/java/sca/modules/extension-helper/src/main/java/org/apache/tuscany/sca/spi/impl/DiscoveryUtils.java

Modified: incubator/tuscany/java/sca/modules/binding-ajax/src/main/java/org/apache/tuscany/sca/binding/ajax/AjaxBindingActivator.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-ajax/src/main/java/org/apache/tuscany/sca/binding/ajax/AjaxBindingActivator.java?view=diff&rev=564976&r1=564975&r2=564976
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-ajax/src/main/java/org/apache/tuscany/sca/binding/ajax/AjaxBindingActivator.java
(original)
+++ incubator/tuscany/java/sca/modules/binding-ajax/src/main/java/org/apache/tuscany/sca/binding/ajax/AjaxBindingActivator.java
Sat Aug 11 14:18:03 2007
@@ -20,9 +20,7 @@
 package org.apache.tuscany.sca.binding.ajax;
 
 import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.http.ExtensibleServletHost;
 import org.apache.tuscany.sca.http.ServletHost;
-import org.apache.tuscany.sca.http.ServletHostExtensionPoint;
 import org.apache.tuscany.sca.runtime.RuntimeComponent;
 import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
 import org.apache.tuscany.sca.runtime.RuntimeComponentService;
@@ -34,8 +32,8 @@
 
     private ServletHost servletHost;
     
-    public AjaxBindingActivator(ServletHostExtensionPoint servletHosts) {
-        this.servletHost = new ExtensibleServletHost(servletHosts);
+    public AjaxBindingActivator(ServletHost servletHost) {
+        this.servletHost = servletHost;
     }
 
     public Class<AjaxBinding> getBindingClass() {

Modified: incubator/tuscany/java/sca/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCBinding.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCBinding.java?view=diff&rev=564976&r1=564975&r2=564976
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCBinding.java
(original)
+++ incubator/tuscany/java/sca/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCBinding.java
Sat Aug 11 14:18:03 2007
@@ -19,7 +19,6 @@
 
 package org.apache.tuscany.sca.binding.jsonrpc;
 
-import org.apache.tuscany.sca.spi.utils.AbstractBinding;
 
 /**
  * A model for the JSONRPC binding.

Modified: incubator/tuscany/java/sca/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCBindingActivator.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCBindingActivator.java?view=diff&rev=564976&r1=564975&r2=564976
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCBindingActivator.java
(original)
+++ incubator/tuscany/java/sca/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCBindingActivator.java
Sat Aug 11 14:18:03 2007
@@ -20,9 +20,7 @@
 package org.apache.tuscany.sca.binding.jsonrpc;
 
 import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.http.ExtensibleServletHost;
 import org.apache.tuscany.sca.http.ServletHost;
-import org.apache.tuscany.sca.http.ServletHostExtensionPoint;
 import org.apache.tuscany.sca.runtime.RuntimeComponent;
 import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
 import org.apache.tuscany.sca.runtime.RuntimeComponentService;
@@ -35,8 +33,8 @@
 
     protected ServletHost servletHost;
 
-    public JSONRPCBindingActivator(ServletHostExtensionPoint servletHosts) {
-        this.servletHost = new ExtensibleServletHost(servletHosts);
+    public JSONRPCBindingActivator(ServletHost servletHost) {
+        this.servletHost = servletHost;
     }
 
     public Class<JSONRPCBinding> getBindingClass() {

Modified: incubator/tuscany/java/sca/modules/extension-helper/src/main/java/org/apache/tuscany/sca/spi/impl/DiscoveryUtils.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/extension-helper/src/main/java/org/apache/tuscany/sca/spi/impl/DiscoveryUtils.java?view=diff&rev=564976&r1=564975&r2=564976
==============================================================================
--- incubator/tuscany/java/sca/modules/extension-helper/src/main/java/org/apache/tuscany/sca/spi/impl/DiscoveryUtils.java
(original)
+++ incubator/tuscany/java/sca/modules/extension-helper/src/main/java/org/apache/tuscany/sca/spi/impl/DiscoveryUtils.java
Sat Aug 11 14:18:03 2007
@@ -24,6 +24,7 @@
 import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
 import java.net.URL;
 import java.util.ArrayList;
 import java.util.Enumeration;
@@ -62,7 +63,11 @@
         Object[] extensions = new Object[paramTypes.length];
 
         for (int i=0; i< paramTypes.length; i++) {
-            extensions[i] = registry.getExtensionPoint(paramTypes[i]);
+            if ("org.apache.tuscany.sca.http.ServletHost".equals(paramTypes[i].getName()))
{
+                extensions[i] = getServletHost(registry);
+            } else {
+                extensions[i] = registry.getExtensionPoint(paramTypes[i]);
+            }
         }
         
         try {
@@ -70,6 +75,31 @@
             return cs[0].newInstance(extensions);
 
         } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    private static Object getServletHost(ExtensionPointRegistry registry) {
+        try {
+
+            Class<?> servletHostEPClass = Class.forName("org.apache.tuscany.sca.http.ServletHostExtensionPoint");
+            Object servletHostEP = registry.getExtensionPoint(servletHostEPClass);
+            Class<?> extensibleServletHost = Class.forName("org.apache.tuscany.sca.http.ExtensibleServletHost");
+            return extensibleServletHost.getConstructor(new Class[] {servletHostEPClass}).newInstance(servletHostEP);
+
+        } catch (ClassNotFoundException e) {
+            throw new RuntimeException(e);
+        } catch (IllegalArgumentException e) {
+            throw new RuntimeException(e);
+        } catch (SecurityException e) {
+            throw new RuntimeException(e);
+        } catch (InstantiationException e) {
+            throw new RuntimeException(e);
+        } catch (IllegalAccessException e) {
+            throw new RuntimeException(e);
+        } catch (InvocationTargetException e) {
+            throw new RuntimeException(e);
+        } catch (NoSuchMethodException e) {
             throw new RuntimeException(e);
         }
     }



---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org


Mime
View raw message