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/31 04:04:54 UTC

svn commit: r501702 - /incubator/tuscany/sandbox/jboynes/sca-client/src/test/java/sample/client/ReallyBasicClient.java

Author: jboynes
Date: Tue Jan 30 19:04:53 2007
New Revision: 501702

URL: http://svn.apache.org/viewvc?view=rev&rev=501702
Log:
add a really basic sample

Added:
    incubator/tuscany/sandbox/jboynes/sca-client/src/test/java/sample/client/ReallyBasicClient.java   (with props)

Added: incubator/tuscany/sandbox/jboynes/sca-client/src/test/java/sample/client/ReallyBasicClient.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/jboynes/sca-client/src/test/java/sample/client/ReallyBasicClient.java?view=auto&rev=501702
==============================================================================
--- incubator/tuscany/sandbox/jboynes/sca-client/src/test/java/sample/client/ReallyBasicClient.java (added)
+++ incubator/tuscany/sandbox/jboynes/sca-client/src/test/java/sample/client/ReallyBasicClient.java Tue Jan 30 19:04:53 2007
@@ -0,0 +1,39 @@
+package sample.client;
+
+import java.net.URI;
+
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.DomainFactory;
+import org.osoa.sca.SCADomain;
+import sample.HelloService;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ReallyBasicClient {
+    private static final URI DOMAIN_URI = URI.create("http://example.com/sca");
+
+    /**
+     * <composite name="impl2">
+     *    <component name="comp2a">
+     *      <implementation.unmanaged/>
+     *      <reference name="helloService" target="hello"/>
+     *    </component>
+     *
+     *    <component name="hello">
+     *      <implementation.java class="sample.HelloServiceImpl"/>
+     *    </component>
+     * </composite>
+     */
+    public static void main(String[] args) {
+        // connect to the domain
+        SCADomain domain = DomainFactory.getInstance().connect(DOMAIN_URI);
+
+        // retreive the context for the unmanaged component
+        ComponentContext context = domain.getContext(URI.create("comp2/comp2A"));
+
+        // access a service through its reference
+        HelloService helloService = context.getService(HelloService.class, "helloService");
+        helloService.hello("World");
+    }
+}

Propchange: incubator/tuscany/sandbox/jboynes/sca-client/src/test/java/sample/client/ReallyBasicClient.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/jboynes/sca-client/src/test/java/sample/client/ReallyBasicClient.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date



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