summaryrefslogtreecommitdiffstats
path: root/sca-java-1.x/trunk/samples/calculator-android
diff options
context:
space:
mode:
authorlresende <lresende@13f79535-47bb-0310-9956-ffa450edef68>2009-11-13 01:42:27 +0000
committerlresende <lresende@13f79535-47bb-0310-9956-ffa450edef68>2009-11-13 01:42:27 +0000
commit3c7c4a749baafcf375f4785a7668d3a25c9063e3 (patch)
treea66b8b031c5dc6c7744f44b44b6bcd371bd0b8df /sca-java-1.x/trunk/samples/calculator-android
parenteb03ff672236cddf65533f39b83ddd5e2984a2bb (diff)
Moving 1.x trunk
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@835700 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-1.x/trunk/samples/calculator-android')
-rw-r--r--sca-java-1.x/trunk/samples/calculator-android/.classpath26
-rw-r--r--sca-java-1.x/trunk/samples/calculator-android/.project39
-rw-r--r--sca-java-1.x/trunk/samples/calculator-android/.settings/org.eclipse.jdt.core.prefs5
-rw-r--r--sca-java-1.x/trunk/samples/calculator-android/AndroidManifest.xml15
-rw-r--r--sca-java-1.x/trunk/samples/calculator-android/META-INF/MANIFEST.MF2
-rw-r--r--sca-java-1.x/trunk/samples/calculator-android/res/drawable/icon.pngbin0 -> 3180 bytes
-rw-r--r--sca-java-1.x/trunk/samples/calculator-android/res/layout/main.xml12
-rw-r--r--sca-java-1.x/trunk/samples/calculator-android/res/values/strings.xml5
-rw-r--r--sca-java-1.x/trunk/samples/calculator-android/src/calculator/AddService.classbin0 -> 134 bytes
-rw-r--r--sca-java-1.x/trunk/samples/calculator-android/src/calculator/AddService.java11
-rw-r--r--sca-java-1.x/trunk/samples/calculator-android/src/calculator/AddServiceImpl.classbin0 -> 1019 bytes
-rw-r--r--sca-java-1.x/trunk/samples/calculator-android/src/calculator/AddServiceImpl.java18
-rw-r--r--sca-java-1.x/trunk/samples/calculator-android/src/calculator/CalculatorBuilder.classbin0 -> 2314 bytes
-rw-r--r--sca-java-1.x/trunk/samples/calculator-android/src/calculator/CalculatorClient.classbin0 -> 461 bytes
-rw-r--r--sca-java-1.x/trunk/samples/calculator-android/src/calculator/CalculatorClient.java30
-rw-r--r--sca-java-1.x/trunk/samples/calculator-android/src/calculator/CalculatorService.classbin0 -> 203 bytes
-rw-r--r--sca-java-1.x/trunk/samples/calculator-android/src/calculator/CalculatorService.java18
-rw-r--r--sca-java-1.x/trunk/samples/calculator-android/src/calculator/CalculatorServiceImpl.classbin0 -> 1682 bytes
-rw-r--r--sca-java-1.x/trunk/samples/calculator-android/src/calculator/CalculatorServiceImpl.java54
-rw-r--r--sca-java-1.x/trunk/samples/calculator-android/src/calculator/DivideService.classbin0 -> 143 bytes
-rw-r--r--sca-java-1.x/trunk/samples/calculator-android/src/calculator/DivideService.java11
-rw-r--r--sca-java-1.x/trunk/samples/calculator-android/src/calculator/DivideServiceImpl.classbin0 -> 1037 bytes
-rw-r--r--sca-java-1.x/trunk/samples/calculator-android/src/calculator/DivideServiceImpl.java18
-rw-r--r--sca-java-1.x/trunk/samples/calculator-android/src/calculator/MultiplyService.classbin0 -> 149 bytes
-rw-r--r--sca-java-1.x/trunk/samples/calculator-android/src/calculator/MultiplyService.java11
-rw-r--r--sca-java-1.x/trunk/samples/calculator-android/src/calculator/MultiplyServiceImpl.classbin0 -> 1050 bytes
-rw-r--r--sca-java-1.x/trunk/samples/calculator-android/src/calculator/MultiplyServiceImpl.java18
-rw-r--r--sca-java-1.x/trunk/samples/calculator-android/src/calculator/SubtractService.classbin0 -> 149 bytes
-rw-r--r--sca-java-1.x/trunk/samples/calculator-android/src/calculator/SubtractService.java11
-rw-r--r--sca-java-1.x/trunk/samples/calculator-android/src/calculator/SubtractServiceImpl.classbin0 -> 1050 bytes
-rw-r--r--sca-java-1.x/trunk/samples/calculator-android/src/calculator/SubtractServiceImpl.java18
-rw-r--r--sca-java-1.x/trunk/samples/calculator-android/src/calculator/android/CalculatorClient.classbin0 -> 920 bytes
-rw-r--r--sca-java-1.x/trunk/samples/calculator-android/src/calculator/android/CalculatorClient.java233
-rw-r--r--sca-java-1.x/trunk/samples/calculator-android/src/calculator/android/R$attr.classbin0 -> 340 bytes
-rw-r--r--sca-java-1.x/trunk/samples/calculator-android/src/calculator/android/R$drawable.classbin0 -> 400 bytes
-rw-r--r--sca-java-1.x/trunk/samples/calculator-android/src/calculator/android/R$layout.classbin0 -> 394 bytes
-rw-r--r--sca-java-1.x/trunk/samples/calculator-android/src/calculator/android/R$string.classbin0 -> 427 bytes
-rw-r--r--sca-java-1.x/trunk/samples/calculator-android/src/calculator/android/R.classbin0 -> 489 bytes
-rw-r--r--sca-java-1.x/trunk/samples/calculator-android/src/calculator/android/R.java23
39 files changed, 578 insertions, 0 deletions
diff --git a/sca-java-1.x/trunk/samples/calculator-android/.classpath b/sca-java-1.x/trunk/samples/calculator-android/.classpath
new file mode 100644
index 0000000000..73c77ee74d
--- /dev/null
+++ b/sca-java-1.x/trunk/samples/calculator-android/.classpath
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/tuscany-assembly"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/tuscany-assembly-xml"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/tuscany-assembly-xsd"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/tuscany-definitions"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/tuscany-definitions-xml"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/tuscany-extensibility"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/tuscany-implementation-java"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/tuscany-implementation-java-runtime"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/tuscany-implementation-java-xml"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/tuscany-interface"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/tuscany-interface-java"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/tuscany-interface-java-xml"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/tuscany-monitor"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/tuscany-policy"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/tuscany-sca-api"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/tuscany-contribution"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/tuscany-contribution-impl"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/tuscany-host-embedded"/>
+ <classpathentry kind="lib" path="/home/acc/.m2/repository/stax/stax-api/1.0.1/stax-api-1.0.1.jar"/>
+ <classpathentry kind="lib" path="/home/acc/.m2/repository/javax/xml/stream/stax-api/1.0-2/stax-api-1.0-2.jar"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/sca-java-1.x/trunk/samples/calculator-android/.project b/sca-java-1.x/trunk/samples/calculator-android/.project
new file mode 100644
index 0000000000..b0a16117c8
--- /dev/null
+++ b/sca-java-1.x/trunk/samples/calculator-android/.project
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>calculator-android</name>
+ <comment></comment>
+ <projects>
+ <project>tuscany-assembly</project>
+ <project>tuscany-definitions</project>
+ <project>tuscany-extensibility</project>
+ <project>tuscany-interface</project>
+ <project>tuscany-monitor</project>
+ <project>tuscany-policy</project>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>com.android.ide.eclipse.adt.ApkBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>com.android.ide.eclipse.adt.AndroidNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/sca-java-1.x/trunk/samples/calculator-android/.settings/org.eclipse.jdt.core.prefs b/sca-java-1.x/trunk/samples/calculator-android/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000000..4077c7b7f0
--- /dev/null
+++ b/sca-java-1.x/trunk/samples/calculator-android/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,5 @@
+#Mon Nov 24 19:53:10 PST 2008
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.source=1.5
diff --git a/sca-java-1.x/trunk/samples/calculator-android/AndroidManifest.xml b/sca-java-1.x/trunk/samples/calculator-android/AndroidManifest.xml
new file mode 100644
index 0000000000..ad6daf347e
--- /dev/null
+++ b/sca-java-1.x/trunk/samples/calculator-android/AndroidManifest.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="calculator.android"
+ android:versionCode="1"
+ android:versionName="1.0.0">
+ <application android:icon="@drawable/icon" android:label="@string/app_name">
+ <activity android:name=".CalculatorClient"
+ android:label="@string/app_name">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+ </application>
+</manifest> \ No newline at end of file
diff --git a/sca-java-1.x/trunk/samples/calculator-android/META-INF/MANIFEST.MF b/sca-java-1.x/trunk/samples/calculator-android/META-INF/MANIFEST.MF
new file mode 100644
index 0000000000..58630c02ef
--- /dev/null
+++ b/sca-java-1.x/trunk/samples/calculator-android/META-INF/MANIFEST.MF
@@ -0,0 +1,2 @@
+Manifest-Version: 1.0
+
diff --git a/sca-java-1.x/trunk/samples/calculator-android/res/drawable/icon.png b/sca-java-1.x/trunk/samples/calculator-android/res/drawable/icon.png
new file mode 100644
index 0000000000..75024841d3
--- /dev/null
+++ b/sca-java-1.x/trunk/samples/calculator-android/res/drawable/icon.png
Binary files differ
diff --git a/sca-java-1.x/trunk/samples/calculator-android/res/layout/main.xml b/sca-java-1.x/trunk/samples/calculator-android/res/layout/main.xml
new file mode 100644
index 0000000000..3a5f117d3c
--- /dev/null
+++ b/sca-java-1.x/trunk/samples/calculator-android/res/layout/main.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="vertical"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ >
+<TextView
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:text="@string/hello"
+ />
+</LinearLayout>
diff --git a/sca-java-1.x/trunk/samples/calculator-android/res/values/strings.xml b/sca-java-1.x/trunk/samples/calculator-android/res/values/strings.xml
new file mode 100644
index 0000000000..71052e74b8
--- /dev/null
+++ b/sca-java-1.x/trunk/samples/calculator-android/res/values/strings.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+ <string name="hello">Hello World, CalculatorClient</string>
+ <string name="app_name">Calculator</string>
+</resources>
diff --git a/sca-java-1.x/trunk/samples/calculator-android/src/calculator/AddService.class b/sca-java-1.x/trunk/samples/calculator-android/src/calculator/AddService.class
new file mode 100644
index 0000000000..8a5ed25f9f
--- /dev/null
+++ b/sca-java-1.x/trunk/samples/calculator-android/src/calculator/AddService.class
Binary files differ
diff --git a/sca-java-1.x/trunk/samples/calculator-android/src/calculator/AddService.java b/sca-java-1.x/trunk/samples/calculator-android/src/calculator/AddService.java
new file mode 100644
index 0000000000..21c6789632
--- /dev/null
+++ b/sca-java-1.x/trunk/samples/calculator-android/src/calculator/AddService.java
@@ -0,0 +1,11 @@
+package calculator;
+
+
+/**
+ * The Add service interface
+ */
+public interface AddService {
+
+ double add(double n1, double n2);
+
+}
diff --git a/sca-java-1.x/trunk/samples/calculator-android/src/calculator/AddServiceImpl.class b/sca-java-1.x/trunk/samples/calculator-android/src/calculator/AddServiceImpl.class
new file mode 100644
index 0000000000..c6fd83f6a1
--- /dev/null
+++ b/sca-java-1.x/trunk/samples/calculator-android/src/calculator/AddServiceImpl.class
Binary files differ
diff --git a/sca-java-1.x/trunk/samples/calculator-android/src/calculator/AddServiceImpl.java b/sca-java-1.x/trunk/samples/calculator-android/src/calculator/AddServiceImpl.java
new file mode 100644
index 0000000000..6181a1c651
--- /dev/null
+++ b/sca-java-1.x/trunk/samples/calculator-android/src/calculator/AddServiceImpl.java
@@ -0,0 +1,18 @@
+package calculator;
+
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * An implementation of the Add service
+ */
+public class AddServiceImpl implements AddService {
+
+ public double add(double n1, double n2) {
+ Logger logger = Logger.getLogger("calculator");
+ logger.log(Level.FINEST, "Adding " + n1 + " and " + n2);
+ return n1 + n2;
+ }
+
+}
diff --git a/sca-java-1.x/trunk/samples/calculator-android/src/calculator/CalculatorBuilder.class b/sca-java-1.x/trunk/samples/calculator-android/src/calculator/CalculatorBuilder.class
new file mode 100644
index 0000000000..b4466a3017
--- /dev/null
+++ b/sca-java-1.x/trunk/samples/calculator-android/src/calculator/CalculatorBuilder.class
Binary files differ
diff --git a/sca-java-1.x/trunk/samples/calculator-android/src/calculator/CalculatorClient.class b/sca-java-1.x/trunk/samples/calculator-android/src/calculator/CalculatorClient.class
new file mode 100644
index 0000000000..aaf9e9710f
--- /dev/null
+++ b/sca-java-1.x/trunk/samples/calculator-android/src/calculator/CalculatorClient.class
Binary files differ
diff --git a/sca-java-1.x/trunk/samples/calculator-android/src/calculator/CalculatorClient.java b/sca-java-1.x/trunk/samples/calculator-android/src/calculator/CalculatorClient.java
new file mode 100644
index 0000000000..3b977259e8
--- /dev/null
+++ b/sca-java-1.x/trunk/samples/calculator-android/src/calculator/CalculatorClient.java
@@ -0,0 +1,30 @@
+package calculator;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+
+
+/**
+ * This client program shows how to create an SCA runtime, start it,
+ * and locate and invoke a SCA component
+ */
+public class CalculatorClient {
+ public static void main(String[] args) throws Exception {
+
+
+ SCADomain scaDomain = SCADomain.newInstance("Calculator.composite");
+
+ CalculatorService calculatorService =
+ scaDomain.getService(CalculatorService.class, "CalculatorServiceComponent");
+
+ // Calculate
+ System.out.println("3 + 2=" + calculatorService.add(3, 2));
+ System.out.println("3 - 2=" + calculatorService.subtract(3, 2));
+ System.out.println("3 * 2=" + calculatorService.multiply(3, 2));
+ System.out.println("3 / 2=" + calculatorService.divide(3, 2));
+
+ scaDomain.close();
+
+ }
+
+}
diff --git a/sca-java-1.x/trunk/samples/calculator-android/src/calculator/CalculatorService.class b/sca-java-1.x/trunk/samples/calculator-android/src/calculator/CalculatorService.class
new file mode 100644
index 0000000000..c3cc2911e9
--- /dev/null
+++ b/sca-java-1.x/trunk/samples/calculator-android/src/calculator/CalculatorService.class
Binary files differ
diff --git a/sca-java-1.x/trunk/samples/calculator-android/src/calculator/CalculatorService.java b/sca-java-1.x/trunk/samples/calculator-android/src/calculator/CalculatorService.java
new file mode 100644
index 0000000000..862d7b892d
--- /dev/null
+++ b/sca-java-1.x/trunk/samples/calculator-android/src/calculator/CalculatorService.java
@@ -0,0 +1,18 @@
+package calculator;
+
+
+
+/**
+ * The Calculator service interface.
+ */
+public interface CalculatorService {
+
+ double add(double n1, double n2);
+
+ double subtract(double n1, double n2);
+
+ double multiply(double n1, double n2);
+
+ double divide(double n1, double n2);
+
+}
diff --git a/sca-java-1.x/trunk/samples/calculator-android/src/calculator/CalculatorServiceImpl.class b/sca-java-1.x/trunk/samples/calculator-android/src/calculator/CalculatorServiceImpl.class
new file mode 100644
index 0000000000..8e0f206119
--- /dev/null
+++ b/sca-java-1.x/trunk/samples/calculator-android/src/calculator/CalculatorServiceImpl.class
Binary files differ
diff --git a/sca-java-1.x/trunk/samples/calculator-android/src/calculator/CalculatorServiceImpl.java b/sca-java-1.x/trunk/samples/calculator-android/src/calculator/CalculatorServiceImpl.java
new file mode 100644
index 0000000000..2c88b5319e
--- /dev/null
+++ b/sca-java-1.x/trunk/samples/calculator-android/src/calculator/CalculatorServiceImpl.java
@@ -0,0 +1,54 @@
+package calculator;
+
+
+//import org.osoa.sca.annotations.Reference;
+
+
+/**
+ * An implementation of the Calculator service.
+ */
+public class CalculatorServiceImpl implements CalculatorService {
+
+ private AddService addService;
+ private SubtractService subtractService;
+ private MultiplyService multiplyService;
+ private DivideService divideService;
+
+
+ //@Reference
+ public void setAddService(AddService addService) {
+ this.addService = addService;
+ }
+
+ //@Reference
+ public void setSubtractService(SubtractService subtractService) {
+ this.subtractService = subtractService;
+ }
+
+ //@Reference
+ public void setDivideService(DivideService divideService) {
+ this.divideService = divideService;
+ }
+
+ //@Reference
+ public void setMultiplyService(MultiplyService multiplyService) {
+ this.multiplyService = multiplyService;
+ }
+
+ public double add(double n1, double n2) {
+ return addService.add(n1, n2);
+ }
+
+ public double subtract(double n1, double n2) {
+ return subtractService.subtract(n1, n2);
+ }
+
+ public double multiply(double n1, double n2) {
+ return multiplyService.multiply(n1, n2);
+ }
+
+ public double divide(double n1, double n2) {
+ return divideService.divide(n1, n2);
+ }
+
+}
diff --git a/sca-java-1.x/trunk/samples/calculator-android/src/calculator/DivideService.class b/sca-java-1.x/trunk/samples/calculator-android/src/calculator/DivideService.class
new file mode 100644
index 0000000000..8f056b16b6
--- /dev/null
+++ b/sca-java-1.x/trunk/samples/calculator-android/src/calculator/DivideService.class
Binary files differ
diff --git a/sca-java-1.x/trunk/samples/calculator-android/src/calculator/DivideService.java b/sca-java-1.x/trunk/samples/calculator-android/src/calculator/DivideService.java
new file mode 100644
index 0000000000..8f544632dc
--- /dev/null
+++ b/sca-java-1.x/trunk/samples/calculator-android/src/calculator/DivideService.java
@@ -0,0 +1,11 @@
+package calculator;
+
+
+/**
+ * The divide service interface
+ */
+public interface DivideService {
+
+ double divide(double n1, double n2);
+
+}
diff --git a/sca-java-1.x/trunk/samples/calculator-android/src/calculator/DivideServiceImpl.class b/sca-java-1.x/trunk/samples/calculator-android/src/calculator/DivideServiceImpl.class
new file mode 100644
index 0000000000..09cae06d9c
--- /dev/null
+++ b/sca-java-1.x/trunk/samples/calculator-android/src/calculator/DivideServiceImpl.class
Binary files differ
diff --git a/sca-java-1.x/trunk/samples/calculator-android/src/calculator/DivideServiceImpl.java b/sca-java-1.x/trunk/samples/calculator-android/src/calculator/DivideServiceImpl.java
new file mode 100644
index 0000000000..5dfae77222
--- /dev/null
+++ b/sca-java-1.x/trunk/samples/calculator-android/src/calculator/DivideServiceImpl.java
@@ -0,0 +1,18 @@
+package calculator;
+
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * An implementation of the Divide service.
+ */
+public class DivideServiceImpl implements DivideService {
+
+ public double divide(double n1, double n2) {
+ Logger logger = Logger.getLogger("calculator");
+ logger.log(Level.FINEST, "Dividing " + n1 + " with " + n2);
+ return n1 / n2;
+ }
+
+}
diff --git a/sca-java-1.x/trunk/samples/calculator-android/src/calculator/MultiplyService.class b/sca-java-1.x/trunk/samples/calculator-android/src/calculator/MultiplyService.class
new file mode 100644
index 0000000000..6542db7083
--- /dev/null
+++ b/sca-java-1.x/trunk/samples/calculator-android/src/calculator/MultiplyService.class
Binary files differ
diff --git a/sca-java-1.x/trunk/samples/calculator-android/src/calculator/MultiplyService.java b/sca-java-1.x/trunk/samples/calculator-android/src/calculator/MultiplyService.java
new file mode 100644
index 0000000000..f7f4ee77b5
--- /dev/null
+++ b/sca-java-1.x/trunk/samples/calculator-android/src/calculator/MultiplyService.java
@@ -0,0 +1,11 @@
+package calculator;
+
+
+/**
+ * The interface for the multiply service
+ */
+public interface MultiplyService {
+
+ double multiply(double n1, double n2);
+
+}
diff --git a/sca-java-1.x/trunk/samples/calculator-android/src/calculator/MultiplyServiceImpl.class b/sca-java-1.x/trunk/samples/calculator-android/src/calculator/MultiplyServiceImpl.class
new file mode 100644
index 0000000000..0e69e7ad2d
--- /dev/null
+++ b/sca-java-1.x/trunk/samples/calculator-android/src/calculator/MultiplyServiceImpl.class
Binary files differ
diff --git a/sca-java-1.x/trunk/samples/calculator-android/src/calculator/MultiplyServiceImpl.java b/sca-java-1.x/trunk/samples/calculator-android/src/calculator/MultiplyServiceImpl.java
new file mode 100644
index 0000000000..3142f86a58
--- /dev/null
+++ b/sca-java-1.x/trunk/samples/calculator-android/src/calculator/MultiplyServiceImpl.java
@@ -0,0 +1,18 @@
+package calculator;
+
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * An implementation of the Multiply service.
+ */
+public class MultiplyServiceImpl implements MultiplyService {
+
+ public double multiply(double n1, double n2) {
+ Logger logger = Logger.getLogger("calculator");
+ logger.log(Level.FINEST, "Multiplying " + n1 + " with " + n2);
+ return n1 * n2;
+ }
+
+}
diff --git a/sca-java-1.x/trunk/samples/calculator-android/src/calculator/SubtractService.class b/sca-java-1.x/trunk/samples/calculator-android/src/calculator/SubtractService.class
new file mode 100644
index 0000000000..84c741e301
--- /dev/null
+++ b/sca-java-1.x/trunk/samples/calculator-android/src/calculator/SubtractService.class
Binary files differ
diff --git a/sca-java-1.x/trunk/samples/calculator-android/src/calculator/SubtractService.java b/sca-java-1.x/trunk/samples/calculator-android/src/calculator/SubtractService.java
new file mode 100644
index 0000000000..2349febb0f
--- /dev/null
+++ b/sca-java-1.x/trunk/samples/calculator-android/src/calculator/SubtractService.java
@@ -0,0 +1,11 @@
+package calculator;
+
+
+/**
+ * The interface for the multiply service
+ */
+public interface SubtractService {
+
+ double subtract(double n1, double n2);
+
+}
diff --git a/sca-java-1.x/trunk/samples/calculator-android/src/calculator/SubtractServiceImpl.class b/sca-java-1.x/trunk/samples/calculator-android/src/calculator/SubtractServiceImpl.class
new file mode 100644
index 0000000000..7b1aeab811
--- /dev/null
+++ b/sca-java-1.x/trunk/samples/calculator-android/src/calculator/SubtractServiceImpl.class
Binary files differ
diff --git a/sca-java-1.x/trunk/samples/calculator-android/src/calculator/SubtractServiceImpl.java b/sca-java-1.x/trunk/samples/calculator-android/src/calculator/SubtractServiceImpl.java
new file mode 100644
index 0000000000..ec55f4f07d
--- /dev/null
+++ b/sca-java-1.x/trunk/samples/calculator-android/src/calculator/SubtractServiceImpl.java
@@ -0,0 +1,18 @@
+package calculator;
+
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * An implementation of the subtract service.
+ */
+public class SubtractServiceImpl implements SubtractService {
+
+ public double subtract(double n1, double n2) {
+ Logger logger = Logger.getLogger("calculator");
+ logger.log(Level.FINEST, "Subtracting " + n1 + " from " + n2);
+ return n1 - n2;
+ }
+
+}
diff --git a/sca-java-1.x/trunk/samples/calculator-android/src/calculator/android/CalculatorClient.class b/sca-java-1.x/trunk/samples/calculator-android/src/calculator/android/CalculatorClient.class
new file mode 100644
index 0000000000..20b588f972
--- /dev/null
+++ b/sca-java-1.x/trunk/samples/calculator-android/src/calculator/android/CalculatorClient.class
Binary files differ
diff --git a/sca-java-1.x/trunk/samples/calculator-android/src/calculator/android/CalculatorClient.java b/sca-java-1.x/trunk/samples/calculator-android/src/calculator/android/CalculatorClient.java
new file mode 100644
index 0000000000..9e5c782447
--- /dev/null
+++ b/sca-java-1.x/trunk/samples/calculator-android/src/calculator/android/CalculatorClient.java
@@ -0,0 +1,233 @@
+package calculator.android;
+
+import java.io.FileDescriptor;
+import java.net.InetAddress;
+import java.net.URL;
+import java.security.Permission;
+
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.service.ContributionService;
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.apache.tuscany.sca.host.embedded.impl.EmbeddedSCADomain;
+
+import android.app.Activity;
+import android.os.Bundle;
+import android.widget.TextView;
+import calculator.CalculatorService;
+
+public class CalculatorClient extends Activity {
+ private EmbeddedSCADomain domain;
+ private CalculatorService calculatorService;
+
+ /** Called when the activity is first created. */
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ String calculationResult = "Error !";
+ try {
+ System.setSecurityManager(new SecurityManager() {
+ @Override
+ public void checkPermission(Permission permission) {
+
+ }
+
+ @Override
+ public void checkAccept(String host, int port) {
+
+ }
+
+ @Override
+ public void checkAccess(Thread thread) {
+ // TODO Auto-generated method stub
+
+ }
+ @Override
+ public void checkAccess(ThreadGroup group) {
+
+ }
+
+ @Override
+ public void checkAwtEventQueueAccess() {
+ // TODO Auto-generated method stub
+
+ }
+ @Override
+ public void checkConnect(String host, int port) {
+
+ }
+ @Override
+ public void checkConnect(String host, int port, Object context) {
+
+ }
+ @Override
+ public void checkCreateClassLoader() {
+ // TODO Auto-generated method stub
+
+ }
+ @Override
+ public void checkDelete(String file) {
+
+ }
+ @Override
+ public void checkExec(String cmd) {
+ // TODO Auto-generated method stub
+
+ }
+ @Override
+ public void checkExit(int status) {
+
+ }
+ @Override
+ public void checkLink(String libName) {
+ // TODO Auto-generated method stub
+
+ }
+ @Override
+ public void checkListen(int port) {
+ // TODO Auto-generated method stub
+
+ }
+ @Override
+ public void checkMemberAccess(Class<?> cls, int type) {
+ // TODO Auto-generated method stub
+
+ }
+ @Override
+ public void checkMulticast(InetAddress maddr) {
+ // TODO Auto-generated method stub
+
+ }
+ @Override
+ public void checkMulticast(InetAddress maddr, byte ttl) {
+ // TODO Auto-generated method stub
+
+ }
+ @Override
+ public void checkPackageAccess(String packageName) {
+ // TODO Auto-generated method stub
+
+ }
+ @Override
+ public void checkPackageDefinition(String packageName) {
+ // TODO Auto-generated method stub
+
+ }
+ @Override
+ public void checkPermission(Permission permission,
+ Object context) {
+ // TODO Auto-generated method stub
+
+ }
+ @Override
+ public void checkPrintJobAccess() {
+ // TODO Auto-generated method stub
+
+ }
+ @Override
+ public void checkPropertiesAccess() {
+ // TODO Auto-generated method stub
+
+ }
+ @Override
+ public void checkPropertyAccess(String key) {
+ // TODO Auto-generated method stub
+
+ }
+ @Override
+ public void checkRead(FileDescriptor fd) {
+ // TODO Auto-generated method stub
+
+ }
+ @Override
+ public void checkRead(String file) {
+ // TODO Auto-generated method stub
+
+ }
+ @Override
+ public void checkRead(String file, Object context) {
+ // TODO Auto-generated method stub
+
+ }
+ @Override
+ public void checkSecurityAccess(String target) {
+ // TODO Auto-generated method stub
+
+ }
+ @Override
+ public void checkSetFactory() {
+ // TODO Auto-generated method stub
+
+ }
+ @Override
+ public void checkSystemClipboardAccess() {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void checkWrite(FileDescriptor fd) {
+ // TODO Auto-generated method stub
+
+ }
+ @Override
+ public void checkWrite(String file) {
+ // TODO Auto-generated method stub
+
+ }
+
+ });
+
+ Thread.currentThread().setContextClassLoader(getClassLoader());
+
+ SCADomain scaDomain = SCADomain.newInstance("Calculator.composite");
+
+ CalculatorService calculatorService =
+ scaDomain.getService(CalculatorService.class, "CalculatorServiceComponent");
+
+ // Calculate
+ System.out.println("3 + 2=" + calculatorService.add(3, 2));
+ System.out.println("3 - 2=" + calculatorService.subtract(3, 2));
+ System.out.println("3 * 2=" + calculatorService.multiply(3, 2));
+ System.out.println("3 / 2=" + calculatorService.divide(3, 2));
+
+ scaDomain.close();
+
+ } catch(Exception e) {
+ e.printStackTrace();
+ }
+
+
+
+ TextView tv = new TextView(this);
+ tv.setText("3 + 2 =" + calculationResult);
+ setContentView(tv);
+
+ }
+
+ @Override
+ protected void onDestroy() {
+ super.onDestroy();
+
+ try {
+ //scaDomain.close();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Override
+ public void onContentChanged() {
+ super.onContentChanged();
+ /*
+ // Calculate
+ System.out.println("3 + 2=" + calculatorService.add(3, 2));
+ System.out.println("3 - 2=" + calculatorService.subtract(3, 2));
+ System.out.println("3 * 2=" + calculatorService.multiply(3, 2));
+ System.out.println("3 / 2=" + calculatorService.divide(3, 2));
+ */
+
+ }
+
+
+} \ No newline at end of file
diff --git a/sca-java-1.x/trunk/samples/calculator-android/src/calculator/android/R$attr.class b/sca-java-1.x/trunk/samples/calculator-android/src/calculator/android/R$attr.class
new file mode 100644
index 0000000000..4d7e121ddc
--- /dev/null
+++ b/sca-java-1.x/trunk/samples/calculator-android/src/calculator/android/R$attr.class
Binary files differ
diff --git a/sca-java-1.x/trunk/samples/calculator-android/src/calculator/android/R$drawable.class b/sca-java-1.x/trunk/samples/calculator-android/src/calculator/android/R$drawable.class
new file mode 100644
index 0000000000..842aa47958
--- /dev/null
+++ b/sca-java-1.x/trunk/samples/calculator-android/src/calculator/android/R$drawable.class
Binary files differ
diff --git a/sca-java-1.x/trunk/samples/calculator-android/src/calculator/android/R$layout.class b/sca-java-1.x/trunk/samples/calculator-android/src/calculator/android/R$layout.class
new file mode 100644
index 0000000000..2b7eadeac8
--- /dev/null
+++ b/sca-java-1.x/trunk/samples/calculator-android/src/calculator/android/R$layout.class
Binary files differ
diff --git a/sca-java-1.x/trunk/samples/calculator-android/src/calculator/android/R$string.class b/sca-java-1.x/trunk/samples/calculator-android/src/calculator/android/R$string.class
new file mode 100644
index 0000000000..fd104e6c86
--- /dev/null
+++ b/sca-java-1.x/trunk/samples/calculator-android/src/calculator/android/R$string.class
Binary files differ
diff --git a/sca-java-1.x/trunk/samples/calculator-android/src/calculator/android/R.class b/sca-java-1.x/trunk/samples/calculator-android/src/calculator/android/R.class
new file mode 100644
index 0000000000..7bca04a8a4
--- /dev/null
+++ b/sca-java-1.x/trunk/samples/calculator-android/src/calculator/android/R.class
Binary files differ
diff --git a/sca-java-1.x/trunk/samples/calculator-android/src/calculator/android/R.java b/sca-java-1.x/trunk/samples/calculator-android/src/calculator/android/R.java
new file mode 100644
index 0000000000..a338c98c3a
--- /dev/null
+++ b/sca-java-1.x/trunk/samples/calculator-android/src/calculator/android/R.java
@@ -0,0 +1,23 @@
+/* AUTO-GENERATED FILE. DO NOT MODIFY.
+ *
+ * This class was automatically generated by the
+ * aapt tool from the resource data it found. It
+ * should not be modified by hand.
+ */
+
+package calculator.android;
+
+public final class R {
+ public static final class attr {
+ }
+ public static final class drawable {
+ public static final int icon=0x7f020000;
+ }
+ public static final class layout {
+ public static final int main=0x7f030000;
+ }
+ public static final class string {
+ public static final int app_name=0x7f040001;
+ public static final int hello=0x7f040000;
+ }
+}