Author: slaws
Date: Wed Apr 14 17:59:45 2010
New Revision: 934063
URL: http://svn.apache.org/viewvc?rev=934063&view=rev
Log:
Add some more parts to the simple banking sample
Added:
tuscany/sandbox/slaws/bank-challenge/client-sl-contribution/
tuscany/sandbox/slaws/bank-challenge/client-sl-contribution/pom.xml (with
props)
tuscany/sandbox/slaws/bank-challenge/client-sl-contribution/src/
tuscany/sandbox/slaws/bank-challenge/client-sl-contribution/src/main/
tuscany/sandbox/slaws/bank-challenge/client-sl-contribution/src/main/java/
tuscany/sandbox/slaws/bank-challenge/client-sl-contribution/src/main/java/client/
tuscany/sandbox/slaws/bank-challenge/client-sl-contribution/src/main/java/client/impl/
tuscany/sandbox/slaws/bank-challenge/client-sl-contribution/src/main/java/client/impl/ClientImpl.java
(with props)
tuscany/sandbox/slaws/bank-challenge/client-sl-contribution/src/main/resources/
tuscany/sandbox/slaws/bank-challenge/client-sl-contribution/src/main/resources/Client.composite
(with props)
tuscany/sandbox/slaws/bank-challenge/client-sl-contribution/src/main/resources/META-INF/
tuscany/sandbox/slaws/bank-challenge/client-sl-contribution/src/main/resources/META-INF/sca-contribution.xml
(with props)
tuscany/sandbox/slaws/bank-challenge/client-sl-contribution/src/test/
tuscany/sandbox/slaws/bank-challenge/client-sl-contribution/src/test/java/
tuscany/sandbox/slaws/bank-challenge/client-sl-contribution/src/test/java/test/
tuscany/sandbox/slaws/bank-challenge/client-sl-contribution/src/test/java/test/BankClientTestCase.java
(with props)
tuscany/sandbox/slaws/bank-challenge/common-contribution/
tuscany/sandbox/slaws/bank-challenge/common-contribution/pom.xml (with
props)
tuscany/sandbox/slaws/bank-challenge/common-contribution/src/
tuscany/sandbox/slaws/bank-challenge/common-contribution/src/main/
tuscany/sandbox/slaws/bank-challenge/common-contribution/src/main/java/
tuscany/sandbox/slaws/bank-challenge/common-contribution/src/main/java/bank/
tuscany/sandbox/slaws/bank-challenge/common-contribution/src/main/java/bank/BankService.java
(with props)
tuscany/sandbox/slaws/bank-challenge/common-contribution/src/main/java/bank/ChallengeControl.java
(with props)
tuscany/sandbox/slaws/bank-challenge/common-contribution/src/main/java/bank/Statement.java
(with props)
tuscany/sandbox/slaws/bank-challenge/common-contribution/src/main/java/bank/StockHolding.java
(with props)
tuscany/sandbox/slaws/bank-challenge/common-contribution/src/main/java/bank/StockQuote.java
(with props)
tuscany/sandbox/slaws/bank-challenge/common-contribution/src/main/resources/
tuscany/sandbox/slaws/bank-challenge/common-contribution/src/main/resources/META-INF/
tuscany/sandbox/slaws/bank-challenge/common-contribution/src/main/resources/META-INF/sca-contribution.xml
(with props)
tuscany/sandbox/slaws/bank-challenge/common-contribution/src/test/
tuscany/sandbox/slaws/bank-challenge/common-contribution/src/test/java/
tuscany/sandbox/slaws/bank-challenge/launcher/
tuscany/sandbox/slaws/bank-challenge/launcher/pom.xml (with props)
tuscany/sandbox/slaws/bank-challenge/launcher/src/
tuscany/sandbox/slaws/bank-challenge/launcher/src/main/
tuscany/sandbox/slaws/bank-challenge/launcher/src/main/java/
tuscany/sandbox/slaws/bank-challenge/launcher/src/main/java/launch/
tuscany/sandbox/slaws/bank-challenge/launcher/src/main/java/launch/BankChallengeLauncher.java
(with props)
tuscany/sandbox/slaws/bank-challenge/launcher/src/main/resources/
Removed:
tuscany/sandbox/slaws/bank-challenge/bank-contribution/src/main/java/bank/BankService.java
tuscany/sandbox/slaws/bank-challenge/bank-contribution/src/main/java/bank/Statement.java
tuscany/sandbox/slaws/bank-challenge/bank-contribution/src/main/java/bank/StockHolding.java
tuscany/sandbox/slaws/bank-challenge/bank-contribution/src/main/java/bank/StockQuote.java
Modified:
tuscany/sandbox/slaws/bank-challenge/bank-contribution/pom.xml
tuscany/sandbox/slaws/bank-challenge/bank-contribution/src/main/java/bank/impl/BankServiceImpl.java
tuscany/sandbox/slaws/bank-challenge/bank-contribution/src/main/resources/Bank.composite
tuscany/sandbox/slaws/bank-challenge/bank-contribution/src/main/resources/META-INF/sca-contribution.xml
tuscany/sandbox/slaws/bank-challenge/bank-contribution/src/test/java/test/BankTestCase.java
tuscany/sandbox/slaws/bank-challenge/pom.xml
Modified: tuscany/sandbox/slaws/bank-challenge/bank-contribution/pom.xml
URL:
http://svn.apache.org/viewvc/tuscany/sandbox/slaws/bank-challenge/bank-contribution/pom.xml?rev=934063&r1=934062&r2=934063&view=diff
==============================================================================
--- tuscany/sandbox/slaws/bank-challenge/bank-contribution/pom.xml (original)
+++ tuscany/sandbox/slaws/bank-challenge/bank-contribution/pom.xml Wed Apr 14
17:59:45 2010
@@ -25,9 +25,9 @@
<version>2.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
- <artifactId>sandbox-bank-challenge</artifactId>
- <name>Apache Tuscany SCA Sandbox Bank Challenge</name>
- <packaging>war</packaging>
+ <artifactId>sandbox-bank-contribution</artifactId>
+ <name>Apache Tuscany SCA Sandbox Bank Contribution</name>
+ <packaging>jar</packaging>
<dependencies>
@@ -77,48 +77,16 @@
<version>4.8.1</version>
<scope>test</scope>
</dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>sandbox-common-contribution</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ </dependency>
</dependencies>
<build>
<finalName>${artifactId}</finalName>
- <plugins>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>build-helper-maven-plugin</artifactId>
- <version>1.4</version>
- <executions>
- <execution>
- <id>add-source</id>
- <phase>generate-sources</phase>
- <goals>
- <goal>add-resource</goal>
- </goals>
- <configuration>
- <resources>
- <resource>
- <directory>src/wsimportout</directory>
- </resource>
- <resource>
- <directory>src/wsgenout</directory>
- </resource>
- </resources>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-jar-plugin</artifactId>
- <version>2.2</version>
- <configuration>
- <archive>
- <manifest>
- <mainClass>calculator.CalculatorClient</mainClass>
- </manifest>
- </archive>
- </configuration>
- </plugin>
- </plugins>
</build>
</project>
Modified:
tuscany/sandbox/slaws/bank-challenge/bank-contribution/src/main/java/bank/impl/BankServiceImpl.java
URL:
http://svn.apache.org/viewvc/tuscany/sandbox/slaws/bank-challenge/bank-contribution/src/main/java/bank/impl/BankServiceImpl.java?rev=934063&r1=934062&r2=934063&view=diff
==============================================================================
---
tuscany/sandbox/slaws/bank-challenge/bank-contribution/src/main/java/bank/impl/BankServiceImpl.java
(original)
+++
tuscany/sandbox/slaws/bank-challenge/bank-contribution/src/main/java/bank/impl/BankServiceImpl.java
Wed Apr 14 17:59:45 2010
@@ -27,6 +27,7 @@ import org.oasisopen.sca.annotation.Scop
import org.oasisopen.sca.annotation.Service;
import bank.BankService;
+import bank.ChallengeControl;
import bank.Statement;
import bank.StockHolding;
import bank.StockQuote;
@@ -34,9 +35,9 @@ import bank.StockQuote;
/**
* An implementation of the Bank service.
*/
-...@service(BankService.class)
+...@service({BankService.class, ChallengeControl.class})
@Scope("COMPOSITE")
-public class BankServiceImpl implements BankService {
+public class BankServiceImpl implements BankService, ChallengeControl {
protected int initialCredit = 1000;
protected int overdrawnCost = 1;
@@ -72,7 +73,7 @@ public class BankServiceImpl implements
}
}
- // public interface
+ // BankService service implementation
public String createAccount(String customerName) {
for (Statement statement : accounts){
@@ -168,6 +169,26 @@ public class BankServiceImpl implements
return stockQuote;
}
+ // ChallengeControl service implmentation
+
+ public void start() {
+
+ }
+
+ public void increment() {
+
+ }
+
+ public void stop() {
+ System.out.println("Customer report");
+ System.out.println("===============");
+
+ for(Statement account : accounts){
+ System.out.println("\n");
+ System.out.println(account);
+ }
+ }
+
// private functions
private void updateStockPrices(){
Modified:
tuscany/sandbox/slaws/bank-challenge/bank-contribution/src/main/resources/Bank.composite
URL:
http://svn.apache.org/viewvc/tuscany/sandbox/slaws/bank-challenge/bank-contribution/src/main/resources/Bank.composite?rev=934063&r1=934062&r2=934063&view=diff
==============================================================================
---
tuscany/sandbox/slaws/bank-challenge/bank-contribution/src/main/resources/Bank.composite
(original)
+++
tuscany/sandbox/slaws/bank-challenge/bank-contribution/src/main/resources/Bank.composite
Wed Apr 14 17:59:45 2010
@@ -26,6 +26,8 @@
<implementation.java class="bank.impl.BankServiceImpl"/>
<service name="BankService">
</service>
+ <service name="ChallengeControl">
+ </service>
</component>
</composite>
Modified:
tuscany/sandbox/slaws/bank-challenge/bank-contribution/src/main/resources/META-INF/sca-contribution.xml
URL:
http://svn.apache.org/viewvc/tuscany/sandbox/slaws/bank-challenge/bank-contribution/src/main/resources/META-INF/sca-contribution.xml?rev=934063&r1=934062&r2=934063&view=diff
==============================================================================
---
tuscany/sandbox/slaws/bank-challenge/bank-contribution/src/main/resources/META-INF/sca-contribution.xml
(original)
+++
tuscany/sandbox/slaws/bank-challenge/bank-contribution/src/main/resources/META-INF/sca-contribution.xml
Wed Apr 14 17:59:45 2010
@@ -20,4 +20,5 @@
<contribution xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912"
xmlns:sample="http://banking-challenge">
<deployable composite="sample:Bank"/>
+ <import.java package="bank"/>
</contribution>
\ No newline at end of file
Modified:
tuscany/sandbox/slaws/bank-challenge/bank-contribution/src/test/java/test/BankTestCase.java
URL:
http://svn.apache.org/viewvc/tuscany/sandbox/slaws/bank-challenge/bank-contribution/src/test/java/test/BankTestCase.java?rev=934063&r1=934062&r2=934063&view=diff
==============================================================================
---
tuscany/sandbox/slaws/bank-challenge/bank-contribution/src/test/java/test/BankTestCase.java
(original)
+++
tuscany/sandbox/slaws/bank-challenge/bank-contribution/src/test/java/test/BankTestCase.java
Wed Apr 14 17:59:45 2010
@@ -38,8 +38,9 @@ public class BankTestCase{
@BeforeClass
public static void setUpBeforeClass() throws Exception {
- node = NodeFactory.newInstance().createNode((String)null, new String[]
{"target/classes"}).start();
- bankService = node.getService(BankService.class,
"BankServiceComponent");
+ node = NodeFactory.newInstance().createNode((String)null, new String[]
{"target/classes"});
+ node.start();
+ bankService = node.getService(BankService.class,
"BankServiceComponent/BankService");
}
@AfterClass
Added: tuscany/sandbox/slaws/bank-challenge/client-sl-contribution/pom.xml
URL:
http://svn.apache.org/viewvc/tuscany/sandbox/slaws/bank-challenge/client-sl-contribution/pom.xml?rev=934063&view=auto
==============================================================================
--- tuscany/sandbox/slaws/bank-challenge/client-sl-contribution/pom.xml (added)
+++ tuscany/sandbox/slaws/bank-challenge/client-sl-contribution/pom.xml Wed Apr
14 17:59:45 2010
@@ -0,0 +1,92 @@
+<?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>2.0-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>sandbox-bank-client-sl-contribution</artifactId>
+ <name>Apache Tuscany SCA Sandbox Bank Client SL Contribution</name>
+ <packaging>jar</packaging>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca-api</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-api</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-impl</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-runtime-axis2</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.axis2</groupId>
+ <artifactId>axis2-webapp</artifactId>
+ <version>1.5.1</version>
+ <type>war</type>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.8.1</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>sandbox-common-contribution</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+</project>
Propchange: tuscany/sandbox/slaws/bank-challenge/client-sl-contribution/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: tuscany/sandbox/slaws/bank-challenge/client-sl-contribution/pom.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: tuscany/sandbox/slaws/bank-challenge/client-sl-contribution/pom.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added:
tuscany/sandbox/slaws/bank-challenge/client-sl-contribution/src/main/java/client/impl/ClientImpl.java
URL:
http://svn.apache.org/viewvc/tuscany/sandbox/slaws/bank-challenge/client-sl-contribution/src/main/java/client/impl/ClientImpl.java?rev=934063&view=auto
==============================================================================
---
tuscany/sandbox/slaws/bank-challenge/client-sl-contribution/src/main/java/client/impl/ClientImpl.java
(added)
+++
tuscany/sandbox/slaws/bank-challenge/client-sl-contribution/src/main/java/client/impl/ClientImpl.java
Wed Apr 14 17:59:45 2010
@@ -0,0 +1,75 @@
+/*
+ * 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 client.impl;
+
+import java.util.List;
+
+import org.oasisopen.sca.annotation.Reference;
+import org.oasisopen.sca.annotation.Scope;
+import org.oasisopen.sca.annotation.Service;
+
+import bank.BankService;
+import bank.ChallengeControl;
+import bank.Statement;
+import bank.StockHolding;
+import bank.StockQuote;
+
+/**
+ * An implementation of the Bank service.
+ */
+...@service(ChallengeControl.class)
+...@scope("COMPOSITE")
+public class ClientImpl implements ChallengeControl {
+
+ @Reference
+ protected BankService bankService;
+
+ private String customerName = "SL";
+ private String accountID;
+
+ public ClientImpl(){
+ }
+
+ public void start() {
+ System.out.println("Starting bank client for " + customerName);
+ accountID = bankService.createAccount(customerName);
+ System.out.println("Account ID for " + customerName + " = " +
accountID);
+ }
+
+ public void increment() {
+ System.out.println("Increment " + customerName);
+
+ List<StockQuote> stockQuotes =
bankService.getAllStockQuotes(accountID);
+
+ for (StockQuote stock : stockQuotes){
+ bankService.buyEquity(accountID, stock.getStockCode(), 1);
+ }
+
+ System.out.println("My statement " +
bankService.getStatement(accountID));
+ }
+
+ public void stop() {
+ System.out.println("Stopping bank client for " + customerName);
+ Statement statement = bankService.getStatement(accountID);
+
+ for (StockHolding holding : statement.getStockHolding()){
+ bankService.sellEquity(accountID, holding.getStockCode(),
holding.getNumberHeld());
+ }
+ }
+}
Propchange:
tuscany/sandbox/slaws/bank-challenge/client-sl-contribution/src/main/java/client/impl/ClientImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
tuscany/sandbox/slaws/bank-challenge/client-sl-contribution/src/main/java/client/impl/ClientImpl.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added:
tuscany/sandbox/slaws/bank-challenge/client-sl-contribution/src/main/resources/Client.composite
URL:
http://svn.apache.org/viewvc/tuscany/sandbox/slaws/bank-challenge/client-sl-contribution/src/main/resources/Client.composite?rev=934063&view=auto
==============================================================================
---
tuscany/sandbox/slaws/bank-challenge/client-sl-contribution/src/main/resources/Client.composite
(added)
+++
tuscany/sandbox/slaws/bank-challenge/client-sl-contribution/src/main/resources/Client.composite
Wed Apr 14 17:59:45 2010
@@ -0,0 +1,30 @@
+<?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://docs.oasis-open.org/ns/opencsa/sca/200912"
+ targetNamespace="http://banking-challenge"
+ xmlns:sample="http://banking-challenge"
+ name="ClientSL">
+
+ <component name="ClientComponentSL">
+ <implementation.java class="client.impl.ClientImpl"/>
+ <reference name="bankService" target="BankServiceComponent"/>
+ </component>
+
+</composite>
Propchange:
tuscany/sandbox/slaws/bank-challenge/client-sl-contribution/src/main/resources/Client.composite
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
tuscany/sandbox/slaws/bank-challenge/client-sl-contribution/src/main/resources/Client.composite
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange:
tuscany/sandbox/slaws/bank-challenge/client-sl-contribution/src/main/resources/Client.composite
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added:
tuscany/sandbox/slaws/bank-challenge/client-sl-contribution/src/main/resources/META-INF/sca-contribution.xml
URL:
http://svn.apache.org/viewvc/tuscany/sandbox/slaws/bank-challenge/client-sl-contribution/src/main/resources/META-INF/sca-contribution.xml?rev=934063&view=auto
==============================================================================
---
tuscany/sandbox/slaws/bank-challenge/client-sl-contribution/src/main/resources/META-INF/sca-contribution.xml
(added)
+++
tuscany/sandbox/slaws/bank-challenge/client-sl-contribution/src/main/resources/META-INF/sca-contribution.xml
Wed Apr 14 17:59:45 2010
@@ -0,0 +1,24 @@
+<?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.
+-->
+<contribution xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912"
+ xmlns:sample="http://banking-challenge">
+ <deployable composite="sample:ClientSL"/>
+ <import.java package="bank"/>
+</contribution>
\ No newline at end of file
Propchange:
tuscany/sandbox/slaws/bank-challenge/client-sl-contribution/src/main/resources/META-INF/sca-contribution.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
tuscany/sandbox/slaws/bank-challenge/client-sl-contribution/src/main/resources/META-INF/sca-contribution.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange:
tuscany/sandbox/slaws/bank-challenge/client-sl-contribution/src/main/resources/META-INF/sca-contribution.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added:
tuscany/sandbox/slaws/bank-challenge/client-sl-contribution/src/test/java/test/BankClientTestCase.java
URL:
http://svn.apache.org/viewvc/tuscany/sandbox/slaws/bank-challenge/client-sl-contribution/src/test/java/test/BankClientTestCase.java?rev=934063&view=auto
==============================================================================
---
tuscany/sandbox/slaws/bank-challenge/client-sl-contribution/src/test/java/test/BankClientTestCase.java
(added)
+++
tuscany/sandbox/slaws/bank-challenge/client-sl-contribution/src/test/java/test/BankClientTestCase.java
Wed Apr 14 17:59:45 2010
@@ -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 test;
+
+import static org.junit.Assert.assertEquals;
+
+import org.apache.tuscany.sca.node.Contribution;
+import org.apache.tuscany.sca.node.Node;
+import org.apache.tuscany.sca.node.NodeFactory;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import bank.ChallengeControl;
+
+/**
+ * Test the Bank service component.
+ */
+public class BankClientTestCase{
+ private static Node node;
+ private static ChallengeControl bankClient;
+
+ @BeforeClass
+ public static void setUpBeforeClass() throws Exception {
+ node = NodeFactory.newInstance().createNode(new Contribution("Common",
"../common-contribution/target/classes"),
+ new Contribution("Bank",
"../bank-contribution/target/classes"),
+ new
Contribution("SLClient", "../client-sl-contribution/target/classes"));
+ node.start();
+ bankClient = node.getService(ChallengeControl.class,
"ClientComponentSL");
+ }
+
+ @AfterClass
+ public static void tearDownAfterClass() throws Exception {
+ node.stop();
+ }
+
+ @Test
+ public void testClient() throws Exception {
+ System.out.println("Start client");
+ bankClient.start();
+ bankClient.increment();
+ System.out.println("Stop client");
+ bankClient.stop();
+ }
+}
Propchange:
tuscany/sandbox/slaws/bank-challenge/client-sl-contribution/src/test/java/test/BankClientTestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
tuscany/sandbox/slaws/bank-challenge/client-sl-contribution/src/test/java/test/BankClientTestCase.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: tuscany/sandbox/slaws/bank-challenge/common-contribution/pom.xml
URL:
http://svn.apache.org/viewvc/tuscany/sandbox/slaws/bank-challenge/common-contribution/pom.xml?rev=934063&view=auto
==============================================================================
--- tuscany/sandbox/slaws/bank-challenge/common-contribution/pom.xml (added)
+++ tuscany/sandbox/slaws/bank-challenge/common-contribution/pom.xml Wed Apr 14
17:59:45 2010
@@ -0,0 +1,86 @@
+<?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>2.0-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>sandbox-common-contribution</artifactId>
+ <name>Apache Tuscany SCA Sandbox Common Contribution</name>
+ <packaging>jar</packaging>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca-api</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-api</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-impl</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-runtime-axis2</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.axis2</groupId>
+ <artifactId>axis2-webapp</artifactId>
+ <version>1.5.1</version>
+ <type>war</type>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.8.1</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+</project>
Propchange: tuscany/sandbox/slaws/bank-challenge/common-contribution/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: tuscany/sandbox/slaws/bank-challenge/common-contribution/pom.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: tuscany/sandbox/slaws/bank-challenge/common-contribution/pom.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added:
tuscany/sandbox/slaws/bank-challenge/common-contribution/src/main/java/bank/BankService.java
URL:
http://svn.apache.org/viewvc/tuscany/sandbox/slaws/bank-challenge/common-contribution/src/main/java/bank/BankService.java?rev=934063&view=auto
==============================================================================
---
tuscany/sandbox/slaws/bank-challenge/common-contribution/src/main/java/bank/BankService.java
(added)
+++
tuscany/sandbox/slaws/bank-challenge/common-contribution/src/main/java/bank/BankService.java
Wed Apr 14 17:59:45 2010
@@ -0,0 +1,40 @@
+/*
+ * 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 bank;
+
+import java.util.List;
+
+import org.oasisopen.sca.annotation.Remotable;
+
+/**
+ * The Bank service interface.
+ */
+...@remotable
+public interface BankService {
+
+ String createAccount(String customerName);
+
+ Statement getStatement(String accountID);
+
+ void buyEquity(String accountID, String equityCode, int number);
+ void sellEquity(String accountID, String equityCode, int number);
+
+ StockQuote getStockQuote(String accountID, String equityCode);
+ List<StockQuote> getAllStockQuotes(String accountID);
+}
Propchange:
tuscany/sandbox/slaws/bank-challenge/common-contribution/src/main/java/bank/BankService.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
tuscany/sandbox/slaws/bank-challenge/common-contribution/src/main/java/bank/BankService.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added:
tuscany/sandbox/slaws/bank-challenge/common-contribution/src/main/java/bank/ChallengeControl.java
URL:
http://svn.apache.org/viewvc/tuscany/sandbox/slaws/bank-challenge/common-contribution/src/main/java/bank/ChallengeControl.java?rev=934063&view=auto
==============================================================================
---
tuscany/sandbox/slaws/bank-challenge/common-contribution/src/main/java/bank/ChallengeControl.java
(added)
+++
tuscany/sandbox/slaws/bank-challenge/common-contribution/src/main/java/bank/ChallengeControl.java
Wed Apr 14 17:59:45 2010
@@ -0,0 +1,32 @@
+/*
+ * 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 bank;
+
+import org.oasisopen.sca.annotation.Remotable;
+
+/**
+ * The Bank service interface.
+ */
+...@remotable
+public interface ChallengeControl {
+
+ void start();
+ void increment();
+ void stop();
+}
Propchange:
tuscany/sandbox/slaws/bank-challenge/common-contribution/src/main/java/bank/ChallengeControl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
tuscany/sandbox/slaws/bank-challenge/common-contribution/src/main/java/bank/ChallengeControl.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added:
tuscany/sandbox/slaws/bank-challenge/common-contribution/src/main/java/bank/Statement.java
URL:
http://svn.apache.org/viewvc/tuscany/sandbox/slaws/bank-challenge/common-contribution/src/main/java/bank/Statement.java?rev=934063&view=auto
==============================================================================
---
tuscany/sandbox/slaws/bank-challenge/common-contribution/src/main/java/bank/Statement.java
(added)
+++
tuscany/sandbox/slaws/bank-challenge/common-contribution/src/main/java/bank/Statement.java
Wed Apr 14 17:59:45 2010
@@ -0,0 +1,143 @@
+/*
+ * 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 bank;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.UUID;
+
+
+/**
+ * A stock quote
+ */
+public class Statement implements Serializable {
+
+ private String customerName;
+ private String accountID;
+ private long cashBalance;
+ private List<StockHolding> stockHoldings;
+ private List<String> transactions = new ArrayList<String>();
+
+ public Statement(){
+ if (this.stockHoldings == null){
+ this.stockHoldings = new ArrayList<StockHolding>();
+ }
+ }
+
+ public Statement(String customerName, String accountID, long cashBalance,
List<StockHolding> stockHoldings){
+ this.customerName = customerName;
+ this.accountID = accountID;
+ this.cashBalance = cashBalance;
+ this.stockHoldings = stockHoldings;
+
+ if (this.accountID == null){
+ this.accountID = UUID.randomUUID().toString();
+ }
+
+ if (this.stockHoldings == null){
+ this.stockHoldings = new ArrayList<StockHolding>();
+ }
+ }
+
+ public String getCustomerName() {
+ return customerName;
+ }
+
+ public String getAccountID() {
+ return accountID;
+ }
+
+ public long getCashBalance() {
+ return cashBalance;
+ }
+
+ public void creditCashBalance(long credit, String reason) {
+ this.cashBalance += credit;
+ transactions.add("credit " + credit + " : " + reason);
+ }
+
+ public void debitCashBalance(long debit, String reason) {
+ this.cashBalance -= debit;
+ transactions.add("debit " + debit + " : " + reason);
+ }
+
+ public List<StockHolding> getStockHolding() {
+ return stockHoldings;
+ }
+
+ public void creditStockHolding(StockHolding stock){
+ stockHoldings.add(stock);
+ debitCashBalance(stock.getPrice() * stock.getNumberHeld(),
+ "bought " + stock.getNumberHeld() + " of " +
stock.getStockCode() + " at " + stock.getPrice());
+ }
+
+ public void debitStockHolding(StockHolding stock){
+ int numberToSell = stock.getNumberHeld();
+ int numberSold = 0;
+ List<StockHolding> toRemove = new ArrayList<StockHolding>();
+
+ for (StockHolding stockHolding : stockHoldings){
+ if (stockHolding.getStockCode().equals(stock.getStockCode())){
+ if (stockHolding.getNumberHeld() > numberToSell){
+ stockHolding.setNumberHeld(stockHolding.getNumberHeld() -
numberToSell);
+ numberSold += numberToSell;
+ numberToSell = 0;
+ break;
+ } else {
+ numberSold += stockHolding.getNumberHeld();
+ numberToSell -= stockHolding.getNumberHeld();
+ stockHolding.setNumberHeld(0);
+ toRemove.add(stockHolding);
+ }
+ }
+ }
+
+ stockHoldings.removeAll(toRemove);
+
+ creditCashBalance(stock.getPrice() * numberSold,
+ "sold " + numberSold + " of " + stock.getStockCode() + " at "
+ stock.getPrice());
+ }
+
+ public List<String> getTransactions() {
+ return transactions;
+ }
+
+ @Override
+ public String toString() {
+ String returnString =
+ "customer name = " + customerName +
+ "\naccount Id = " + accountID +
+ "\nbalance = " + cashBalance +
+ "\nequities = \n";
+
+ for (StockHolding stock : stockHoldings){
+ returnString += " stock " + stock.getStockCode() + " number held
= " + stock.getNumberHeld() + "\n";
+ }
+
+ returnString +=
+ "transactions = \n";
+
+ for(String transaction : transactions){
+ returnString += " " + transaction + "\n";
+ }
+
+ return returnString;
+ }
+}
Propchange:
tuscany/sandbox/slaws/bank-challenge/common-contribution/src/main/java/bank/Statement.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
tuscany/sandbox/slaws/bank-challenge/common-contribution/src/main/java/bank/Statement.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added:
tuscany/sandbox/slaws/bank-challenge/common-contribution/src/main/java/bank/StockHolding.java
URL:
http://svn.apache.org/viewvc/tuscany/sandbox/slaws/bank-challenge/common-contribution/src/main/java/bank/StockHolding.java?rev=934063&view=auto
==============================================================================
---
tuscany/sandbox/slaws/bank-challenge/common-contribution/src/main/java/bank/StockHolding.java
(added)
+++
tuscany/sandbox/slaws/bank-challenge/common-contribution/src/main/java/bank/StockHolding.java
Wed Apr 14 17:59:45 2010
@@ -0,0 +1,58 @@
+/*
+ * 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 bank;
+
+import java.io.Serializable;
+
+/**
+ * A stock quote
+ */
+public class StockHolding implements Serializable {
+
+ private String stockCode;
+ private int numberHeld;
+ private long price;
+
+ public StockHolding(String stockCode, int numberHeld, long price){
+ this.stockCode = stockCode;
+ this.numberHeld = numberHeld;
+ this.price = price;
+ }
+
+ public String getStockCode() {
+ return stockCode;
+ }
+
+ public int getNumberHeld() {
+ return numberHeld;
+ }
+
+ public void setNumberHeld(int numberHeld) {
+ this.numberHeld = numberHeld;
+ }
+
+ public long getPrice() {
+ return price;
+ }
+
+ @Override
+ public String toString() {
+ return stockCode + " - number=" + numberHeld + " - price=" + price;
+ }
+}
Propchange:
tuscany/sandbox/slaws/bank-challenge/common-contribution/src/main/java/bank/StockHolding.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
tuscany/sandbox/slaws/bank-challenge/common-contribution/src/main/java/bank/StockHolding.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added:
tuscany/sandbox/slaws/bank-challenge/common-contribution/src/main/java/bank/StockQuote.java
URL:
http://svn.apache.org/viewvc/tuscany/sandbox/slaws/bank-challenge/common-contribution/src/main/java/bank/StockQuote.java?rev=934063&view=auto
==============================================================================
---
tuscany/sandbox/slaws/bank-challenge/common-contribution/src/main/java/bank/StockQuote.java
(added)
+++
tuscany/sandbox/slaws/bank-challenge/common-contribution/src/main/java/bank/StockQuote.java
Wed Apr 14 17:59:45 2010
@@ -0,0 +1,52 @@
+/*
+ * 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 bank;
+
+import java.io.Serializable;
+
+/**
+ * A stock quote
+ */
+public class StockQuote implements Serializable {
+
+ private String stockCode;
+ private long stockQuote;
+
+ public StockQuote(String stockCode, long stockQuote){
+ this.stockCode = stockCode;
+ this.stockQuote = stockQuote;
+ }
+
+ public String getStockCode() {
+ return stockCode;
+ }
+
+ public long getStockQuote() {
+ return stockQuote;
+ }
+
+ public void setStockQuote(long stockQuote) {
+ this.stockQuote = stockQuote;
+ }
+
+ @Override
+ public String toString() {
+ return stockCode + " - " + stockQuote;
+ }
+}
Propchange:
tuscany/sandbox/slaws/bank-challenge/common-contribution/src/main/java/bank/StockQuote.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
tuscany/sandbox/slaws/bank-challenge/common-contribution/src/main/java/bank/StockQuote.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added:
tuscany/sandbox/slaws/bank-challenge/common-contribution/src/main/resources/META-INF/sca-contribution.xml
URL:
http://svn.apache.org/viewvc/tuscany/sandbox/slaws/bank-challenge/common-contribution/src/main/resources/META-INF/sca-contribution.xml?rev=934063&view=auto
==============================================================================
---
tuscany/sandbox/slaws/bank-challenge/common-contribution/src/main/resources/META-INF/sca-contribution.xml
(added)
+++
tuscany/sandbox/slaws/bank-challenge/common-contribution/src/main/resources/META-INF/sca-contribution.xml
Wed Apr 14 17:59:45 2010
@@ -0,0 +1,23 @@
+<?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.
+-->
+<contribution xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912"
+ xmlns:sample="http://banking-challenge">
+ <export.java package="bank"/>
+</contribution>
\ No newline at end of file
Propchange:
tuscany/sandbox/slaws/bank-challenge/common-contribution/src/main/resources/META-INF/sca-contribution.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
tuscany/sandbox/slaws/bank-challenge/common-contribution/src/main/resources/META-INF/sca-contribution.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange:
tuscany/sandbox/slaws/bank-challenge/common-contribution/src/main/resources/META-INF/sca-contribution.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: tuscany/sandbox/slaws/bank-challenge/launcher/pom.xml
URL:
http://svn.apache.org/viewvc/tuscany/sandbox/slaws/bank-challenge/launcher/pom.xml?rev=934063&view=auto
==============================================================================
--- tuscany/sandbox/slaws/bank-challenge/launcher/pom.xml (added)
+++ tuscany/sandbox/slaws/bank-challenge/launcher/pom.xml Wed Apr 14 17:59:45
2010
@@ -0,0 +1,92 @@
+<?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>2.0-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>sandbox-bank-challenge-launcher</artifactId>
+ <name>Apache Tuscany SCA Sandbox Bank Challenge Launcher</name>
+ <packaging>war</packaging>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca-api</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-api</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-impl</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-runtime-axis2</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.axis2</groupId>
+ <artifactId>axis2-webapp</artifactId>
+ <version>1.5.1</version>
+ <type>war</type>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.8.1</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>sandbox-common-contribution</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+</project>
Propchange: tuscany/sandbox/slaws/bank-challenge/launcher/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: tuscany/sandbox/slaws/bank-challenge/launcher/pom.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: tuscany/sandbox/slaws/bank-challenge/launcher/pom.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added:
tuscany/sandbox/slaws/bank-challenge/launcher/src/main/java/launch/BankChallengeLauncher.java
URL:
http://svn.apache.org/viewvc/tuscany/sandbox/slaws/bank-challenge/launcher/src/main/java/launch/BankChallengeLauncher.java?rev=934063&view=auto
==============================================================================
---
tuscany/sandbox/slaws/bank-challenge/launcher/src/main/java/launch/BankChallengeLauncher.java
(added)
+++
tuscany/sandbox/slaws/bank-challenge/launcher/src/main/java/launch/BankChallengeLauncher.java
Wed Apr 14 17:59:45 2010
@@ -0,0 +1,66 @@
+/*
+ * 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 launch;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.tuscany.sca.node.Contribution;
+import org.apache.tuscany.sca.node.Node;
+import org.apache.tuscany.sca.node.NodeFactory;
+
+import bank.ChallengeControl;
+
+public class BankChallengeLauncher {
+
+ public static void main(String[] args) throws Exception {
+ Node node = NodeFactory.newInstance().createNode(new
Contribution("Bank", "../bank-contribution/target/classes"),
+ new
Contribution("Common", "../common-contribution/target/classes"),
+ new
Contribution("SLClient", "../client-sl-contribution/target/classes"));
+ node.start();
+
+ List<ChallengeControl> bankClients = new ArrayList<ChallengeControl>();
+
+ bankClients.add(node.getService(ChallengeControl.class,
"ClientComponentSL"));
+
+ // start all clients
+ Iterator<ChallengeControl> bankClientsIterator =
bankClients.iterator();
+ while(bankClientsIterator.hasNext()){
+ bankClientsIterator.next().start();
+ }
+
+ for(int i=0; i<10; i++){
+ // increment all clients
+ bankClientsIterator = bankClients.iterator();
+ while(bankClientsIterator.hasNext()){
+ bankClientsIterator.next().increment();
+ }
+ }
+
+ // stop all clients
+ bankClientsIterator = bankClients.iterator();
+ while(bankClientsIterator.hasNext()){
+ bankClientsIterator.next().stop();
+ }
+
+ node.stop();
+ }
+}
Propchange:
tuscany/sandbox/slaws/bank-challenge/launcher/src/main/java/launch/BankChallengeLauncher.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
tuscany/sandbox/slaws/bank-challenge/launcher/src/main/java/launch/BankChallengeLauncher.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: tuscany/sandbox/slaws/bank-challenge/pom.xml
URL:
http://svn.apache.org/viewvc/tuscany/sandbox/slaws/bank-challenge/pom.xml?rev=934063&r1=934062&r2=934063&view=diff
==============================================================================
--- tuscany/sandbox/slaws/bank-challenge/pom.xml (original)
+++ tuscany/sandbox/slaws/bank-challenge/pom.xml Wed Apr 14 17:59:45 2010
@@ -43,6 +43,7 @@
<activeByDefault>true</activeByDefault>
</activation>
<modules>
+ <module>common-contribution</module>
<module>bank-contribution</module>
<module>client-sl-contribution</module>
<module>launcher</module>