summaryrefslogtreecommitdiffstats
path: root/branches/sca-java-M2/samples/applications/bigbank/account/src/main
diff options
context:
space:
mode:
authordims <dims@13f79535-47bb-0310-9956-ffa450edef68>2008-06-17 00:23:01 +0000
committerdims <dims@13f79535-47bb-0310-9956-ffa450edef68>2008-06-17 00:23:01 +0000
commitbdd0a41aed7edf21ec2a65cfa17a86af2ef8c48a (patch)
tree38a92061c0793434c4be189f1d70c3458b6bc41d /branches/sca-java-M2/samples/applications/bigbank/account/src/main
Move Tuscany from Incubator to top level.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@668359 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'branches/sca-java-M2/samples/applications/bigbank/account/src/main')
-rw-r--r--branches/sca-java-M2/samples/applications/bigbank/account/src/main/java/bigbank/account/services/account/AccountServiceImpl.java279
-rw-r--r--branches/sca-java-M2/samples/applications/bigbank/account/src/main/java/bigbank/account/services/accountdata/AccountDataService.java87
-rw-r--r--branches/sca-java-M2/samples/applications/bigbank/account/src/main/java/bigbank/account/services/accountdata/AccountDataServiceDASImpl.java400
-rw-r--r--branches/sca-java-M2/samples/applications/bigbank/account/src/main/java/bigbank/account/services/accountdata/AccountDataServiceImpl.java106
-rw-r--r--branches/sca-java-M2/samples/applications/bigbank/account/src/main/java/bigbank/account/services/accountdata/CustomerIdService.java98
-rw-r--r--branches/sca-java-M2/samples/applications/bigbank/account/src/main/java/bigbank/account/services/accountdb/AccountDBInit.java465
-rw-r--r--branches/sca-java-M2/samples/applications/bigbank/account/src/main/java/bigbank/account/services/accountlogger/AccountLoggerDataServiceImpl.java129
-rw-r--r--branches/sca-java-M2/samples/applications/bigbank/account/src/main/java/bigbank/account/services/accountlogger/AccountLoggerService.java47
-rw-r--r--branches/sca-java-M2/samples/applications/bigbank/account/src/main/java/bigbank/account/services/accountlogger/AccountLoggerServiceImpl.java216
-rw-r--r--branches/sca-java-M2/samples/applications/bigbank/account/src/main/java/bigbank/account/services/stockquote/StockQuote.java228
-rw-r--r--branches/sca-java-M2/samples/applications/bigbank/account/src/main/java/bigbank/account/services/stockquote/StockQuoteService.java31
-rw-r--r--branches/sca-java-M2/samples/applications/bigbank/account/src/main/java/bigbank/account/services/stockquote/StockQuoteServiceImpl.java68
-rw-r--r--branches/sca-java-M2/samples/applications/bigbank/account/src/main/java/bigbank/account/services/stockquote/StockQuoteWebservicexServiceImpl.java153
-rw-r--r--branches/sca-java-M2/samples/applications/bigbank/account/src/main/resources/DasAccountConfiguration.xml80
-rw-r--r--branches/sca-java-M2/samples/applications/bigbank/account/src/main/resources/META-INF/LICENSE.txt416
-rw-r--r--branches/sca-java-M2/samples/applications/bigbank/account/src/main/resources/META-INF/NOTICE18
-rw-r--r--branches/sca-java-M2/samples/applications/bigbank/account/src/main/resources/wsdl/AccountService.wsdl467
-rw-r--r--branches/sca-java-M2/samples/applications/bigbank/account/src/main/resources/wsdl/stockquotes.webservicex.wsdl136
-rw-r--r--branches/sca-java-M2/samples/applications/bigbank/account/src/main/webapp/WEB-INF/default.scdl80
-rw-r--r--branches/sca-java-M2/samples/applications/bigbank/account/src/main/webapp/WEB-INF/web.xml66
20 files changed, 3570 insertions, 0 deletions
diff --git a/branches/sca-java-M2/samples/applications/bigbank/account/src/main/java/bigbank/account/services/account/AccountServiceImpl.java b/branches/sca-java-M2/samples/applications/bigbank/account/src/main/java/bigbank/account/services/account/AccountServiceImpl.java
new file mode 100644
index 0000000000..74baa636f5
--- /dev/null
+++ b/branches/sca-java-M2/samples/applications/bigbank/account/src/main/java/bigbank/account/services/account/AccountServiceImpl.java
@@ -0,0 +1,279 @@
+/*
+ * 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.services.account;
+
+import java.rmi.RemoteException;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.TimeZone;
+
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+import bigbank.account.services.accountdata.AccountDataService;
+import bigbank.account.services.stockquote.StockQuote;
+import bigbank.account.services.stockquote.StockQuoteService;
+
+import com.bigbank.account.AccountLog;
+import com.bigbank.account.AccountReport;
+import com.bigbank.account.AccountService;
+import com.bigbank.account.AccountSummary;
+import com.bigbank.account.CustomerProfileData;
+import com.bigbank.account.StockSummary;
+
+@Service(interfaces = AccountService.class)
+public class AccountServiceImpl implements AccountService {
+
+ public static final String CHECKING_ACCOUNT_PREFIX = "134-43-394";
+
+ public static final String SAVINGS_ACCOUNT_PREFIX = "134-42-623";
+
+ public static final String ACCOUNT_TYPE_SAVINGS = "savings";
+
+ public static final String ACCOUNT_TYPE_CHECKINGS = "checkings";
+
+ public static final DateFormat tsformatXSDDateTime = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSz");
+ static {
+ AccountServiceImpl.tsformatXSDDateTime.setTimeZone(TimeZone.getTimeZone("UTC"));
+ }
+
+ private float currencyConversion = 0.0f;
+
+ private String currency = "USD";
+
+ @Property
+ public void setCurrency(final String currency) {
+ this.currency = currency;
+ }
+
+ float getCurrencyConversion() {
+ if (currencyConversion == 0.0F) {
+ if ("USD".equals(currency)) {
+ currencyConversion = 1.0f;
+ } else if ("EURO".equals(currency)) {
+ currencyConversion = 0.8f;
+ } else {
+ try {
+ currencyConversion = Float.parseFloat(currency);
+ } catch (Exception e) {
+ currencyConversion = 1.0f;
+ }
+
+ }
+
+ }
+ return currencyConversion;
+
+ }
+
+ private AccountDataService accountDataService;
+
+ @Reference
+ public void setAccountDataService(AccountDataService accountDataService) {
+ this.accountDataService = accountDataService;
+ }
+
+ private StockQuoteService stockQuoteService;
+
+ @Reference
+ public void setStockQuoteService(StockQuoteService stockQuoteService) {
+ this.stockQuoteService = stockQuoteService;
+ }
+
+ public AccountServiceImpl() {
+ }
+
+ @SuppressWarnings("unchecked")
+ public AccountReport getAccountReport(int customerID) throws RemoteException {
+
+ try {
+ AccountReport accountReport = accountDataService.getAccountReport(customerID);
+ // convert to local currency.
+ List<AccountSummary> accounts = accountReport.getAccountSummaries();
+ for (AccountSummary accountSummary : accounts) {
+ accountSummary.setBalance(fromUSDollarToCurrency(accountSummary.getBalance()));
+
+ }
+ return updateStockInformation(accountReport);
+ } catch (Exception e) {
+ e.printStackTrace();
+ if (e instanceof RemoteException) {
+ throw (RemoteException) e;
+ } else {
+ throw new RemoteException(e.getClass() + " " + e.getMessage(), e);
+ }
+ }
+ }
+
+ private AccountReport updateStockInformation(AccountReport accountReport) throws RemoteException {
+ List<StockSummary> stocks = accountReport.getStockSummaries();
+ if (stocks.size() < 1) {
+ return accountReport; // nothing todo
+ }
+ HashSet<String> owned = new HashSet<String>(stocks.size());
+ for (StockSummary stock : stocks) {
+ owned.add(stock.getSymbol());
+ }
+ ArrayList<String> ownedStr = new ArrayList<String>(owned.size() * 5);
+ for (String s : owned) {
+
+ ownedStr.add(s);
+ }
+
+ Map<String, StockQuote> stockInfo = stockQuoteService.getQuotes(ownedStr.toArray(new String[owned.size()]));
+
+ for (StockSummary stock : stocks) {
+ String symbol = stock.getSymbol();
+ StockQuote stockquote = stockInfo.get(symbol);
+ if (stockquote == null) {
+ stock.setCurrentPrice(Float.NaN);
+ stock.setCompany("*not found*");
+ stock.setHighPrice(Float.NaN);
+ stock.setLowPrice(Float.NaN);
+
+ } else {
+ stock.setCurrentPrice(fromUSDollarToCurrency(convertToFloat(stockquote.getStockQuote())));
+ stock.setCompany(stockquote.getCompanyName());
+ stock.setHighPrice(fromUSDollarToCurrency(convertToFloat(stockquote.getDayHighPrice())));
+ stock.setLowPrice(fromUSDollarToCurrency(convertToFloat(stockquote.getDayLowPrice())));
+ }
+ }
+
+ return accountReport;
+ }
+
+ float convertToFloat(final String s) {
+
+ try {
+ return Float.parseFloat(s);
+ } catch (Exception e) {
+ return Float.NaN;
+ }
+
+ }
+
+ private float fromUSDollarToCurrency(float value) {
+ return value * getCurrencyConversion();
+
+ }
+
+ private float toUSDollarfromCurrency(float value) {
+
+ return value / getCurrencyConversion();
+ }
+
+ public CustomerProfileData getCustomerProfile(String logonID) throws RemoteException {
+
+ try {
+ return accountDataService.getCustomerProfile(logonID);
+ } catch (Exception e) {
+ e.printStackTrace();
+ if (e instanceof RemoteException) {
+ throw (RemoteException) e;
+ } else {
+ throw new RemoteException(e.getClass() + " " + e.getMessage(), e);
+ }
+ }
+
+ }
+
+ public float deposit(String account, float ammount) throws RemoteException {
+ try {
+ return accountDataService.deposit(account, toUSDollarfromCurrency(ammount));
+ } catch (RemoteException e) {
+ e.printStackTrace();
+ throw e;
+ } catch (Exception e) {
+ e.printStackTrace();
+ throw new RemoteException(e.getClass() + " " + e.getMessage(), e);
+ }
+ }
+
+ public StockSummary purchaseStock(int id, StockSummary stock) throws RemoteException {
+ try {
+ String symbol = stock.getSymbol();
+ Map<String, StockQuote> stockInfo = stockQuoteService.getQuotes(new String[] { symbol });
+
+ StockQuote stockQuote = stockInfo.get(symbol);
+ stock.setPurchasePrice(Float.parseFloat(stockQuote.getStockQuote()));
+ String purchaseDate = tsformatXSDDateTime.format(new Date());
+ if (purchaseDate.endsWith("UTC")) {
+ purchaseDate = purchaseDate.substring(0, purchaseDate.length() - 3) + "Z";
+ }
+ stock.setPurchaseDate(purchaseDate);
+
+ return accountDataService.purchaseStock(id, stock);
+ } catch (RemoteException e) {
+ e.printStackTrace();
+ throw e;
+ } catch (Exception e) {
+ e.printStackTrace();
+ throw new RemoteException(e.getClass() + " " + e.getMessage(), e);
+ }
+ }
+
+ public StockSummary sellStock(int purchaseLotNumber, int quantity) throws RemoteException {
+ try {
+ return accountDataService.sellStock(purchaseLotNumber, quantity);
+ } catch (RemoteException e) {
+ e.printStackTrace();
+ throw e;
+ } catch (Exception e) {
+ e.printStackTrace();
+ throw new RemoteException(e.getClass() + " " + e.getMessage(), e);
+ }
+ }
+
+ public float withdraw(String account, float ammount) throws RemoteException {
+ try {
+ return accountDataService.withdraw(account, toUSDollarfromCurrency(ammount));
+ } catch (RemoteException e) {
+ e.printStackTrace();
+ throw e;
+ } catch (Exception e) {
+ e.printStackTrace();
+ throw new RemoteException(e.getClass() + " " + e.getMessage(), e);
+ }
+ }
+
+ public CustomerProfileData createAccount(CustomerProfileData customerProfile, boolean createSavings, boolean createCheckings)
+ throws RemoteException {
+ try {
+ return accountDataService.createAccount(customerProfile, createSavings, createCheckings);
+ } catch (RemoteException e) {
+ e.printStackTrace();
+ throw e;
+ } catch (Exception e) {
+ e.printStackTrace();
+ throw new RemoteException(e.getClass() + " " + e.getMessage(), e);
+ }
+ }
+
+ public AccountLog getAccountLog(final int customerID) throws RemoteException {
+ return accountDataService.getAccountLog(customerID);
+ }
+
+}
diff --git a/branches/sca-java-M2/samples/applications/bigbank/account/src/main/java/bigbank/account/services/accountdata/AccountDataService.java b/branches/sca-java-M2/samples/applications/bigbank/account/src/main/java/bigbank/account/services/accountdata/AccountDataService.java
new file mode 100644
index 0000000000..884127cd9e
--- /dev/null
+++ b/branches/sca-java-M2/samples/applications/bigbank/account/src/main/java/bigbank/account/services/accountdata/AccountDataService.java
@@ -0,0 +1,87 @@
+/*
+ * 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.services.accountdata;
+
+public interface AccountDataService {
+
+ /**
+ * Auto generated method signatures
+ *
+ * @param param0*
+ * @param param1*
+ * @param param2
+ */
+ public com.bigbank.account.StockSummary purchaseStock(int param0, com.bigbank.account.StockSummary parm1) throws java.rmi.RemoteException;
+
+ /**
+ * Auto generated method signatures
+ *
+ * @param param4
+ */
+ public com.bigbank.account.CustomerProfileData getCustomerProfile(java.lang.String param4) throws java.rmi.RemoteException;
+
+ /**
+ * Auto generated method signatures
+ *
+ * @param param6*
+ * @param param7
+ */
+ public float deposit(java.lang.String param6, float param7) throws java.rmi.RemoteException;
+
+ /**
+ * Auto generated method signatures
+ *
+ * @param param9*
+ * @param param10*
+ * @param param11
+ */
+ public com.bigbank.account.CustomerProfileData createAccount(com.bigbank.account.CustomerProfileData param9, boolean param10, boolean param11)
+ throws java.rmi.RemoteException;
+
+ /**
+ * Auto generated method signatures
+ *
+ * @param param13*
+ * @param param14
+ */
+ public com.bigbank.account.StockSummary sellStock(int param13, int param14) throws java.rmi.RemoteException;
+
+ /**
+ * Auto generated method signatures
+ *
+ * @param param16*
+ * @param param17
+ */
+ public float withdraw(java.lang.String param16, float param17) throws java.rmi.RemoteException;
+
+ /**
+ * Auto generated method signatures
+ *
+ * @param param19
+ */
+ public com.bigbank.account.AccountReport getAccountReport(int param19) throws java.rmi.RemoteException;
+
+ /**
+ * Auto generated method signatures
+ *
+ * @param param0
+ */
+ public com.bigbank.account.AccountLog getAccountLog(int param0) throws java.rmi.RemoteException;
+
+}
diff --git a/branches/sca-java-M2/samples/applications/bigbank/account/src/main/java/bigbank/account/services/accountdata/AccountDataServiceDASImpl.java b/branches/sca-java-M2/samples/applications/bigbank/account/src/main/java/bigbank/account/services/accountdata/AccountDataServiceDASImpl.java
new file mode 100644
index 0000000000..c346a3221f
--- /dev/null
+++ b/branches/sca-java-M2/samples/applications/bigbank/account/src/main/java/bigbank/account/services/accountdata/AccountDataServiceDASImpl.java
@@ -0,0 +1,400 @@
+/*
+ * 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.services.accountdata;
+
+import java.io.InputStream;
+import java.rmi.RemoteException;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.text.DateFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Collection;
+import java.util.List;
+import java.util.Properties;
+import java.util.TimeZone;
+
+import org.apache.tuscany.das.rdb.Command;
+import org.apache.tuscany.das.rdb.Converter;
+import org.apache.tuscany.das.rdb.DAS;
+import org.osoa.sca.annotations.Service;
+
+import bigbank.account.services.account.AccountServiceImpl;
+
+import com.bigbank.account.AccountFactory;
+import com.bigbank.account.AccountReport;
+import com.bigbank.account.AccountSummary;
+import com.bigbank.account.CustomerProfileData;
+import com.bigbank.account.StockSummary;
+import commonj.sdo.DataObject;
+
+@Service(CustomerIdService.class)
+public class AccountDataServiceDASImpl implements CustomerIdService { // TODO fix this!
+
+ static public String dbDirectory = null;
+
+ public static final DateFormat tsformatXSDDateTime = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSz");
+
+ public static final DateFormat sqlformatDateTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSSz");
+
+ static {
+ tsformatXSDDateTime.setTimeZone(TimeZone.getTimeZone("UTC"));
+
+ }
+
+ public CustomerProfileData getCustomerProfile(String logonID) throws RemoteException {
+
+ try {
+ InputStream mapping = createConfigStream();
+ Connection conn = getConnection();
+ DAS das = DAS.FACTORY.createDAS(mapping, conn);
+
+ Command select = das.createCommand("SELECT firstName, lastName, loginID, password, id FROM customers where loginID = ?");
+
+ select.setParameter(1, logonID);
+
+ DataObject root = select.executeQuery();
+ conn.close();
+
+ Collection customers = root.getList("CustomerProfileData");
+ CustomerProfileData customerProfileData = (CustomerProfileData) customers.iterator().next();
+
+ return customerProfileData;
+ } catch (Exception e) {
+
+ e.printStackTrace();
+ RemoteException re = new RemoteException("Failed to get customer profile'" + logonID + "' ", e);
+ re.printStackTrace();
+ throw re;
+ }
+ }
+
+ protected static final String driver = "org.apache.derby.jdbc.EmbeddedDriver";
+
+ protected static final String protocol = "jdbc:derby:";
+
+ public CustomerProfileData createAccount(CustomerProfileData customerProfile, boolean createSavings, boolean createCheckings)
+ throws RemoteException {
+
+ try {
+ DAS das = DAS.FACTORY.createDAS(getConnection());
+ Command insert = das.createCommand("insert into customers (firstName,lastName,address,email, loginID, password ) values ('"
+ + customerProfile.getFirstName() + "', '" + customerProfile.getLastName() + "', '" + customerProfile.getAddress() + "', '"
+ + customerProfile.getEmail() + "', '" + customerProfile.getLoginID() + "', '" + customerProfile.getPassword() + "')");
+
+ insert.execute();
+ CustomerProfileData ret = getCustomerProfile(customerProfile.getLoginID());
+ String cid = ret.getId() + "";
+ if (createSavings) {
+ insert = das.createCommand("insert into accounts (id,accountNumber, accountType, balance ) values (" + cid + ", '"
+ + AccountServiceImpl.SAVINGS_ACCOUNT_PREFIX + cid + "', '" + AccountServiceImpl.ACCOUNT_TYPE_SAVINGS + "', " + 1.0F + ")");
+ insert.execute();
+
+ }
+ if (createCheckings) {
+ insert = das.createCommand("insert into accounts (id,accountNumber, accountType, balance ) values (" + cid + ", '"
+ + AccountServiceImpl.CHECKING_ACCOUNT_PREFIX + cid + "', '" + AccountServiceImpl.ACCOUNT_TYPE_CHECKINGS + "', " + 1.0F + ")");
+ insert.execute();
+
+ }
+
+ return ret;
+ } catch (Exception e) {
+ if (e instanceof RemoteException) {
+ throw (RemoteException) e;
+ }
+ throw new RemoteException("createAccount " + e.getClass().getName() + "'. " + e.getMessage(), e);
+ }
+ }
+
+ public CustomerProfileData createAccountNOTWORKING(CustomerProfileData customerProfile, boolean createSavings, boolean createCheckings)
+ throws RemoteException {
+ try {
+ DAS das = DAS.FACTORY.createDAS(createConfigStream(), getConnection());
+ Command read = das.getCommand("all customers");
+
+ // select.setDataObjectModel();
+ DataObject root = read.executeQuery();
+
+ // Create a new stockPurchase
+ DataObject customer = root.createDataObject("customerProfileData");
+
+ // THIS SEEMS TO BE THE ONLY WAY TO DO THIS .. NO WAY TO JUST ADD AN EXISTING CUSTOMER.
+ customer.set("firstName", customerProfile.getFirstName());
+ customer.set("lastName", customerProfile.getLastName());
+ customer.set("address", customerProfile.getAddress());
+ customer.set("email", customerProfile.getEmail());
+ customer.set("loginID", customerProfile.getLoginID());
+ customer.set("password", customerProfile.getPassword());
+
+ das.applyChanges(root);
+ return getCustomerProfile(customerProfile.getLoginID());
+
+ } catch (Exception e) {
+ if (e instanceof RemoteException) {
+ throw (RemoteException) e;
+ }
+ throw new RemoteException("createAccount " + e.getClass().getName() + "'. " + e.getMessage(), e);
+ }
+
+ }
+
+ public AccountReport getAccountReport(final int customerID) throws RemoteException {
+ try {
+ final AccountFactory accountFactory = AccountFactory.INSTANCE;
+ final AccountReport accountReport = accountFactory.createAccountReport();
+ InputStream mapping = createConfigStream();
+
+ Connection conn = getConnection();
+ DAS das = DAS.FACTORY.createDAS(mapping, conn);
+
+ Command select = das.createCommand("SELECT accountNumber, accountType, balance FROM accounts where id = ?");
+ select.setParameter(1, customerID);
+
+ DataObject root = select.executeQuery();
+ accountReport.getAccountSummaries().addAll(root.getList("AccountSummary"));
+
+ // Get Stocks
+
+ select = das.createCommand("SELECT Symbol, quantity, purchasePrice, purchaseDate, purchaseLotNumber FROM stocks where id = ?");
+ select.setParameter(1, customerID);
+
+ // select.addConverter("STOCKS.PURCHASEDATE", DateConverter.class.getName());
+
+ root = select.executeQuery();
+ accountReport.getStockSummaries().addAll(root.getList("StockSummary"));
+
+ conn.close();
+
+ return accountReport;
+ } catch (Exception e) {
+ if (e instanceof RemoteException) {
+ throw (RemoteException) e;
+ }
+ throw new RemoteException("getAccountReport failed. customerID ('" + customerID + "')" + e.getClass().getName() + "'. " + e.getMessage(),
+ e);
+ }
+ }
+
+ public float withdraw(String account, float ammount) throws RemoteException {
+
+ return deposit(account, -ammount);
+ }
+
+ public float deposit(String account, float ammount) throws RemoteException {
+
+ try {
+ Connection conn = getConnection();
+ DAS das = DAS.FACTORY.createDAS(createConfigStream(), conn);
+
+ Command select = das.createCommand("SELECT accountNumber, balance FROM accounts where accountNumber = ?");
+ select.setParameter(1, account);
+
+ DataObject root = select.executeQuery();
+ Collection accounts = root.getList("AccountSummary");
+ AccountSummary accountData = (AccountSummary) accounts.iterator().next();
+ float newbalance = accountData.getBalance() + ammount;
+ accountData.setBalance(newbalance);
+ // update department set companyid = ? where department.name = ?
+
+ Command update = das.getCommand("update balance");
+ update.setParameter(1, new Float(newbalance));
+ update.setParameter(2, account);
+ update.execute();
+ conn.close();
+ return newbalance;
+ } catch (Exception e) {
+ throw new RemoteException(e.getClass().getName(), e);
+ }
+
+ }
+
+ public StockSummary sellStock(int purchaseLotNumber, int quantity) throws RemoteException {
+ try {
+ DAS das = DAS.FACTORY.createDAS(createConfigStream(), getConnection());
+
+ Command read = das.getCommand("stockbylotSelect");
+ read.setParameter(1, purchaseLotNumber);// autoboxing :-)
+ DataObject root = read.executeQuery();
+ List stocks = root.getList("StockSummary");
+ if (null != stocks && !stocks.isEmpty()) {
+ StockSummary stock = (StockSummary) stocks.get(0);
+ int newQuatity = Math.max(stock.getQuantity() - quantity, 0);
+ if (newQuatity < 1) {
+
+ Command delete = das.createCommand("DELETE FROM STOCKS WHERE PURCHASELOTNUMBER = ?");
+ delete.setParameter(1, purchaseLotNumber);
+ delete.execute();
+
+ } else {
+
+ Command update = das.getCommand("stockbylot");
+
+ update.setParameter(1, newQuatity);
+ update.setParameter(2, purchaseLotNumber);
+ update.execute();
+
+ stock.setQuantity(newQuatity);
+ }
+ return stock;
+ }
+
+ return null;
+ } catch (Exception e) {
+ throw new RemoteException("sellStock", e);
+ }
+ }
+
+ public StockSummary purchaseStock(int id, StockSummary stock) throws RemoteException {
+
+ try {
+ DAS das = DAS.FACTORY.createDAS(getConnection());
+ Command insert = das.createCommand("insert into stocks (id, symbol, quantity, purchasePrice, purchaseDate) values (?,?,?,?,?)");
+ insert.setParameter(1, new Integer(id));
+ insert.setParameter(2, stock.getSymbol());
+ insert.setParameter(3, stock.getQuantity());
+ insert.setParameter(4, stock.getPurchasePrice());
+ insert.setParameter(5, DateConverter.INSTANCE.getColumnValue(stock.getPurchaseDate()));
+
+ insert.execute();
+
+ return stock;
+ } catch (Exception e) {
+ if (e instanceof RemoteException) {
+ throw (RemoteException) e;
+ }
+ throw new RemoteException("purchaseStock " + e.getClass().getName() + "'. " + e.getMessage(), e);
+ }
+ }
+
+ protected Connection getConnection() throws InstantiationException, IllegalAccessException, ClassNotFoundException, SQLException {
+ Connection conn;
+ Class.forName(driver).newInstance();
+ Properties props = new Properties();
+ // props.put("user", "tuscany");
+ // props.put("password", "tuscany");
+ conn = DriverManager.getConnection(protocol + dbDirectory + ";create=true", props);
+
+ conn.setAutoCommit(false);
+ return conn;
+ }
+
+ protected InputStream createConfigStream() {
+ InputStream mapping = getClass().getClassLoader().getResourceAsStream("DasAccountConfiguration.xml");
+ return mapping;
+ }
+
+ public static class DateConverter implements Converter {
+ public final static DateConverter INSTANCE = new DateConverter();
+
+ public DateConverter() { // public empty constructor
+ }
+
+ public Object getPropertyValue(Object columnData) {
+
+ try {
+
+ String ret = tsformatXSDDateTime.format(columnData);
+ if (ret.endsWith("UTC")) {
+ ret = ret.substring(0, ret.length() - 3) + "Z";
+ }
+ return ret;
+
+ } catch (Exception e) {
+
+ e.printStackTrace();
+ throw new IllegalArgumentException(e);
+ }
+
+ }
+
+ public Object getColumnValue(Object propertyData) {
+
+ if (propertyData instanceof java.util.Date) {
+ // Need to convert back to local time for DB and remove timezone notation at the end..
+ String ret = sqlformatDateTime.format(propertyData);
+ char lc = ret.charAt(ret.length() - 1);
+ while (!Character.isDigit(lc)) {
+ ret = ret.substring(0, ret.length() - 1);
+ lc = ret.charAt(ret.length() - 1);
+ }
+ return ret;
+ } else if (propertyData instanceof String) {
+
+ try {
+ String time = (String) propertyData;
+ char last = time.charAt(time.length() - 1);
+ if (last == 'z' || last == 'Z') {
+ time = time.substring(0, time.length() - 1);
+ }
+ if (!time.endsWith("UTC")) {
+ time = time + "UTC";
+ }
+ return getColumnValue(tsformatXSDDateTime.parse(time));
+ } catch (ParseException e) {
+ throw new IllegalArgumentException("'" + propertyData + "' does not parse to date.");
+ }
+ } else {
+ throw new IllegalArgumentException();
+ }
+
+ }
+
+ }
+
+ public int getCustomerIdByPurchaseLotNumber(int purchaseLotNumber) throws RemoteException {
+
+ return queryCustomerId("select id from stocks where purchaseLotNumber = " + purchaseLotNumber);
+ }
+
+ public int getCustomerIdByAccount(String account) throws RemoteException {
+
+ return queryCustomerId("select id from accounts where accountNumber = '" + account + "'");
+ }
+
+ private int queryCustomerId(String query) throws RemoteException {
+
+ try {
+ Connection conn = getConnection();
+
+ Statement s = conn.createStatement();
+
+ ResultSet rs = s.executeQuery(query);
+ int id = -1;
+ if (rs.next()) {
+ id = rs.getInt("id");
+ }
+
+ conn.commit();
+
+ rs.close();
+ s.close();
+ conn.close();
+
+ return id;
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ throw new RemoteException(e.getClass().getName(), e);
+ }
+ }
+}
diff --git a/branches/sca-java-M2/samples/applications/bigbank/account/src/main/java/bigbank/account/services/accountdata/AccountDataServiceImpl.java b/branches/sca-java-M2/samples/applications/bigbank/account/src/main/java/bigbank/account/services/accountdata/AccountDataServiceImpl.java
new file mode 100644
index 0000000000..5e08cf634f
--- /dev/null
+++ b/branches/sca-java-M2/samples/applications/bigbank/account/src/main/java/bigbank/account/services/accountdata/AccountDataServiceImpl.java
@@ -0,0 +1,106 @@
+/*
+ * 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.services.accountdata;
+
+import java.rmi.RemoteException;
+import java.util.List;
+
+import org.osoa.sca.annotations.Service;
+
+import com.bigbank.account.AccountFactory;
+import com.bigbank.account.AccountLog;
+import com.bigbank.account.AccountReport;
+import com.bigbank.account.AccountSummary;
+import com.bigbank.account.CustomerProfileData;
+import com.bigbank.account.StockSummary;
+
+@Service(AccountDataService.class)
+public class AccountDataServiceImpl implements AccountDataService {
+
+ public CustomerProfileData getCustomerProfile(String logonID) throws RemoteException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public AccountReport getAccountReport(int customerID) {
+ final AccountFactory accountFactory = AccountFactory.INSTANCE;
+ AccountReport accountReport = accountFactory.createAccountReport();
+ List accounts = accountReport.getAccountSummaries();
+
+ AccountSummary account = accountFactory.createAccountSummary();
+ account.setAccountType("1111");
+ account.setAccountNumber("22-22-22");
+ account.setBalance(123.45F);
+ accounts.add(account);
+
+ account = accountFactory.createAccountSummary();
+ account.setAccountType("04-11-19");
+ account.setAccountNumber("11-23");
+ account.setBalance(543.21F);
+ accounts.add(account);
+
+ List stocks = accountReport.getStockSummaries();
+ StockSummary stock = accountFactory.createStockSummary();
+ stock.setSymbol("IBM");
+ stock.setPurchaseDate("1999-11-23");
+ stock.setPurchaseLotNumber(101);
+ stock.setPurchasePrice(33.33F);
+ stock.setQuantity(10);
+ stocks.add(stock);
+
+ stock = accountFactory.createStockSummary();
+ stock.setSymbol("TUSK");
+ stock.setPurchaseDate("2005-01-05");
+ stock.setPurchaseLotNumber(102);
+ stock.setPurchasePrice(11.11F);
+ stock.setQuantity(4);
+ stocks.add(stock);
+ return accountReport;
+ }
+
+ public CustomerProfileData createAccount(CustomerProfileData customerProfile, boolean createSavings, boolean createCheckings)
+ throws RemoteException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public float deposit(String param6, float param7) throws RemoteException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ public StockSummary purchaseStock(int param0, StockSummary stock) throws RemoteException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public StockSummary sellStock(int param13, int param14) throws RemoteException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public float withdraw(String param16, float param17) throws RemoteException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ public AccountLog getAccountLog(final int customerID) throws RemoteException {
+ throw new RemoteException("This method should not be called");
+ }
+}
diff --git a/branches/sca-java-M2/samples/applications/bigbank/account/src/main/java/bigbank/account/services/accountdata/CustomerIdService.java b/branches/sca-java-M2/samples/applications/bigbank/account/src/main/java/bigbank/account/services/accountdata/CustomerIdService.java
new file mode 100644
index 0000000000..b355a09008
--- /dev/null
+++ b/branches/sca-java-M2/samples/applications/bigbank/account/src/main/java/bigbank/account/services/accountdata/CustomerIdService.java
@@ -0,0 +1,98 @@
+/*
+ * 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.services.accountdata;
+
+import java.rmi.RemoteException;
+
+/**
+ * This interface allows access to a customer's id from the data service.
+ */
+public interface CustomerIdService {
+
+ /*
+ * Return -1 if purchaseLotNumber not found
+ */
+ public int getCustomerIdByPurchaseLotNumber(int purchaseLotNumber) throws RemoteException;
+
+ /*
+ * Return -1 if account not found
+ */
+ public int getCustomerIdByAccount(String account) throws RemoteException;
+
+ // TODO (isilval) Fix this !!!
+ // Apparently, configuration can't deal with extends so I am adding the contents of AccountDataService here
+
+ /**
+ * Auto generated method signatures
+ *
+ * @param param0*
+ * @param param1*
+ * @param param2
+ */
+ public com.bigbank.account.StockSummary purchaseStock(int param0, com.bigbank.account.StockSummary parm1) throws java.rmi.RemoteException;
+
+ /**
+ * Auto generated method signatures
+ *
+ * @param param4
+ */
+ public com.bigbank.account.CustomerProfileData getCustomerProfile(java.lang.String param4) throws java.rmi.RemoteException;
+
+ /**
+ * Auto generated method signatures
+ *
+ * @param param6*
+ * @param param7
+ */
+ public float deposit(java.lang.String param6, float param7) throws java.rmi.RemoteException;
+
+ /**
+ * Auto generated method signatures
+ *
+ * @param param9*
+ * @param param10*
+ * @param param11
+ */
+ public com.bigbank.account.CustomerProfileData createAccount(com.bigbank.account.CustomerProfileData param9, boolean param10, boolean param11)
+ throws java.rmi.RemoteException;
+
+ /**
+ * Auto generated method signatures
+ *
+ * @param param13*
+ * @param param14
+ */
+ public com.bigbank.account.StockSummary sellStock(int param13, int param14) throws java.rmi.RemoteException;
+
+ /**
+ * Auto generated method signatures
+ *
+ * @param param16*
+ * @param param17
+ */
+ public float withdraw(java.lang.String param16, float param17) throws java.rmi.RemoteException;
+
+ /**
+ * Auto generated method signatures
+ *
+ * @param param19
+ */
+ public com.bigbank.account.AccountReport getAccountReport(int param19) throws java.rmi.RemoteException;
+
+}
diff --git a/branches/sca-java-M2/samples/applications/bigbank/account/src/main/java/bigbank/account/services/accountdb/AccountDBInit.java b/branches/sca-java-M2/samples/applications/bigbank/account/src/main/java/bigbank/account/services/accountdb/AccountDBInit.java
new file mode 100644
index 0000000000..1225c95f84
--- /dev/null
+++ b/branches/sca-java-M2/samples/applications/bigbank/account/src/main/java/bigbank/account/services/accountdb/AccountDBInit.java
@@ -0,0 +1,465 @@
+/*
+ * 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.services.accountdb;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.PrintStream;
+import java.io.PrintWriter;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.text.DateFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Collection;
+import java.util.Date;
+import java.util.Properties;
+
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.tuscany.das.rdb.Command;
+import org.apache.tuscany.das.rdb.Converter;
+import org.apache.tuscany.das.rdb.DAS;
+import org.apache.tuscany.das.rdb.config.ConfigFactory;
+import org.apache.tuscany.sdo.util.SDOUtil;
+
+import bigbank.account.services.account.AccountServiceImpl;
+import bigbank.account.services.accountdata.AccountDataServiceDASImpl;
+import bigbank.account.services.accountlogger.AccountLoggerServiceImpl;
+
+import com.bigbank.account.AccountFactory;
+import com.bigbank.account.AccountSummary;
+import com.bigbank.account.CustomerProfileData;
+import com.bigbank.account.StockSummary;
+import commonj.sdo.DataObject;
+import com.bigbank.account.purchaseStock;
+import com.bigbank.account.withdraw;
+
+public class AccountDBInit extends HttpServlet {
+
+ private static final long serialVersionUID = -4795999792460944805L;
+
+ protected static final String driver = "org.apache.derby.jdbc.EmbeddedDriver";
+
+ protected static final String protocol = "jdbc:derby:";
+
+ protected String dbDirectory = null;
+
+ protected String dasConfigFile = null;
+
+ boolean deleteExisting = false;
+
+ @Override
+ public void init() throws ServletException {
+ try {
+
+ registerTypes();
+ ServletConfig servletConfig = getServletConfig();
+ ServletContext servletContext = servletConfig.getServletContext();
+ dbDirectory = servletContext.getRealPath("WEB-INF/bigbankdb/accounts");
+ dasConfigFile = servletContext.getRealPath("WEB-INF/classes/DasAccountConfiguration.xml");
+ deleteExisting = false;
+
+ createDB(dbDirectory);
+
+ } catch (Exception e) {
+
+ e.printStackTrace();
+ log(e.toString(), e);
+ throw new ServletException(e);
+ }
+ }
+
+ /*
+ * (non-Java-doc)
+ *
+ * @see javax.servlet.http.HttpServlet#doGet(HttpServletRequest arg0, HttpServletResponse arg1)
+ */
+ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
+ response.setContentType("text/html");
+
+ PrintWriter out = response.getWriter();
+
+ out.println();
+ out.println("<center><h2>BigBank database initialization servlet !<h2></center>");
+ out.println();
+ }
+
+ public AccountDBInit() {
+ }
+
+ public AccountDBInit(String dbDirectory, String dasConfigFile, Boolean deleteExisting) {
+ this.dbDirectory = dbDirectory;
+ this.dasConfigFile = dasConfigFile;
+ this.deleteExisting = deleteExisting;
+ }
+
+ private Connection createConnection() throws InstantiationException, IllegalAccessException, ClassNotFoundException, SQLException {
+ return createConnection(dbDirectory);
+ }
+
+ private static Connection createConnection(final String location) throws InstantiationException, IllegalAccessException, ClassNotFoundException,
+ SQLException {
+ Connection conn;
+ Class.forName(driver).newInstance();
+ Properties props = new Properties();
+ conn = DriverManager.getConnection(protocol + location + ";create=true", props);
+
+ conn.setAutoCommit(false);
+ return conn;
+ }
+
+ public static void createDB(final String location) throws Exception {
+ Connection conn = null;
+ AccountDataServiceDASImpl.dbDirectory = location;
+ AccountLoggerServiceImpl.dbDirectory = location; // TODO get rid of this (isilval)
+ Exception processessingException = null;
+ try {
+ conn = createConnection(location);
+
+ creatTables(conn);
+
+ int id = createCustomer(conn, "Test", "User", "304 Fox Trot ln, Apex, NC", "test@das.org", "test", "password");
+ createAccount(conn, id, AccountServiceImpl.SAVINGS_ACCOUNT_PREFIX + id, AccountServiceImpl.ACCOUNT_TYPE_SAVINGS, 123.43F);
+ createAccount(conn, id, AccountServiceImpl.CHECKING_ACCOUNT_PREFIX + id, AccountServiceImpl.ACCOUNT_TYPE_CHECKINGS, 23.12F);
+ createStockPurchase(conn, id, "IBM", 33, 66.20F, "2005-11-23 13:22:02");
+ createStockPurchase(conn, id, "DELL", 13, 12.74F, "2003-01-03 11:04:03");
+ createStockPurchase(conn, id, "LU", 7, 2.74F, "2003-01-04 16:04:03");
+ createStockPurchase(conn, id, "IBM", 22, 81.43F, "2004-02-03 13:04:33");
+
+ id = createCustomer(conn, "test2", "demo2", "Pleasant Plains Rd, ViewMount, CO", "test2@das.org", "test2", "password");
+ createAccount(conn, id, AccountServiceImpl.SAVINGS_ACCOUNT_PREFIX + id, AccountServiceImpl.ACCOUNT_TYPE_SAVINGS, 924.40F);
+ createAccount(conn, id, AccountServiceImpl.CHECKING_ACCOUNT_PREFIX + id, AccountServiceImpl.ACCOUNT_TYPE_CHECKINGS, 33.26F);
+ createStockPurchase(conn, id, "FOO", 3, 6.20F, "2000-09-11 09:11:01");
+
+ conn.commit();
+
+ } catch (org.apache.derby.impl.jdbc.EmbedSQLException e) {
+ if (conn != null && !conn.isClosed()) {
+ conn.rollback();
+ }
+ if (e.getErrorCode() == 20000 && "X0Y32".equalsIgnoreCase(e.getSQLState()) && -1 != e.getMessage().indexOf("already exists")) {
+ // this is ok the database is there.
+
+ } else {
+
+ e.printStackTrace();
+ processessingException = e;
+ throw e;
+ }
+ } finally {
+ try {
+ if (null != conn && !conn.isClosed()) {
+
+ conn.close();
+ }
+ conn = null;
+ } catch (Exception e) {
+ e.printStackTrace();
+ if (null != processessingException) {
+ throw e;
+ }
+ }
+ }
+
+ }
+
+ protected static void creatTables(Connection conn) throws Exception {
+ Statement s = conn.createStatement();
+
+ s
+ .execute("create table customers(firstName varchar(80) NOT NULL, lastName varchar(80), address varchar(180),email varchar(40),loginID varchar(80) NOT NULL UNIQUE, password varchar(80), id int NOT NULL PRIMARY KEY GENERATED ALWAYS AS IDENTITY)");
+
+ s.execute("create table accounts(id int NOT NULL, accountNumber varchar(80) NOT NULL UNIQUE, accountType varchar(80), balance real )");
+
+ s
+ .execute("create table stocks(id int NOT NULL, Symbol varchar(8) NOT NULL, quantity int NOT NULL, purchasePrice real NOT NULL, purchaseDate TIMESTAMP, purchaseLotNumber int NOT NULL PRIMARY KEY GENERATED ALWAYS AS IDENTITY )");
+
+ s
+ .execute("create table acctLog (logSeqNo int NOT NULL PRIMARY KEY GENERATED ALWAYS AS IDENTITY, id int NOT NULL, accountNumber varchar(80) NOT NULL, actionType varchar(32) NOT NULL, amount real )");
+
+ s
+ .execute("create table stockLog (logSeqNo int NOT NULL PRIMARY KEY GENERATED ALWAYS AS IDENTITY, id int NOT NULL, Symbol varchar(8) NOT NULL, quantity int NOT NULL, actionType varchar(32) NOT NULL, purchaseLotNumber int NOT NULL )");
+
+ s.close();
+ }
+
+ protected static int createCustomer(Connection conn, final String firstName, final String lastName, final String address, final String email,
+ final String logonID, final String password) throws SQLException, Exception {
+ Statement s = conn.createStatement();
+
+ s.execute("insert into customers (firstName,lastName,address,email, loginID, password ) " + "values ('" + firstName + "', '" + lastName
+ + "', '" + address + "', '" + email + "', '" + logonID + "', '" + password + "')");
+
+ ResultSet rs = s.executeQuery("SELECT loginID, id FROM customers where loginID='" + logonID + "'");
+ if (!rs.next()) {
+ throw new Exception("Wrong number of rows");
+ }
+ int id = rs.getInt(2);
+ s.close();
+
+ return id;
+ }
+
+ protected static void createAccount(Connection conn, int customerID, final String accountNumber, final String accountType, final float balance)
+ throws SQLException, Exception {
+ Statement s = conn.createStatement();
+
+ s.execute("insert into accounts (id,accountNumber, accountType, balance ) " + "values (" + customerID + ", '" + accountNumber + "', '"
+ + accountType + "', " + balance + ")");
+
+ s.close();
+ }
+
+ protected InputStream createConfigStream() {
+ InputStream mapping = getClass().getClassLoader().getResourceAsStream("DasAccountConfiguration.xml");
+ return mapping;
+ }
+
+ protected static void createStockPurchase(Connection conn, int customerID, final String stockSymbol, final int quantity,
+ final float purchasePrice, String purchaseDate) throws SQLException, Exception {
+ Statement s = conn.createStatement();
+
+ s.execute("insert into stocks (id, symbol, quantity, purchasePrice, purchaseDate ) values (" + customerID + ", '" + stockSymbol + "', "
+ + quantity + ", " + purchasePrice + ", '" + purchaseDate + "')");
+
+ s.close();
+
+ }
+
+ protected static void registerTypes() {
+ SDOUtil.registerStaticTypes(AccountFactory.class);
+ // TODO remove
+ SDOUtil.registerStaticTypes(ConfigFactory.class);
+
+ }
+
+ public void testWithdrawThroughDAS(withdraw wd) throws Exception {
+
+ Connection conn = createConnection();
+ DAS das = DAS.FACTORY.createDAS(createConfigStream(), conn);
+ Command select = das.getCommand("get account");
+
+ select.setParameter(1, wd.getAccountNumber());
+
+ DataObject root = select.executeQuery();
+
+ Collection accounts = root.getList("AccountSummary");
+ AccountSummary account = (AccountSummary) accounts.iterator().next();
+ float newbalance = account.getBalance() - wd.getAmount();
+ account.setBalance(newbalance);
+ // update department set companyid = ? where department.name = ?
+
+ Command update = das.getCommand("update balance");
+ update.setParameter(1, new Float(newbalance));
+ update.setParameter(2, wd.getAccountNumber());
+
+ update.execute();
+ conn.close();
+ }
+
+ protected void testStrockPurchaseThroughDAS(purchaseStock sp) throws InstantiationException, IllegalAccessException, ClassNotFoundException,
+ SQLException {
+
+ DAS das = DAS.FACTORY.createDAS(createConfigStream(), createConnection());
+ Command read = das.getCommand("all stocks");
+
+ DataObject root = read.executeQuery();
+
+ // Create a new stockPurchase
+ DataObject stockPurchase = root.createDataObject("StockSummary");
+ stockPurchase.set("id", new Integer(sp.getId()));
+ stockPurchase.set("symbol", sp.getStock().getSymbol());
+ stockPurchase.set("quantity", new Integer(sp.getStock().getQuantity()));
+ stockPurchase.set("purchasePrice", new Float(11.00));
+ // String type = stockPurchase.getType().getProperty("purchaseDate").getType().toString();
+ stockPurchase.setDate("purchaseDate", new Date());
+
+ das.applyChanges(root);
+ }
+
+ public CustomerProfileData testgetCustomerByLoginIDThroughDASRead(final String logonID) throws Exception {
+ InputStream mapping = createConfigStream();
+ Connection conn = createConnection();
+ DAS das = DAS.FACTORY.createDAS(mapping, conn);
+ Command select = das.createCommand("SELECT firstName, lastName, loginID, password, id FROM customers where loginID = ?");
+
+ select.setParameter(1, logonID);
+
+ DataObject root = select.executeQuery();
+ conn.close();
+
+ Collection customers = root.getList("CustomerProfileData");
+ CustomerProfileData customerProfileData = (CustomerProfileData) customers.iterator().next();
+ System.out.println(customerProfileData);
+ System.out.flush();
+ return customerProfileData;
+
+ }
+
+ protected void readDBstdout(PrintStream stream) throws Exception {
+ Connection conn = null;
+ try {
+ conn = createConnection(dbDirectory);
+ Statement s = conn.createStatement();
+ ResultSet rs = s.executeQuery("SELECT firstName, lastName, loginID, password, id FROM customers ORDER BY lastName");
+ while (rs.next()) {
+ stream.print(rs.getString(1));
+ stream.print(" ");
+ stream.print(rs.getString(2));
+ stream.print(" ");
+ stream.print(rs.getString(3));
+ stream.print(" ");
+ stream.print(rs.getString(4));
+ stream.print(" ");
+ stream.print(rs.getString(5));
+ stream.println();
+ int id = rs.getInt(5);
+ Statement s1 = conn.createStatement();
+ ResultSet rs1 = s1.executeQuery("SELECT accountNumber, accountType, balance FROM accounts where id=" + id);
+ stream.println("====Customers accounts");
+ while (rs1.next()) {
+ stream.print("\t");
+ stream.print(rs1.getString(1));
+ stream.print(" ");
+ stream.print(rs1.getString(2));
+ stream.print(" ");
+ stream.print(rs1.getString(3));
+ stream.println();
+ }
+ rs1.close();
+ rs1 = s1.executeQuery("SELECT symbol, quantity, purchasePrice, purchaseDate, purchaseLotNumber FROM stocks where id=" + id);
+ stream.println("====Customers Stocks");
+ while (rs1.next()) {
+ stream.print("\t");
+ stream.print(rs1.getString(1));
+ stream.print(" ");
+ stream.print(rs1.getString(2));
+ stream.print(" ");
+ stream.print(rs1.getString(3));
+ stream.print(" ");
+ stream.print(rs1.getString(4));
+ stream.print(" ");
+ stream.print(rs1.getString(5));
+ stream.println();
+ }
+ s1.close();
+ stream.println();
+
+ }
+ s.close();
+ conn.commit();
+ } catch (Exception e) {
+ e.printStackTrace();
+ } finally {
+ if (conn != null) {
+ conn.close();
+ }
+ conn = null;
+ }
+
+ }
+
+ public static class MyDateConverter implements Converter {
+
+ private static final DateFormat tsformat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
+
+ public Object getPropertyValue(Object columnData) {
+
+ try {
+ return tsformat.parse(columnData.toString());
+ } catch (ParseException e) {
+
+ e.printStackTrace();
+ throw new IllegalArgumentException(e);
+ }
+
+ }
+
+ public Object getColumnValue(Object propertyData) {
+
+ if (propertyData instanceof Date) {
+ return tsformat.format(propertyData);
+ } else {
+ throw new IllegalArgumentException();
+ }
+
+ }
+
+ }
+
+ /**
+ * @param args
+ */
+ public static void main(String[] args) throws Exception {
+ registerTypes();
+ String dbDirectory = null; // "c:/derbydbtest/foo";
+ String dasConfigFile = null;
+ Boolean deleteExisting = false;
+ for (String x : args) {
+ if ("-d".equals(x)) {
+ deleteExisting = true;
+ }
+ if (x.startsWith("-db:")) {
+ dbDirectory = x.substring("-db:".length());
+ }
+ if (x.startsWith("-config:")) {
+ dasConfigFile = x.substring("-config:".length());
+ ;
+ }
+
+ }
+ AccountDBInit accountDBInit = new AccountDBInit(dbDirectory, dasConfigFile, deleteExisting);
+
+ createDB(dbDirectory);
+
+ accountDBInit.readDBstdout(System.out);
+
+ // Test withdrawl
+ withdraw wd = AccountFactory.INSTANCE.createwithdraw();
+ wd.setAccountNumber("134-43-3942");
+ wd.setAmount(1.00F);
+ accountDBInit.testWithdrawThroughDAS(wd);
+
+ accountDBInit.readDBstdout(System.out);
+
+ // test stock purchase.
+ purchaseStock sp = AccountFactory.INSTANCE.createpurchaseStock();
+ StockSummary stock = AccountFactory.INSTANCE.createStockSummary();
+ stock.setSymbol("GOOG");
+ stock.setQuantity(10);
+ stock.setPurchasePrice(25.00F);
+ sp.setId(1);
+ sp.setStock(stock);
+
+ accountDBInit.testStrockPurchaseThroughDAS(sp);
+
+ accountDBInit.readDBstdout(System.out);
+
+ System.out.flush();
+ }
+}
diff --git a/branches/sca-java-M2/samples/applications/bigbank/account/src/main/java/bigbank/account/services/accountlogger/AccountLoggerDataServiceImpl.java b/branches/sca-java-M2/samples/applications/bigbank/account/src/main/java/bigbank/account/services/accountlogger/AccountLoggerDataServiceImpl.java
new file mode 100644
index 0000000000..2360344cd1
--- /dev/null
+++ b/branches/sca-java-M2/samples/applications/bigbank/account/src/main/java/bigbank/account/services/accountlogger/AccountLoggerDataServiceImpl.java
@@ -0,0 +1,129 @@
+/*
+ * 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.services.accountlogger;
+
+import java.rmi.RemoteException;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+import bigbank.account.services.accountdata.AccountDataService;
+import bigbank.account.services.accountdata.CustomerIdService;
+
+import com.bigbank.account.AccountLog;
+import com.bigbank.account.AccountReport;
+import com.bigbank.account.CustomerProfileData;
+import com.bigbank.account.StockSummary;
+
+/**
+ * This class implements the Account Data Logger service component.
+ */
+@Service(AccountDataService.class)
+public class AccountLoggerDataServiceImpl implements AccountDataService {
+
+ private CustomerIdService accountDataService; // TODO fix this!
+
+ @Reference
+ public void setAccountDataService(CustomerIdService accountDataService) {
+ this.accountDataService = accountDataService;
+ }
+
+ private AccountLoggerService accountLoggerService;
+
+ @Reference
+ public void setAccountLoggerService(AccountLoggerService accountLoggerService) {
+ this.accountLoggerService = accountLoggerService;
+ }
+
+ public StockSummary purchaseStock(int id, StockSummary stock) throws RemoteException {
+ accountLoggerService.logPurchaseStock(id, stock);
+
+ return accountDataService.purchaseStock(id, stock);
+ }
+
+ public CustomerProfileData getCustomerProfile(String logonID) throws RemoteException {
+
+ return accountDataService.getCustomerProfile(logonID);
+ }
+
+ public float deposit(String account, float amount) throws RemoteException {
+ try {
+ if (!(accountDataService instanceof CustomerIdService)) {
+ throw new RemoteException("Can't use data service as customer id service");
+ }
+ int id = accountDataService.getCustomerIdByAccount(account);
+ // int id = accountDataService.getCustomerIdByAccount(account);
+ accountLoggerService.logDeposit(id, account, amount);
+
+ return accountDataService.deposit(account, amount);
+ } catch (RemoteException e) {
+ e.printStackTrace();
+ throw e;
+ } catch (Exception e) {
+ e.printStackTrace();
+ throw new RemoteException(e.getClass() + " " + e.getMessage(), e);
+ }
+ }
+
+ public CustomerProfileData createAccount(CustomerProfileData customerProfile, boolean createSavings, boolean createChecking)
+ throws RemoteException {
+
+ return accountDataService.createAccount(customerProfile, createSavings, createChecking);
+ }
+
+ public StockSummary sellStock(int purchaseLotNumber, int quantity) throws RemoteException {
+ try {
+ int id = accountDataService.getCustomerIdByPurchaseLotNumber(purchaseLotNumber);
+ StockSummary ss = accountDataService.sellStock(purchaseLotNumber, quantity);
+ if (ss != null) {
+ if (!(accountDataService instanceof CustomerIdService)) {
+ throw new RemoteException("Can't use data service as customer id service");
+ }
+ accountLoggerService.logSellStock(id, ss, quantity);
+ }
+ return ss;
+ } catch (RemoteException e) {
+ e.printStackTrace();
+ throw e;
+ } catch (Exception e) {
+ e.printStackTrace();
+ throw new RemoteException(e.getClass() + " " + e.getMessage(), e);
+ }
+ }
+
+ public float withdraw(String account, float amount) throws RemoteException {
+ if (!(accountDataService instanceof CustomerIdService)) {
+ throw new RemoteException("Can't use data service as customer id service");
+ }
+ int id = accountDataService.getCustomerIdByAccount(account);
+ // int id = accountDataService.getCustomerIdByAccount(account);
+ accountLoggerService.logWithdrawal(id, account, amount);
+
+ return accountDataService.withdraw(account, amount);
+ }
+
+ public AccountReport getAccountReport(final int customerID) throws RemoteException {
+
+ return accountDataService.getAccountReport(customerID);
+ }
+
+ public AccountLog getAccountLog(final int customerID) throws RemoteException {
+ return accountLoggerService.getAccountLog(customerID);
+ }
+}
diff --git a/branches/sca-java-M2/samples/applications/bigbank/account/src/main/java/bigbank/account/services/accountlogger/AccountLoggerService.java b/branches/sca-java-M2/samples/applications/bigbank/account/src/main/java/bigbank/account/services/accountlogger/AccountLoggerService.java
new file mode 100644
index 0000000000..b9b2821d38
--- /dev/null
+++ b/branches/sca-java-M2/samples/applications/bigbank/account/src/main/java/bigbank/account/services/accountlogger/AccountLoggerService.java
@@ -0,0 +1,47 @@
+/*
+ * 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.services.accountlogger;
+
+import java.rmi.RemoteException;
+
+import org.osoa.sca.annotations.OneWay;
+
+import com.bigbank.account.AccountLog;
+import com.bigbank.account.StockSummary;
+
+/**
+ * This is the business interface of the Account Logger service component.
+ */
+public interface AccountLoggerService {
+
+ @OneWay
+ public void logDeposit(int id, String account, float amount) throws RemoteException;
+
+ @OneWay
+ public void logWithdrawal(int id, String account, float amount) throws RemoteException;
+
+ @OneWay
+ public void logPurchaseStock(int id, StockSummary stock) throws RemoteException;
+
+ @OneWay
+ public void logSellStock(int id, StockSummary stock, int quantity) throws RemoteException;
+
+ public AccountLog getAccountLog(int id) throws RemoteException;
+
+}
diff --git a/branches/sca-java-M2/samples/applications/bigbank/account/src/main/java/bigbank/account/services/accountlogger/AccountLoggerServiceImpl.java b/branches/sca-java-M2/samples/applications/bigbank/account/src/main/java/bigbank/account/services/accountlogger/AccountLoggerServiceImpl.java
new file mode 100644
index 0000000000..8919aad311
--- /dev/null
+++ b/branches/sca-java-M2/samples/applications/bigbank/account/src/main/java/bigbank/account/services/accountlogger/AccountLoggerServiceImpl.java
@@ -0,0 +1,216 @@
+/*
+ * 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.services.accountlogger;
+
+import java.io.InputStream;
+import java.rmi.RemoteException;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.ResultSet;
+import java.sql.Statement;
+import java.util.Properties;
+
+import org.apache.tuscany.das.rdb.Command;
+import org.apache.tuscany.das.rdb.DAS;
+import org.osoa.sca.annotations.Service;
+
+import com.bigbank.account.AccountFactory;
+import com.bigbank.account.AccountLog;
+import com.bigbank.account.StockSummary;
+import commonj.sdo.DataObject;
+
+/**
+ * This class implements the Account Logger service component.
+ */
+@Service(AccountLoggerService.class)
+public class AccountLoggerServiceImpl implements AccountLoggerService {
+
+ public static final String ACCT_ACTION_TYPE_DEPOSIT = "deposit";
+
+ public static final String ACCT_ACTION_TYPE_WITHDRAW = "withdraw";
+
+ public static final String STOCK_ACTION_TYPE_PURCHASE = "purchase";
+
+ public static final String STOCK_ACTION_TYPE_SELL = "sell";
+
+ static public String dbDirectory = null;
+
+ protected static final String driver = "org.apache.derby.jdbc.EmbeddedDriver";
+
+ protected static final String protocol = "jdbc:derby:";
+
+ public void logDeposit(int id, String account, float amount) throws RemoteException {
+ DAS das = DAS.FACTORY.createDAS(getConnection());
+ Command insert = das.createCommand("insert into acctLog (id, accountNumber, actionType, amount) values (?,?,?,?)");
+ insert.setParameter(1, new Integer(id));
+ insert.setParameter(2, account);
+ insert.setParameter(3, ACCT_ACTION_TYPE_DEPOSIT);
+ insert.setParameter(4, new Float(amount));
+
+ insert.execute();
+ /*
+ * performLog("insert into acctLog (id, accountNumber, actionType, amount) values (" + id + ", '" + account + "', '" +
+ * ACCT_ACTION_TYPE_DEPOSIT + "', " + amount + ")");
+ */
+ }
+
+ public void logWithdrawal(int id, String account, float amount) throws RemoteException {
+ DAS das = DAS.FACTORY.createDAS(getConnection());
+ Command insert = das.createCommand("insert into acctLog (id, accountNumber, actionType, amount) values (?,?,?,?)");
+ insert.setParameter(1, new Integer(id));
+ insert.setParameter(2, account);
+ insert.setParameter(3, ACCT_ACTION_TYPE_WITHDRAW);
+ insert.setParameter(4, new Float(amount));
+
+ insert.execute();
+ /*
+ * performLog("insert into acctLog (id ,accountNumber, actionType, amount) values (" + id + ", '" + account + "', '" +
+ * ACCT_ACTION_TYPE_WITHDRAW + "', " + amount + ")");
+ */
+ }
+
+ public void logPurchaseStock(int id, StockSummary stock) throws RemoteException {
+ DAS das = DAS.FACTORY.createDAS(getConnection());
+ Command insert = das.createCommand("insert into stockLog (id, Symbol, quantity, actionType, purchaseLotNumber) values (?,?,?,?,?)");
+ insert.setParameter(1, new Integer(id));
+ insert.setParameter(2, stock.getSymbol());
+ insert.setParameter(3, new Integer(stock.getQuantity()));
+ insert.setParameter(4, STOCK_ACTION_TYPE_PURCHASE);
+ insert.setParameter(5, new Integer(stock.getPurchaseLotNumber()));
+
+ insert.execute();
+ /*
+ * performLog("insert into stockLog (id, Symbol, quantity, actionType, purchaseLotNumber) values (" + id + ", '" + stock.getSymbol() + "', " +
+ * stock.getQuantity() + ", '" + STOCK_ACTION_TYPE_PURCHASE + ", " + stock.getPurchaseLotNumber() + ")");
+ */
+ }
+
+ public void logSellStock(int id, StockSummary stock, int quantity) throws RemoteException {
+
+ String symbol = ((stock.getSymbol() != null) ? stock.getSymbol() : "null");
+ DAS das = DAS.FACTORY.createDAS(getConnection());
+ Command insert = das.createCommand("insert into stockLog (id, Symbol, quantity, actionType, purchaseLotNumber) values (?,?,?,?,?)");
+ insert.setParameter(1, new Integer(id));
+ insert.setParameter(2, symbol);
+ insert.setParameter(3, new Integer(quantity));
+ insert.setParameter(4, STOCK_ACTION_TYPE_SELL);
+ insert.setParameter(5, new Integer(stock.getPurchaseLotNumber()));
+
+ insert.execute();
+ /*
+ * performLog("insert into stockLog (id, Symbol, quantity, actionType, purchaseLotNumber) values (" + id + ", '" + stock.getSymbol() + "', " +
+ * quantity + ", '" + STOCK_ACTION_TYPE_SELL + ", " + stock.getPurchaseLotNumber() + ")");
+ */
+ }
+
+ private void performLog(String toLog) throws RemoteException {
+
+ try {
+ Connection conn = getConnection();
+
+ Statement s = conn.createStatement();
+
+ s.execute(toLog);
+
+ conn.commit();
+
+ System.out.println("SN id acctNo action amount");
+ ResultSet rs = s.executeQuery("select * from acctLog");
+ while (rs.next()) {
+ System.out.println(rs.getInt("logSeqNo") + " " + rs.getInt("id") + " " + rs.getString("accountNumber") + " "
+ + rs.getString("actionType") + " " + rs.getFloat("amount"));
+ }
+
+ conn.commit();
+
+ System.out.println("SN Symbol qty action plot#");
+ rs = s.executeQuery("select * from stockLog");
+ while (rs.next()) {
+ System.out.println(rs.getInt("logSeqNo") + " " + rs.getString("Symbol") + " " + rs.getInt("quantity") + " "
+ + rs.getString("actionType") + " " + rs.getInt("purchaseLotNumber"));
+ }
+
+ conn.commit();
+
+ s.close();
+
+ conn.close();
+ } catch (Exception e) {
+ e.printStackTrace();
+ throw new RemoteException(e.getClass().getName(), e);
+ }
+
+ System.out.println("Logged " + toLog);
+ }
+
+ protected Connection getConnection() throws RemoteException {
+ try {
+ Connection conn;
+ Class.forName(driver).newInstance();
+ Properties props = new Properties();
+ // props.put("user", "tuscany");
+ // props.put("password", "tuscany");
+ conn = DriverManager.getConnection(protocol + dbDirectory + ";create=true", props);
+
+ conn.setAutoCommit(false);
+ return conn;
+ } catch (Exception e) {
+ e.printStackTrace();
+ throw new RemoteException(e.getClass().getName(), e);
+ }
+ }
+
+ public AccountLog getAccountLog(final int customerID) throws RemoteException {
+
+ try {
+ final AccountFactory accountFactory = AccountFactory.INSTANCE;
+ final AccountLog accountLog = accountFactory.createAccountLog();
+ InputStream mapping = createConfigStream();
+
+ Connection conn = getConnection();
+ DAS das = DAS.FACTORY.createDAS(mapping, conn);
+ Command select = das.createCommand("SELECT logSeqNo, accountNumber, actionType, amount FROM acctLog where id = ?");
+
+ select.setParameter(1, customerID);
+
+ DataObject root = select.executeQuery();
+ accountLog.getAccountLogEntries().addAll(root.getList("AccountLogEntry"));
+
+ select = das.createCommand("SELECT logSeqNo, Symbol, quantity, actionType, purchaseLotNumber FROM stockLog where id = ?");
+ select.setParameter(1, customerID);
+ root = select.executeQuery();
+ accountLog.getStockLogEntries().addAll(root.getList("StockLogEntry"));
+
+ conn.close();
+
+ return accountLog;
+ } catch (Exception e) {
+ if (e instanceof RemoteException) {
+ throw (RemoteException) e;
+ }
+ throw new RemoteException("getAccountLog failed. customerID ('" + customerID + "')" + e.getClass().getName() + "'. " + e.getMessage(), e);
+ }
+ }
+
+ protected InputStream createConfigStream() {
+ InputStream mapping = getClass().getClassLoader().getResourceAsStream("DasAccountConfiguration.xml");
+ return mapping;
+ }
+
+}
diff --git a/branches/sca-java-M2/samples/applications/bigbank/account/src/main/java/bigbank/account/services/stockquote/StockQuote.java b/branches/sca-java-M2/samples/applications/bigbank/account/src/main/java/bigbank/account/services/stockquote/StockQuote.java
new file mode 100644
index 0000000000..c7498f093d
--- /dev/null
+++ b/branches/sca-java-M2/samples/applications/bigbank/account/src/main/java/bigbank/account/services/stockquote/StockQuote.java
@@ -0,0 +1,228 @@
+/*
+ * 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.services.stockquote;
+
+public class StockQuote {
+
+ private String companyName;
+
+ private String symbol;
+
+ private String stockQuote;
+
+ private String lastUpdated;
+
+ private String change;
+
+ private String openPrice;
+
+ private String dayHighPrice;
+
+ private String dayLowPrice;
+
+ private String volume;
+
+ private String marketCap;
+
+ private String yearRange;
+
+ private String exDividendDate;
+
+ private String dividendYield;
+
+ private String dividendPerShare;
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected StockQuote() {
+ super();
+ }
+
+ public String getCompanyName() {
+ return companyName;
+ }
+
+ public void setCompanyName(String newCompanyName) {
+ companyName = newCompanyName;
+ }
+
+ public String getSymbol() {
+ return symbol;
+ }
+
+ public void setSymbol(String newStockTicker) {
+ symbol = newStockTicker;
+ }
+
+ public String getStockQuote() {
+ return stockQuote;
+ }
+
+ public void setStockQuote(String newStockQuote) {
+ stockQuote = newStockQuote;
+ }
+
+ public String getLastUpdated() {
+ return lastUpdated;
+ }
+
+ public void setLastUpdated(String newLastUpdated) {
+ lastUpdated = newLastUpdated;
+ }
+
+ public String getChange() {
+ return change;
+ }
+
+ public void setChange(String newChange) {
+ change = newChange;
+ }
+
+ public String getOpenPrice() {
+ return openPrice;
+ }
+
+ public void setOpenPrice(String newOpenPrice) {
+ openPrice = newOpenPrice;
+ }
+
+ public String getDayHighPrice() {
+ return dayHighPrice;
+ }
+
+ public void setDayHighPrice(String newDayHighPrice) {
+ dayHighPrice = newDayHighPrice;
+ }
+
+ public String getDayLowPrice() {
+ return dayLowPrice;
+ }
+
+ public void setDayLowPrice(String newDayLowPrice) {
+ dayLowPrice = newDayLowPrice;
+ }
+
+ public String getVolume() {
+ return volume;
+ }
+
+ public void setVolume(String newVolume) {
+ volume = newVolume;
+ }
+
+ public String getMarketCap() {
+ return marketCap;
+ }
+
+ public void setMarketCap(String newMarketCap) {
+ marketCap = newMarketCap;
+ }
+
+ public String getYearRange() {
+ return yearRange;
+ }
+
+ public void setYearRange(String newYearRange) {
+ yearRange = newYearRange;
+ }
+
+ public String getExDividendDate() {
+ return exDividendDate;
+ }
+
+ public void setExDividendDate(String newExDividendDate) {
+ exDividendDate = newExDividendDate;
+ }
+
+ public String getDividendYield() {
+ return dividendYield;
+ }
+
+ public void setDividendYield(String newDividendYield) {
+ dividendYield = newDividendYield;
+ }
+
+ public String getDividendPerShare() {
+ return dividendPerShare;
+ }
+
+ public void setDividendPerShare(String newDividendPerShare) {
+ dividendPerShare = newDividendPerShare;
+ }
+
+ @Override
+ public String toString() {
+
+ StringBuffer result = new StringBuffer(super.toString());
+ result.append(" (companyName: ");
+ result.append(companyName);
+ result.append(", symbol: ");
+ result.append(symbol);
+ result.append(", stockQuote: ");
+ result.append(stockQuote);
+ result.append(", lastUpdated: ");
+ result.append(lastUpdated);
+ result.append(", change: ");
+ result.append(change);
+ result.append(", openPrice: ");
+ result.append(openPrice);
+ result.append(", dayHighPrice: ");
+ result.append(dayHighPrice);
+ result.append(", dayLowPrice: ");
+ result.append(dayLowPrice);
+ result.append(", volume: ");
+ result.append(volume);
+ result.append(", marketCap: ");
+ result.append(marketCap);
+ result.append(", yearRange: ");
+ result.append(yearRange);
+ result.append(", exDividendDate: ");
+ result.append(exDividendDate);
+ result.append(", dividendYield: ");
+ result.append(dividendYield);
+ result.append(", dividendPerShare: ");
+ result.append(dividendPerShare);
+ result.append(')');
+ return result.toString();
+ }
+
+ @Override
+ public StockQuote clone() {
+ StockQuote ret = new StockQuote();
+ ret.companyName = companyName;
+ ret.symbol = symbol;
+ ret.stockQuote = stockQuote;
+ ret.lastUpdated = lastUpdated;
+ ret.change = change;
+ ret.openPrice = openPrice;
+ ret.dayHighPrice = dayHighPrice;
+ ret.dayLowPrice = dayLowPrice;
+ ret.volume = volume;
+ ret.marketCap = marketCap;
+ ret.yearRange = yearRange;
+ ret.exDividendDate = exDividendDate;
+ ret.dividendYield = dividendYield;
+ ret.dividendPerShare = dividendPerShare;
+ return ret;
+ }
+
+}
diff --git a/branches/sca-java-M2/samples/applications/bigbank/account/src/main/java/bigbank/account/services/stockquote/StockQuoteService.java b/branches/sca-java-M2/samples/applications/bigbank/account/src/main/java/bigbank/account/services/stockquote/StockQuoteService.java
new file mode 100644
index 0000000000..9d5c243f9a
--- /dev/null
+++ b/branches/sca-java-M2/samples/applications/bigbank/account/src/main/java/bigbank/account/services/stockquote/StockQuoteService.java
@@ -0,0 +1,31 @@
+/*
+ * 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.services.stockquote;
+
+import java.rmi.RemoteException;
+import java.util.Map;
+
+/**
+ * This is the business interface of the HelloWorld service component.
+ */
+public interface StockQuoteService {
+
+ public Map getQuotes(String[] symbols) throws RemoteException;
+
+}
diff --git a/branches/sca-java-M2/samples/applications/bigbank/account/src/main/java/bigbank/account/services/stockquote/StockQuoteServiceImpl.java b/branches/sca-java-M2/samples/applications/bigbank/account/src/main/java/bigbank/account/services/stockquote/StockQuoteServiceImpl.java
new file mode 100644
index 0000000000..b0c31d4d81
--- /dev/null
+++ b/branches/sca-java-M2/samples/applications/bigbank/account/src/main/java/bigbank/account/services/stockquote/StockQuoteServiceImpl.java
@@ -0,0 +1,68 @@
+/*
+ * 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.services.stockquote;
+
+import java.rmi.RemoteException;
+import java.util.Hashtable;
+import java.util.Map;
+import java.util.Random;
+
+/* Mock StockQuoteService */
+
+public class StockQuoteServiceImpl implements StockQuoteService {
+
+ static Random rn = new Random();
+
+ static Hashtable<String, StockQuote> stocks = new Hashtable<String, StockQuote>();
+
+ public synchronized Map getQuotes(String[] symbols) throws RemoteException {
+ Map<String, StockQuote> ret = new Hashtable<String, StockQuote>();
+ for (String sym : symbols) {
+ sym = sym.toUpperCase();
+ if (!ret.containsKey(sym)) {
+ StockQuote sq = stocks.get(sym);
+ if (sq == null) {
+ sq = new StockQuote();
+ stocks.put(sym, sq);
+ sq.setSymbol(sym);
+ sq.setCompanyName(sym + " INC");
+ float val = rn.nextFloat() * 97.0F + 3.0F;
+ sq.setStockQuote(val + "");
+ sq.setDayHighPrice(val + "");
+ sq.setDayLowPrice(val + "");
+ sq.setOpenPrice(val + "");
+ } else {
+ float diff = (rn.nextFloat() * 2.0F) - 1;
+ float newval = new Float(sq.getStockQuote()) + diff; // auto boxing cool.
+ sq.setStockQuote(newval + "");
+ float dh = Math.max(newval, new Float(sq.getDayHighPrice()));
+ sq.setDayHighPrice(dh + "");
+ float dl = Math.min(newval, new Float(sq.getDayLowPrice()));
+ sq.setDayLowPrice(dl + "");
+
+ }
+ ret.put(sym, sq.clone());
+ }
+
+ }
+
+ return ret;
+ }
+
+}
diff --git a/branches/sca-java-M2/samples/applications/bigbank/account/src/main/java/bigbank/account/services/stockquote/StockQuoteWebservicexServiceImpl.java b/branches/sca-java-M2/samples/applications/bigbank/account/src/main/java/bigbank/account/services/stockquote/StockQuoteWebservicexServiceImpl.java
new file mode 100644
index 0000000000..9e103f3738
--- /dev/null
+++ b/branches/sca-java-M2/samples/applications/bigbank/account/src/main/java/bigbank/account/services/stockquote/StockQuoteWebservicexServiceImpl.java
@@ -0,0 +1,153 @@
+/*
+ * 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.services.stockquote;
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+import java.lang.reflect.Method;
+import java.rmi.RemoteException;
+import java.util.ArrayList;
+import java.util.Hashtable;
+import java.util.Map;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamReader;
+
+import net.x.webservice.StockQuoteSoap;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * This class implements the Stock quote service component.
+ */
+@Service(StockQuoteService.class)
+@Scope("MODULE")
+public class StockQuoteWebservicexServiceImpl implements StockQuoteService {
+
+ @Reference
+ public StockQuoteSoap stockQuoteService = null; // Injected by the SCA container.
+
+ /**
+ * @throws RemoteException
+ * @see bigbank.account.services.stockquote.StockQuoteService#getQuotes(String[])
+ */
+ public Map getQuotes(final String[] symbols) throws RemoteException {
+ try {
+ assert null != stockQuoteService : "stockQuoteService was not set by the SCA runtime!";
+ StringBuilder sb = new StringBuilder(5 * symbols.length);
+ for (String sym : symbols) {
+ if (sb.length() != 0) {
+ sb.append(' ');
+ }
+ sb.append(sym);
+ }
+ String stockdata = stockQuoteService.GetQuote(sb.toString());
+
+ InputStream in = new ByteArrayInputStream(stockdata.getBytes());
+ XMLInputFactory factory = XMLInputFactory.newInstance();
+ XMLStreamReader parser = factory.createXMLStreamReader(in);
+ ArrayList<StockQuote> listQuotes = new ArrayList<StockQuote>();
+ Hashtable<String, StockQuote> listQuoteHT = new Hashtable<String, StockQuote>();
+ MapStock currentStock = null;
+ StringBuilder currentText = new StringBuilder(100);
+ for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) {
+ String lname;
+ switch (event) {
+ case XMLStreamConstants.START_ELEMENT:
+ if (parser.getLocalName() == "Stock") {
+
+ currentStock = new MapStock();
+ listQuotes.add(currentStock);
+ }
+ break;
+ case XMLStreamConstants.END_ELEMENT:
+ lname = parser.getLocalName();
+ String mname = "set" + lname;
+ try {
+ Method setter = MapStock.class.getMethod(mname, new Class[] { String.class });
+ if (setter != null) {
+ setter.invoke(currentStock, currentText.toString());
+ if (lname.equals("Symbol")) {
+ listQuoteHT.put(currentText.toString(), currentStock);
+
+ }
+ }
+ } catch (NoSuchMethodException e) {
+
+ }
+ // System.err.println(parser.getLocalName() + ":" + currentText.toString());
+ currentText.setLength(0);
+ break;
+ case XMLStreamConstants.CHARACTERS:
+ // System.out.print(parser.getText());
+ currentText.append(parser.getText());
+ break;
+ case XMLStreamConstants.CDATA:
+ // System.out.print(parser.getText());
+ currentText.append(parser.getText());
+ break;
+ } // end switch
+ } // end while
+ parser.close();
+
+ return listQuoteHT;
+ } catch (Exception e) {
+ e.printStackTrace();
+ throw new RemoteException(e.getClass().getName() + e.getMessage(), e);
+ }
+ }
+
+ public static class MapStock extends StockQuote {
+
+ public void setLast(String val) {
+ super.setStockQuote(val);
+ }
+
+ public void setDate(String val) {
+ };
+
+ public void setTime(String val) {
+ };
+
+ public void setHigh(String val) {
+ super.setDayHighPrice(val);
+ }
+
+ public void setLow(String val) {
+ super.setDayLowPrice(val);
+ }
+
+ public void setOpen(String val) {
+ super.setOpenPrice(val);
+ }
+
+ public void setMktCap(String val) {
+ super.setMarketCap(val);
+ }
+
+ public void setName(String val) {
+ super.setCompanyName(val);
+ }
+
+ }
+
+}
diff --git a/branches/sca-java-M2/samples/applications/bigbank/account/src/main/resources/DasAccountConfiguration.xml b/branches/sca-java-M2/samples/applications/bigbank/account/src/main/resources/DasAccountConfiguration.xml
new file mode 100644
index 0000000000..dba87e91d0
--- /dev/null
+++ b/branches/sca-java-M2/samples/applications/bigbank/account/src/main/resources/DasAccountConfiguration.xml
@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="ASCII"?>
+<!--
+ * 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.
+-->
+<Config xsi:noNamespaceSchemaLocation="http:///org.apache.tuscany.das.rdb/config.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ dataObjectModel="http://www.bigbank.com/account">
+
+ <Table tableName="CUSTOMERS" typeName="CustomerProfileData">
+ <!-- Column name="firstName" primaryKey="true"/ -->
+ <Column columnName="FIRSTNAME"/>
+ <Column columnName="LASTNAME"/>
+ <Column columnName="ADDRESS"/>
+ <Column columnName="EMAIL"/>
+ <Column columnName="LOGINID"/>
+ <Column columnName="PASSWORD"/>
+ <Column columnName="ID"/>
+ </Table>
+
+ <Table tableName="ACCOUNTS" typeName="AccountSummary">
+ <!-- Column name="firstName" primaryKey="true"/ -->
+ <Column columnName="ACCOUNTNUMBER"/>
+ <Column columnName="BALANCE"/>
+ </Table>
+
+
+
+ <Table tableName="STOCKS" typeName="StockSummary" >
+ <Column columnName="ID" propertyName="id"/>
+ <Column columnName="Symbol" propertyName="symbol"/>
+ <Column columnName="quantity" propertyName="quantity"/>
+ <Column columnName="purchasePrice" propertyName="purchasePrice"/>
+ <Column columnName="PURCHASEDATE" propertyName="purchaseDate" converterClassName="bigbank.account.services.accountdata.AccountDataServiceDASImpl$DateConverter"/>
+ </Table>
+
+
+ <Table tableName="ACCTLOG" typeName="AccountLogEntry">
+ <Column columnName="logSeqNo"/>
+ <Column columnName="ID"/>
+ <Column columnName="ACCOUNTNUMBER"/>
+ <Column columnName="ACTIONTYPE"/>
+ <Column columnName="AMOUNT"/>
+ </Table>
+
+
+
+ <Table tableName="STOCKLOG" typeName="StockLogEntry" >
+ <Column columnName="logSeqNo"/>
+ <Column columnName="ID"/>
+ <Column columnName="Symbol"/>
+ <Column columnName="quantity"/>
+ <Column columnName="actionType"/>
+ <Column columnName="purchaseLotNumber"/>
+ </Table>
+
+
+ <Command name="get account" SQL="SELECT accountNumber, accountType, balance FROM accounts where accountNumber = ?" kind="Select" />
+ <Command name="update balance" SQL="update ACCOUNTS set BALANCE = ? where ACCOUNTNUMBER = ?" kind="Update" />
+
+ <Command name="all customers" SQL="select * from CUSTOMERS" kind="Select"/>
+
+ <Command name="all stocks" SQL="select symbol, quantity, purchaseprice, purchasedate from stocks" kind="Select"/>
+ <Command name="stockbylotSelect" SQL="select quantity from STOCKS WHERE purchaseLotNumber = ?" kind="Select" />
+ <Command name="stockbylot" SQL="update STOCKS set quantity = ? WHERE purchaseLotNumber = ?" kind="Update" />
+
+</Config>
diff --git a/branches/sca-java-M2/samples/applications/bigbank/account/src/main/resources/META-INF/LICENSE.txt b/branches/sca-java-M2/samples/applications/bigbank/account/src/main/resources/META-INF/LICENSE.txt
new file mode 100644
index 0000000000..bdec70a4fa
--- /dev/null
+++ b/branches/sca-java-M2/samples/applications/bigbank/account/src/main/resources/META-INF/LICENSE.txt
@@ -0,0 +1,416 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed 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.
+
+===============================================================================================================
+
+
+License for the Service Data Objects JavaDoc and Interface Definition files.
+
+Permission to copy, make derivative works of, and distribute the Service Data Objects
+JavaDoc and Interface Definition Files files in any medium without fee or royalty as part
+of a compliant implementation of the Service Data Objects Specification is hereby granted.
+The Service Data Objects Specification may be found at any of the following locations:
+
+http://dev2dev.bea.com/technologies/commonj/index.jsp
+http://www.ibm.com/developerworks/library/specification/ws-sdo/
+http://oracle.com/technology/webservices/sca
+https://www.sdn.sap.com/
+http://www.xcalia/xdn/specs/sdo
+
+THE SERVICE DATA OBJECTS SPECIFICATION AND THE JAVADOC AND INTERFACE DEFINITION FILES
+ARE PROVIDED "AS IS," AND THE AUTHORS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS
+SPECIFICATION OR THE JAVADOC AND INTERFACE DEFINITION FILES AND THE IMPLEMENTATION OF THEIR CONTENTS,
+INCLUDING, BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE,
+NON-INFRINGEMENT OR TITLE. THE AUTHORS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL,
+INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF OR RELATING TO ANY USE OR DISTRIBUTION OF THE
+SERVICE DATA OBJECTS SPECIFICATION OR THE JAVADOC OR INTERFACE DEFINTION FILES.
+
+The name and trademarks of the Authors may NOT be used in any manner, including advertising or
+publicity pertaining to the Service Component Architecture Specification or its contents without specific,
+written prior permission. Title to copyright in the Service Data Objects Specification and the
+JavaDoc and Interface Definition Files will at all times remain with the Authors.
+
+No other rights are granted by implication, estoppel or otherwise.
+
+=================================================================================================================
+Eclipse Public License - v 1.0
+
+THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
+
+1. DEFINITIONS
+
+"Contribution" means:
+
+a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and
+b) in the case of each subsequent Contributor:
+
+i) changes to the Program, and
+
+ii) additions to the Program;
+
+where such changes and/or additions to the Program originate from and are distributed by that particular Contributor. A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone acting on such Contributor's behalf. Contributions do not include additions to the Program which: (i) are separate modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not derivative works of the Program.
+
+"Contributor" means any person or entity that distributes the Program.
+
+"Licensed Patents " mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of its Contribution alone or when combined with the Program.
+
+"Program" means the Contributions distributed in accordance with this Agreement.
+
+"Recipient" means anyone who receives the Program under this Agreement, including all Contributors.
+
+2. GRANT OF RIGHTS
+
+a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, distribute and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code form.
+
+b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the Contribution of such Contributor, if any, in source code and object code form. This patent license shall apply to the combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder.
+
+c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the Program, it is Recipient's responsibility to acquire that license before distributing the Program.
+
+d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to grant the copyright license set forth in this Agreement.
+
+3. REQUIREMENTS
+
+A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that:
+
+a) it complies with the terms and conditions of this Agreement; and
+
+b) its license agreement:
+
+i) effectively disclaims on behalf of all Contributors all warranties and conditions, express and implied, including warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and fitness for a particular purpose;
+
+ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special, incidental and consequential damages, such as lost profits;
+
+iii) states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any other party; and
+
+iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it in a reasonable manner on or through a medium customarily used for software exchange.
+
+When the Program is made available in source code form:
+
+a) it must be made available under this Agreement; and
+
+b) a copy of this Agreement must be included with each copy of the Program.
+
+Contributors may not remove or alter any copyright notices contained within the Program.
+
+Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows subsequent Recipients to identify the originator of the Contribution.
+
+4. COMMERCIAL DISTRIBUTION
+
+Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes the Program in a commercial product offering should do so in a manner which does not create potential liability for other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor ("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor") against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may participate in any such claim at its own expense.
+
+For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone. Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result, the Commercial Contributor must pay those damages.
+
+5. NO WARRANTY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for determining the appropriateness of using and distributing the Program and assumes all risks associated with its exercise of rights under this Agreement , including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations.
+
+6. DISCLAIMER OF LIABILITY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+7. GENERAL
+
+If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable.
+
+If Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such litigation is filed.
+
+All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses granted by Recipient relating to the Program shall continue and survive.
+
+Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the right to modify this Agreement. The Eclipse Foundation is the initial Agreement Steward. The Eclipse Foundation may assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the Agreement will be given a distinguishing version number. The Program (including Contributions) may always be distributed subject to the version of the Agreement under which it was received. In addition, after a new version of the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the new version. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or otherwise. All rights in the Program not expressly granted under this Agreement are reserved.
+
+This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause of action arose. Each party waives its rights to a jury trial in any resulting litigation.
+
+===================================================================================================
+
+Common Public License - v 1.0
+
+THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS COMMON PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
+
+1. DEFINITIONS
+
+"Contribution" means:
+
+ a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and
+ b) in the case of each subsequent Contributor:
+
+ i) changes to the Program, and
+
+ ii) additions to the Program;
+
+ where such changes and/or additions to the Program originate from and are distributed by that particular Contributor. A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone acting on such Contributor's behalf. Contributions do not include additions to the Program which: (i) are separate modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not derivative works of the Program.
+
+"Contributor" means any person or entity that distributes the Program.
+
+"Licensed Patents " mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of its Contribution alone or when combined with the Program.
+
+"Program" means the Contributions distributed in accordance with this Agreement.
+
+"Recipient" means anyone who receives the Program under this Agreement, including all Contributors.
+
+2. GRANT OF RIGHTS
+
+ a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, distribute and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code form.
+
+ b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the Contribution of such Contributor, if any, in source code and object code form. This patent license shall apply to the combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder.
+
+ c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the Program, it is Recipient's responsibility to acquire that license before distributing the Program.
+
+ d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to grant the copyright license set forth in this Agreement.
+
+3. REQUIREMENTS
+
+A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that:
+
+ a) it complies with the terms and conditions of this Agreement; and
+
+ b) its license agreement:
+
+ i) effectively disclaims on behalf of all Contributors all warranties and conditions, express and implied, including warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and fitness for a particular purpose;
+
+ ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special, incidental and consequential damages, such as lost profits;
+
+ iii) states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any other party; and
+
+ iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it in a reasonable manner on or through a medium customarily used for software exchange.
+
+When the Program is made available in source code form:
+
+ a) it must be made available under this Agreement; and
+
+ b) a copy of this Agreement must be included with each copy of the Program.
+
+Contributors may not remove or alter any copyright notices contained within the Program.
+
+Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows subsequent Recipients to identify the originator of the Contribution.
+
+4. COMMERCIAL DISTRIBUTION
+
+Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes the Program in a commercial product offering should do so in a manner which does not create potential liability for other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor ("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor") against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may participate in any such claim at its own expense.
+
+For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone. Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result, the Commercial Contributor must pay those damages.
+
+5. NO WARRANTY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for determining the appropriateness of using and distributing the Program and assumes all risks associated with its exercise of rights under this Agreement, including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations.
+
+6. DISCLAIMER OF LIABILITY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+7. GENERAL
+
+If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable.
+
+If Recipient institutes patent litigation against a Contributor with respect to a patent applicable to software (including a cross-claim or counterclaim in a lawsuit), then any patent licenses granted by that Contributor to such Recipient under this Agreement shall terminate as of the date such litigation is filed. In addition, if Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such litigation is filed.
+
+All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses granted by Recipient relating to the Program shall continue and survive.
+
+Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the right to modify this Agreement. IBM is the initial Agreement Steward. IBM may assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the Agreement will be given a distinguishing version number. The Program (including Contributions) may always be distributed subject to the version of the Agreement under which it was received. In addition, after a new version of the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the new version. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or otherwise. All rights in the Program not expressly granted under this Agreement are reserved.
+
+This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause of action arose. Each party waives its rights to a jury trial in any resulting litigation.
+
+
+
+
+
+
diff --git a/branches/sca-java-M2/samples/applications/bigbank/account/src/main/resources/META-INF/NOTICE b/branches/sca-java-M2/samples/applications/bigbank/account/src/main/resources/META-INF/NOTICE
new file mode 100644
index 0000000000..d48810c0ec
--- /dev/null
+++ b/branches/sca-java-M2/samples/applications/bigbank/account/src/main/resources/META-INF/NOTICE
@@ -0,0 +1,18 @@
+=========================================================================
+== NOTICE file corresponding to the section 4 d of ==
+== the Apache License, Version 2.0, ==
+== in this case for the Apache Tuscany distribution. ==
+=========================================================================
+
+This product includes software developed by the Apache Software Foundation
+(http://www.apache.org/).
+
+This product also includes software developed by:
+- the Eclipse Modeling Framework project (http://www.eclipse.org/emf/)
+- the Celtix project (http://celtix.objectweb.org/)
+- the Mozilla Rhino project (http://www.mozilla.org/rhino/)
+- the GlassFish JAX-WS project (https://jax-ws.dev.java.net/)
+
+Please read the LICENSE.txt file present in the root directory of this
+distribution.
+
diff --git a/branches/sca-java-M2/samples/applications/bigbank/account/src/main/resources/wsdl/AccountService.wsdl b/branches/sca-java-M2/samples/applications/bigbank/account/src/main/resources/wsdl/AccountService.wsdl
new file mode 100644
index 0000000000..9acb92664d
--- /dev/null
+++ b/branches/sca-java-M2/samples/applications/bigbank/account/src/main/resources/wsdl/AccountService.wsdl
@@ -0,0 +1,467 @@
+<?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.
+-->
+<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:account="http://www.bigbank.com/account"
+ targetNamespace="http://www.bigbank.com/account"
+ name="AccountService">
+
+ <wsdl:types>
+ <xsd:schema targetNamespace="http://www.bigbank.com/account"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:account="http://www.bigbank.com/account"
+
+ > <!-- xmlns:sdojava="commonj.sdo/java" sdojava:package="org.apache.tuscany.samples.bigbank.account" -->
+
+
+<!-- <xsd:complexType name="DataGraphRoot">
+ <xsd:sequence>
+ <xsd:element name="customerProfileData" type="account:CustomerProfileData" maxOccurs="unbounded" minOccurs="0" />
+ <xsd:element name="StockSummaries" type="account:StockSummary" maxOccurs="unbounded" minOccurs="0" />
+ <xsd:element name="AccountSummaries" type="account:AccountSummary" maxOccurs="unbounded" minOccurs="0" />
+ <xsd:element name="StockLogEntries" type="account:StockLogEntry" maxOccurs="unbounded" minOccurs="0" />
+ <xsd:element name="AccountLogEntries" type="account:AccountLogEntry" maxOccurs="unbounded" minOccurs="0" />
+ </xsd:sequence>
+ </xsd:complexType>-->
+
+
+ <xsd:element name="getAccountReport">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="customerID"
+ type="xsd:int" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="getAccountReportResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="accountReport"
+ type="account:AccountReport" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:complexType name="AccountReport">
+ <xsd:sequence>
+ <xsd:element name="accountSummaries"
+ type="account:AccountSummary" maxOccurs="unbounded" />
+ <xsd:element name="stockSummaries"
+ type="account:StockSummary" maxOccurs="unbounded" />
+
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="AccountSummary">
+ <xsd:attribute name="accountNumber" type="xsd:string" />
+ <xsd:attribute name="accountType" type="xsd:string" />
+ <xsd:attribute name="balance" type="xsd:float" />
+ </xsd:complexType>
+
+ <xsd:complexType name="StockSummary">
+ <!-- xsd:attribute name="id" type="xsd:int" / -->
+ <xsd:attribute name="purchaseLotNumber" type="xsd:int" />
+ <!-- unique id for this purchase -->
+ <xsd:attribute name="symbol" type="xsd:string" />
+ <xsd:attribute name="quantity" type="xsd:int" />
+ <xsd:attribute name="purchaseDate" type="xsd:dateTime" />
+ <xsd:attribute name="purchasePrice" type="xsd:float" />
+ <xsd:attribute name="currentPrice" type="xsd:float" />
+ <xsd:attribute name="company" type="xsd:string" />
+ <xsd:attribute name="highPrice" type="xsd:float" />
+ <xsd:attribute name="lowPrice" type="xsd:float" />
+
+ </xsd:complexType>
+
+ <!-- Profile in data base -->
+ <xsd:element name="getCustomerProfile">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="loginID" type="xsd:string" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:complexType name="CustomerProfileData">
+ <xsd:sequence>
+ <xsd:element name="firstName" type="xsd:string" />
+ <xsd:element name="lastName" type="xsd:string" />
+ <xsd:element name="address" type="xsd:string" />
+ <xsd:element name="email" type="xsd:string" />
+ <xsd:element name="loginID" type="xsd:string" />
+ <xsd:element name="password" type="xsd:string" />
+ <xsd:element name="id" type="xsd:int" />
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:element name="getCustomerProfileResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="customerProfile"
+ type="account:CustomerProfileData" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="withdraw">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="accountNumber"
+ type="xsd:string" />
+ <xsd:element name="amount" type="xsd:float" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="withdrawResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="balance" type="xsd:float" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="deposit">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="accountNumber"
+ type="xsd:string" />
+ <xsd:element name="amount" type="xsd:float" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="depositResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="balance" type="xsd:float" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="purchaseStock">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="id" type="xsd:int" />
+ <xsd:element name="stock" type="account:StockSummary" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="purchaseStockResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="purchaseSummary"
+ type="account:StockSummary" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+
+
+ <xsd:element name="sellStock">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="purchaseLotNumber"
+ type="xsd:int" /><!-- unique id for this purchase -->
+ <xsd:element name="quantity" type="xsd:int" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="createAccount">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="customerProfile"
+ type="account:CustomerProfileData" />
+ <xsd:element name="createSavings"
+ type="xsd:boolean" />
+ <xsd:element name="createCheckings"
+ type="xsd:boolean" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="createAccountResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="customerProfile"
+ type="account:CustomerProfileData" />
+ </xsd:sequence>
+ </xsd:complexType>
+
+ </xsd:element>
+
+ <xsd:element name="getAccountLog">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="customerID"
+ type="xsd:int" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="getAccountLogResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="accountLog"
+ type="account:AccountLog" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:complexType name="AccountLog">
+ <xsd:sequence>
+ <xsd:element name="accountLogEntries"
+ type="account:AccountLogEntry" maxOccurs="unbounded" />
+ <xsd:element name="stockLogEntries"
+ type="account:StockLogEntry" maxOccurs="unbounded" />
+
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="AccountLogEntry">
+ <xsd:attribute name="logSeqNo" type="xsd:int" />
+ <xsd:attribute name="id" type="xsd:int" />
+ <xsd:attribute name="accountNumber" type="xsd:string" />
+ <xsd:attribute name="actionType" type="xsd:string" />
+ <xsd:attribute name="amount" type="xsd:float" />
+ </xsd:complexType>
+
+ <xsd:complexType name="StockLogEntry">
+ <xsd:attribute name="logSeqNo" type="xsd:int" />
+ <xsd:attribute name="id" type="xsd:int" />
+ <xsd:attribute name="symbol" type="xsd:string" />
+ <xsd:attribute name="quantity" type="xsd:int" />
+ <xsd:attribute name="actionType" type="xsd:string" />
+ <xsd:attribute name="purchaseLotNumber" type="xsd:int" />
+ </xsd:complexType>
+
+ </xsd:schema>
+ </wsdl:types>
+ <wsdl:message name="getAccountReportRequest">
+ <wsdl:part element="account:getAccountReport"
+ name="getAccountReportRequest" />
+ </wsdl:message>
+ <wsdl:message name="getAccountReportResponse">
+ <wsdl:part element="account:getAccountReportResponse"
+ name="getAccountReportResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="getCustomerProfileRequest">
+ <wsdl:part element="account:getCustomerProfile"
+ name="getCustomerProfile" />
+ </wsdl:message>
+ <wsdl:message name="getCustomerProfileResponse">
+ <wsdl:part element="account:getCustomerProfileResponse"
+ name="getCustomerProfileResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="withdrawRequest">
+ <wsdl:part element="account:withdraw" name="withdrawRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="withdrawResponse">
+ <wsdl:part element="account:withdrawResponse"
+ name="withdrawResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="depositRequest">
+ <wsdl:part element="account:deposit" name="depositRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="depositResponse">
+ <wsdl:part element="account:depositResponse"
+ name="depositResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="purchaseStockRequest">
+ <wsdl:part element="account:purchaseStock"
+ name="purchaseStockRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="purchaseStockResponse">
+ <wsdl:part element="account:purchaseStockResponse"
+ name="purchaseStockResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="sellStockRequest">
+ <wsdl:part element="account:sellStock" name="sellStockRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="createAccountRequest">
+ <wsdl:part element="account:createAccount" name="createAccountRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="createAccountResponse">
+ <wsdl:part element="account:createAccountResponse" name="createAccountResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="getAccountLogRequest">
+ <wsdl:part element="account:getAccountLog"
+ name="getAccountLogRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="getAccountLogResponse">
+ <wsdl:part element="account:getAccountLogResponse"
+ name="getAccountLogResponse" />
+ </wsdl:message>
+
+ <wsdl:portType name="AccountService">
+ <wsdl:operation name="getAccountReport">
+ <wsdl:input message="account:getAccountReportRequest" />
+ <wsdl:output message="account:getAccountReportResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="getCustomerProfile">
+ <wsdl:input message="account:getCustomerProfileRequest" />
+ <wsdl:output message="account:getCustomerProfileResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="withdraw">
+ <wsdl:input message="account:withdrawRequest" />
+ <wsdl:output message="account:withdrawResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="deposit">
+ <wsdl:input message="account:depositRequest" />
+ <wsdl:output message="account:depositResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="purchaseStock">
+ <wsdl:input message="account:purchaseStockRequest" />
+ <wsdl:output message="account:purchaseStockResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="sellStock">
+ <wsdl:input message="account:sellStockRequest" />
+ <wsdl:output message="account:purchaseStockResponse" />
+ </wsdl:operation>
+
+
+ <wsdl:operation name="createAccount">
+ <wsdl:input message="account:createAccountRequest" />
+ <wsdl:output message="account:createAccountResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="getAccountLog">
+ <wsdl:input message="account:getAccountLogRequest" />
+ <wsdl:output message="account:getAccountLogResponse" />
+ </wsdl:operation>
+
+ </wsdl:portType>
+
+
+
+ <wsdl:binding name="AccountServiceSOAP" type="account:AccountService">
+ <soap:binding style="document"
+ transport="http://schemas.xmlsoap.org/soap/http" />
+ <wsdl:operation name="getAccountReport">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/getAccountReport" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getCustomerProfile">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/getCustomerProfile" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="withdraw">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/withdraw" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="deposit">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/deposit" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="purchaseStock">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/purchaseStock" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="sellStock">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/sellStock" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="createAccount">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/createAccount" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="getAccountLog">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/getAccountLog" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ </wsdl:binding>
+ <wsdl:service name="AccountService">
+ <wsdl:port binding="account:AccountServiceSOAP"
+ name="AccountServiceSOAP">
+ <soap:address
+ location="http://localhost:8080/sample-bigbank-account/services/AccountService" />
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
diff --git a/branches/sca-java-M2/samples/applications/bigbank/account/src/main/resources/wsdl/stockquotes.webservicex.wsdl b/branches/sca-java-M2/samples/applications/bigbank/account/src/main/resources/wsdl/stockquotes.webservicex.wsdl
new file mode 100644
index 0000000000..16c980a30e
--- /dev/null
+++ b/branches/sca-java-M2/samples/applications/bigbank/account/src/main/resources/wsdl/stockquotes.webservicex.wsdl
@@ -0,0 +1,136 @@
+<?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.
+-->
+<wsdl:definitions xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="http://www.webserviceX.NET/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" targetNamespace="http://www.webserviceX.NET/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+ <wsdl:types>
+ <s:schema elementFormDefault="qualified"
+ targetNamespace="http://www.webserviceX.NET/" >
+ <!--
+ xmlns:sdojava="commonj.sdo/java"
+ sdojava:package="net.x.webservice"
+ -->
+
+
+ >
+ <s:element name="GetQuote">
+ <s:complexType>
+ <s:sequence>
+ <s:element minOccurs="0" maxOccurs="1" name="symbol" type="s:string"/>
+ </s:sequence>
+ </s:complexType>
+ </s:element>
+ <s:element name="GetQuoteResponse">
+ <s:complexType>
+ <s:sequence>
+ <s:element minOccurs="0" maxOccurs="1" name="GetQuoteResult" type="s:string"/>
+ </s:sequence>
+ </s:complexType>
+ </s:element>
+ <s:element name="string" nillable="true" type="s:string"/>
+ </s:schema>
+ </wsdl:types>
+ <wsdl:message name="GetQuoteSoapIn">
+ <wsdl:part name="parameters" element="tns:GetQuote"/>
+ </wsdl:message>
+ <wsdl:message name="GetQuoteSoapOut">
+ <wsdl:part name="parameters" element="tns:GetQuoteResponse"/>
+ </wsdl:message>
+ <wsdl:message name="GetQuoteHttpGetIn">
+ <wsdl:part name="symbol" type="s:string"/>
+ </wsdl:message>
+ <wsdl:message name="GetQuoteHttpGetOut">
+ <wsdl:part name="Body" element="tns:string"/>
+ </wsdl:message>
+ <wsdl:message name="GetQuoteHttpPostIn">
+ <wsdl:part name="symbol" type="s:string"/>
+ </wsdl:message>
+ <wsdl:message name="GetQuoteHttpPostOut">
+ <wsdl:part name="Body" element="tns:string"/>
+ </wsdl:message>
+ <wsdl:portType name="StockQuoteSoap">
+ <wsdl:operation name="GetQuote">
+ <documentation xmlns="http://schemas.xmlsoap.org/wsdl/">Get Stock quote for a company Symbol</documentation>
+ <wsdl:input message="tns:GetQuoteSoapIn"/>
+ <wsdl:output message="tns:GetQuoteSoapOut"/>
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:portType name="StockQuoteHttpGet">
+ <wsdl:operation name="GetQuote">
+ <documentation xmlns="http://schemas.xmlsoap.org/wsdl/">Get Stock quote for a company Symbol</documentation>
+ <wsdl:input message="tns:GetQuoteHttpGetIn"/>
+ <wsdl:output message="tns:GetQuoteHttpGetOut"/>
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:portType name="StockQuoteHttpPost">
+ <wsdl:operation name="GetQuote">
+ <documentation xmlns="http://schemas.xmlsoap.org/wsdl/">Get Stock quote for a company Symbol</documentation>
+ <wsdl:input message="tns:GetQuoteHttpPostIn"/>
+ <wsdl:output message="tns:GetQuoteHttpPostOut"/>
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="StockQuoteSoap" type="tns:StockQuoteSoap">
+ <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
+ <wsdl:operation name="GetQuote">
+ <soap:operation soapAction="http://www.webserviceX.NET/GetQuote" style="document"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+
+ <wsdl:binding name="StockQuoteHttpGet" type="tns:StockQuoteHttpGet">
+ <http:binding verb="GET"/>
+ <wsdl:operation name="GetQuote">
+ <http:operation location="/GetQuote"/>
+ <wsdl:input>
+ <http:urlEncoded/>
+ </wsdl:input>
+ <wsdl:output>
+ <mime:mimeXml part="Body"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:binding name="StockQuoteHttpPost" type="tns:StockQuoteHttpPost">
+ <http:binding verb="POST"/>
+ <wsdl:operation name="GetQuote">
+ <http:operation location="/GetQuote"/>
+ <wsdl:input>
+ <mime:content type="application/x-www-form-urlencoded"/>
+ </wsdl:input>
+ <wsdl:output>
+ <mime:mimeXml part="Body"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+
+ <wsdl:service name="StockQuote">
+ <wsdl:port name="StockQuoteSoap" binding="tns:StockQuoteSoap">
+ <soap:address location="http://www.webservicex.com/stockquote.asmx"/>
+ </wsdl:port>
+ <wsdl:port name="StockQuoteHttpGet" binding="tns:StockQuoteHttpGet">
+ <http:address location="http://www.webservicex.com/stockquote.asmx"/>
+ </wsdl:port>
+ <wsdl:port name="StockQuoteHttpPost" binding="tns:StockQuoteHttpPost">
+ <http:address location="http://www.webservicex.com/stockquote.asmx"/>
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
diff --git a/branches/sca-java-M2/samples/applications/bigbank/account/src/main/webapp/WEB-INF/default.scdl b/branches/sca-java-M2/samples/applications/bigbank/account/src/main/webapp/WEB-INF/default.scdl
new file mode 100644
index 0000000000..7c83a1a648
--- /dev/null
+++ b/branches/sca-java-M2/samples/applications/bigbank/account/src/main/webapp/WEB-INF/default.scdl
@@ -0,0 +1,80 @@
+<?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" xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance"
+ name="bigbank.account">
+
+
+ <service name="AccountService">
+ <!-- interface.java interface="com.bigbank.account.AccountService"/-->
+ <interface.wsdl interface="http://www.bigbank.com/account#wsdl.interface(AccountService)"
+ wsdli:wsdlLocation="http://www.bigbank.com/account wsdl/AccountService.wsdl" />
+
+
+ <binding.ws endpoint="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)"
+ conformanceURIs="http://ws-i.org/profiles/basic/1.1" location="wsdl/AccountService.wsdl" />
+
+ <reference>AccountServiceComponent</reference>
+ </service>
+
+
+ <property name="currency" type="xsd:string">USD</property>
+
+ <component name="AccountServiceComponent">
+ <implementation.java class="bigbank.account.services.account.AccountServiceImpl" />
+ <property name="currency" source="$currency" />
+ <reference name="accountDataService">AccountLoggerDataServiceComponent</reference>
+ <reference name="stockQuoteService">StockQuoteServiceComponent</reference>
+ </component>
+
+ <component name="AccountLoggerDataServiceComponent">
+ <implementation.java class="bigbank.account.services.accountlogger.AccountLoggerDataServiceImpl" />
+ <reference name="accountDataService">AccountDataServiceComponent</reference>
+ <reference name="accountLoggerService">AccountLoggerServiceComponent</reference>
+ </component>
+
+ <component name="AccountDataServiceComponent">
+ <implementation.java class="bigbank.account.services.accountdata.AccountDataServiceDASImpl" />
+ </component>
+
+ <component name="AccountLoggerServiceComponent">
+ <implementation.java class="bigbank.account.services.accountlogger.AccountLoggerServiceImpl" />
+ </component>
+
+ <!-- by default, we use the faked stock quote implemented as a POJO component -->
+ <component name="StockQuoteServiceComponent">
+ <implementation.java class="bigbank.account.services.stockquote.StockQuoteServiceImpl" />
+ </component>
+
+ <!-- Please uncomment the following to get the real stock quote -->
+ <!--
+ <component name="StockQuoteServiceComponent">
+ <implementation.java class="bigbank.account.services.stockquote.StockQuoteWebservicexServiceImpl" />
+ <reference name="stockQuoteService">StockQuoteWebService</reference>
+ </component>
+
+ <reference name="StockQuoteWebService">
+ <interface.wsdl interface="http://www.webserviceX.NET/#wsdl.interface(StockQuoteSoap)"
+ wsdli:wsdlLocation="http://www.webserviceX.NET/ wsdl/stockquotes.webservicex.wsdl" />
+ <binding.ws endpoint="http://www.webserviceX.NET/#wsdl.endpoint(StockQuote/StockQuoteSoap)"
+ location="wsdl/stockquotes.webservicex.wsdl" />
+ </reference>
+ -->
+
+</composite> \ No newline at end of file
diff --git a/branches/sca-java-M2/samples/applications/bigbank/account/src/main/webapp/WEB-INF/web.xml b/branches/sca-java-M2/samples/applications/bigbank/account/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000000..0f685b2581
--- /dev/null
+++ b/branches/sca-java-M2/samples/applications/bigbank/account/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,66 @@
+<?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.
+-->
+
+<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web
+Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
+<web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
+
+ <display-name>Tuscany Bigbank Account sample</display-name>
+
+ <!-- context-param>
+ <param-name>tuscany.systemScdlPath</param-name>
+ <param-value>/META-INF/tuscany/webapp.scdl</param-value>
+ </context-param -->
+
+ <!-- context-param>
+ <param-name>tuscany.applicationScdlPath</param-name>
+ <param-value>/META-INF/sca/default.scdl</param-value>
+ </context-param -->
+
+ <context-param>
+ <param-name>tuscany.online</param-name>
+ <param-value>true</param-value>
+ </context-param>
+
+
+ <listener>
+ <listener-class>org.apache.tuscany.runtime.webapp.TuscanyContextListener</listener-class>
+ </listener>
+
+ <servlet>
+ <servlet-name>TuscanyServlet</servlet-name>
+ <display-name>Tuscany Servlet</display-name>
+ <servlet-class>org.apache.tuscany.runtime.webapp.TuscanyServlet</servlet-class>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>TuscanyServlet</servlet-name>
+ <url-pattern>/services/*</url-pattern>
+
+ </servlet-mapping>
+ <servlet>
+ <!-- Initialize bigbank database -->
+ <servlet-name>AccountDBInit</servlet-name>
+ <servlet-class>bigbank.account.services.accountdb.AccountDBInit</servlet-class>
+ <load-on-startup>2</load-on-startup>
+ </servlet>
+
+
+</web-app>