summaryrefslogtreecommitdiffstats
path: root/branches/sca-java-0.91/samples/simple-bigbank
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--branches/sca-java-0.91/samples/simple-bigbank/README89
-rw-r--r--branches/sca-java-0.91/samples/simple-bigbank/build.xml72
-rw-r--r--branches/sca-java-0.91/samples/simple-bigbank/pom.xml71
-rw-r--r--branches/sca-java-0.91/samples/simple-bigbank/simple-bigbank.pngbin0 -> 10202 bytes
-rw-r--r--branches/sca-java-0.91/samples/simple-bigbank/simple-bigbank.svg200
-rw-r--r--branches/sca-java-0.91/samples/simple-bigbank/src/main/java/bigbank/account/AccountReport.java42
-rw-r--r--branches/sca-java-0.91/samples/simple-bigbank/src/main/java/bigbank/account/AccountService.java26
-rw-r--r--branches/sca-java-0.91/samples/simple-bigbank/src/main/java/bigbank/account/AccountServiceImpl.java61
-rw-r--r--branches/sca-java-0.91/samples/simple-bigbank/src/main/java/bigbank/accountdata/Account.java26
-rw-r--r--branches/sca-java-0.91/samples/simple-bigbank/src/main/java/bigbank/accountdata/AccountDataService.java28
-rw-r--r--branches/sca-java-0.91/samples/simple-bigbank/src/main/java/bigbank/accountdata/AccountDataServiceImpl.java56
-rw-r--r--branches/sca-java-0.91/samples/simple-bigbank/src/main/java/bigbank/accountdata/CheckingAccount.java35
-rw-r--r--branches/sca-java-0.91/samples/simple-bigbank/src/main/java/bigbank/accountdata/SavingsAccount.java35
-rw-r--r--branches/sca-java-0.91/samples/simple-bigbank/src/main/java/bigbank/accountdata/StockAccount.java39
-rw-r--r--branches/sca-java-0.91/samples/simple-bigbank/src/main/java/bigbank/client/BigBankClient.java43
-rw-r--r--branches/sca-java-0.91/samples/simple-bigbank/src/main/resources/BigBank.composite33
-rw-r--r--branches/sca-java-0.91/samples/simple-bigbank/src/test/java/bigbank/BigBankTestCase.java48
17 files changed, 904 insertions, 0 deletions
diff --git a/branches/sca-java-0.91/samples/simple-bigbank/README b/branches/sca-java-0.91/samples/simple-bigbank/README
new file mode 100644
index 0000000000..92e4a379ac
--- /dev/null
+++ b/branches/sca-java-0.91/samples/simple-bigbank/README
@@ -0,0 +1,89 @@
+Calculator Sample
+=================
+This sample implements a simple a version of the BigBank scenrio used in
+various places in the SCA specification documents.
+
+The README in the samples directory (the directory above this) provides
+general instructions about building and running samples. Take a look there
+first.
+
+If you just want to run it to see what happens open a command prompt, navigate
+to this sample directory and do:
+
+ant run
+
+OR if you don't have ant, on Windows do
+
+java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-simple-bigbank.jar bigbank.client.BigBankClient
+
+and on *nix do
+
+java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-simple-bigbank.jar bigbank.client.BigBankClient
+
+
+Sample Overview
+---------------
+The sample provides a composite with two java components wired together
+with a default binding. A request to the AccountComponent results in a
+request to the AccountDataComponent to get account data. The data returns
+back via the AccountComponent to the client.
+
+calculator/
+ src/
+ main/
+ java/
+ bigbank/
+ account/ - AccountComponent implementation
+ accountdata/ - AccountDataComponent implementation
+ client/ - starts the SCA Runtime and
+ deploys the BigBank.composite.
+ It then calls the deployed AccountService
+ resources/
+ BigBank.composite - the SCA assembly for this sample
+ test/
+ java/
+ bigbank/
+ BigBankTestCase.java - JUnit test case
+ simple-bigbank.png - a pictorial representation of the sample
+ .composite file
+ build.xml - the Ant build file
+ pom.xml - the Maven build file
+
+Building And Running The Sample Using Ant
+-----------------------------------------
+With the binary distribution the sample can be built and run using Ant as
+follows
+
+cd simple-bigbank
+ant compile
+ant run
+
+You should see the following output from the run target.
+
+run:
+ [java] Account summary: currency: USD, [ID:Foo_CHA12345, balance:1500.0, ID
+:Foo_SAA12345, balance:1500.0, ID:Foo_STA12345, symbol:IBM, quantity:100]
+
+Building And Running The Sample Using Maven
+-------------------------------------------
+With either the binary or source distributions the sample can be built and run
+using Maven as follows.
+
+cd simple-bigbank
+mvn
+
+You should see the following output from the test phase.
+
+-------------------------------------------------------
+ T E S T S
+-------------------------------------------------------
+Running bigbank.BigBankTestCase
+Account summary: currency: USD, [ID:Foo_CHA12345, balance:1500.0, ID:Foo_SAA1234
+5, balance:1500.0, ID:Foo_STA12345, symbol:IBM, quantity:100]
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.592 sec
+
+Results :
+
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
+
+This shows that the Junit test cases have run successfully.
diff --git a/branches/sca-java-0.91/samples/simple-bigbank/build.xml b/branches/sca-java-0.91/samples/simple-bigbank/build.xml
new file mode 100644
index 0000000000..a814014eae
--- /dev/null
+++ b/branches/sca-java-0.91/samples/simple-bigbank/build.xml
@@ -0,0 +1,72 @@
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project name="simple-bigbank" default="compile">
+ <property name="test.class" value="bigbank.client.BigBankClient" />
+ <property name="test.jar" value="sample-simple-bigbank.jar" />
+
+ <target name="init">
+ <mkdir dir="target/classes"/>
+ </target>
+
+ <target name="compile" depends="init">
+ <javac srcdir="src/main/java"
+ destdir="target/classes"
+ debug="on"
+ source="1.5"
+ target="1.5">
+ <classpath>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </javac>
+ <copy todir="target/classes">
+ <fileset dir="src/main/resources"/>
+ </copy>
+ <jar destfile="target/${test.jar}" basedir="target/classes">
+ <manifest>
+ <attribute name="Main-Class" value="${test.class}" />
+ </manifest>
+ </jar>
+ </target>
+
+ <target name="run-classes">
+ <java classname="${test.class}"
+ fork="true">
+ <classpath>
+ <pathelement path="target/classes"/>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="run">
+ <java classname="${test.class}"
+ fork="true">
+ <classpath>
+ <pathelement path="target/${test.jar}"/>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="clean">
+ <delete quiet="true" includeemptydirs="true">
+ <fileset dir="target"/>
+ </delete>
+ </target>
+</project>
diff --git a/branches/sca-java-0.91/samples/simple-bigbank/pom.xml b/branches/sca-java-0.91/samples/simple-bigbank/pom.xml
new file mode 100644
index 0000000000..99e8617699
--- /dev/null
+++ b/branches/sca-java-0.91/samples/simple-bigbank/pom.xml
@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca</artifactId>
+ <version>0.91-incubating-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>sample-simple-bigbank</artifactId>
+ <name>Apache Tuscany Simplified BigBank Sample</name>
+
+ <repositories>
+ <repository>
+ <id>apache.incubator</id>
+ <url>http://people.apache.org/repo/m2-incubating-repository</url>
+ </repository>
+ </repositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>0.91-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>0.91-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core-databinding</artifactId>
+ <version>0.91-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+
+</project>
diff --git a/branches/sca-java-0.91/samples/simple-bigbank/simple-bigbank.png b/branches/sca-java-0.91/samples/simple-bigbank/simple-bigbank.png
new file mode 100644
index 0000000000..593c047f6a
--- /dev/null
+++ b/branches/sca-java-0.91/samples/simple-bigbank/simple-bigbank.png
Binary files differ
diff --git a/branches/sca-java-0.91/samples/simple-bigbank/simple-bigbank.svg b/branches/sca-java-0.91/samples/simple-bigbank/simple-bigbank.svg
new file mode 100644
index 0000000000..c64f6de6b9
--- /dev/null
+++ b/branches/sca-java-0.91/samples/simple-bigbank/simple-bigbank.svg
@@ -0,0 +1,200 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="1052.3622"
+ height="744.09448"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.44"
+ sodipodi:docbase="C:\simon\Projects\Tuscany\java\java-head\sca\samples\simple-bigbank"
+ sodipodi:docname="simple-bigbank.svg"
+ version="1.0"
+ inkscape:export-filename="C:\simon\Projects\Tuscany\java\java-head\sca\samples\simple-bigbank\simple-bigbank.png"
+ inkscape:export-xdpi="52.84"
+ inkscape:export-ydpi="52.84">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ gridtolerance="10000"
+ guidetolerance="10"
+ objecttolerance="10"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="1.4"
+ inkscape:cx="468.4064"
+ inkscape:cy="414.63224"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ inkscape:window-width="1054"
+ inkscape:window-height="721"
+ inkscape:window-x="120"
+ inkscape:window-y="172" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <g
+ id="g2997">
+ <rect
+ rx="15.307091"
+ ry="12.692303"
+ y="192.00233"
+ x="258.31146"
+ height="299.99988"
+ width="495.71429"
+ id="rect2067"
+ style="opacity:1;fill:#90baf4;fill-opacity:1;stroke:#060000;stroke-width:1.99999964;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
+ <flowRoot
+ id="flowRoot2954"
+ xml:space="preserve"><flowRegion
+ id="flowRegion2956"><rect
+ y="212.66591"
+ x="281.42856"
+ height="61.42857"
+ width="170"
+ id="rect2958" /></flowRegion><flowPara
+ id="flowPara2960">BigBank</flowPara></flowRoot> </g>
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2988"
+ width="115.66247"
+ height="85.862968"
+ x="339.91632"
+ y="310.73904"
+ rx="6.9961648"
+ ry="7.1230249" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2966"
+ transform="translate(84.32554,112.8005)"><flowRegion
+ id="flowRegion2968"><rect
+ id="rect2970"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara2972">Account</flowPara><flowPara
+ id="flowPara1883">Service</flowPara><flowPara
+ id="flowPara1885">Component</flowPara></flowRoot> <rect
+ style="opacity:1;fill:#fff62c;fill-opacity:1;stroke:#060000;stroke-width:0.99999994;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect3006"
+ width="43.861084"
+ height="29.993773"
+ x="376.59262"
+ y="285.79593"
+ rx="21.930542"
+ ry="0" />
+ <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 322.76581,342.58603 L 356.10085,342.58603 L 362.16176,355.71801 L 355.0907,367.83985 L 322.76581,367.83985 L 330.34196,355.71801 L 322.76581,342.58603 z "
+ id="path3017" />
+ <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 436.01825,340.74775 L 469.35329,340.74775 L 475.4142,353.87973 L 468.34314,366.00157 L 436.01825,366.00157 L 443.5944,353.87973 L 436.01825,340.74775 z "
+ id="path3019" />
+ <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1.00000012px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 226.73063,330.75341 L 280.61512,330.75341 L 290.41229,356.14253 L 278.98226,379.57867 L 226.73063,379.57867 L 238.97711,356.14253 L 226.73063,330.75341 z "
+ id="path1887" />
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect1889"
+ width="115.66247"
+ height="85.862968"
+ x="557.25488"
+ y="308.38455"
+ rx="6.9961648"
+ ry="7.1230249" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1891"
+ transform="translate(301.6641,110.446)"><flowRegion
+ id="flowRegion1893"><rect
+ id="rect1895"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara1897">Account</flowPara><flowPara
+ id="flowPara1909">Data</flowPara><flowPara
+ id="flowPara1899">Service</flowPara><flowPara
+ id="flowPara1901">Component</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 540.10438,340.23154 L 573.43942,340.23154 L 579.50033,353.36352 L 572.42927,365.48536 L 540.10438,365.48536 L 547.68053,353.36352 L 540.10438,340.23154 z "
+ id="path1905" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 290,355.52305 C 329.28571,355.52305 329.28571,355.52305 329.28571,355.52305"
+ id="path1913" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 475,353.3802 C 547.14286,352.66591 547.14286,352.66591 547.14286,352.66591"
+ id="path1919" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1921"
+ transform="translate(95.23912,80.79069)"
+ style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion1923"><rect
+ id="rect1925"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ id="flowPara1931">currency</flowPara></flowRoot> <flowRoot
+ xml:space="preserve"
+ id="flowRoot1933"
+ transform="translate(-42.61803,130.0764)"
+ style="font-size:11px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion1935"><rect
+ id="rect1937"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:11px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ id="flowPara1939">Account</flowPara><flowPara
+ id="flowPara1941">Service</flowPara><flowPara
+ id="flowPara1943" /></flowRoot> </g>
+</svg>
diff --git a/branches/sca-java-0.91/samples/simple-bigbank/src/main/java/bigbank/account/AccountReport.java b/branches/sca-java-0.91/samples/simple-bigbank/src/main/java/bigbank/account/AccountReport.java
new file mode 100644
index 0000000000..3f207e2f79
--- /dev/null
+++ b/branches/sca-java-0.91/samples/simple-bigbank/src/main/java/bigbank/account/AccountReport.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package bigbank.account;
+
+import java.util.List;
+
+/**
+ */
+public class AccountReport {
+ private List<String> summaries;
+ private String currency;
+
+ public AccountReport(String currency, List<String> summaries) {
+ this.currency = currency;
+ this.summaries = summaries;
+ }
+
+ public List getAccountSummaries() { return summaries; }
+
+ public String getCurrency() { return currency; }
+
+ public String toString() {
+ return "currency: "+ currency + ", " + summaries;
+ }
+
+}
diff --git a/branches/sca-java-0.91/samples/simple-bigbank/src/main/java/bigbank/account/AccountService.java b/branches/sca-java-0.91/samples/simple-bigbank/src/main/java/bigbank/account/AccountService.java
new file mode 100644
index 0000000000..7c9082b944
--- /dev/null
+++ b/branches/sca-java-0.91/samples/simple-bigbank/src/main/java/bigbank/account/AccountService.java
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package bigbank.account;
+
+/**
+ * Interface for a account service
+ */
+public interface AccountService {
+ public AccountReport getAccountReport(String customerID);
+}
diff --git a/branches/sca-java-0.91/samples/simple-bigbank/src/main/java/bigbank/account/AccountServiceImpl.java b/branches/sca-java-0.91/samples/simple-bigbank/src/main/java/bigbank/account/AccountServiceImpl.java
new file mode 100644
index 0000000000..0d73a6c3c9
--- /dev/null
+++ b/branches/sca-java-0.91/samples/simple-bigbank/src/main/java/bigbank/account/AccountServiceImpl.java
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package bigbank.account;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+import bigbank.accountdata.AccountDataService;
+import bigbank.accountdata.CheckingAccount;
+import bigbank.accountdata.SavingsAccount;
+import bigbank.accountdata.StockAccount;
+
+/**
+ * Account service implementation
+ */
+@Service(AccountService.class)
+public class AccountServiceImpl implements AccountService {
+
+ @Reference
+ public AccountDataService accountDataService;
+
+ @Property
+ public String currency;
+
+ public AccountReport getAccountReport(String s) {
+ List<String> summaries = new ArrayList<String>();
+
+ CheckingAccount ca = accountDataService.getCheckingAccount(s);
+ summaries.add(ca.getSummary());
+
+ SavingsAccount sa = accountDataService.getSavingsAccount(s);
+ summaries.add(sa.getSummary());
+
+ StockAccount sk = accountDataService.getStockAccount(s);
+ summaries.add(sk.getSummary());
+
+ AccountReport report = new AccountReport(currency, summaries);
+
+ return report;
+ }
+}
diff --git a/branches/sca-java-0.91/samples/simple-bigbank/src/main/java/bigbank/accountdata/Account.java b/branches/sca-java-0.91/samples/simple-bigbank/src/main/java/bigbank/accountdata/Account.java
new file mode 100644
index 0000000000..a5ae7b3955
--- /dev/null
+++ b/branches/sca-java-0.91/samples/simple-bigbank/src/main/java/bigbank/accountdata/Account.java
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package bigbank.accountdata;
+
+/**
+ * Interface for a account service
+ */
+public interface Account {
+ String getSummary();
+}
diff --git a/branches/sca-java-0.91/samples/simple-bigbank/src/main/java/bigbank/accountdata/AccountDataService.java b/branches/sca-java-0.91/samples/simple-bigbank/src/main/java/bigbank/accountdata/AccountDataService.java
new file mode 100644
index 0000000000..c354de387b
--- /dev/null
+++ b/branches/sca-java-0.91/samples/simple-bigbank/src/main/java/bigbank/accountdata/AccountDataService.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package bigbank.accountdata;
+
+/**
+ * Interface for a account data service
+ */
+public interface AccountDataService {
+ public CheckingAccount getCheckingAccount(String customerID);
+ public SavingsAccount getSavingsAccount(String customerID);
+ public StockAccount getStockAccount(String customerID);
+}
diff --git a/branches/sca-java-0.91/samples/simple-bigbank/src/main/java/bigbank/accountdata/AccountDataServiceImpl.java b/branches/sca-java-0.91/samples/simple-bigbank/src/main/java/bigbank/accountdata/AccountDataServiceImpl.java
new file mode 100644
index 0000000000..c8fc6277ca
--- /dev/null
+++ b/branches/sca-java-0.91/samples/simple-bigbank/src/main/java/bigbank/accountdata/AccountDataServiceImpl.java
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package bigbank.accountdata;
+
+import org.osoa.sca.annotations.Service;
+
+/**
+ * Account data service implementation
+ */
+@Service(AccountDataService.class)
+public class AccountDataServiceImpl implements AccountDataService {
+
+ public CheckingAccount getCheckingAccount(String customerID) {
+
+ CheckingAccount checkingAccount = new CheckingAccount();
+ checkingAccount.setAccountNumber(customerID+"_"+"CHA12345");
+ checkingAccount.setBalance(1500.0f);
+
+ return checkingAccount;
+ }
+
+ public SavingsAccount getSavingsAccount(String customerID) {
+
+ SavingsAccount savingsAccount = new SavingsAccount();
+ savingsAccount.setAccountNumber(customerID+"_"+"SAA12345");
+ savingsAccount.setBalance(1500.0f);
+
+ return savingsAccount;
+ }
+
+ public StockAccount getStockAccount(String customerID) {
+
+ StockAccount stockAccount = new StockAccount();
+ stockAccount.setAccountNumber(customerID+"_"+"STA12345");
+ stockAccount.setSymbol("IBM");
+ stockAccount.setQuantity(100);
+
+ return stockAccount;
+ }
+}
diff --git a/branches/sca-java-0.91/samples/simple-bigbank/src/main/java/bigbank/accountdata/CheckingAccount.java b/branches/sca-java-0.91/samples/simple-bigbank/src/main/java/bigbank/accountdata/CheckingAccount.java
new file mode 100644
index 0000000000..11bdff757e
--- /dev/null
+++ b/branches/sca-java-0.91/samples/simple-bigbank/src/main/java/bigbank/accountdata/CheckingAccount.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package bigbank.accountdata;
+
+/**
+ * An account service implementation for a checking account
+ */
+public class CheckingAccount implements Account {
+ private String accountNumber;
+ private double balance;
+
+ public String getAccountNumber() { return accountNumber; }
+ public void setAccountNumber(String n) { this.accountNumber = n; }
+
+ public double getBalance() { return balance; }
+ public void setBalance(double b) { this.balance = b; }
+
+ public String getSummary() { return "ID:" + accountNumber + ", balance:" + balance; }
+}
diff --git a/branches/sca-java-0.91/samples/simple-bigbank/src/main/java/bigbank/accountdata/SavingsAccount.java b/branches/sca-java-0.91/samples/simple-bigbank/src/main/java/bigbank/accountdata/SavingsAccount.java
new file mode 100644
index 0000000000..b791024076
--- /dev/null
+++ b/branches/sca-java-0.91/samples/simple-bigbank/src/main/java/bigbank/accountdata/SavingsAccount.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package bigbank.accountdata;
+
+/**
+ * An account service implementation for a savings account
+ */
+public class SavingsAccount implements Account {
+ private String accountNumber;
+ private double balance;
+
+ public String getAccountNumber() { return accountNumber; }
+ public void setAccountNumber(String n) { this.accountNumber = n; }
+
+ public double getBalance() { return balance; }
+ public void setBalance(double b) { this.balance = b; }
+
+ public String getSummary() { return "ID:" + accountNumber + ", balance:" + balance; }
+}
diff --git a/branches/sca-java-0.91/samples/simple-bigbank/src/main/java/bigbank/accountdata/StockAccount.java b/branches/sca-java-0.91/samples/simple-bigbank/src/main/java/bigbank/accountdata/StockAccount.java
new file mode 100644
index 0000000000..03df61772b
--- /dev/null
+++ b/branches/sca-java-0.91/samples/simple-bigbank/src/main/java/bigbank/accountdata/StockAccount.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package bigbank.accountdata;
+
+/**
+ * An account service implementation for a stock account
+ */
+public class StockAccount implements Account {
+ private String accountNumber;
+ private String symbol;
+ private int quantity;
+
+ public String getAccountNumber() { return accountNumber; }
+ public void setAccountNumber(String n) { this.accountNumber = n; }
+
+ public double getQuantity() { return quantity; }
+ public void setQuantity(int a) { this.quantity = a; }
+
+ public String getSymbol() { return symbol; }
+ public void setSymbol(String s) { this.symbol = s; }
+
+ public String getSummary() { return "ID:" + accountNumber + ", symbol:" + symbol + ", quantity:" + quantity; }
+}
diff --git a/branches/sca-java-0.91/samples/simple-bigbank/src/main/java/bigbank/client/BigBankClient.java b/branches/sca-java-0.91/samples/simple-bigbank/src/main/java/bigbank/client/BigBankClient.java
new file mode 100644
index 0000000000..edbf910d37
--- /dev/null
+++ b/branches/sca-java-0.91/samples/simple-bigbank/src/main/java/bigbank/client/BigBankClient.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package bigbank.client;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+import bigbank.account.AccountService;
+
+/**
+ * This client program shows how to create an SCA runtime, start it,
+ * and locate and invoke a SCA component
+ */
+public class BigBankClient {
+ public static void main(String[] args) throws Exception {
+
+ SCADomain scaDomain = SCADomain.newInstance("BigBank.composite");
+
+ AccountService accountService = scaDomain.getService(AccountService.class,
+ "AccountServiceComponent");
+
+ System.out.println("Account summary: " + accountService.getAccountReport("Foo") );
+
+ scaDomain.close();
+ }
+
+}
diff --git a/branches/sca-java-0.91/samples/simple-bigbank/src/main/resources/BigBank.composite b/branches/sca-java-0.91/samples/simple-bigbank/src/main/resources/BigBank.composite
new file mode 100644
index 0000000000..ebebce5af9
--- /dev/null
+++ b/branches/sca-java-0.91/samples/simple-bigbank/src/main/resources/BigBank.composite
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ name="BigBank">
+
+ <component name="AccountServiceComponent">
+ <implementation.java class="bigbank.account.AccountServiceImpl"/>
+ <reference name="accountDataService" target="AccountDataServiceComponent"/>
+ <property name="currency">USD</property>
+ </component>
+
+ <component name="AccountDataServiceComponent">
+ <implementation.java class="bigbank.accountdata.AccountDataServiceImpl"/>
+ </component>
+
+</composite>
diff --git a/branches/sca-java-0.91/samples/simple-bigbank/src/test/java/bigbank/BigBankTestCase.java b/branches/sca-java-0.91/samples/simple-bigbank/src/test/java/bigbank/BigBankTestCase.java
new file mode 100644
index 0000000000..42d780953d
--- /dev/null
+++ b/branches/sca-java-0.91/samples/simple-bigbank/src/test/java/bigbank/BigBankTestCase.java
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package bigbank;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+import bigbank.account.AccountService;
+
+/**
+ * Tests out the big bank service
+ *
+ */
+public class BigBankTestCase extends TestCase {
+
+ private SCADomain scaDomain;
+ AccountService accountService;
+
+ protected void setUp() throws Exception {
+ scaDomain = SCADomain.newInstance("BigBank.composite");
+ accountService = scaDomain.getService(AccountService.class, "AccountServiceComponent");
+ }
+
+ protected void tearDown() throws Exception {
+ scaDomain.close();
+ }
+
+ public void test() throws Exception {
+ System.out.println("Account summary: " + accountService.getAccountReport("Foo") );
+ }
+}