From stonehenge-commits-return-391-apmail-incubator-stonehenge-commits-archive=incubator.apache.org@incubator.apache.org Thu Jun 04 07:04:53 2009 Return-Path: Delivered-To: apmail-incubator-stonehenge-commits-archive@minotaur.apache.org Received: (qmail 13718 invoked from network); 4 Jun 2009 07:04:53 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 4 Jun 2009 07:04:53 -0000 Received: (qmail 44727 invoked by uid 500); 4 Jun 2009 07:05:05 -0000 Delivered-To: apmail-incubator-stonehenge-commits-archive@incubator.apache.org Received: (qmail 44697 invoked by uid 500); 4 Jun 2009 07:05:05 -0000 Mailing-List: contact stonehenge-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: stonehenge-dev@incubator.apache.org Delivered-To: mailing list stonehenge-commits@incubator.apache.org Received: (qmail 44687 invoked by uid 99); 4 Jun 2009 07:05:05 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 04 Jun 2009 07:05:05 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 04 Jun 2009 07:04:51 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id CD82D23888BD; Thu, 4 Jun 2009 07:04:30 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r781666 [2/6] - in /incubator/stonehenge/contrib/stocktrader/metro: ./ business_service/ business_service/config/ business_service/etc/ business_service/etc/order_processor/ business_service/lib/ business_service/lib/commons/ business_servi... Date: Thu, 04 Jun 2009 07:04:27 -0000 To: stonehenge-commits@incubator.apache.org From: drewbai@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20090604070430.CD82D23888BD@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Added: incubator/stonehenge/contrib/stocktrader/metro/business_service/etc/wsdl0.wsdl URL: http://svn.apache.org/viewvc/incubator/stonehenge/contrib/stocktrader/metro/business_service/etc/wsdl0.wsdl?rev=781666&view=auto ============================================================================== --- incubator/stonehenge/contrib/stocktrader/metro/business_service/etc/wsdl0.wsdl (added) +++ incubator/stonehenge/contrib/stocktrader/metro/business_service/etc/wsdl0.wsdl Thu Jun 4 07:04:21 2009 @@ -0,0 +1,257 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Added: incubator/stonehenge/contrib/stocktrader/metro/business_service/etc/xsd0.xsd URL: http://svn.apache.org/viewvc/incubator/stonehenge/contrib/stocktrader/metro/business_service/etc/xsd0.xsd?rev=781666&view=auto ============================================================================== --- incubator/stonehenge/contrib/stocktrader/metro/business_service/etc/xsd0.xsd (added) +++ incubator/stonehenge/contrib/stocktrader/metro/business_service/etc/xsd0.xsd Thu Jun 4 07:04:21 2009 @@ -0,0 +1,355 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Added: incubator/stonehenge/contrib/stocktrader/metro/business_service/etc/xsd1.xsd URL: http://svn.apache.org/viewvc/incubator/stonehenge/contrib/stocktrader/metro/business_service/etc/xsd1.xsd?rev=781666&view=auto ============================================================================== --- incubator/stonehenge/contrib/stocktrader/metro/business_service/etc/xsd1.xsd (added) +++ incubator/stonehenge/contrib/stocktrader/metro/business_service/etc/xsd1.xsd Thu Jun 4 07:04:21 2009 @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Added: incubator/stonehenge/contrib/stocktrader/metro/business_service/lib/commons/commons-logging-1.1.1.jar URL: http://svn.apache.org/viewvc/incubator/stonehenge/contrib/stocktrader/metro/business_service/lib/commons/commons-logging-1.1.1.jar?rev=781666&view=auto ============================================================================== Binary file - no diff available. Propchange: incubator/stonehenge/contrib/stocktrader/metro/business_service/lib/commons/commons-logging-1.1.1.jar ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: incubator/stonehenge/contrib/stocktrader/metro/business_service/lib/log4j/log4j-1.2.15.jar URL: http://svn.apache.org/viewvc/incubator/stonehenge/contrib/stocktrader/metro/business_service/lib/log4j/log4j-1.2.15.jar?rev=781666&view=auto ============================================================================== Binary file - no diff available. Propchange: incubator/stonehenge/contrib/stocktrader/metro/business_service/lib/log4j/log4j-1.2.15.jar ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: incubator/stonehenge/contrib/stocktrader/metro/business_service/lib/metro/webservices-api.jar URL: http://svn.apache.org/viewvc/incubator/stonehenge/contrib/stocktrader/metro/business_service/lib/metro/webservices-api.jar?rev=781666&view=auto ============================================================================== Binary file - no diff available. Propchange: incubator/stonehenge/contrib/stocktrader/metro/business_service/lib/metro/webservices-api.jar ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: incubator/stonehenge/contrib/stocktrader/metro/business_service/lib/metro/webservices-extra-api.jar URL: http://svn.apache.org/viewvc/incubator/stonehenge/contrib/stocktrader/metro/business_service/lib/metro/webservices-extra-api.jar?rev=781666&view=auto ============================================================================== Binary file - no diff available. Propchange: incubator/stonehenge/contrib/stocktrader/metro/business_service/lib/metro/webservices-extra-api.jar ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: incubator/stonehenge/contrib/stocktrader/metro/business_service/lib/metro/webservices-extra.jar URL: http://svn.apache.org/viewvc/incubator/stonehenge/contrib/stocktrader/metro/business_service/lib/metro/webservices-extra.jar?rev=781666&view=auto ============================================================================== Binary file - no diff available. Propchange: incubator/stonehenge/contrib/stocktrader/metro/business_service/lib/metro/webservices-extra.jar ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: incubator/stonehenge/contrib/stocktrader/metro/business_service/lib/metro/webservices-rt.jar URL: http://svn.apache.org/viewvc/incubator/stonehenge/contrib/stocktrader/metro/business_service/lib/metro/webservices-rt.jar?rev=781666&view=auto ============================================================================== Binary file - no diff available. Propchange: incubator/stonehenge/contrib/stocktrader/metro/business_service/lib/metro/webservices-rt.jar ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: incubator/stonehenge/contrib/stocktrader/metro/business_service/lib/metro/webservices-tools.jar URL: http://svn.apache.org/viewvc/incubator/stonehenge/contrib/stocktrader/metro/business_service/lib/metro/webservices-tools.jar?rev=781666&view=auto ============================================================================== Binary file - no diff available. Propchange: incubator/stonehenge/contrib/stocktrader/metro/business_service/lib/metro/webservices-tools.jar ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: incubator/stonehenge/contrib/stocktrader/metro/business_service/lib/mssql/jtds-1.2.2.jar URL: http://svn.apache.org/viewvc/incubator/stonehenge/contrib/stocktrader/metro/business_service/lib/mssql/jtds-1.2.2.jar?rev=781666&view=auto ============================================================================== Binary file - no diff available. Propchange: incubator/stonehenge/contrib/stocktrader/metro/business_service/lib/mssql/jtds-1.2.2.jar ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: incubator/stonehenge/contrib/stocktrader/metro/business_service/src/org/wso2/stocktrader/CustomAccountBean.java URL: http://svn.apache.org/viewvc/incubator/stonehenge/contrib/stocktrader/metro/business_service/src/org/wso2/stocktrader/CustomAccountBean.java?rev=781666&view=auto ============================================================================== --- incubator/stonehenge/contrib/stocktrader/metro/business_service/src/org/wso2/stocktrader/CustomAccountBean.java (added) +++ incubator/stonehenge/contrib/stocktrader/metro/business_service/src/org/wso2/stocktrader/CustomAccountBean.java Thu Jun 4 07:04:21 2009 @@ -0,0 +1,69 @@ +/* + * 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 org.wso2.stocktrader; + +import java.math.BigDecimal; +import java.util.Calendar; + +import com.ibm.websphere.samples.trade.AccountDataBean; + +public class CustomAccountBean extends AccountDataBean { + + /** + * + */ + private static final long serialVersionUID = -6368651996080304426L; + + protected String userID; + + public CustomAccountBean() { + } + + public CustomAccountBean(AccountDataBean accountDataBean) { + setAccountID(accountDataBean.getAccountID()); + setBalance(accountDataBean.getBalance()); + setCreationDate(accountDataBean.getCreationDate()); + setLastLogin(accountDataBean.getLastLogin()); + setLoginCount(accountDataBean.getLoginCount()); + setLogoutCount(accountDataBean.getLogoutCount()); + setOpenBalance(accountDataBean.getOpenBalance()); + } + + public CustomAccountBean(int accountId, String profileId, + Calendar creationDate, BigDecimal openBalance, int logoutCount, + BigDecimal balance, Calendar lastLogIn, int loginCount) { + setAccountID(accountId); + setProfileID(profileId); + setCreationDate(creationDate); + setOpenBalance(openBalance); + setLogoutCount(logoutCount); + setBalance(balance); + setLastLogin(lastLogIn); + setLoginCount(loginCount); + setLogoutCount(logoutCount); + } + + public String getUserID() { + return this.userID; + } + + public void setUserID(String userID) { + this.userID = userID; + } + +} Added: incubator/stonehenge/contrib/stocktrader/metro/business_service/src/org/wso2/stocktrader/CustomAccountProfileBean.java URL: http://svn.apache.org/viewvc/incubator/stonehenge/contrib/stocktrader/metro/business_service/src/org/wso2/stocktrader/CustomAccountProfileBean.java?rev=781666&view=auto ============================================================================== --- incubator/stonehenge/contrib/stocktrader/metro/business_service/src/org/wso2/stocktrader/CustomAccountProfileBean.java (added) +++ incubator/stonehenge/contrib/stocktrader/metro/business_service/src/org/wso2/stocktrader/CustomAccountProfileBean.java Thu Jun 4 07:04:21 2009 @@ -0,0 +1,52 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.wso2.stocktrader; + +import com.ibm.websphere.samples.trade.AccountProfileDataBean; + +public class CustomAccountProfileBean extends AccountProfileDataBean { + + /** + * + */ + private static final long serialVersionUID = 1485167358537563576L; + + public CustomAccountProfileBean() { + } + + public CustomAccountProfileBean( + AccountProfileDataBean accountProfileDataBean) { + setAddress(accountProfileDataBean.getAddress()); + setCreditCard(accountProfileDataBean.getCreditCard()); + setEmail(accountProfileDataBean.getEmail()); + setFullName(accountProfileDataBean.getFullName()); + setPassword(accountProfileDataBean.getPassword()); + setUserID(accountProfileDataBean.getUserID()); + } + + public CustomAccountProfileBean(String userId, String password, + String fullName, String address, String email, String creditcard) { + setUserID(userId); + setPassword(password); + setFullName(fullName); + setAddress(address); + setEmail(email); + setCreditCard(creditcard); + } + +} Added: incubator/stonehenge/contrib/stocktrader/metro/business_service/src/org/wso2/stocktrader/CustomHoldingBean.java URL: http://svn.apache.org/viewvc/incubator/stonehenge/contrib/stocktrader/metro/business_service/src/org/wso2/stocktrader/CustomHoldingBean.java?rev=781666&view=auto ============================================================================== --- incubator/stonehenge/contrib/stocktrader/metro/business_service/src/org/wso2/stocktrader/CustomHoldingBean.java (added) +++ incubator/stonehenge/contrib/stocktrader/metro/business_service/src/org/wso2/stocktrader/CustomHoldingBean.java Thu Jun 4 07:04:21 2009 @@ -0,0 +1,83 @@ +/* + * 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 org.wso2.stocktrader; + +import java.math.BigDecimal; +import java.util.Calendar; + +import com.ibm.websphere.samples.trade.HoldingDataBean; + +/** + * This class is to be used as the data model for holding information. + */ +public class CustomHoldingBean extends HoldingDataBean { + + /** + * + */ + private static final long serialVersionUID = 3294871357941879094L; + private int accountID; + + public CustomHoldingBean() { + } + + /** + * Constructs a data model instance with holding information. + * + * @param accountId + * the account ID of the buyer + * @param holdingID + * the holding ID of the stock + * @param quantity + * the quantity of the stock + * @param purchasePrice + * the purchase price of the stock + * @param purchaseDate + * the date of the purchase of the stock + * @param quoteID + * the quote ID of the stock + */ + public CustomHoldingBean(int accountId, int holdingID, double quantity, + BigDecimal purchasePrice, Calendar purchaseDate, String quoteID) { + setAccountID(accountId); + setHoldingID(holdingID); + setQuantity(quantity); + setPurchasePrice(purchasePrice); + setPurchaseDate(purchaseDate); + setQuoteID(quoteID); + } + + public CustomHoldingBean(int holdingID, double quantity, + BigDecimal purchasePrice, Calendar purchaseDate, String quoteID, + int accountID) { + setHoldingID(holdingID); + setAccountID(accountID); + setQuantity(quantity); + setPurchasePrice(purchasePrice); + setPurchaseDate(purchaseDate); + setQuoteID(quoteID); + } + + public int getAccountID() { + return accountID; + } + + public void setAccountID(int accountID) { + this.accountID = accountID; + } +} Added: incubator/stonehenge/contrib/stocktrader/metro/business_service/src/org/wso2/stocktrader/CustomMarketSummaryBean.java URL: http://svn.apache.org/viewvc/incubator/stonehenge/contrib/stocktrader/metro/business_service/src/org/wso2/stocktrader/CustomMarketSummaryBean.java?rev=781666&view=auto ============================================================================== --- incubator/stonehenge/contrib/stocktrader/metro/business_service/src/org/wso2/stocktrader/CustomMarketSummaryBean.java (added) +++ incubator/stonehenge/contrib/stocktrader/metro/business_service/src/org/wso2/stocktrader/CustomMarketSummaryBean.java Thu Jun 4 07:04:21 2009 @@ -0,0 +1,67 @@ +/* + * 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 org.wso2.stocktrader; + +import java.math.BigDecimal; +import java.util.List; + +import com.ibm.websphere.samples.trade.ArrayOfQuoteDataBean; +import com.ibm.websphere.samples.trade.MarketSummaryDataBeanWS; + +public class CustomMarketSummaryBean extends MarketSummaryDataBeanWS { + + /** + * + */ + private static final long serialVersionUID = 6180349684421231291L; + + public CustomMarketSummaryBean(BigDecimal tSIA, BigDecimal openTSIA, + double volume, List topGainers, + List topLosers) { + setTSIA(tSIA); + setOpenTSIA(openTSIA); + setVolume(volume); + setTopGainers(topGainers); + setTopLosers(topLosers); + } + + private void setTopGainers(List topGainers) { + ArrayOfQuoteDataBean arrayOfQuoteDataBean = new ArrayOfQuoteDataBean(); + + // FIXED: used array for metro generated code + arrayOfQuoteDataBean.getQuoteDataBean().addAll(topGainers); + +// CustomQuoteBean[] qouteBeans = new CustomQuoteBean[topGainers.size()]; +// qouteBeans = (CustomQuoteBean[]) topGainers.toArray(qouteBeans); +// arrayOfQuoteDataBean.setQuoteDataBean(qouteBeans); + setTopGainers(arrayOfQuoteDataBean); + } + + private void setTopLosers(List topLosers) { + ArrayOfQuoteDataBean arrayOfQouteDataBean = new ArrayOfQuoteDataBean(); + + // FIXED: used array for metro generated code + arrayOfQouteDataBean.getQuoteDataBean().addAll(topLosers); + +// CustomQuoteBean[] qouteBeans = new CustomQuoteBean[topLosers.size()]; +// qouteBeans = (CustomQuoteBean[]) topLosers.toArray(qouteBeans); +// arrayOfQouteDataBean.setQuoteDataBean(qouteBeans); + setTopLosers(arrayOfQouteDataBean); + } + +} Added: incubator/stonehenge/contrib/stocktrader/metro/business_service/src/org/wso2/stocktrader/CustomOrderBean.java URL: http://svn.apache.org/viewvc/incubator/stonehenge/contrib/stocktrader/metro/business_service/src/org/wso2/stocktrader/CustomOrderBean.java?rev=781666&view=auto ============================================================================== --- incubator/stonehenge/contrib/stocktrader/metro/business_service/src/org/wso2/stocktrader/CustomOrderBean.java (added) +++ incubator/stonehenge/contrib/stocktrader/metro/business_service/src/org/wso2/stocktrader/CustomOrderBean.java Thu Jun 4 07:04:21 2009 @@ -0,0 +1,89 @@ +/* + * 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 org.wso2.stocktrader; + +import java.math.BigDecimal; +import java.util.Calendar; + +import com.ibm.websphere.samples.trade.OrderDataBean; + +/** + * This class is to be used as the data model for order information. + */ +public class CustomOrderBean extends OrderDataBean { + + private static final long serialVersionUID = 5294153874232419015L; + + int accountId; + int holdingId; + + public CustomOrderBean(OrderDataBean orderDataBean) { + setCompletionDate(orderDataBean.getCompletionDate()); + setOpenDate(orderDataBean.getOpenDate()); + setOrderFee(orderDataBean.getOrderFee()); + setOrderID(orderDataBean.getOrderID()); + setOrderStatus(orderDataBean.getOrderStatus()); + setOrderType(orderDataBean.getOrderType()); + setPrice(orderDataBean.getPrice()); + setQuantity(orderDataBean.getQuantity()); + setSymbol(orderDataBean.getSymbol()); + } + + public CustomOrderBean(int orderId, String orderType, String orderStatus, + Calendar openDate, Calendar completionDate, double quantity, + BigDecimal price, BigDecimal orderFee, String symbol) { + setOrderID(orderId); + setOrderType(orderType); + setOrderStatus(orderStatus); + setOpenDate(openDate); + setCompletionDate(completionDate); + setQuantity(quantity); + setPrice(price); + setOrderFee(orderFee); + setSymbol(symbol); + } + + /** + * Constructs data instance for order information. + * + * @param accountId + * the account ID of the buyer or seller + * @param holdingId + * the ID of corresponding holding of the order + */ + public CustomOrderBean(int accountId, int holdingId) { + this.accountId = accountId; + this.holdingId = holdingId; + } + + public int getAccountId() { + return accountId; + } + + public void setAccountId(int accountId) { + this.accountId = accountId; + } + + public int getHoldingId() { + return holdingId; + } + + public void setHoldingId(int holdingId) { + this.holdingId = holdingId; + } +} Added: incubator/stonehenge/contrib/stocktrader/metro/business_service/src/org/wso2/stocktrader/CustomQuoteBean.java URL: http://svn.apache.org/viewvc/incubator/stonehenge/contrib/stocktrader/metro/business_service/src/org/wso2/stocktrader/CustomQuoteBean.java?rev=781666&view=auto ============================================================================== --- incubator/stonehenge/contrib/stocktrader/metro/business_service/src/org/wso2/stocktrader/CustomQuoteBean.java (added) +++ incubator/stonehenge/contrib/stocktrader/metro/business_service/src/org/wso2/stocktrader/CustomQuoteBean.java Thu Jun 4 07:04:21 2009 @@ -0,0 +1,62 @@ +/* + * 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 org.wso2.stocktrader; + +import java.math.BigDecimal; + +import com.ibm.websphere.samples.trade.QuoteDataBean; + +/** + * This class to be used as the data model for quote information. + */ +public class CustomQuoteBean extends QuoteDataBean { + + /** + * + */ + private static final long serialVersionUID = 7129349720689180586L; + + public CustomQuoteBean() { + } + + /** + * Constructs an instance for quote information. + * + * @param symbol + * @param companyName + * @param volume + * @param price + * @param open + * @param low + * @param high + * @param change + */ + public CustomQuoteBean(String symbol, String companyName, double volume, + BigDecimal price, BigDecimal open, BigDecimal low, BigDecimal high, + double change) { + setSymbol(symbol); + setCompanyName(companyName); + setVolume(volume); + setPrice(price); + setOpen(open); + setLow(low); + setHigh(high); + setChange(change); + } + +} Added: incubator/stonehenge/contrib/stocktrader/metro/business_service/src/org/wso2/stocktrader/dal/CustomerDAO.java URL: http://svn.apache.org/viewvc/incubator/stonehenge/contrib/stocktrader/metro/business_service/src/org/wso2/stocktrader/dal/CustomerDAO.java?rev=781666&view=auto ============================================================================== --- incubator/stonehenge/contrib/stocktrader/metro/business_service/src/org/wso2/stocktrader/dal/CustomerDAO.java (added) +++ incubator/stonehenge/contrib/stocktrader/metro/business_service/src/org/wso2/stocktrader/dal/CustomerDAO.java Thu Jun 4 07:04:21 2009 @@ -0,0 +1,69 @@ +/* + * 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 org.wso2.stocktrader.dal; + +import java.math.BigDecimal; +import java.util.List; + +import org.wso2.stocktrader.CustomAccountBean; +import org.wso2.stocktrader.CustomAccountProfileBean; +import org.wso2.stocktrader.CustomOrderBean; +import org.wso2.stocktrader.CustomHoldingBean; + +public interface CustomerDAO { + + public CustomHoldingBean getHoldingForUpdate(int orderId) + throws DAOException; + + public CustomHoldingBean getHolding(String userId, int holdingID) + throws DAOException; + + public void updateAccountBalance(int accountId, BigDecimal total) + throws DAOException; + + public CustomAccountBean login(String userId, String password) + throws DAOException; + + public void logoutUser(String userId) throws DAOException; + + public CustomAccountBean getCustomerByUserId(String userId) + throws DAOException; + + public CustomAccountProfileBean getAccountProfileData(String userId) + throws DAOException; + + public List getOrders(String userId, boolean top, + int maxTop, int maxDefault) throws DAOException; + + public List getClosedOrders(String userId) + throws DAOException; + + public void insertAccountProfile(CustomAccountProfileBean accountProfileBean) + throws DAOException; + + public void insertAccount(CustomAccountBean accountBean) + throws DAOException; + + public CustomAccountProfileBean update( + CustomAccountProfileBean customAccountProfile) throws DAOException; + + public List getHoldings(String userID) + throws DAOException; + +} Added: incubator/stonehenge/contrib/stocktrader/metro/business_service/src/org/wso2/stocktrader/dal/DAOException.java URL: http://svn.apache.org/viewvc/incubator/stonehenge/contrib/stocktrader/metro/business_service/src/org/wso2/stocktrader/dal/DAOException.java?rev=781666&view=auto ============================================================================== --- incubator/stonehenge/contrib/stocktrader/metro/business_service/src/org/wso2/stocktrader/dal/DAOException.java (added) +++ incubator/stonehenge/contrib/stocktrader/metro/business_service/src/org/wso2/stocktrader/dal/DAOException.java Thu Jun 4 07:04:21 2009 @@ -0,0 +1,32 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +package org.wso2.stocktrader.dal; + +public class DAOException extends Exception { + + private static final long serialVersionUID = -3206469251941804179L; + + public DAOException(String message) { + super(message); + } + + public DAOException(String message, Throwable throwable) { + super(message, throwable); + } +} Added: incubator/stonehenge/contrib/stocktrader/metro/business_service/src/org/wso2/stocktrader/dal/DAOFactory.java URL: http://svn.apache.org/viewvc/incubator/stonehenge/contrib/stocktrader/metro/business_service/src/org/wso2/stocktrader/dal/DAOFactory.java?rev=781666&view=auto ============================================================================== --- incubator/stonehenge/contrib/stocktrader/metro/business_service/src/org/wso2/stocktrader/dal/DAOFactory.java (added) +++ incubator/stonehenge/contrib/stocktrader/metro/business_service/src/org/wso2/stocktrader/dal/DAOFactory.java Thu Jun 4 07:04:21 2009 @@ -0,0 +1,39 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.wso2.stocktrader.dal; + +import org.wso2.stocktrader.mssql.MSSQLDAOFactory; + +public abstract class DAOFactory { + public static final int MS_SQL_FACTORY = 1; + + public abstract CustomerDAO getCustomerDAO() throws DAOException; + public abstract MarketSummaryDAO getMarketSummaryDAO() throws DAOException; + public abstract OrderDAO getOrderDAO() throws DAOException; + + public static DAOFactory getFacotry(int type) { + switch (type) { + case MS_SQL_FACTORY: + DAOFactory factory = MSSQLDAOFactory.getInstance(); + return factory; + default: + throw new IllegalArgumentException("Unknown Database type " + type); + } + } + +} Added: incubator/stonehenge/contrib/stocktrader/metro/business_service/src/org/wso2/stocktrader/dal/MarketSummaryDAO.java URL: http://svn.apache.org/viewvc/incubator/stonehenge/contrib/stocktrader/metro/business_service/src/org/wso2/stocktrader/dal/MarketSummaryDAO.java?rev=781666&view=auto ============================================================================== --- incubator/stonehenge/contrib/stocktrader/metro/business_service/src/org/wso2/stocktrader/dal/MarketSummaryDAO.java (added) +++ incubator/stonehenge/contrib/stocktrader/metro/business_service/src/org/wso2/stocktrader/dal/MarketSummaryDAO.java Thu Jun 4 07:04:21 2009 @@ -0,0 +1,36 @@ +/* + * 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 org.wso2.stocktrader.dal; + +import org.wso2.stocktrader.CustomMarketSummaryBean; +import org.wso2.stocktrader.CustomQuoteBean; + +public interface MarketSummaryDAO { + + public CustomQuoteBean getQuote(String symbol) throws DAOException; + + public CustomQuoteBean getQuoteForUpdate(String symbol) throws DAOException; + + public void updateStockPriceVolume(double quantity, CustomQuoteBean quote) + throws DAOException; + + public CustomMarketSummaryBean getCustomMarketSummary() throws DAOException; + + + +} Added: incubator/stonehenge/contrib/stocktrader/metro/business_service/src/org/wso2/stocktrader/dal/OrderDAO.java URL: http://svn.apache.org/viewvc/incubator/stonehenge/contrib/stocktrader/metro/business_service/src/org/wso2/stocktrader/dal/OrderDAO.java?rev=781666&view=auto ============================================================================== --- incubator/stonehenge/contrib/stocktrader/metro/business_service/src/org/wso2/stocktrader/dal/OrderDAO.java (added) +++ incubator/stonehenge/contrib/stocktrader/metro/business_service/src/org/wso2/stocktrader/dal/OrderDAO.java Thu Jun 4 07:04:21 2009 @@ -0,0 +1,55 @@ +/* + * 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 org.wso2.stocktrader.dal; + +import java.math.BigDecimal; + +import org.wso2.stocktrader.CustomHoldingBean; +import org.wso2.stocktrader.CustomOrderBean; +import org.wso2.stocktrader.CustomQuoteBean; + +public interface OrderDAO { + + public CustomQuoteBean getQuoteForUpdate(String symbol) throws DAOException; + + public int createHolding(CustomOrderBean order) throws DAOException; + + public void updateHolding(int holdingId, double quantity) + throws DAOException; + + public void deleteHolding(int holdingId) throws DAOException; + + public CustomHoldingBean getHoldingForUpdate(int orderId) + throws DAOException; + + public CustomHoldingBean getHolding(int holdingId) throws DAOException; + + public void updateAccountBalance(int accountId, BigDecimal total) + throws DAOException; + + public CustomOrderBean createOrder(String userID, String symbol, + String orderType, double quantity, int holdingID) + throws DAOException; + + public void updateOrder(CustomOrderBean order) throws DAOException; + + public void updateStockPriceVolume(double quantity, CustomQuoteBean quote) + throws DAOException; + + public void closeOrder(CustomOrderBean order) throws DAOException; +} Added: incubator/stonehenge/contrib/stocktrader/metro/business_service/src/org/wso2/stocktrader/mssql/AbstractMSSQLDAO.java URL: http://svn.apache.org/viewvc/incubator/stonehenge/contrib/stocktrader/metro/business_service/src/org/wso2/stocktrader/mssql/AbstractMSSQLDAO.java?rev=781666&view=auto ============================================================================== --- incubator/stonehenge/contrib/stocktrader/metro/business_service/src/org/wso2/stocktrader/mssql/AbstractMSSQLDAO.java (added) +++ incubator/stonehenge/contrib/stocktrader/metro/business_service/src/org/wso2/stocktrader/mssql/AbstractMSSQLDAO.java Thu Jun 4 07:04:21 2009 @@ -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 org.wso2.stocktrader.mssql; + +import java.sql.Connection; +import java.sql.SQLException; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.wso2.stocktrader.dal.DAOException; + +public class AbstractMSSQLDAO { + + private static final Log logger = LogFactory.getLog(AbstractMSSQLDAO.class); + + protected Connection sqlConnection; + + private int previousTransactionIsolation; + + public AbstractMSSQLDAO(Connection sqlConnection) throws DAOException { + this.sqlConnection = sqlConnection; + } + + public void beginTransaction() throws DAOException { + logger.debug("AbstractMSSQLDAO.beginTransaction()"); + try { + sqlConnection.setAutoCommit(false); + previousTransactionIsolation = sqlConnection + .getTransactionIsolation(); + sqlConnection + .setTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED); + } catch (SQLException e) { + e.printStackTrace(); + logger.debug("", e); + throw new DAOException( + "Exception was thrown during the start of transaction", e); + } + } + + public void commitTransaction() throws DAOException { + logger.debug("AbstractMSSQLDAO.commitTransaction()"); + try { + sqlConnection.commit(); + sqlConnection.setAutoCommit(true); + sqlConnection.setTransactionIsolation(previousTransactionIsolation); + } catch (SQLException e) { + throw new DAOException( + "Exception is thrown during the commit of transaction", e); + } + } + + public void rollbackTransaction() throws DAOException { + logger.debug("AbstractMSSQLDAO.rollbackTransaction()"); + try { + sqlConnection.rollback(); + sqlConnection.setAutoCommit(true); + sqlConnection.setTransactionIsolation(previousTransactionIsolation); + } catch (SQLException e) { + throw new DAOException( + "Exception is thrown during the rollback of transaction", e); + + } + } + + public void close() throws DAOException { + try { + sqlConnection.close(); + } catch (SQLException e) { + throw new DAOException("", e); + } + } +}