You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by js...@apache.org on 2007/04/12 08:01:36 UTC

svn commit: r527781 - /incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/host/embedded/SimpleCompositeContextImpl.java

Author: jsdelfino
Date: Wed Apr 11 23:01:35 2007
New Revision: 527781

URL: http://svn.apache.org/viewvc?view=rev&rev=527781
Log:
Support CompositeContext.locateService(componentName). Temporary to help the bringup of samples and integration tests that still use CompositeContext.

Modified:
    incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/host/embedded/SimpleCompositeContextImpl.java

Modified: incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/host/embedded/SimpleCompositeContextImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/host/embedded/SimpleCompositeContextImpl.java?view=diff&rev=527781&r1=527780&r2=527781
==============================================================================
--- incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/host/embedded/SimpleCompositeContextImpl.java (original)
+++ incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/host/embedded/SimpleCompositeContextImpl.java Wed Apr 11 23:01:35 2007
@@ -98,6 +98,16 @@
                     break;
                 }
             }
+            for (Component component: composite.getComponents()) {
+                if (serviceName.equals(component.getName())) {
+                    ComponentContext context = runtime.getComponentContext(URI.create(component.getName()));
+                    if (context == null) {
+                        throw new ServiceRuntimeException("Service not found: " + serviceName);
+                    }
+                    ServiceReference<T> serviceReference = context.createSelfReference(serviceType);
+                    return serviceReference.getService();
+                }
+            }
             throw new ServiceRuntimeException("Service not found: " + serviceName);
             
         } else {



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