diff options
Diffstat (limited to 'tags/java-stable-20060304/samples/bigbank/account')
16 files changed, 943 insertions, 0 deletions
diff --git a/tags/java-stable-20060304/samples/bigbank/account/pom.xml b/tags/java-stable-20060304/samples/bigbank/account/pom.xml new file mode 100644 index 0000000000..d1a385145f --- /dev/null +++ b/tags/java-stable-20060304/samples/bigbank/account/pom.xml @@ -0,0 +1,77 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Copyright (c) 2005-2006 The Apache Software Foundation or its licensors, as applicable. + * + * 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. + --> +<project> + <parent> + <groupId>org.apache.tuscany.samples.bigbank</groupId> + <artifactId>bigbank-samples</artifactId> + <version>SNAPSHOT</version> + </parent> + <modelVersion>4.0.0</modelVersion> + <artifactId>account</artifactId> + <packaging>war</packaging> + <name>Tuscany sample BigBank account</name> + <description>BigBank sample - account module</description> + <version>SNAPSHOT</version> + + <dependencies> + <dependency> + <groupId>org.apache.tuscany</groupId> + <artifactId>tuscany-core</artifactId> + <version>${pom.version}</version> + <scope>provided</scope> <!-- use provided so tuscany infrastructue is not inc. in the war--> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.apache.tuscany</groupId> + <artifactId>tuscany-sdo-plugin</artifactId> + <executions> + <execution> + <configuration> + <schemaFile>${basedir}/src/main/resources/wsdl/AccountService.wsdl</schemaFile> + <noNotification>true</noNotification> + <noContainer>true</noContainer> + <noInterfaces>true</noInterfaces> + <noUnsettable>true</noUnsettable> + </configuration> + <goals> + <goal>generate</goal> + </goals> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.apache.tuscany</groupId> + <artifactId>tuscany-sca-plugin</artifactId> + <executions> + <execution> + <configuration> + <wsdlFile>${basedir}/src/main/resources/wsdl/AccountService.wsdl</wsdlFile> + <javaPackage>org.apache.tuscany.samples.bigbank.account.services.account</javaPackage> + </configuration> + <goals> + <goal>generate</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> + +</project> diff --git a/tags/java-stable-20060304/samples/bigbank/account/src/main/java/org/apache/tuscany/samples/bigbank/account/services/account/AccountServiceImpl.java b/tags/java-stable-20060304/samples/bigbank/account/src/main/java/org/apache/tuscany/samples/bigbank/account/services/account/AccountServiceImpl.java new file mode 100644 index 0000000000..4552615227 --- /dev/null +++ b/tags/java-stable-20060304/samples/bigbank/account/src/main/java/org/apache/tuscany/samples/bigbank/account/services/account/AccountServiceImpl.java @@ -0,0 +1,91 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * 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. + */ +package org.apache.tuscany.samples.bigbank.account.services.account; + +import java.util.List; + +import org.apache.tuscany.samples.bigbank.account.AccountFactory; +import org.apache.tuscany.samples.bigbank.account.AccountReport; +import org.apache.tuscany.samples.bigbank.account.AccountSummary; +import org.apache.tuscany.samples.bigbank.account.services.accountdata.AccountDataService; +import org.apache.tuscany.samples.bigbank.account.services.accountdata.CheckingAccount; +import org.apache.tuscany.samples.bigbank.account.services.accountdata.SavingsAccount; +import org.apache.tuscany.samples.bigbank.account.services.accountdata.StockAccount; +import org.apache.tuscany.samples.bigbank.account.services.stockquote.StockQuoteService; +import org.apache.tuscany.sdo.util.SDOUtil; +import org.osoa.sca.annotations.Property; +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Service; + +@Service(interfaces=AccountService.class) +public class AccountServiceImpl implements AccountService { + + static { + SDOUtil.registerStaticTypes(AccountFactory.class); + } + + @Property + private String currency = "USD"; + + @Reference + private AccountDataService accountDataService; + @Reference + private StockQuoteService stockQuoteService; + + public AccountServiceImpl() { + } + + public AccountReport getAccountReport(String customerID) { + + AccountFactory accountFactory=new AccountFactory(); + + AccountReport accountReport = accountFactory.createAccountReport(); + List accountSummaries = accountReport.getAccountSummaries(); + + CheckingAccount checkingAccount = accountDataService.getCheckingAccount(customerID); + AccountSummary checkingAccountSummary = accountFactory.createAccountSummary(); + checkingAccountSummary.setAccountNumber(checkingAccount.getAccountNumber()); + checkingAccountSummary.setAccountType("checking"); + checkingAccountSummary.setBalance(fromUSDollarToCurrency(checkingAccount.getBalance())); + accountSummaries.add(checkingAccountSummary); + + SavingsAccount savingsAccount = accountDataService.getSavingsAccount(customerID); + AccountSummary savingsAccountSummary = accountFactory.createAccountSummary(); + savingsAccountSummary.setAccountNumber(savingsAccount.getAccountNumber()); + savingsAccountSummary.setAccountType("savings"); + savingsAccountSummary.setBalance(fromUSDollarToCurrency(savingsAccount.getBalance())); + accountSummaries.add(savingsAccountSummary); + + StockAccount stockAccount = accountDataService.getStockAccount(customerID); + AccountSummary stockAccountSummary = accountFactory.createAccountSummary(); + stockAccountSummary.setAccountNumber(stockAccount.getAccountNumber()); + stockAccountSummary.setAccountType("stock"); + float balance = (stockQuoteService.getQuote(stockAccount.getSymbol())) * stockAccount.getQuantity(); + stockAccountSummary.setBalance(fromUSDollarToCurrency(balance)); + accountSummaries.add(stockAccountSummary); + + return accountReport; + } + + private float fromUSDollarToCurrency(float value) { + + if (currency.equals("USD")) return value; + else if (currency.equals("EURO")) return value * 0.8f; + else + return 0.0f; + } +} diff --git a/tags/java-stable-20060304/samples/bigbank/account/src/main/java/org/apache/tuscany/samples/bigbank/account/services/accountdata/AccountDataService.java b/tags/java-stable-20060304/samples/bigbank/account/src/main/java/org/apache/tuscany/samples/bigbank/account/services/accountdata/AccountDataService.java new file mode 100644 index 0000000000..b0d07ed3e7 --- /dev/null +++ b/tags/java-stable-20060304/samples/bigbank/account/src/main/java/org/apache/tuscany/samples/bigbank/account/services/accountdata/AccountDataService.java @@ -0,0 +1,26 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * 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. + */ +package org.apache.tuscany.samples.bigbank.account.services.accountdata; + +public interface AccountDataService { + + CheckingAccount getCheckingAccount(String customerID); + + SavingsAccount getSavingsAccount(String customerID); + + StockAccount getStockAccount(String customerID); +} diff --git a/tags/java-stable-20060304/samples/bigbank/account/src/main/java/org/apache/tuscany/samples/bigbank/account/services/accountdata/AccountDataServiceImpl.java b/tags/java-stable-20060304/samples/bigbank/account/src/main/java/org/apache/tuscany/samples/bigbank/account/services/accountdata/AccountDataServiceImpl.java new file mode 100644 index 0000000000..963277ee76 --- /dev/null +++ b/tags/java-stable-20060304/samples/bigbank/account/src/main/java/org/apache/tuscany/samples/bigbank/account/services/accountdata/AccountDataServiceImpl.java @@ -0,0 +1,51 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * 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. + */ +package org.apache.tuscany.samples.bigbank.account.services.accountdata; + +import org.osoa.sca.annotations.Service; + +@Service(AccountDataService.class) +public class AccountDataServiceImpl implements AccountDataService { + + public CheckingAccount getCheckingAccount(String customerID) { + + CheckingAccount checkingAccount = new CheckingAccount(); + checkingAccount.setAccountNumber(customerID + "_" + "CHA12345"); + checkingAccount.setBalance(1500.0f); + + return checkingAccount; + } + + public SavingsAccount getSavingsAccount(String customerID) { + + SavingsAccount savingsAccount = new SavingsAccount(); + savingsAccount.setAccountNumber(customerID + "_" + "SAA12345"); + savingsAccount.setBalance(1500.0f); + + return savingsAccount; + } + + public StockAccount getStockAccount(String customerID) { + + StockAccount stockAccount = new StockAccount(); + stockAccount.setAccountNumber(customerID + "_" + "STA12345"); + stockAccount.setSymbol("IBM"); + stockAccount.setQuantity(100); + + return stockAccount; + } +} diff --git a/tags/java-stable-20060304/samples/bigbank/account/src/main/java/org/apache/tuscany/samples/bigbank/account/services/accountdata/CheckingAccount.java b/tags/java-stable-20060304/samples/bigbank/account/src/main/java/org/apache/tuscany/samples/bigbank/account/services/accountdata/CheckingAccount.java new file mode 100644 index 0000000000..b3dd6185e1 --- /dev/null +++ b/tags/java-stable-20060304/samples/bigbank/account/src/main/java/org/apache/tuscany/samples/bigbank/account/services/accountdata/CheckingAccount.java @@ -0,0 +1,39 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * 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. + */ +package org.apache.tuscany.samples.bigbank.account.services.accountdata; + +public class CheckingAccount { + + private String accountNumber; + private float balance; + + public String getAccountNumber() { + return accountNumber; + } + + public void setAccountNumber(String accountNumber) { + this.accountNumber = accountNumber; + } + + public float getBalance() { + return balance; + } + + public void setBalance(float balance) { + this.balance = balance; + } +} diff --git a/tags/java-stable-20060304/samples/bigbank/account/src/main/java/org/apache/tuscany/samples/bigbank/account/services/accountdata/SavingsAccount.java b/tags/java-stable-20060304/samples/bigbank/account/src/main/java/org/apache/tuscany/samples/bigbank/account/services/accountdata/SavingsAccount.java new file mode 100644 index 0000000000..0b7f2e0fd5 --- /dev/null +++ b/tags/java-stable-20060304/samples/bigbank/account/src/main/java/org/apache/tuscany/samples/bigbank/account/services/accountdata/SavingsAccount.java @@ -0,0 +1,39 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * 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. + */ +package org.apache.tuscany.samples.bigbank.account.services.accountdata; + +public class SavingsAccount { + + private String accountNumber; + private float balance; + + public String getAccountNumber() { + return accountNumber; + } + + public void setAccountNumber(String accountNumber) { + this.accountNumber = accountNumber; + } + + public float getBalance() { + return balance; + } + + public void setBalance(float balance) { + this.balance = balance; + } +} diff --git a/tags/java-stable-20060304/samples/bigbank/account/src/main/java/org/apache/tuscany/samples/bigbank/account/services/accountdata/StockAccount.java b/tags/java-stable-20060304/samples/bigbank/account/src/main/java/org/apache/tuscany/samples/bigbank/account/services/accountdata/StockAccount.java new file mode 100644 index 0000000000..f6b90259b3 --- /dev/null +++ b/tags/java-stable-20060304/samples/bigbank/account/src/main/java/org/apache/tuscany/samples/bigbank/account/services/accountdata/StockAccount.java @@ -0,0 +1,48 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * 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. + */ +package org.apache.tuscany.samples.bigbank.account.services.accountdata; + +public class StockAccount { + + private String accountNumber; + private String symbol; + private int quantity; + + public String getAccountNumber() { + return accountNumber; + } + + public void setAccountNumber(String accountNumber) { + this.accountNumber = accountNumber; + } + + public int getQuantity() { + return quantity; + } + + public void setQuantity(int quantity) { + this.quantity = quantity; + } + + public String getSymbol() { + return symbol; + } + + public void setSymbol(String symbol) { + this.symbol = symbol; + } +} diff --git a/tags/java-stable-20060304/samples/bigbank/account/src/main/java/org/apache/tuscany/samples/bigbank/account/services/stockquote/StockQuoteService.java b/tags/java-stable-20060304/samples/bigbank/account/src/main/java/org/apache/tuscany/samples/bigbank/account/services/stockquote/StockQuoteService.java new file mode 100644 index 0000000000..80ac8d58be --- /dev/null +++ b/tags/java-stable-20060304/samples/bigbank/account/src/main/java/org/apache/tuscany/samples/bigbank/account/services/stockquote/StockQuoteService.java @@ -0,0 +1,27 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * 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. + */ +package org.apache.tuscany.samples.bigbank.account.services.stockquote; + +import org.osoa.sca.annotations.Remotable; + +@Remotable +public interface StockQuoteService { + + public float getQuote(String symbol); +} + +
\ No newline at end of file diff --git a/tags/java-stable-20060304/samples/bigbank/account/src/main/java/org/apache/tuscany/samples/bigbank/account/services/stockquote/StockQuoteServiceImpl.java b/tags/java-stable-20060304/samples/bigbank/account/src/main/java/org/apache/tuscany/samples/bigbank/account/services/stockquote/StockQuoteServiceImpl.java new file mode 100644 index 0000000000..ff4878b10c --- /dev/null +++ b/tags/java-stable-20060304/samples/bigbank/account/src/main/java/org/apache/tuscany/samples/bigbank/account/services/stockquote/StockQuoteServiceImpl.java @@ -0,0 +1,28 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * 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. + */ +package org.apache.tuscany.samples.bigbank.account.services.stockquote; + +/* Dummy'd up StockQuoteService, override webservice for now */ + +public class StockQuoteServiceImpl implements StockQuoteService { + + public float getQuote(String symbol) { + // Just hardcode for now + return 83.00f; + } + +}
\ No newline at end of file diff --git a/tags/java-stable-20060304/samples/bigbank/account/src/main/resources/sca.module b/tags/java-stable-20060304/samples/bigbank/account/src/main/resources/sca.module new file mode 100644 index 0000000000..b13d844609 --- /dev/null +++ b/tags/java-stable-20060304/samples/bigbank/account/src/main/resources/sca.module @@ -0,0 +1,61 @@ +<?xml version="1.0" encoding="ASCII"?>
+<!--
+ Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
+
+ 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.
+ -->
+<module xmlns="http://www.osoa.org/xmlns/sca/0.9" xmlns:v="http://www.osoa.org/xmlns/sca/values/0.9"
+
+ name="tuscany.samples.bigbank.account">
+
+ <entryPoint name="AccountService">
+ <interface.java interface="org.apache.tuscany.samples.bigbank.account.services.account.AccountService"/>
+ <binding.ws port="http://www.bigbank.com/Account/#AccountServiceSOAP"/>
+ <reference>AccountServiceComponent/AccountService</reference>
+ </entryPoint>
+
+ <component name="AccountServiceComponent">
+ <implementation.java class="org.apache.tuscany.samples.bigbank.account.services.account.AccountServiceImpl"/>
+ <properties>
+ <v:currency>EURO</v:currency>
+ </properties>
+ <references>
+ <v:accountDataService>AccountDataServiceComponent</v:accountDataService>
+ <v:stockQuoteService>StockQuoteService</v:stockQuoteService>
+ </references>
+ </component>
+
+ <component name="AccountDataServiceComponent">
+ <implementation.java class="org.apache.tuscany.samples.bigbank.account.services.accountdata.AccountDataServiceImpl"/>
+ </component>
+
+ <component name="StockQuoteService">
+ <implementation.java class="org.apache.tuscany.samples.bigbank.account.services.stockquote.StockQuoteServiceImpl"/>
+ </component>
+
+ <!--
+ <externalService name="StockQuoteService">
+ <interface.java interface="org.apache.tuscany.samples.bigbank.account.services.stockquote"/>
+ <binding.ws port="http://www.quickstockquote.com/StockQuoteService#StockQuoteServiceSOAP"/>
+ </externalService>
+ -->
+
+ <import.wsdl + location="wsdl/AccountService.wsdl" + namespace="http://www.bigbank.com/Account/"/> + <import.wsdl + location="wsdl/StockQuoteWebService.wsdl" + namespace="http://webservice.stockquote"/> + +</module>
+
diff --git a/tags/java-stable-20060304/samples/bigbank/account/src/main/resources/sca.subsystem b/tags/java-stable-20060304/samples/bigbank/account/src/main/resources/sca.subsystem new file mode 100644 index 0000000000..b15fa2bc5c --- /dev/null +++ b/tags/java-stable-20060304/samples/bigbank/account/src/main/resources/sca.subsystem @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="ASCII"?>
+<!--
+ Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
+
+ 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.
+ -->
+<subsystem xmlns="http://www.osoa.org/xmlns/sca/0.9"
+
+ name="tuscany.runtime.bigbank.account">
+
+ <moduleComponent name="tuscany-samples-bigbank-account" module="tuscany.samples.bigbank.account"/>
+
+</subsystem>
+
diff --git a/tags/java-stable-20060304/samples/bigbank/account/src/main/resources/wsdl/AccountService.wsdl b/tags/java-stable-20060304/samples/bigbank/account/src/main/resources/wsdl/AccountService.wsdl new file mode 100644 index 0000000000..5d087530dd --- /dev/null +++ b/tags/java-stable-20060304/samples/bigbank/account/src/main/resources/wsdl/AccountService.wsdl @@ -0,0 +1,90 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
+
+ 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.
+ -->
+<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:tns="http://www.bigbank.com/Account/"
+ 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:element name="getAccountReport"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="customerID" type="xsd:string"/> + </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: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: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:portType name="AccountService">
+ <wsdl:operation name="getAccountReport">
+ <wsdl:input message="tns:getAccountReportRequest"/>
+ <wsdl:output message="tns:getAccountReportResponse"/>
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="AccountServiceSOAP" type="tns: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:binding>
+ <wsdl:service name="AccountService">
+ <wsdl:port binding="tns:AccountServiceSOAP"
+ name="AccountServiceSOAP">
+ <soap:address location="http://localhost:8080/account-SNAPSHOT/services/AccountService"/>
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
diff --git a/tags/java-stable-20060304/samples/bigbank/account/src/main/resources/wsdl/StockQuoteWebService.wsdl b/tags/java-stable-20060304/samples/bigbank/account/src/main/resources/wsdl/StockQuoteWebService.wsdl new file mode 100644 index 0000000000..9678d9d6ea --- /dev/null +++ b/tags/java-stable-20060304/samples/bigbank/account/src/main/resources/wsdl/StockQuoteWebService.wsdl @@ -0,0 +1,98 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
+
+ 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.
+ -->
+<wsdl:definitions targetNamespace="http://webservice.stockquote" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://webservice.stockquote" xmlns:intf="http://webservice.stockquote" xmlns:tns1="http://stockquote" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="">
+ <!--WSDL created by Apache Axis version: 1.2.1
+Built on Jun 14, 2005 (09:15:57 EDT)-->
+ <wsdl:types>
+ <schema elementFormDefault="qualified" targetNamespace="http://stockquote" xmlns="http://www.w3.org/2001/XMLSchema">
+ <complexType name="GetQuoteRequest">
+ <sequence>
+ <element name="symbol" nillable="true" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ <complexType name="GetQuoteResponse">
+ <sequence>
+ <element name="price" type="xsd:float"/>
+ </sequence>
+ </complexType>
+ </schema>
+ <schema elementFormDefault="qualified" targetNamespace="http://webservice.stockquote" xmlns="http://www.w3.org/2001/XMLSchema">
+ <import namespace="http://stockquote"/>
+ <element name="request" type="tns1:GetQuoteRequest"/>
+ <element name="getQuoteReturn" type="tns1:GetQuoteResponse"/>
+ </schema>
+ </wsdl:types>
+
+ <wsdl:message name="getQuoteResponse">
+
+ <wsdl:part element="impl:getQuoteReturn" name="getQuoteReturn"/>
+
+ </wsdl:message>
+
+ <wsdl:message name="getQuoteRequest">
+
+ <wsdl:part element="impl:request" name="request"/>
+
+ </wsdl:message>
+
+ <wsdl:portType name="StockQuoteWebService">
+
+ <wsdl:operation name="getQuote" parameterOrder="request">
+
+ <wsdl:input message="impl:getQuoteRequest" name="getQuoteRequest"/>
+
+ <wsdl:output message="impl:getQuoteResponse" name="getQuoteResponse"/>
+
+ </wsdl:operation>
+
+ </wsdl:portType>
+
+ <wsdl:binding name="StockQuoteWebServiceSoapBinding" type="impl:StockQuoteWebService">
+
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+
+ <wsdl:operation name="getQuote">
+
+ <wsdlsoap:operation soapAction=""/>
+
+ <wsdl:input name="getQuoteRequest">
+
+ <wsdlsoap:body use="literal"/>
+
+ </wsdl:input>
+
+ <wsdl:output name="getQuoteResponse">
+
+ <wsdlsoap:body use="literal"/>
+
+ </wsdl:output>
+
+ </wsdl:operation>
+
+ </wsdl:binding>
+
+ <wsdl:service name="StockQuoteWebServiceService">
+
+ <wsdl:port binding="impl:StockQuoteWebServiceSoapBinding" name="StockQuoteWebService">
+
+ <wsdlsoap:address location="http://localhost:8123/StockQuoteWebService/services/StockQuoteWebService"/>
+
+ </wsdl:port>
+
+ </wsdl:service>
+
+</wsdl:definitions>
diff --git a/tags/java-stable-20060304/samples/bigbank/account/src/main/webapp/WEB-INF/axis2.xml b/tags/java-stable-20060304/samples/bigbank/account/src/main/webapp/WEB-INF/axis2.xml new file mode 100644 index 0000000000..a38cf9864a --- /dev/null +++ b/tags/java-stable-20060304/samples/bigbank/account/src/main/webapp/WEB-INF/axis2.xml @@ -0,0 +1,167 @@ +<axisconfig name="AxisJava2.0"> + <!-- ================================================= --> + <!-- Parameters --> + <!-- ================================================= --> + <parameter name="hotdeployment" locked="false">false</parameter> + <parameter name="hotupdate" locked="false">false</parameter> + <parameter name="enableMTOM" locked="false">false</parameter> + <!-- Uncomment this to enable REST support --> + <!-- <parameter name="enableREST" locked="false">true</parameter>--> + + + <parameter name="userName" locked="false">admin</parameter> + <parameter name="password" locked="false">axis2</parameter> + + <parameter name="seralizeLocation" locked="false">.</parameter> + <hostConfiguration> + <ip>127.0.0.1</ip> + <port>5555</port> + </hostConfiguration> + + + <!--if you want to extract the service archive file and work with that please uncomment this--> + <!--else , it wont extract archive file or does not take into consideration if someone drop--> + <!--exploded directory into /service directory--> + <!--<parameter name="extractServiceArchive" locked="false">true</parameter>--> + + + <!-- The way of adding listener to the system--> + <!-- <listener class="org.apache.axis2.ObserverIMPL">--> + <!-- <parameter name="RSS_URL" locked="false">http://127.0.0.1/rss</parameter>--> + <!-- </listener>--> + + <!-- ================================================= --> + <!-- Message Receivers --> + <!-- ================================================= --> + <!--This is the Deafult Message Receiver for the system , if you want to have MessageReceivers for --> + <!--all the other MEP implement it and add the correct entry to here , so that you can refer from--> + <!--any operation --> + <!--Note : You can ovride this for particular service by adding the same element with your requirement--> + <messageReceivers> + <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-only" + class="org.apache.axis2.receivers.RawXMLINOnlyMessageReceiver"/> + <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out" + class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/> + </messageReceivers> + <!-- ================================================= --> + <!-- Transport Ins --> + <!-- ================================================= --> + <transportReceiver name="http" class="org.apache.axis2.transport.http.SimpleHTTPServer"> + <parameter name="port" locked="false">6060</parameter> + </transportReceiver> + + <!-- Uncomment this one with the appropriate papameters to enable the SMTP transport Receiver + <transportReceiver name="mail" class="org.apache.axis2.transport.mail.SimpleMailListener"> + <parameter name="transport.mail.pop3.host" locked="false">127.0.0.1</parameter> + <parameter name="transport.mail.pop3.user" locked="false">axis2</parameter> + <parameter name="transport.mail.pop3.password" locked="false">axis2</parameter> + <parameter name="transport.mail.pop3.port" locked="false">110</parameter> + <parameter name="transport.mail.replyToAddress" locked="false">axis2@127.0.0.1</parameter> + </transportReceiver> --> + + <!--REMOVED FOR TUSCANY transportReceiver name="tcp" class="org.apache.axis2.transport.tcp.TCPServer"> + <parameter name="port" locked="false">6060</parameter> + </transportReceiver --> + + <!--REMOVED FOR TUSCANY transportReceiver name="jms" class="org.apache.axis2.transport.jms.SimpleJMSListener"> + <parameter name="transport.jms.Destination" locked="false">dynamicQueues/FOO</parameter> + <parameter name="java.naming.factory.initial" locked="false"> + org.activemq.jndi.ActiveMQInitialContextFactory</parameter> + <parameter name="java.naming.provider.url" locked="false">tcp://localhost:61616</parameter> + </transportReceiver> + --> + + <!-- ================================================= --> + <!-- Transport Outs --> + <!-- ================================================= --> + + <!--REMOVED FOR TUSCANY transportSender name="tcp" class="org.apache.axis2.transport.tcp.TCPTransportSender"/> --> + <transportSender name="local" class="org.apache.axis2.transport.local.LocalTransportSender"/> + <!--REMOVED FOR TUSCANY transportSender name="jms" class="org.apache.axis2.transport.jms.JMSSender"/> --> + <transportSender name="http" class="org.apache.axis2.transport.http.CommonsHTTPTransportSender"> + <parameter name="PROTOCOL" locked="false">HTTP/1.1</parameter> + <parameter name="Transfer-Encoding" locked="false">chunked</parameter> + </transportSender> + <transportSender name="https" + class="org.apache.axis2.transport.http.CommonsHTTPTransportSender"> + <parameter name="PROTOCOL" locked="false">HTTP/1.1</parameter> + <parameter name="Transfer-Encoding" locked="false">chunked</parameter> + </transportSender> + + <!-- Uncomment this one with the appropriate papameters to enable the SMTP transport Receiver + <transportSender name="mailto" class="org.apache.axis2.transport.mail.MailTransportSender"> + <parameter name="transport.mail.smtp.host" locked="false">127.0.0.1</parameter> + <parameter name="transport.mail.smtp.user" locked="false">axis2</parameter> + <parameter name="transport.mail.smtp.password" locked="false">axis2</parameter> + <parameter name="transport.mail.smtp.port" locked="false">25</parameter> + </transportSender> + --> + + <!-- ================================================= --> + <!-- Global Modules --> + <!-- ================================================= --> + <!-- Comment this to disable Addressing --> + <!--REMOVED FOR TUSCANY module ref="addressing"/> --> + + + <!--Configuring module , providing parameters for modules whether they refer or not--> + <!--<moduleConfig name="addressing">--> + <!--<parameter name="addressingPara" locked="false">N/A</parameter>--> + <!--</moduleConfig>--> + + <!-- ================================================= --> + <!-- Phases --> + <!-- ================================================= --> + <phaseOrder type="inflow"> + <!-- System pre defined phases --> + <phase name="TransportIn"/> + <phase name="PreDispatch"/> + <phase name="Dispatch" class="org.apache.axis2.engine.DispatchPhase"> + <handler name="AddressingBasedDispatcher" + class="org.apache.axis2.engine.AddressingBasedDispatcher"> + <order phase="Dispatch"/> + </handler> + + <handler name="RequestURIBasedDispatcher" + class="org.apache.axis2.engine.RequestURIBasedDispatcher"> + <order phase="Dispatch"/> + </handler> + + <handler name="SOAPActionBasedDispatcher" + class="org.apache.axis2.engine.SOAPActionBasedDispatcher"> + <order phase="Dispatch"/> + </handler> + + <handler name="SOAPMessageBodyBasedDispatcher" + class="org.apache.axis2.engine.SOAPMessageBodyBasedDispatcher"> + <order phase="Dispatch"/> + </handler> + <handler name="InstanceDispatcher" + class="org.apache.axis2.engine.InstanceDispatcher"> + <order phase="PostDispatch"/> + </handler> + </phase> + <!-- System pre defined phases --> + <!-- After Postdispatch phase module author or or service author can add any phase he want --> + <phase name="userphase1"/> + </phaseOrder> + <phaseOrder type="outflow"> + <!-- user can add his own phases to this area --> + <phase name="userphase1"/> + <!--system predefined phase--> + <!--these phase will run irrespective of the service--> + <phase name="PolicyDetermination"/> + <phase name="MessageOut"/> + </phaseOrder> + <phaseOrder type="INfaultflow"> + <!-- user can add his own phases to this area --> + <phase name="userphase1"/> + </phaseOrder> + <phaseOrder type="Outfaultflow"> + <!-- user can add his own phases to this area --> + <phase name="userphase1"/> + <phase name="PolicyDetermination"/> + <phase name="MessageOut"/> + </phaseOrder> +</axisconfig> + diff --git a/tags/java-stable-20060304/samples/bigbank/account/src/main/webapp/WEB-INF/web.xml b/tags/java-stable-20060304/samples/bigbank/account/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000000..46bed8f4fe --- /dev/null +++ b/tags/java-stable-20060304/samples/bigbank/account/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable. + + 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. + --> +<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> + +</web-app> diff --git a/tags/java-stable-20060304/samples/bigbank/account/src/test/java/org/apache/tuscany/samples/bigbank/account/client/AccountClient.java b/tags/java-stable-20060304/samples/bigbank/account/src/test/java/org/apache/tuscany/samples/bigbank/account/client/AccountClient.java new file mode 100644 index 0000000000..b9bf5351c0 --- /dev/null +++ b/tags/java-stable-20060304/samples/bigbank/account/src/test/java/org/apache/tuscany/samples/bigbank/account/client/AccountClient.java @@ -0,0 +1,56 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * 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. + */ +package org.apache.tuscany.samples.bigbank.account.client; + +import java.util.Iterator; + +import org.apache.tuscany.core.client.TuscanyRuntime; +import org.apache.tuscany.samples.bigbank.account.AccountReport; +import org.apache.tuscany.samples.bigbank.account.AccountSummary; +import org.apache.tuscany.samples.bigbank.account.services.account.AccountService; +import org.osoa.sca.CurrentModuleContext; +import org.osoa.sca.ModuleContext; +import org.osoa.sca.SCA; + +public class AccountClient extends SCA { + + public void start() { + } + + public void stop() { + } + + public static void main(String[] args) throws Exception { + TuscanyRuntime tuscany = new TuscanyRuntime("bigbank.account.testclient", null); + tuscany.start(); + ModuleContext moduleContext = CurrentModuleContext.getContext(); + + AccountService accountService = (AccountService) moduleContext.locateService("AccountServiceComponent"); + + AccountReport accountReport = accountService.getAccountReport("12345"); + + for (Iterator i = accountReport.getAccountSummaries().iterator(); i.hasNext();) { + AccountSummary accountSummary = (AccountSummary) i.next(); + + System.out.println(accountSummary.getAccountNumber()); + System.out.println(accountSummary.getAccountType()); + System.out.println(accountSummary.getBalance()); + } + + } + +} |