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/01/30 21:37:24 UTC

svn commit: r501548 - in /incubator/tuscany/sandbox/jboynes/sca-client/src: main/java/org/osoa/sca/CompositeContext.java main/java/org/osoa/sca/SCADomain.java test/java/sample/client/BasicClient.java

Author: jboynes
Date: Tue Jan 30 12:37:23 2007
New Revision: 501548

URL: http://svn.apache.org/viewvc?view=rev&rev=501548
Log:
remove CompositeContext
have SCADOmain return ComponentContext for an unmanaged component
fix client sample to use ComponentContext API

Removed:
    incubator/tuscany/sandbox/jboynes/sca-client/src/main/java/org/osoa/sca/CompositeContext.java
Modified:
    incubator/tuscany/sandbox/jboynes/sca-client/src/main/java/org/osoa/sca/SCADomain.java
    incubator/tuscany/sandbox/jboynes/sca-client/src/test/java/sample/client/BasicClient.java

Modified: incubator/tuscany/sandbox/jboynes/sca-client/src/main/java/org/osoa/sca/SCADomain.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/jboynes/sca-client/src/main/java/org/osoa/sca/SCADomain.java?view=diff&rev=501548&r1=501547&r2=501548
==============================================================================
--- incubator/tuscany/sandbox/jboynes/sca-client/src/main/java/org/osoa/sca/SCADomain.java (original)
+++ incubator/tuscany/sandbox/jboynes/sca-client/src/main/java/org/osoa/sca/SCADomain.java Tue Jan 30 12:37:23 2007
@@ -14,15 +14,16 @@
     URI getBaseURI();
 
     /**
-     * Return the CompositeContext identified by the supplied component id.
-     * The supplied URI must identify a component implemented by a composite.
-     * The returned context can be used by unmanaged code to access services
-     * provided by components defined in the composite.
+     * Return the ComponentContext identified by the supplied component id.
+     * The supplied URI must identify a component whose implementation is unmanaged.
+     * The returned context can be used by unmanaged code to access references and properties
+     * defined by the component type.
+     * The URI will be resolved against the Domain's base URI.
      *
-     * @param componentURI the id of a component implemented by a composite
+     * @param componentURI the id of a component whose implementation is unmanaged
      * @return the context for that component
      */
-    CompositeContext getContext(URI componentURI);
+    ComponentContext getContext(URI componentURI);
 
     /**
      * Disconnect from this domain, shutting down any components running in the local environment

Modified: incubator/tuscany/sandbox/jboynes/sca-client/src/test/java/sample/client/BasicClient.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/jboynes/sca-client/src/test/java/sample/client/BasicClient.java?view=diff&rev=501548&r1=501547&r2=501548
==============================================================================
--- incubator/tuscany/sandbox/jboynes/sca-client/src/test/java/sample/client/BasicClient.java (original)
+++ incubator/tuscany/sandbox/jboynes/sca-client/src/test/java/sample/client/BasicClient.java Tue Jan 30 12:37:23 2007
@@ -1,6 +1,10 @@
 package sample.client;
 
-import org.osoa.sca.CompositeContext;
+import java.net.URI;
+
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.DomainFactory;
+import org.osoa.sca.SCADomain;
 import org.osoa.sca.ServiceReference;
 import sample.HelloService;
 
@@ -8,15 +12,17 @@
  * @version $Rev$ $Date$
  */
 public class BasicClient {
-    private CompositeContext context;
+    private static final URI DOMAIN_URI = URI.create("http://sca.example.com/Domain");
+
+    private static ComponentContext context;
 
     public void useComponentDirectly() {
-        HelloService helloService = context.locateService(HelloService.class, "helloService");
+        HelloService helloService = context.getService(HelloService.class, "helloService");
         helloService.hello("World");
     }
 
     public void useComponentViaReference() {
-        ServiceReference<HelloService> ref = context.locateServiceReference(HelloService.class, "helloService");
+        ServiceReference<HelloService> ref = context.getServiceReference(HelloService.class, "helloService");
         HelloService helloService = ref.getService();
         helloService.hello("World");
 
@@ -25,16 +31,23 @@
     }
 
     public void useReferenceDirectly() {
-        HelloService helloService = context.locateService(HelloService.class, "helloReference");
+        HelloService helloService = context.getService(HelloService.class, "helloReference");
         helloService.hello("World");
     }
 
     public void useReferenceViaReference() {
-        ServiceReference<HelloService> ref = context.locateServiceReference(HelloService.class, "helloReference");
+        ServiceReference<HelloService> ref = context.getServiceReference(HelloService.class, "helloReference");
         HelloService helloService = ref.getService();
         helloService.hello("World");
 
         ServiceReference<HelloService> ref2 = context.cast(helloService);
         assert ref == ref2;
+    }
+
+    public static void main(String[] args) {
+        SCADomain domain = DomainFactory.getInstance().connect(DOMAIN_URI);
+        context = domain.getContext(URI.create("path/to/unmanaged/component"));
+        // call methods
+        domain.disconnect();
     }
 }



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