summaryrefslogtreecommitdiffstats
path: root/sandbox/jboynes/sca-client/src/test/java/sample/client/BasicClient.java
diff options
context:
space:
mode:
Diffstat (limited to 'sandbox/jboynes/sca-client/src/test/java/sample/client/BasicClient.java')
-rw-r--r--sandbox/jboynes/sca-client/src/test/java/sample/client/BasicClient.java38
1 files changed, 38 insertions, 0 deletions
diff --git a/sandbox/jboynes/sca-client/src/test/java/sample/client/BasicClient.java b/sandbox/jboynes/sca-client/src/test/java/sample/client/BasicClient.java
new file mode 100644
index 0000000000..6565a6a5f7
--- /dev/null
+++ b/sandbox/jboynes/sca-client/src/test/java/sample/client/BasicClient.java
@@ -0,0 +1,38 @@
+package sample.client;
+
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.ServiceReference;
+import sample.HelloService;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class BasicClient {
+ private ComponentContext context;
+
+ public void useComponentDirectly() {
+ HelloService helloService = context.getService(HelloService.class, "helloService");
+ helloService.hello("World");
+ }
+
+ public void useComponentViaReference() {
+ ServiceReference<HelloService> ref = context.getServiceReference(HelloService.class, "helloService");
+ HelloService helloService = ref.getService();
+ helloService.hello("World");
+
+ ServiceReference<HelloService> ref2 = context.cast(helloService);
+ }
+
+ public void useReferenceDirectly() {
+ HelloService helloService = context.getService(HelloService.class, "helloReference");
+ helloService.hello("World");
+ }
+
+ public void useReferenceViaReference() {
+ ServiceReference<HelloService> ref = context.getServiceReference(HelloService.class, "helloReference");
+ HelloService helloService = ref.getService();
+ helloService.hello("World");
+
+ ServiceReference<HelloService> ref2 = context.cast(helloService);
+ }
+}