You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by jb...@apache.org on 2007/02/16 15:55:39 UTC

svn commit: r508430 - /incubator/tuscany/java/sca/runtime/standalone/standalone-host/src/main/java/org/apache/tuscany/runtime/standalone/host/StandaloneRuntimeImpl.java

Author: jboynes
Date: Fri Feb 16 06:55:38 2007
New Revision: 508430

URL: http://svn.apache.org/viewvc?view=rev&rev=508430
Log:
fix compile problem related to capture of ?

Modified:
    incubator/tuscany/java/sca/runtime/standalone/standalone-host/src/main/java/org/apache/tuscany/runtime/standalone/host/StandaloneRuntimeImpl.java

Modified: incubator/tuscany/java/sca/runtime/standalone/standalone-host/src/main/java/org/apache/tuscany/runtime/standalone/host/StandaloneRuntimeImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/runtime/standalone/standalone-host/src/main/java/org/apache/tuscany/runtime/standalone/host/StandaloneRuntimeImpl.java?view=diff&rev=508430&r1=508429&r2=508430
==============================================================================
--- incubator/tuscany/java/sca/runtime/standalone/standalone-host/src/main/java/org/apache/tuscany/runtime/standalone/host/StandaloneRuntimeImpl.java (original)
+++ incubator/tuscany/java/sca/runtime/standalone/standalone-host/src/main/java/org/apache/tuscany/runtime/standalone/host/StandaloneRuntimeImpl.java Fri Feb 16 06:55:38 2007
@@ -21,11 +21,13 @@
 import java.net.URI;
 import java.net.URL;
 import java.util.Map;
+import java.lang.reflect.InvocationTargetException;
 
 import org.apache.tuscany.spi.component.AtomicComponent;
 import org.apache.tuscany.spi.component.Component;
 import org.apache.tuscany.spi.component.RegistrationException;
 import org.apache.tuscany.spi.component.TargetResolutionException;
+import org.apache.tuscany.spi.component.TargetInvokerCreationException;
 import org.apache.tuscany.spi.deployer.Deployer;
 import org.apache.tuscany.spi.implementation.java.JavaMappedService;
 import org.apache.tuscany.spi.implementation.java.PojoComponentType;
@@ -89,23 +91,26 @@
         for (Map.Entry<String, ComponentDefinition<? extends Implementation<?>>> entry : components.entrySet()) {
             String name = entry.getKey();
             ComponentDefinition<? extends Implementation<?>> launchedDefinition = entry.getValue();
-            Implementation<?> implementation = launchedDefinition.getImplementation();
+            Implementation implementation = launchedDefinition.getImplementation();
             if(implementation.getClass().isAssignableFrom(Launched.class)) {
-                Launched launched = (Launched) implementation;
-                PojoComponentType launchedType = launched.getComponentType();
-                Map services = launchedType.getServices();
-                JavaMappedService testService = (JavaMappedService) services.get("main");
-                Operation<?> operation = testService.getServiceContract().getOperations().get("main");
-                // TODO Find the component and invoke main on the component
-                URI componentUri = compositeUri.resolve(name);
-                Component component = getComponentManager().getComponent(componentUri);
-                if(component == null) {
-                    System.err.println("Unable to get component " + componentUri);
-                } else {
-                    TargetInvoker targetInvoker = component.createTargetInvoker("main", operation, null);
-                    targetInvoker.invokeTarget(null, TargetInvoker.NONE);
-                }
+                run(compositeUri.resolve(name), implementation);
             }
+        }
+    }
+
+    private void run(URI componentUri, Implementation implementation) throws TargetInvokerCreationException, InvocationTargetException {
+        Launched launched = (Launched) implementation;
+        PojoComponentType launchedType = launched.getComponentType();
+        Map services = launchedType.getServices();
+        JavaMappedService testService = (JavaMappedService) services.get("main");
+        Operation<?> operation = testService.getServiceContract().getOperations().get("main");
+        // TODO Find the component and invoke main on the component
+        Component component = getComponentManager().getComponent(componentUri);
+        if(component == null) {
+            System.err.println("Unable to get component " + componentUri);
+        } else {
+            TargetInvoker targetInvoker = component.createTargetInvoker("main", operation, null);
+            targetInvoker.invokeTarget(null, TargetInvoker.NONE);
         }
     }
 



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